home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BYE5 / B5C-ICM.INS < prev    next >
Text File  |  2000-06-30  |  3KB  |  102 lines

  1. ;----------------------------------------------------------------------
  2. ;
  3. ; B5C-ICM.INS        Intersil ICM7170 Clock Chip          02 Sep 86
  4. ;        Clock routine for the the BYE5xx program
  5. ;    Clock usable in 6502 and Z80 systems and possibly others
  6. ;            By George F. Reding [72436,45]
  7. ;
  8. ; Note:  A clock set program in 8080 code is available named MSXRTC.ASM
  9. ;            By George F. Reding [72436,45]
  10. ;
  11. ;----------------------------------------------------------------------
  12. ;
  13. IO00    EQU    00H        ; Available i/o ports available at "J5" on
  14. IO10    EQU    10H        ; Morrow hard disk systems
  15. IO20    EQU    20H        ; You may have to install the 40-pin header
  16. IO30    EQU    30H        ; strip at that location as I have done.
  17. ;
  18. ; If using a Morrow hard disk set CLDATA to IOnn+1 and CLREGL to IOnn
  19. ; On other machines use your appropriate i/o port c/s line & address.
  20. ;
  21. CLDATA    EQU    IO00+1        ; Rtc data port
  22. CLREGL    EQU    IO00        ; Register latch
  23. ;
  24. ; Time, date, day of week, and alarm is moved to the ICM7170 buffers
  25. ; on receipt of desire to read the 1/100th seconds of the time. This
  26. ; short insert for BYE5xx is only reading the time, date, and day of
  27. ; week.
  28. ;
  29. ; To read the alarm values, send to register latch the values of 08H
  30. ; thru 0FH for the 1/100 secs, hours, mins, seconds, month, day, year,
  31. ; and day of week, respectively.  If you can use the alarm, you can
  32. ; imitate the clock/date/weekday reading.
  33. ;
  34. ;
  35. CLKCEN EQU    019H        ; Bcd for 20th century for BYE
  36. ;
  37. TIME:    PUSH    PSW        ; Save in case used elsewhere
  38. ;
  39. ; This will move the data to the clock's internal buffer
  40. ;
  41.     MVI    A,00H        ; Counter 1/100 seconds
  42.     OUT    CLREGL        ; Send to clock register latch
  43. ;
  44. ; All values are now read from the clock's buffer
  45. ;
  46.     IN    CLDATA        ; Get binary 1/100 secs, not used in BYE
  47. ;
  48.     MVI    A,01H        ; Counter hours
  49.     OUT    CLREGL        ; Send to clock register latch
  50.     IN    CLDATA        ; Get binary hours
  51.     STA    CCHOUR        ; Store binary hours
  52.     CALL    BINBCD        ; Convert to bcd
  53.     STA    RTCBUF+0    ; Store bcd hours
  54. ;
  55.     MVI    A,02H        ; Counter minutes
  56.     OUT    CLREGL        ; Send to clock register latch
  57.     IN    CLDATA        ; Get binary minutes
  58.     STA    CCMIN        ; Store binary minutes
  59.     CALL    BINBCD        ; Convert to bcd
  60.     STA    RTCBUF+1    ; Store bcd minutes
  61. ;
  62.     MVI    A,03H        ; Counter seconds
  63.     OUT    CLREGL        ; Send to clock register latch
  64.     IN    CLDATA        ; Get binary seconds
  65.     CALL    BINBCD        ; Convert to bcd
  66.     STA    RTCBUF+2    ; Store bcd seconds
  67. ;
  68.     MVI    A,04H        ; Counter month
  69.     OUT    CLREGL        ; Send to clock register latch
  70.     IN    CLDATA        ; Get binary month
  71.     CALL    BINBCD        ; Convert to bcd
  72.     STA    RTCBUF+5    ; Store bcd month
  73. ;
  74.     MVI    A,05H        ; Counter day
  75.     OUT    CLREGL        ; Send to clock register latch
  76.     IN    CLDATA        ; Get binary day
  77.     CALL    BINBCD        ; Convert to bcd
  78.     STA    RTCBUF+6    ; Store bcd day
  79. ;
  80.     MVI    A,06H        ; Counter year
  81.     OUT    CLREGL        ; Send to clock register latch
  82.     IN    CLDATA        ; Get binary year
  83.     CALL    BINBCD        ; Convert to bcd
  84.     STA    RTCBUF+4    ; Store bcd year
  85. ;
  86. ; Day of week is not used in the BYE buffer so is remarked out here
  87. ;
  88. ;    MVI    A,07H        ; Counter day of week
  89. ;    OUT    CLREGL        ; Send to clock register latch
  90. ;    IN    CLDATA        ; Get binary day of week
  91. ;    CALL    BINBCD        ; Convert to bcd
  92. ;    STA    *UNUSED*    ; Store bcd week
  93. ;
  94.     MVI    A,CLKCEN    ; Set century value for RTCBUF+3
  95.     STA    RTCBUF+3    ; and store it
  96. ;
  97.     POP    PSW        ; Restore reg initially saved
  98.     RET
  99. ;
  100. ; End of the CLOCK routine
  101. ;
  102.         Intersil ICM7170 Clock Chip          02