home *** CD-ROM | disk | FTP | other *** search
- ; Library: ZSLIB
- ; Version: 3.4
- ; Module: SDATS1
- ; Version: 1.0
- ; Author: Gene Pizzetta
- ; Date: October 8, 1991
- ;
- ; SDATS1 -- Prints long form of date in American or European format, e.g.,
- ; "March 2, 1988" or "2 March 1988", with switchable output.
- ;
- ; Entry: HL = address of date as BCD yy mm dd
- ; A = date format flag (0=American, FFh=European)
- ; Exit: None
- ; Uses: None
- ;
- PUBLIC SDATS1
- ;
- EXTRN DSTRMO,SAFHC,ZOUT ; ZSLIB
- EXTRN SA2HC,SPSTR ; SYSLIB
- ;
- SDATS1: ld (DatFmt),a ; save format byte
- push hl
- push de
- push bc
- push af
- ld c,(hl) ; save year
- inc hl
- ld b,(hl) ; save month
- inc hl
- ld a,(hl)
- push af ; save day
- ld a,(DatFmt) ; format?
- or a
- jr z,DoMnth ; (American)
- ; Print day if European format
- pop af ; get day
- call SAFHC
- call Space
- ; Print month
- DoMnth: xor a ; clear carry for DAA
- ld hl,DSTRMO ; point to months table
- 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 ; HL --> month
- call SPSTR ; print month
- call Space
- ld a,(DatFmt) ; format?
- or a
- jr nz,DoYear ; (European)
- ; Print day if American format
- pop af ; get day
- call SAFHC
- ld a,',' ; print comma
- call ZOUT
- call Space
- ; Print year
- DoYear: ld a,c ; get year
- cp 78h
- ld a,19h
- jr nc,Cent20 ; 20th century
- ld a,20h
- Cent20: call SAFHC ; century
- ld a,c
- call SA2HC ; year
- pop af
- pop bc
- pop de
- pop hl
- ret
- ;
- Space: ld a,' '
- jp ZOUT
- ;
- ; Data
- ;
- DSEG
- ;
- DatFmt: ds 1
- ;
- end