home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Z3LIB Module Name: Z3IFELSE
- ; Author: Richard Conn
- ; Z3LIB Version Number: 1.3
- ; Module Version Number: 1.1
- ;
- public ifelse
-
- ext getmsg
-
- ;
- ; IFELSE complements the Active Bit for the Current IF. Return with
- ; A=0 and Zero Flag Set (Z) if there is no current IF.
- ;
- ifelse:
- push hl ;save regs
- push bc
- call getmsg ;pt to messages
- inc hl ;pt to IF byte
- ld a,(hl) ;get IF byte
- or a ;any active IFs?
- jp z,iferr
- ld b,a ;get IF byte in B
- inc hl ;pt to IF active byte
- ld a,(hl) ;get it
- cpl ;flip bits
- and b ;look at only interested bit
- ld c,a ;result in C
- ld a,b ;complement IF byte
- cpl
- ld b,a
- ld a,(hl) ;get active byte
- and b ;mask in only uninterested bits
- or c ;mask in complement of interested bit
- ld (hl),a ;save result
- pop bc ;restore registers
- pop hl
- xor a ;return NZ
- dec a
- ret
- iferr:
- pop bc ;restore registers
- pop hl
- xor a ;return Z
- ret
-
- end