home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / ftp.demon.co.uk-pub-cpm / foodo-v1.lbr / PANOVL.ZZ0 / PANOVL.Z80
Text File  |  1994-01-01  |  4KB  |  164 lines

  1. ;
  2. ; panovl.mac
  3. ;
  4. ; user-written overlay for pancake
  5. ;
  6. ; written ron murray 17/11/88
  7. ; modified to use bye5 clock inserts rjm 13/1/90
  8. ;
  9. ; this version dated 21/2/90 rjm
  10. ;
  11.  
  12. false    equ    0
  13. true    equ    not false
  14. no    equ    false
  15. yes    equ    true
  16. bdos    equ    5
  17.  
  18. ; this overlay defines equates and strings for pancake. edit as you wish.
  19. ; you will also need to supply the name of your bye5 clock insert at the
  20. ; appropriate point.
  21. ;
  22.     org    0109h        ; Start after initial jp, and then some
  23.  
  24. ; Your _must_ place your ENV address here as BYE loads Pancake.com and as
  25. ; a result the env pointer does not get set.
  26.  
  27. ; Place your Z3ENV address here..
  28.  
  29.     dw    0f580h        ; Your ENV address
  30.     dw    0        ; Do NOT alter this one
  31.  
  32. ; Jump table: do not change
  33.  
  34.     jp    pantime        ; get time/date
  35.  
  36. ;------------------------------------------------------------------------------
  37. ; Place your local STD area code number here
  38. ; Edit this to reflect your local STD number.
  39.  
  40. stdnum:    db    '09'    ; Your local STD code. Up to eight numbers allowed
  41.  
  42. ;----------------------------------------------------------------------
  43. ; DO NOT ALTER THIS!
  44.  
  45.     db    '-'    ; DO NOT alter this one. It is ALWAYS last!
  46. ;
  47. ;------------------------------------------------------------------------------
  48. ;
  49. ; Insert the filename of your bye5 clock insert here. don't forget to make
  50. ; sure that the file is on the correct drive/user area before you assemble
  51. ; this file! Also note that the insert must be in z80 code before use:
  52. ; convert with xiz or whatever if necessary.
  53. ;
  54.     include    clock.lib
  55. ;
  56. ;------------------------------------------------------------------------------
  57. ;
  58. ; end of user-specified equates. do not change anything below this point!
  59. ;
  60. ;------------------------------------------------------------------------------
  61. ;
  62. ; time routine
  63. ;
  64. ; Destroys af and hl, retains the rest returns (in hl) address of a table
  65. ; containing the current time as follows:
  66. ;
  67. ; 0    year    e.g. 1988
  68. ; 2    month    1 - 12
  69. ; 4    day    1 - 31
  70. ; 6    hour    0 - 23
  71. ; 8    minute    0 - 59
  72. ; 10    second    0 - 59
  73.  
  74. ; Each is a 2-byte binary value.
  75.  
  76. pantime:push    af        ; save regs
  77.     push    bc
  78.     push    de
  79.     push    ix        ; in case insert uses ix, iy
  80.     push    iy
  81.     call    time        ; call the bye5 clock insert
  82.     ld    a,(rtcbuf+4)    ; convert years
  83.     call    bcdbin
  84.     ld    de,1900        ; add century
  85.     add    hl,de
  86.     ld    (timetab),hl    ; store
  87.     ld    a,(rtcbuf+5)    ; convert month
  88.     call    bcdbin
  89.     ld    (timetab+2),hl
  90.     ld    a,(rtcbuf+6)    ; day
  91.     call    bcdbin
  92.     ld    (timetab+4),hl
  93.     ld    a,(rtcbuf)    ; hour
  94.     call    bcdbin
  95.     ld    (timetab+6),hl
  96.     ld    a,(rtcbuf+1)    ; minute
  97.     call    bcdbin
  98.     ld    (timetab+8),hl
  99.     ld    a,(rtcbuf+2)    ; second
  100.     call    bcdbin
  101.     ld    (timetab+10),hl
  102.     pop    iy        ; restore regs
  103.     pop    ix
  104.     pop    de
  105.     pop    bc
  106.     pop    af
  107.     ld    hl,timetab    ; point to table
  108.     ret            ; and quit
  109.  
  110. ; Convert bcd value in a to 2-byte binary value in hl. modified from
  111. ; routine in bye5 (with apologies).
  112.  
  113. bcdbin:    ld    h,a        ; save a
  114.     and    0fh        ; mask off hi nybble
  115.     ld    l,a        ; save low nybble
  116.     ld    a,h        ; get original back
  117.     and    0f0h        ; mask lsb
  118.     rrca            ; x2
  119.     ld    h,a
  120.     rrca            ; x4
  121.     rrca            ; x8
  122.     add    a,h        ; x10
  123.     add    a,l        ; low nibble
  124.     ld    l,a        ; put in hl
  125.     ld    h,0        ; msb = 0
  126.     ret
  127.  
  128. ; Binbcd will convert a 0-99 binary number to 0-99 bcd number.
  129. ; Call with (a)=binary number 0-99. (a)=0-99 bcd on exit
  130.  
  131. binbcd:    or    a    ; bcd 0 = binary 0,
  132.     ret    z    ; so return.
  133.     push    bc
  134.     ld    b,a    ; conversion counter.
  135.     xor    a    ; clear 'a'.
  136. binlop:    inc    a    ; add one.
  137.     daa        ; binary to bcd.
  138.     djnz    binlop    ; all converted?
  139.     pop    bc
  140.     ret
  141.  
  142. ; Time table: pointed to by hl on return from time routine. all are two-byte
  143. ; binary values.
  144.  
  145. timetab:
  146. year:    ds    2
  147. month:    ds    2
  148. day:    ds    2
  149. hour:    ds    2
  150. minute:    ds    2
  151. second:    ds    2
  152.  
  153. ; dummy bye5 time buffers:
  154.  
  155. rtcbuf:    ds    7
  156. cchour:    ds    1        ; not used but necessary to keep
  157. ccmin:    ds    1        ; the bye overlay happy.
  158.  
  159.      if    ($ ge 0300h)
  160.     jp    error        overlay    too large!!!
  161.      endif
  162.  
  163.     end
  164.