home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / zslsrc36.lbr / SDATS2.ZZ0 / SDATS2.Z80
Encoding:
Text File  |  1991-10-08  |  1.4 KB  |  73 lines

  1. ; Library:    ZSLIB
  2. ; Version:    3.4
  3. ; Module:    SDATS2
  4. ; Version:    1.0
  5. ; Author:    Gene Pizzetta
  6. ; Date:        October 8, 1991
  7. ;
  8. ; SDATS2 -- Prints intermediate form of date in American or European format,
  9. ; e.g., "Mar 02 88" or "02 Mar 88", with switchable output.
  10. ;
  11. ; Entry:  HL = address of date as BCD yy mm dd
  12. ;      A = date format flag (0=American, FFh=European)
  13. ; Exit:   None
  14. ; Uses:   None
  15. ;
  16.     PUBLIC    SDATS2
  17. ;
  18.     EXTRN    DSTRM3,ZOUT    ; ZSLIB
  19.     EXTRN    SA2HC        ; SYSLIB
  20. ;
  21. SDATS2:    push    hl
  22.     push    de
  23.     push    bc
  24.     push    af
  25.     ld    c,a        ; save flag
  26.     ld    d,(hl)        ; save year
  27.     inc    hl
  28.     ld    e,(hl)        ; save month
  29.     inc    hl
  30.     or    a        ; test flag
  31.     ld    a,(hl)        ; get day
  32.     push    af        ; save day
  33.     call    nz,PRDAY    ; if European, do day
  34. ; Print month
  35.     xor    a        ; Clear carry for DAA
  36.     ld    a,e        ; Get month
  37.     ld    hl,DSTRM3-3    ; ..from months table
  38. NXTMTH:    inc    hl
  39.     inc    hl
  40.     inc    hl        ; Point to string
  41.     dec    a
  42.     daa            ; Decimal adjust
  43.     jr    nz,NXTMTH
  44.     ld    b,3        ; 3 characters
  45. PRMON:    ld    a,(hl)
  46.     inc    hl
  47.     call    ZOUT
  48.     djnz    PRMON
  49.     call    SPACE
  50.     pop    af        ; recover day
  51.     inc    c        ; test flag
  52.     dec    c
  53.     call    z,PRDAY        ; if American, do day
  54. ; Print year
  55.     ld    a,d        ; Get year
  56.     call    SA2HC
  57.     pop    af
  58.     pop    bc
  59.     pop    de
  60.     pop    hl
  61.     ret
  62. ;
  63. ; Subroutines
  64. ;
  65. ; Print day and fall through to SPACE
  66. ;
  67. PRDAY:    call    SA2HC
  68. ;
  69. SPACE:    ld    a,' '
  70.     jp    ZOUT
  71. ;
  72.     end
  73.