home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / bye3 / b3c-xero.ins < prev    next >
Text File  |  1994-07-13  |  2KB  |  83 lines

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