; .z80 name ('GOTCHA') ; ; Written by Murray L. Lesser, March 21, 1982 ; Written in Zilog mnemonics ; Assembled with SLR180 as follows: slr gotcha/6 ; Ref: "Using Microsoft Compiled BASIC," McGraw-Hill Book Company ; Minor edits done by: Lee Bradley, Z-Node #12 203 665-1100 ; ; GOTCHA is a called subroutine for a BASCOM program. It ; stores the string length and starting address of the text ; that the CCP places in tbuff (ie. the command tail) (after ; removing any leading blanks,) in the string pointer of the ; passed argument. The GOTCHA call must be the first use of ; that string variable in the calling program. ; ; Sample use in BASCOM driver TEST.BAS: ; ; CALL GOTCHA(A$) ; PRINT CHR$(34) A$ CHR$(34) ; END ; ; System dependent addresses: base equ 0 ; CP/M zero-page offset ; Other addresses: tbuff equ base+80h ; CP/M tbuff gotcha:: ; entry point ; check for zero-length string: ld a,(tbuff) ; command-line count ld (hl),a ; store count in pointer cp 0 ; any value? ret z ; if not, done. ; remove leading blank(s): ld de,tbuff+1 blank: dec (hl) ; reduce count ret z ; return if no string inc de ; next byte ld a,(de) cp ' ' ; check for blank jr z,blank ; if so, go again ; store string address in BASCOM's pointer: inc hl ; to address pointer ld (hl),e ; low-order byte inc hl ld (hl),d ; high-order byte ; done, so return: ret end