; Library: ZSLIB ; Version: 2.1 ; Module: ZSMTIMC3 ; Version: 1.1 ; Author: Carson Wilson ; Date: February 2, 1990 ; Changes: Shortened code. ; Version: 1.0 ; Author: Carson Wilson ; Date: January 6, 1990 ; Purpose: Store civilian time with formatted hours. ; PUBLIC MTIMC3 EXTRN MA2HC ; SYSLIB EXTRN MOUT,MHL4DC,MAFHC ; ZSLIB ; ; MTIMC3 - Store civilian time as "hh:mm " or "h:mm " if a.m., ; "hh:mmp" or "h:mmp" if p.m., to memory at DE. ; Store relative time as "+nnnn " to memory at DE. ; ; Entry: - points to date as BCD yy mm dd hh mm ; - points to memory (6 bytes max.) ; Exit: - points to byte following output ; Uses: - ; MTIMC3: push hl push bc push af ld b,' ' ; Default to a.m. or relative inc hl inc hl inc hl ; Point to time bit 7,(hl) ; Test relative jr z,REALTM ld a,'+' ; Show relative time call MOUT ;push de ;ld d,(hl) ;inc hl ;ld e,(hl) ;ex de,hl ;pop de ld a,(hl) inc hl ld l,(hl) ld h,a res 7,h ; Remove flag call MHL4DC ; Store relative time jr EXIT REALTM: 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 ld b,'p' ; Yes, p.m. sub 12h ; Xlate to civilian daa NOTMIL: cp 12h ; 12:xx p.m.? jr nz,NOTML2 ; No ld b,'p' ; Yes, show '12:xxp' NOTML1: ld a,12h ; Make 12:xx NOTML2: call MAFHC ; Store formatted hours ld a,':' call MOUT inc hl ld a,(hl) call MA2HC ; Store minutes EXIT: ld a,b call MOUT ; 'p' or space pop af pop bc pop hl ret end ; End ZSMTIMC3.Z80