home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / TIME5.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  68 lines

  1.     page    66,132
  2. ;******************************** TIME5.ASM  *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. comment 
  13. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  TIME  )
  14. ASC_DATE - Creates a date string of the form MM/DD/YY.
  15. ;
  16. ; input:  DX        year (1980-2099)
  17. ;      AH        month (1-12)
  18. ;      AL        day (1-31)
  19. ;    DS:SI        destination string ("string")
  20. ;
  21. ; output: si points past last character stored.      
  22. ;* * * * * * * * * * * * * *
  23. 
  24.     PUBLIC    asc_date
  25. asc_date    proc    far
  26.         apush    ax,bx,dx,di
  27.  
  28.         push    es
  29.         push    ds
  30.         pop    es        ;ensure ES = DS in large data models
  31.  
  32.         mov    di,si        ;DI = SI
  33.         xchg    ax,bx        ;BX = month and day
  34.         mov    al,bh        ;AL = month
  35.         aam            ;AX = month in BCD format
  36.         add    ax,"00"        ;AX = month in decimal digits
  37.         xchg    al,ah
  38.         stosw            ;write month to string
  39.         mov    al,"/"
  40.         stosb            ;write "/" to string
  41.         xchg    ax,bx        ;AL = day
  42.         aam            ;AX = day in BCD format
  43.         add    ax,"00"        ;AX = day in decimal digits
  44.         xchg    al,ah
  45.         stosw            ;write day to string
  46.         mov    al,"/"
  47.         stosb            ;write "/" to string
  48.         xchg    ax,dx        ;AX = year
  49.         mov    dl,100
  50.         div    dl        ;DL = last two digits of year
  51.         mov    al,ah        ;AL = last two digits of year
  52.         aam            ;AX = year in BCD format
  53.         add    ax,"00"        ;AX = year in decimal digits
  54.         xchg    al,ah
  55.         stosw            ;write year to string
  56.         xor    al,al
  57.         stosb            ;write NULL to end of string
  58.  
  59.         pop    es
  60.  
  61.         apop    ax,bx,dx,di
  62.         retf
  63. asc_date    endp
  64.  
  65.  
  66. LIBSEG    ENDS
  67.     end
  68.