TITLE "Z3IFELSE - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3IFELSE.Z80 Ver 1.1 by Richard Conn ; Date : 29 Mar 89 ; Version : 1.2 ; Module : Z3IFELSE ; Abstract: This module contains the routine IFELSE which ; complements the Active bit for the current IF. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC IFELSE ; External References EXT GETMSG .Z80 CSEG ;=============================================================== ; NAME - IFELSE ; Entry: - None ; Exit : A <> 0, Zero Flag Reset (NZ) If Ok ; A = 0 and Zero Flag Set (Z) if no current IF ; Uses : AF ; Special Requirements: None ;=============================================================== 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? JR Z,IFERR ; ..Exit with A=0, Z set if error 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 OR 0FFH ; ..return NZ IFERR: POP BC ; Restore registers POP HL RET END