; Library: SPDATM ; Version: 1.0 ; Author: Terry Hazen ; Date: March 20, 1991 ; Purpose: Provide switched output date and time display module public srdat1,stimc3 public safhc ext spstr,sout,sa2hc ; SYSLIB ext @b2hh,@b2hl ; SYSLIB4+ ; Module: SRDAT1 - modification of ZSLIB routine ; Version: 1.1s ; Author: Terry Hazen ; Date: March 13, 1991 ; Purpose: Print date in long form. ; ; SRDAT1 - Display/print long form of date, e.g., "March 2, 1988", switched ; ; Entry: - points to date as BCD yy mm dd. ; Exit: - Date is displayed and/or printed. ; Uses: - none. ; srdat1: push hl ; Save registers push de push bc push af ; ld c,(hl) ; Save year inc hl ld b,(hl) ; Save month inc hl ; Test day ld a,(hl) push af ; Save day ; xor a ; Clear carry for DAA ld hl,months ld a,b ; Get month ; nxtmth: ld e,(hl) inc hl ld d,(hl) inc hl dec a daa ; Decimal adjust jr nz,nxtmth ; ex de,hl call spstr ; Print month call space ; pop af ; Get day call safhc ; Print it ; ld a,',' call sout call space ; ld a,c ; Get year cp 78h ld a,19h jr nc,twenty ; 20th century ; ld a,20h ; twenty: call safhc ; Print century ld a,c call sa2hc ; Print year jr restreg ; ; Print space ; space: ld a,' ' jp sout ; Module: STIMC3 - modification of ZSLIB routine ; Version: 1.0s ; Author: Terry Hazen ; Date: March 20, 1991 ; Purpose: Print civilian time with formatted hours. ; ; STIMC3 - Display/print civilian time as " hh:mm " or " h:mm ", switched ; ; Entry: - points to date as BCD yy mm dd hh mm ; Exit: Time displayed and/or printed ; Uses: None ; stimc3: push hl ; Save registers push de push bc push af ; call space ; Space over to time display call space ; inc hl ; Point to hours inc hl inc hl ld a,(hl) ; Hours or a ; Hour 0 (00:xx a.m.)? jr z,notml1 ; Yes, make 12:xx a.m. ; cp 13h ; Time past 12:59 hours? jr c,notmil ; No, don't change ; sub 12h ; Xlate to civilian daa ; notmil: cp 12h ; 12:xx p.m.? jr nz,notml2 ; No ; notml1: ld a,12h ; Make 12:xx ; notml2: call safhc ; Print formatted hours ; ld a,':' call sout inc hl ld a,(hl) call sa2hc ; Print minutes ; restreg:pop af ; Restore registers pop bc pop de pop hl ret ; Module: SAFHC - modification of ZSLIB routine ; Version: 1.0s ; Author: Terry Hazen ; Date: March 13, 1991 ; Purpose: Print A as up to 2 hex characters, switched ; ; SAFHC - Display/print A as up to 2 hex characters, switched ; ; Entry: - Contains number to be printed ; Exit: Number displayed and/or printed ; Uses: - None ; safhc: push af push af call @b2hh ; High of A to hex char. in A cp '0' call nz,sout ; Print digit if not zero pop af call @b2hl ; Low of A to hex char. in A call sout ; Print & return pop af ret ; ; Initialized Data ; months: dw jan dw feb dw mar dw apr dw may dw jun dw jul dw aug dw sep dw oct dw nov dw dec ; jan: db 'January',0 feb: db 'February',0 mar: db 'March',0 apr: db 'April',0 may: db 'May',0 jun: db 'June',0 jul: db 'July' ,0 aug: db 'August',0 sep: db 'September',0 oct: db 'October',0 nov: db 'November',0 dec: db 'December',0 end ; ; End SPDATM.Z80