TITLE "Z3GZNC - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3GZNC.Z80 Ver 1.1 by Richard Conn ; Date : 15 Mar 87 ; Version : 1.2 ; Module : Z3GZNC ; Abstract: This module contains the routine GETZNC which ; returns the address of the next character that ZEX will ; return, and the character itself ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC GETZNC ; External References EXT ENVPTR .Z80 CSEG ;=============================================================== ; NAME - GETZNC ; Entry: - None ; Exit : HL - Points to next char ZEX will return ; A = char, Carry Flag Reset (NZ) if Ok, else ; A = 0, Carry Flag Set (C) if no char available ; Uses : AF,HL ; Special Requirements: None ;=============================================================== GETZNC: PUSH HL LD HL,(ENVPTR) ;pt to environment LD A,H ;any environment? OR L JR Z,ERROR0 PUSH DE ;pt to message byte LD DE,34 ;offset to message ptr ADD HL,DE LD A,(HL) ;get address of messages INC HL LD H,(HL) LD L,A ; HL pts to message OR H ;any messages? JR Z,ERROR LD DE,9 ;pt to Zex Next Char Address ADD HL,DE LD E,(HL) ;get address INC HL LD D,(HL) EX DE,HL POP DE POP AF ;clear stack LD A,(HL) ;get next char OR A ;set Z and Clear Carry RET ERROR0: POP DE ; Restore DE ERROR: POP HL ;restore HL SCF ;set carry RET END