; Library: ZSLIB ; Version: 2.1 ; Module: ZSISBCDD ; Version: 1.1 ; Author: Carson Wilson ; Date: February 2, 1990 ; Changes: Shortened code length (thanks to Howard Goldstein). ; ; Version: 1.0 ; Author: Carson Wilson ; Date: January 21, 1990 ; Purpose: Test BCD date/time at HL for validity ; PUBLIC ISBCD, ISBCDD ; ; ISBCDD - Test BCD date/time at HL for validity ; Enter: - points to possible YY,MM,DD,hh,mm in BCD. ; Exit: (Z) means date/time ok: ; A = '*' (2Ah) if wildcards used. ; A = 00h if no wildcards used. ; (NZ) and = 0FFh means date/time invalid ; Uses: ; ISBCDD: push hl ld a,(hl) ; BCD year call ISBCD jr nc,ISNO inc hl ; month ld a,(hl) or a jr z,ISNO cp 13h ;jr nc,ISNO call c,ISBCD jr nc,ISNO inc hl ; day ld a,(hl) or a jr z,ISNO cp 32h ;jr nc,ISNO call c,ISBCD jr nc,ISNO inc hl ; hour ld a,(hl) bit 7,a ; relative time? jr nz,ISOK ; yes. cp 24h ;jr nc,ISNO call c,ISBCD jr nc,ISNO inc hl ; min ld a,(hl) cp 60h ;jr nc,ISNO call c,ISBCD jr nc,ISNO ISOK: pop hl xor a ; Return no error ret ISNO: ld a,(hl) cp '*' pop hl ret z ; Allow wildcard or 0FFh ret ; Subroutines ; ISBCD - Test if byte in A is BCD. (Condensed by Howard Goldstein) ; Enter: holds byte to test ; Exit: (C) means byte is BCD ; (NC) means byte is invalid ; Uses: ; ISBCD: ; See if nibbles in 0..9 cp 09Ah ret nc ; Not BCD if > 99 and 00001111b ; Test right nibble cp 00Ah ret end ; End ZSISBCDD.Z80