; ; COOKOVL.Z80 ; ; User overlay for AUTOCOOK ; ; Written Ron Murray 7/12/88 ; Modified to use BYE clock overlays for time rjm 13/1/90 ; ; This version dated 26/2/90 rjm ; ; This file should be modified as necessary to suit your system. You will ; need to supply the name of your BYE5 clock routine at the appropriate ; point (don't forget to ensure that it's in the current drive/user when ; you assemble this overlay!), and you'll need to supply the full ; drive/user/name of your BYE.COM file for AUTOCOOK to return to. false equ 0 true equ not false no equ false yes equ true bdos equ 5 org 0103h+10 ; Skip env code ; Jump table: do NOT change jp cooktime ;------------------------------------------------------------------------------ ; ; Insert the filename of your BYE5 clock insert below. Ensure that it's in ; the appropriate drive/user when you assemble this file! Also note that the ; insert must be in Z80 code before use: convert with XIZ or whatever if ; necessary. ; include clock.lib ; ;------------------------------------------------------------------------------ ; ; End of user-specified equates. Do not change anything below this point! ; ;------------------------------------------------------------------------------ ; ; Time routine ; ; Destroys AF and HL, retains the rest ; Returns (in HL) address of a table containing the current time as follows: ; ; 0 year e.g. 1988 ; 2 month 1 - 12 ; 4 day 1 - 31 ; 6 hour 0 - 23 ; 8 minute 0 - 59 ; 10 second 0 - 59 ; ; Each is a 2-byte binary value. cooktime: push af ; save regs push bc push de push ix ; in case insert uses ix, iy push iy call time ; call the BYE5 clock insert ld a,(rtcbuf+4) ; convert years call bcdbin ld de,1900 ; add century add hl,de ld (timetab),hl ; store ld a,(rtcbuf+5) ; convert month call bcdbin ld (timetab+2),hl ld a,(rtcbuf+6) ; day call bcdbin ld (timetab+4),hl ld a,(rtcbuf) ; hour call bcdbin ld (timetab+6),hl ld a,(rtcbuf+1) ; minute call bcdbin ld (timetab+8),hl ld a,(rtcbuf+2) ; second call bcdbin ld (timetab+10),hl pop iy ; restore regs pop ix pop de pop bc pop af ld hl,timetab ; point to table ret ; and quit ; Convert BCD value in A to 2-byte binary value in HL. Modified from ; routine in BYE5 (with apologies). bcdbin: ld h,a ; save A and 0fh ; mask off hi nybble ld l,a ; save low nybble ld a,h ; get original back and 0f0h ; mask LSB rrca ; X2 ld h,a rrca ; X4 rrca ; X8 add a,h ; X10 add a,l ; Low nibble ld l,a ; put in HL ld h,0 ; MSB = 0 ret ; ; BINBCD will convert a 0-99 binary number to 0-99 BCD number. Call ; with (A)=binary number 0-99. (A)=0-99 BCD on exit binbcd: or a ; BCD 0 = Binary 0, ret z ; so return. push bc ld b,a ; Conversion counter. xor a ; Clear 'A'. binlop: inc a ; Add one. daa ; Binary to BCD. djnz binlop ; All converted? pop bc ret ; ; Time table: pointed to by hl on return from time routine. All are two-byte ; binary values. timetab: year: ds 2 month: ds 2 day: ds 2 hour: ds 2 minute: ds 2 second: ds 2 ; Dummy BYE5 time buffers: rtcbuf: ds 7 cchour: ds 1 ; Not used but necessary to keep ccmin: ds 1 ; the BYE overlay happy. if $ ge 0300h jp xerror ; Overlay too large! endif end