home *** CD-ROM | disk | FTP | other *** search
- ; Library: ZSLIB
- ; Version: 3.1
- ; Module: GCOMNAM
- ; Version: 1.0
- ; Author: Gene Pizzetta
- ; Date: August 10, 1991
- ;
- ; GCOMNAM -- Get and store program's invocation name.
- ;
- ; Entry: HL = address of default program name (space terminated)
- ; Exit: None
- ; Uses: None
- ; Notes: Gets program's invocation name from ZCPR3 external file control
- ; block, if one exists. If not, the default program name is stored.
- ; The default program name must be either 8 characters long or
- ; terminated by a space character. The program name (minus any
- ; trailing spaces) is stored as a null-terminated string at public
- ; label COMNAM that can be accessed by print routines such as
- ; SYSLIB's PSTR and EPSTR.
- ;
- PUBLIC GCOMNAM ; module entry
- PUBLIC COMNAM ; stored program name
- ;
- EXTRN GETEFCB ; Z3LIB
- ;
- GCOMNAM:
- push af
- push bc
- push de
- push hl
- ld de,COMNAM ; point to name storage buffer
- ld a,(de) ; is this a re-run?
- or a
- jr nz,GDone ; (yes, name is already stored)
- ;
- call getefcb ; get external FCB address
- inc hl ; HL = address, move past drive byte
- ld b,8 ; name is 8 characters maximum
- jr nz,GCom1 ; (move name)
- pop hl ; recover default name address
- push hl
- GCom1: ld a,(hl) ; get name character
- and 7Fh ; strip attribute
- cp ' '
- jr z,GDone ; (don't store spaces)
- ld (de),a ; store next character
- inc hl ; increment pointers
- inc de
- djnz GCom1
- GDone: pop hl
- pop de
- pop bc
- pop af
- ret
- ;
- ; Name storage buffer
- ;
- COMNAM: ds 9,0 ; initialized to zeroes
- ;
- end