home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
ZCPR33
/
S-Z
/
XALIAS11.LBR
/
XALIAS0.ZZ0
/
XALIAS0.Z80
Wrap
Text File
|
2000-06-30
|
7KB
|
417 lines
; Program: XALIAS0
; Author: Paul Pomerleau and Richard Conn
; Version: 1.1
; Date: August 2, 1987
;
version equ 11
;
; The purpose of XALIAS0 is to create aliases using the VALIAS1
; program.
;
;
; Basic Equates
;
kill equ 5000h
kilsiz equ 254
buffer equ 4000h ;1K (approx) buffer
tbuff equ 80h
fcb equ 5ch
cr equ 0dh
lf equ 0ah
;
; External References
;
ext led
public kill,kilsiz,cmdlst,cmdlen
ext $memry
ext putcl
ext z3init,getwhl,z3log
ext print,sksp,crlf,pfn1,padc
ext hmovb,sfa,cout,ccout,pstr,zfname,capstr,capin
ext f$open,f$read,f$close,f$make,f$delete,f$write,f$exist,initfcb
;
; Key Equates for Address Definition of Environment
;
envdefn equ 103H ;Beginning of Environment Definition
envclas equ 108H ;Address of Environment Descriptor Class
ENTRY:
jp START
defb 'Z3ENV'
defb 1 ; Type-1 environment
ENVADDR:
dw 0f300h
; Configuration section
;
CMDLST: db 'QDSEXAF','S'+80h,'D'+80h,'G','H',127,'T', ; For LED
db 127+80h,'R','Y'+80h,'YUVIPWMC' ;
CMDLEN equ $ - CMDLST
; Main code section
;
START:
call z3init ; Initialize library routines
;
; Print Banner
;
call print
db 'XALIAS, Version '
db (version/10)+'0','.',(version mod 10)+'0',0
;
; Check for File
;
call getwheel
xor a
ld (kill),a
ld hl,fcb+1 ;pt to file name
ld a,(hl) ;get first char
cp ' ' ;no name if space
jp z,create ;create an ALIAS if no name
cp '/' ;help?
jr nz,start0
;
; Help Message
;
call print
db cr,lf,'XALIAS -- Create ALIAS Commands'
db cr,lf,'Syntax:'
db cr,lf,9,'XALIAS [dir:cmdname]',0
ret
;
; Load ALIAS File
;
start0:
start1:
call print
db 9,9,'ALIAS: ',0
ld hl,fcb+1 ;pt to name
ld b,8 ;8 chars
nfcr0:
ld a,(hl) ;print name
cp ' '
jr z,nfcr1
call cout
inc hl ;pt to next char
djnz nfcr0
nfcr1: call setcom ;set file type of file in FCB to COM if not already
ld de,fcb
call z3log
ld hl,buffer ;pt to file storage buffer
call f$open ;open ALIAS file for input
jr z,load ;load file
create: call print
db cr,lf,lf,' New',0
call codend
inc hl
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
ld de,-100H+17 ;compute offset
add hl,de
ld (oldaline),hl
ld (hl),0
jp input
;
; Load ALIAS File
;
load:
ld hl,buffer ;pt to load buffer
ld c,9 ;set block count
load1:
ld de,fcb ;pt to FCB
call f$read ;read next block
jr nz,load2
ld de,tbuff ;pt to buffer
ex de,hl
ld b,128 ;128 bytes
call hmovb
ex de,hl ;DE pts to next block
dec c ;count down
jr nz,load1
;
; Error - Not an ALIAS File
;
noALIAS:
call crlf
call crlf
ld de,fcb+1
call pfn1
call print
db ' is Not an ALIAS',0
ret
;
; Load Complete - Check for ALIAS File Structure
;
load2:
call f$close ;close input file
ld hl,(buffer+1) ;get address of START
ld de,buffer-100H
add hl,de ;pt to actual address
ld de,9 ;skip to ALIAS ID
add hl,de
ld de,ALIASid ;compare
ld b,8 ;8 chars
acheck:
ld a,(de) ;get char
cp (hl) ;compare
jr nz,noALIAS
inc hl ;pt to next
inc de
djnz acheck
ld (oldaline),hl ;save ptr to old ALIAS command line
;
; Display Data on Old ALIAS
;
call print
db cr,lf,lf,' Old ALIAS Command Line:',0
ld hl,(oldaline)
ld b,1 ;set line count
cr0a:
ld a,(hl) ;check for done
or a
jr z,cr1
call crlf ;new line
ld a,b ;print line number
call padc
inc b ;increment count
call print ;print prompt
db ' --> ',0
cr0b:
ld a,(hl) ;get char
or a
jr z,cr1
call ccout ;print char with control char processing
inc hl ;pt to next
cp ';' ;next logical line?
jr z,cr0a
jr cr0b
cr1:;
; Input ALIAS from User
;
cr1a:
call print
db cr,lf
db cr,lf,' Edit',0
input: call print
db ' ALIAS:'
db cr,lf,' --> ',0
ld hl,(oldaline)
ld de,MYBUF+1
ld bc,201
ldir
ld a,0ffh ;upcase input line from user
call bbline ; MY REPLACEMENT
call sksp ;skip to non-blank
ld a,(hl) ;get char
or a ;any input?
ret z
push hl ;save ptr
;
; Set Buffers in New ALIAS to Reflect the XALIAS0 Buffers
;
call codend ;pt to new alias
inc hl ;pt to start of buffers
inc hl
inc hl
ld de,envdefn ;pt to environment definition
ld bc,8 ;prepare to copy 8 bytes for class 1
; bytes are: DB 'Z3ENV',3
; DW envaddr
;
; Copy the Buffers Over
;
ex de,hl
ldir
;
; Prep to Copy New Command Into ALIAS
;
call codend ;pt to new alias command buffer
inc hl
ld e,(hl) ;get address of START
inc hl
ld d,(hl)
ld hl,17 ;pt to buffer at START+17
add hl,de
ld de,-100H ;compute offset
add hl,de ;HL contains offset
ex de,hl
call codend
add hl,de ;HL pts to absolute address
pop de ;pt to new command
;
; Copy New Command into ALIAS File
;
cr2:
ld bc,255 ;check for overflow (max number of chars)
ex de,hl
ldir
;
; ALIAS Command Line Copied
;
cr3:
call crlf
ld a,(fcb + 1) ;file loaded?
cp ' ' ;' '=no
jp nz,write1
call print
db cr,lf,' Name of ALIAS: ',0
xor a
ld (MYBUF+1),a
ld a,0ffh ;capitalize
call bbline
call sksp ;skip to non-blank
ld a,(hl)
or a
jp z,create
call crlf
ld de,fcb ;pt to FCB
call zfname ;convert and place in FCB
call setcom
call z3log
;
; Write File whose Name is in FCB
;
write:
ld de,fcb ;check for file
call initfcb ;clear FCB
call f$exist ;check for existence
jr z,write1
call print
db cr,lf,' File ',0
ld de,fcb+1
call pfn1
call print
db ' Exists - Overwrite (N for No)? ',0
call capin
push af
call cout
pop af
cp 'N'
ret z ;abort if not Y
ld de,fcb ;clear file attributes
xor a
call sfa ;set file attributes to R/W DIR
call f$delete ;delete file
;
; Create New File
;
write1:
ld de,fcb ;pt to FCB
call initfcb ;init it
call f$make ;create file
inc a
jr z,werr
ld c,8 ;8 sectors
call codend ;pt to file
write2:
ld de,tbuff ;copy sector into buffer
ld b,128 ;128 bytes
call hmovb
ld de,fcb ;write block
call f$write
jr nz,werr
dec c ;count down
jr nz,write2
call f$close ;close file
call print
db cr,lf,' ALIAS Created',0
ret
werr:
call print
db cr,lf,' Error in Creating File',0
ret
;
; Determine End of Code to Nearest 128 bytes
;
codend:
push de
ld hl,($memry) ;get next available byte
ld a,l ;get low
and 80h ;set MSB
ld l,a
ld de,128 ;next 128 bytes
add hl,de
pop de
ret
;
; Set File Type of File in FCB to COM if Not Already Set
;
setcom:
push hl
push de
push bc
ld hl,comtyp ;set COM type
ld de,fcb+9 ;copy into file type
ld b,3 ;3 bytes
call hmovb
pop bc
pop de
pop hl
ret
;
; Input ALIAS Command from User
;
getwheel:
call getwhl ;get wheel byte
ret nz
pop hl
call print
db cr,lf,' Modification of ALIAS Not Permitted',0
ret
;
; Replacement for SYSLIB's BBLINE
;
BBLINE: push de
push bc
push af
ld de,MYBUF
xor a
ld (de),a
ld bc,254
ld a,00011001b ; Ouput the line, start at start,
; keep the insert, initialize length/location
call led
pop af
or a
ld hl,MYBUF+1
push hl
call nz,capstr
pop hl
pop bc
pop de
ret
;
; Hidden Buffer: MYBUF
;
MYBUF: ds 256
;
; Buffers
;
comtyp:
db 'COM' ;COM File Type
aliasid:
db 'Z3 ALIAS' ;ALIAS File ID
FUNC10: dw 0
oldaline:
dw 0 ;ptr to old alias line
end
COM' ;COM File Type
aliasid:
db 'Z3 AL