TITLE "Z3GZFC - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3GZFC.Z80 Ver 1.1 by Richard Conn ; Date : 15 Mar 87 ; Version : 1.2 ; Module : Z3GZFC ; Abstract: This module contains the routine GETZFC which ; returns the first character in the ZEX command buffer ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC GETZFC ; External References EXT ENVPTR .Z80 CSEG ;=============================================================== ; NAME - GETZFC ; Entry: - None ; Exit : HL - Points to the first char in ZEX buffer ; A = char, Carry Flag Reset (NC) if Ok ; A = 0, Carry Flag Set (C) if data unavailable ; Uses : AF,HL ; Special Requirements: None ;=============================================================== GETZFC: 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,11 ;pt to Zex First Char 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 ERROR: POP DE ; Restore DE ERROR0: POP HL ;restore HL SCF ;set carry RET END