home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / util / arkts.ark / ARKTS.Z80 < prev    next >
Encoding:
Text File  |  1988-12-23  |  2.5 KB  |  109 lines

  1.  
  2.     ASEG
  3. ;
  4. TITLE 'ARK Time stamp   VERS:- 00.02  DATE:- 12/22/88  TIME:- 22:13:44'
  5. ;
  6. ; Routine that reads clock and loads the five bytes in ARK for time
  7. ; stamping.  Uses the same concept that TIMESTAMP does by overlaying the
  8. ; first JP in .ARK with a new one to a clock read routine past the end
  9. ; of .ARK.  After the clock routine reads the clock, loads the bytes at
  10. ; 103h-107h of ARK, restores .ARK back to it original state and .ARK can
  11. ; reuse the space taken by this routine.  You have to customize your own
  12. ; clock-read section
  13. ;
  14. ; Use MLOAD to add clock read routine to ARK.COM:
  15. ;
  16. ;         MLOAD ARK.COM=ARK.COM,ARKTS
  17. ;
  18. ; by Harold H. Jones   TERC PBBS  (615)-239-8696
  19. ;
  20. ;-----------------------------------------------------------------------
  21. ;
  22. ; Byte in .ARK to put time date into
  23. ;
  24. YEAR    EQU    103H        ; In binary
  25. MONTH    EQU    104H
  26. DAY    EQU    105H
  27. HOUR    EQU    106H
  28. MIN    EQU    107H
  29. ;
  30. ENDARK    EQU    3780H        ; Address passed end of ARK.COM
  31. ;                ;   Each new version may vary
  32. OLDJMP    EQU    28FAH        ; Address to restore
  33. ;                ;   (May very with version.)  Use DDT
  34. ;                ;   to check address at 0101h.
  35. ;                ; At 101h
  36. JMPADD    EQU    0100H        ; Address of JP to this routine
  37. ;
  38.     ORG    JMPADD + 1
  39.     DW    ENDARK        ; New JP to clock read routine.  Overlay
  40. ;                ;   old JP with new one to clock read
  41.     ORG    ENDARK        ; End of .ARK and start of clock read
  42. ;
  43. ; Clock read routine (Z-Time)
  44. ;
  45. PORT    EQU    0E0H        ; Data at port is in BCD
  46. ;                ; 9-19-88 8:23:15
  47. ;                ; E2h=15h
  48. ;                ; E3h=23h
  49. ;                ; E4h=20h
  50. ;                ; E5h=02h
  51. ;                ; E6h=19h
  52. ;                ; E7h=09h
  53. ;                ; E8h=00h
  54. ;                ; E9h=88h
  55. ;
  56. READ:    IN    A,(PORT+3)    ; Get  minutes in BCD
  57.     CALL    BCDBIN        ; Convert to binary
  58.     LD    (MIN),A        ; Put where .ARK expects
  59.     IN    A,(PORT+4)    ; Get hour
  60.     CALL    BCDBIN
  61.     LD    (HOUR),A
  62.     IN    A,(PORT+6)    ; Get day
  63.     CALL    BCDBIN
  64.     LD    (DAY),A
  65.     IN    A,(PORT+7)    ; Get month
  66.     CALL    BCDBIN
  67.     LD    (MONTH),A
  68.     IN    A,(PORT+9)    ; Get year
  69.     CALL    BCDBIN
  70.     LD    (YEAR),A
  71. ;
  72. ; End of clock read
  73. ;
  74. ; Restore original JP address
  75. ;
  76.     LD    HL,OLDJMP    ; Restore OLDJMP
  77.     LD    (JMPADD+1),HL
  78.     JP    OLDJMP        ; Start .ARK
  79. ;
  80. ; Borrowed from BYE510
  81. ;
  82. ;  BCD to Binary converter
  83. ;  -----------------------
  84. ;  This routine will convert an 8 bit BCD number (0-99) to binary.
  85. ;
  86. ;  To use:
  87. ;
  88. ;    LDA    BCDNUMBER
  89. ;    CALL    BCDBIN
  90. ;
  91. ;  The routine returns with the binary number in the A register.
  92. ;
  93. BCDBIN:    PUSH    DE
  94.     LD    E,A        ; Save original byte
  95.     AND    15
  96.     LD    D,A        ; Save low nibble
  97.     LD    A,E
  98.     AND    240        ; Mask LSN
  99.     RRCA            ; X2
  100.     LD    E,A
  101.     RRCA            ; X4
  102.     RRCA            ; X8
  103.     ADD    E        ; X10
  104.     ADD    D        ; Low nibble
  105.     POP    DE
  106.     RET
  107. ;
  108.     END
  109.