home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / bye5 / b5-clock.lbr / B5C-XERO.IQS / B5C-XERO.INS
Encoding:
Text File  |  1986-03-08  |  2.4 KB  |  93 lines

  1. ;
  2. ;**********************************************************************
  3. ;
  4. ; B5C-XERO.INS    A TIME insert for BYE500 and up
  5. ;  07/15/85    Note:  This is an insert--not an overlay
  6. ;            Wayne Masters
  7. ;            Potpourri, 408-378-7474
  8. ;
  9. ; Adapted from:
  10. ; MBC-XERO.ASM -- Version 1.0 -- 05/24/84 -- by Isaac Salzman
  11. ;
  12. ;    This insert is for a Xerox 820-II running BYE5. This
  13. ;    routine will only work on a Xerox 820-II, not an 820. It
  14. ;    will also (most likely) work on the 16/8 as well.
  15. ;
  16. ;    When called this routine will check the RTCBUF. If a '99H'
  17. ;    is in the first byte, the clock is initialized. Next the
  18. ;    seconds are checked, and if changed since last update of
  19. ;    RTC buffer, the clock is stopped, data copied to RTCBUF and
  20. ;    the clock is restarted. (If no change in seconds, the
  21. ;    routine returns immediately.)
  22. ;
  23. ;**********************************************************************
  24. ;
  25. ;
  26. ;Xerox clock initialization
  27. ;
  28. XERCLK    EQU    0F039H        ; Location of Xerox 820-II time vector
  29.                 ; Monitor routine. When called, it returns
  30.                 ; The addr of the 820's clock in high mem.
  31. TIME:
  32.     LXI    H,0        ; Clear HL
  33.     CALL    XERCLK        ; Get pointer to TOD in HL
  34.     MOV    A,M
  35.     CALL    MOVETM
  36.     STA    RTCBUF+6    ; Get day
  37. ;
  38.     INX    H
  39.     MOV    A,M
  40.     CALL    MOVETM
  41.     STA    RTCBUF+5    ; Get month
  42. ;
  43.     INX    H
  44.     MOV    A,M
  45.     CALL    MOVETM
  46.     STA    RTCBUF+4    ; Get year
  47. ;
  48.     INX    H
  49.     MOV    A,M
  50.     CALL    MOVETM
  51.     STA    RTCBUF        ; Update hours
  52. ;
  53.     INX    H
  54.     MOV    A,M
  55.     CALL    MOVETM
  56.     STA    RTCBUF+1    ; Update minutes
  57. ;
  58.     INX    H
  59.     MOV    A,M
  60.     CALL    MOVETM
  61.     STA    RTCBUF+2    ; Update seconds
  62. ;
  63.     LDA    RTCBUF        ; Get BCD HH
  64.     CALL    BCDBIN        ; And convert to binary
  65.     STA    CCHOUR        ; For BYE5
  66.     LDA    RTCBUF+1    ; Get BCD MM
  67.     CALL    BCDBIN
  68.     STA    CCMIN        ; Binary for BYE5
  69.     RET            ; And return (for now..)
  70. ;
  71. MOVETM:    MVI    B,0        ; Clear reg B
  72. CONV:    CPI    10        ; Are we >= 10 ?
  73.     JC    ADDREST        ; No, add the rest
  74.     SUI    10        ; Subtract 10 from A
  75.     MOV    C,A        ; Put A in C (store it for a sec)
  76.     MOV    A,B        ; Put B in A
  77.     ADI    16        ; Add 16
  78.     MOV    B,A        ; Store it back in B
  79.     MOV    A,C        ; Get our original value back in A
  80.     JMP    CONV
  81. ADDREST:
  82.     ADD    B        ; Add the rest to what's in A
  83.     RET            ; Return
  84. ;
  85. ;**********************************************************************
  86. ;
  87. ; This is the end of the TIME insert for BYE500 and up. If you
  88. ; replace the existing TIME insert with this, and have a Xerox 820-II,
  89. ; it SHOULD work fine...
  90. ;
  91. ;**********************************************************************
  92. ;
  93.