; @.Z80 Version 1.00 ; 25 January 1987 ; ; Joe Griffith ; 516 Hollomon Dr. ; Hampton, VA 23666 ;------------------------------------------------------ version equ 10 ;------------------------------------------------------ ; The point of this program is to ; possition the cursor on the screen. ; It is only useful in aliases or ZEX ; files. ; ; Syntax: @ cc rr cmd1 cmd2... comment ; where: rr = desired row ; cc = desired column ; cmdx = EOL - erase to the end of the line ; EOS - erase to the end of the screen ; BEL - ring the bell ; comment = any ascii text ;------------------------------------------------------ ; Assemble: ; ; ZAS @ ; ZLINK @,GRXLIB/,VLIB/,Z3LIB/,SYSLIB/ $$C100 ; ;----------------------------------------------------------- ; Preliminaries bel equ 7 ;ascii bell esc equ 27 ;ascii escape cr equ 13 ;ascii carriage return lf equ 10 ;ascii line feed par1 equ 5Dh ;1st parameter, 1st char par2 equ 6Dh ;2nd parameter, 1st char cmdl equ 80h ;command line start ;---------------------------------------------------------- ; external SYSLIB, Z3LIB, VLIB routines ext z3init, print, pstr, eval10, cout, compb ext z3vinit, tinit, dinit, gotoxy, ereol ext grxinit, clreos ;---------------------------------------------------------- jp start db 'Z3ENV' ;this is a ZCPR3 utility db 1 ;with an external environment z3eadr: dw 0000h ;not installed yet ;---------------------------------------------------------- start: ld hl,z3eadr ;load address of environment ptr ld a,(hl) ;get the first byte or a ;set the flags jp nz,begin ;must be installed already inc hl ;bump to second half ld a,(hl) ;get the second byt or a ;set the flags jp nz,begin ;must be installed already call print db cr,lf,'@ has not been installed',0 ret ;---------------------------------------------------------- begin: ld hl,(z3eadr) ;get the address of environment call z3init ;initialize syslib call z3vinit ;initialize vlib call grxinit ;initialize grxlib call tinit ;initialize terminal ;---------------------------------------------------------- ld hl,cmdl+2 ;pt to 1st char of 1st param call eval10 ;evaluate it cp 0 ;was that a zero? jp z,prthlp ld b,a ;move it to b for storage inc hl ;pt to 1st char of 2nd param call eval10 ;evaluate it push hl ;save the resulting position cp 0 ;was it a zro? jr nz,moveit inc e ;make it column one moveit: ld h,b ;put row back in h ld l,e ;put column in l call gotoxy ;go there cmds: pop hl ;get the original position back ld a,(hl) ;get that character cp 0 ;is it a null (the end) jp z,exit inc hl ;pt to 1st char of rest of comd ld b,3 ;load length of cmds ld de,eos ;point to 'EOS' string call compb ;compare command with eos jr z,doeos ld de,eol ;point to 'EOL' string call compb ;compare command with eol jr z,doeol ld de,bell ;point to 'BEL' string call compb ;compare command with bel jr z,dobell call pstr ;no match so print what's left jp exit eos: db 'EOS' eol: db 'EOL' bell: db 'BEL' ;---------------------------------------------------------- doeos: call clreos ;clear the screen to the end jr again doeol: call ereol ;erase the line jr again dobell: ld a,bel ;load the ascii bell char call cout ;send it again: inc hl ;bump the pointer 3 chars inc hl inc hl push hl ;save it jp cmds ;---------------------------------------------------------- prthlp: call print db '@ Version ' db [version/10]+'0','.',[version mod 10]+'0' db cr,lf,lf,' Syntax: @ rr cc cmd1 cmd2... comment' db cr,lf,lf,' Where: rr = row' db cr,lf,' cc = column' db cr,lf,' cmdx = EOL erase to end of line' db cr,lf,' EOS erase to end of screen' db cr,lf,' BEL ring terminal bell' db cr,lf,' comment = any ascii phrase' db 0 ret ;------------------------------------------------------------ exit: call dinit ;deinitialize terminal ret end