mirror of
https://github.com/wwarthen/RomWBW.git
synced 2026-02-06 14:11:48 -06:00
1085 lines
18 KiB
Plaintext
1085 lines
18 KiB
Plaintext
; ZCPR3 TCAP Facility (Z3TCAP)
|
||
; Program Name: TCMAKE
|
||
; Author: Richard Conn
|
||
; Version: 1.0
|
||
; Date: 10 Mar 84
|
||
version equ 10
|
||
|
||
;
|
||
; TCMAKE allows the user to create a Z3T file for his particular
|
||
; terminal.
|
||
;
|
||
|
||
;
|
||
; Basic Equates
|
||
;
|
||
z3env SET 0f400h ;ZCPR3 Environment Descriptor
|
||
qch equ '\' ;quote char
|
||
fcb equ 5ch
|
||
tbuff equ 80h
|
||
ctrlc equ 'C'-'@'
|
||
cr equ 0dh
|
||
lf equ 0ah
|
||
|
||
;
|
||
; ZCPR3 and SYSLIB References
|
||
;
|
||
ext z3init,qprint,z3log
|
||
ext bbline,sksp,eval
|
||
ext codend,moveb,fillb,hmovb
|
||
ext print,pfn1,pstr,capine,cin,caps,crlf,cout,pafdc,pa2hc
|
||
ext initfcb,f$make,f$write,f$close
|
||
ext f$exist,gfa,f$delete
|
||
|
||
;
|
||
; Environment Definition
|
||
;
|
||
if z3env ne 0
|
||
;
|
||
; External ZCPR3 Environment Descriptor
|
||
;
|
||
jmp start
|
||
db 'Z3ENV' ;This is a ZCPR3 Utility
|
||
db 1 ;External Environment Descriptor
|
||
z3eadr:
|
||
dw z3env
|
||
start:
|
||
lhld z3eadr ;pt to ZCPR3 environment
|
||
;
|
||
else
|
||
;
|
||
; Internal ZCPR3 Environment Descriptor
|
||
;
|
||
MACLIB Z3BASE.LIB
|
||
MACLIB SYSENV.LIB
|
||
z3eadr:
|
||
jmp start
|
||
SYSENV
|
||
start:
|
||
lxi h,z3eadr ;pt to ZCPR3 environment
|
||
endif
|
||
|
||
;
|
||
; Start of Program -- Initialize ZCPR3 Environment
|
||
;
|
||
call z3init ;initialize the ZCPR3 Env and the VLIB Env
|
||
|
||
;
|
||
; Print Banner
|
||
;
|
||
call qprint
|
||
db 'TCMAKE, Version '
|
||
db (version/10)+'0','.',(version mod 10)+'0'
|
||
db cr,lf,0
|
||
|
||
;
|
||
; Check for Entry in FCB
|
||
;
|
||
lda fcb+1 ;get first char
|
||
cpi ' ' ;none if space
|
||
jz help
|
||
cpi '/' ;none if slash
|
||
jnz start1
|
||
;
|
||
; Print Help Info
|
||
;
|
||
help:
|
||
call print
|
||
db 'TCMAKE - Create a Z3T File'
|
||
db cr,lf,'Syntax:'
|
||
db cr,lf,' TCMAKE outfile -or- TCMAKE outfile.typ'
|
||
db cr,lf
|
||
db cr,lf,'where "outfile" is the file to be generated by'
|
||
db cr,lf,'the execution of TCMAKE. If no file type is'
|
||
db cr,lf,'given, a file type of Z3T is the default.'
|
||
db 0
|
||
ret
|
||
;
|
||
; Resume Processing
|
||
;
|
||
start1:
|
||
;
|
||
; Set Default File Type if None
|
||
;
|
||
lxi d,fcb+9 ;pt to file type
|
||
lxi h,deftyp ;pt to default file type
|
||
mvi b,3 ;3 bytes
|
||
ldax d ;get first char
|
||
cpi ' ' ;none if space
|
||
cz moveb ;set default file type
|
||
;
|
||
; Init the Buffers and Pointers
|
||
;
|
||
call codend ;pt to scratch area
|
||
shld scratch ;set ptr
|
||
lxi d,100h ;give space (overkill)
|
||
xra a ;init strings to empty
|
||
sta rcfirst ;clear flag
|
||
dad d
|
||
shld cladr ;CL
|
||
mov m,a ;clear
|
||
dad d
|
||
shld cmadr ;CM
|
||
mov m,a ;clear
|
||
dad d
|
||
shld ceadr ;CE
|
||
mov m,a ;clear
|
||
dad d
|
||
shld soadr ;SO
|
||
mov m,a ;clear
|
||
dad d
|
||
shld seadr ;SE
|
||
mov m,a ;clear
|
||
dad d
|
||
shld tiadr ;TI
|
||
mov m,a ;clear
|
||
dad d
|
||
shld teadr ;TE
|
||
mov m,a ;clear
|
||
dad d
|
||
shld cmbadr ;CM Beginning
|
||
mov m,a ;clear
|
||
dad d
|
||
shld cmmadr ;CM Middle
|
||
mov m,a ;clear
|
||
dad d
|
||
shld cmeadr ;CM Ending
|
||
mov m,a ;clear
|
||
dad d
|
||
shld reqn ;Row Equation
|
||
mov m,a
|
||
dad d
|
||
shld ceqn ;Column Equation
|
||
mov m,a
|
||
lxi h,ku ;clear 1-byte buffers
|
||
mvi b,7 ;7 of them
|
||
xra a ;0 fill
|
||
call fillb
|
||
;
|
||
; Create the Data Base
|
||
;
|
||
menu1:
|
||
call create ;create entry
|
||
call assemble ;assemble the entry
|
||
jz menu1 ;continue if buffer overflow
|
||
;
|
||
; Confirm Selection
|
||
;
|
||
call print
|
||
db cr,lf,' Selected Terminal is: ',0
|
||
lhld scratch ;pt to buffer
|
||
call prent ;print name
|
||
call print
|
||
db ' -- Confirm (Y/N)? ',0
|
||
call capine ;get input
|
||
call crlf
|
||
cpi 'Y'
|
||
jnz menu1 ;continue
|
||
call wrfile ;write file
|
||
ret
|
||
;
|
||
; Assemble Data into Z3T Format
|
||
; Return with Z if Buffer Overflow (more than 128 bytes)
|
||
; Return with NZ if OK
|
||
;
|
||
assemble:
|
||
mvi c,128-23 ;128 bytes max with 23 bytes for header
|
||
mvi b,23 ;copy 23 byte header
|
||
lhld scratch ;into scratch area
|
||
lxi d,tname ;from TNAME
|
||
xchg
|
||
call hmovb
|
||
lhld cladr ;copy CL string
|
||
call asmcopy
|
||
lxi h,crcmd ;reverse row/col to col/row?
|
||
lda rcfirst ;get flag
|
||
cpi 'C' ;reverse if C
|
||
jnz asmc0
|
||
call asmcopy
|
||
dcx d ;don't let zero in
|
||
asmc0:
|
||
lhld cmbadr ;CM Beginning
|
||
call asmcopy
|
||
dcx d
|
||
lhld ceqn ;prepare for col first
|
||
lda rcfirst ;get row/col flag
|
||
cpi 'C' ;col/row?
|
||
jz asmc1
|
||
lhld reqn ;row first, so store row
|
||
asmc1:
|
||
call asmcopy
|
||
dcx d ;skip 0
|
||
lhld cmmadr ;CM Middle
|
||
call asmcopy
|
||
dcx d ;skip 0
|
||
lhld reqn ;prepare for row first
|
||
lda rcfirst ;get row/col flag
|
||
cpi 'C' ;col/row?
|
||
jz asmc2
|
||
lhld ceqn ;col first, so store col
|
||
asmc2:
|
||
call asmcopy
|
||
dcx d ;skip 0
|
||
lhld cmeadr ;CM Ending
|
||
call asmcopy
|
||
lhld ceadr ;CE
|
||
call asmcopy
|
||
lhld soadr ;SO
|
||
call asmcopy
|
||
lhld seadr ;SE
|
||
call asmcopy
|
||
lhld tiadr ;TI
|
||
call asmcopy
|
||
lhld teadr ;TE
|
||
call asmcopy
|
||
xra a ;zero rest
|
||
asmzero:
|
||
stax d ;store 0
|
||
inx d
|
||
dcr c ;count down
|
||
jnz asmzero
|
||
dcr c ;return NZ for OK
|
||
ret
|
||
;
|
||
; Copy TCAP String from HL to DE
|
||
; Check for SCRATCH Area Overflow by Counting C Down
|
||
; Allow For Quotes
|
||
;
|
||
asmcopy:
|
||
mov a,m ;get char
|
||
stax d ;store it
|
||
inx h ;pt to next
|
||
inx d
|
||
ora a ;done?
|
||
rz
|
||
dcr c ;check for overflow
|
||
jz asmovfl
|
||
cpi qch ;quote?
|
||
jnz asmcopy
|
||
mov a,m ;get quoted byte
|
||
stax d ;store it
|
||
inx h ;pt to next
|
||
inx d
|
||
dcr c ;check for overflow
|
||
jnz asmcopy
|
||
asmovfl:
|
||
pop psw ;clear stack
|
||
call print
|
||
db cr,lf,'** Buffer Overflow **',0
|
||
xra a ;error code
|
||
ret
|
||
|
||
;
|
||
; Create Entries
|
||
;
|
||
create:
|
||
call print
|
||
db cr,lf
|
||
db cr,lf,' ** Z3TCAP Main Menu',0
|
||
call prfdata ;print file data
|
||
call print
|
||
db cr,lf
|
||
db cr,lf,'Define: 1. Clear Screen Sequence'
|
||
db cr,lf,' 2. Cursor Motion Sequence'
|
||
db cr,lf,' 3. Clear to End of Line Sequence'
|
||
db cr,lf,' 4. Standout Mode Sequences'
|
||
db cr,lf,' 5. Terminal Init/Deinit Sequences'
|
||
db cr,lf,' 6. Arrow Keys'
|
||
db cr,lf,' 7. Terminal Name'
|
||
db cr,lf
|
||
db cr,lf,'Status: S. Print Status (Definitions so far)'
|
||
db cr,lf
|
||
db cr,lf,'Exit: X. Exit and Write File'
|
||
db cr,lf,' Q. Quit and Abort Program without Writing File'
|
||
db cr,lf
|
||
db cr,lf,'Command? ',0
|
||
call capine ;get response
|
||
call crlf
|
||
lxi h,ctable ;pt to command table
|
||
call tscan ;scan table
|
||
call print
|
||
db ' Invalid Command: ',0
|
||
call cout ;print char
|
||
jmp create ;resume
|
||
;
|
||
; Print File Data
|
||
;
|
||
prfdata:
|
||
call print
|
||
db ' for File ',0
|
||
lxi d,fcb+1
|
||
call pfn1
|
||
call print
|
||
db ' **',0
|
||
ret
|
||
;
|
||
; Define Name of Terminal
|
||
;
|
||
namedef:
|
||
lxi h,tname ;space fill terminal name buffer
|
||
mvi a,' '
|
||
mvi b,16
|
||
call fillb
|
||
call print
|
||
db cr,lf,' Input Name of Terminal: ',0
|
||
xra a ;no caps
|
||
call bbline ;get line from user
|
||
call sksp ;skip over leading spaces
|
||
lxi d,tname ;save name in buffer
|
||
mvi b,16 ;16 bytes max
|
||
putname:
|
||
mov a,m ;get next char
|
||
ora a ;done?
|
||
jz pn1
|
||
stax d ;put next char
|
||
inx h ;pt to next
|
||
inx d
|
||
dcr b ;count down
|
||
jnz putname
|
||
pn1:
|
||
jmp create
|
||
;
|
||
; Define Arrow Keys
|
||
;
|
||
arrowdef:
|
||
call print
|
||
db 'Arrow Key Definition'
|
||
db cr,lf,' Your Terminal''s Arrow Keys may be defined ONLY'
|
||
db cr,lf,' if they generate only one character each. If they'
|
||
db cr,lf,' do, type Y to continue. If not, type anything else.'
|
||
db cr,lf,' Define Arrow Keys (Y/N)? ',0
|
||
call capine
|
||
cpi 'Y'
|
||
jnz create
|
||
call print
|
||
db cr,lf,' Strike the Appropriate Arrow Key'
|
||
db cr,lf,' 1. Arrow UP? ',0
|
||
lxi h,ku ;pt to first entry
|
||
call cin
|
||
mov m,a ;store it
|
||
inx h ;pt to next
|
||
call ccout
|
||
call print
|
||
db cr,lf,' 2. Arrow DOWN? ',0
|
||
call cin
|
||
mov m,a
|
||
inx h
|
||
call ccout
|
||
call print
|
||
db cr,lf,' 3. Arrow RIGHT? ',0
|
||
call cin
|
||
mov m,a
|
||
inx h
|
||
call ccout
|
||
call print
|
||
db cr,lf,' 4. Arrow LEFT? ',0
|
||
call cin
|
||
mov m,a
|
||
call ccout
|
||
jmp create
|
||
;
|
||
; Review Arrow Keys
|
||
;
|
||
arrowrev:
|
||
call print
|
||
db cr,lf,'Review of Arrow Key Definitions'
|
||
db cr,lf,' 1. Arrow UP = ',0
|
||
lxi h,ku ;pt to first
|
||
mov a,m
|
||
call ccout
|
||
inx h
|
||
call print
|
||
db cr,lf,' 2. Arrow DOWN = ',0
|
||
mov a,m
|
||
call ccout
|
||
inx h
|
||
call print
|
||
db cr,lf,' 3. Arrow RIGHT = ',0
|
||
mov a,m
|
||
call ccout
|
||
inx h
|
||
call print
|
||
db cr,lf,' 4. Arrow LEFT = ',0
|
||
mov a,m
|
||
call ccout
|
||
ret
|
||
|
||
;
|
||
; Quit Create Mode and Program
|
||
;
|
||
crquit:
|
||
call print
|
||
db 'Do you really want to quit (Y/N)? ',0
|
||
call capine ;get input from user
|
||
cpi 'Y' ;see if he typed a Y
|
||
jnz create ;resume if not
|
||
pop psw ;clear stack
|
||
;
|
||
; Exit Create Mode
|
||
;
|
||
crexit:
|
||
ret
|
||
;
|
||
; CL Definition
|
||
;
|
||
cldef:
|
||
call print
|
||
db 'Clear Screen Definition',cr,lf
|
||
db ' 1. Timing Delay',0
|
||
call getdelay ;get delay constant
|
||
sta cld ;save delay constant
|
||
call print
|
||
db cr,lf,' 2. Clear Screen Byte Sequence',0
|
||
lhld cladr ;pt to buffer
|
||
call getstr
|
||
jmp create
|
||
|
||
;
|
||
; CL Review
|
||
;
|
||
clreview:
|
||
call print
|
||
db cr,lf,'Review of Clear Screen Definition'
|
||
db cr,lf,' 1. Timing Delay = ',0
|
||
lda cld
|
||
call pafdc
|
||
call print
|
||
db ' Milliseconds'
|
||
db cr,lf,' 2. Clear Screen Sequence:',0
|
||
lhld cladr
|
||
call prtstr
|
||
ret
|
||
;
|
||
; CE Definition
|
||
;
|
||
cedef:
|
||
call print
|
||
db 'Clear to End of Line Definition',cr,lf
|
||
db ' 1. Timing Delay',0
|
||
call getdelay ;get delay constant
|
||
sta ced ;save delay constant
|
||
call print
|
||
db cr,lf,' 2. Clear to End of Line Byte Sequence',0
|
||
lhld ceadr ;pt to buffer
|
||
call getstr
|
||
jmp create
|
||
;
|
||
; CE Review
|
||
;
|
||
cereview:
|
||
call print
|
||
db cr,lf,'Review of Clear to End of Line Definition'
|
||
db cr,lf,' 1. Timing Delay = ',0
|
||
lda ced
|
||
call pafdc
|
||
call print
|
||
db ' Milliseconds'
|
||
db cr,lf,' 2. Clear to End of Line Sequence:',0
|
||
lhld ceadr
|
||
call prtstr
|
||
ret
|
||
;
|
||
; SO Definition
|
||
;
|
||
sodef:
|
||
call print
|
||
db 'Standout Mode Definition',cr,lf
|
||
db ' 1. Begin Standout Mode Byte Sequence',0
|
||
lhld soadr ;pt to buffer
|
||
call getstr
|
||
call print
|
||
db cr,lf,' 2. End Standout Mode Byte Sequence',0
|
||
lhld seadr ;pt to buffer
|
||
call getstr
|
||
jmp create
|
||
;
|
||
; SO Review
|
||
;
|
||
soreview:
|
||
call print
|
||
db cr,lf,'Review of Standout Mode Definition'
|
||
db cr,lf,' 1. Begin Standout Mode Sequence:',0
|
||
lhld soadr
|
||
call prtstr
|
||
call print
|
||
db cr,lf,' 2. End Standout Mode Sequence:',0
|
||
lhld seadr
|
||
call prtstr
|
||
ret
|
||
;
|
||
; TI Definition
|
||
;
|
||
tidef:
|
||
call print
|
||
db 'Terminal Init/Deinit Definition',cr,lf
|
||
db ' 1. Terminal Initialization Byte Sequence',0
|
||
lhld tiadr ;pt to buffer
|
||
call getstr
|
||
call print
|
||
db cr,lf,' 2. Terminal Deinitialization Byte Sequence',0
|
||
lhld teadr ;pt to buffer
|
||
call getstr
|
||
jmp create
|
||
;
|
||
; TI Review
|
||
;
|
||
tireview:
|
||
call print
|
||
db cr,lf,'Review of Terminal Init/Deinit Definition'
|
||
db cr,lf,' 1. Terminal Initialization Sequence: ',0
|
||
lhld tiadr
|
||
call prtstr
|
||
call print
|
||
db cr,lf,' 2. Terminal Deinitialization Sequence: ',0
|
||
lhld teadr
|
||
call prtstr
|
||
ret
|
||
;
|
||
; CM Definition
|
||
;
|
||
cmdef:
|
||
call print
|
||
db 'Cursor Motion Definition',cr,lf
|
||
db ' 1. Timing Delay',0
|
||
call getdelay ;get delay
|
||
sta cmd
|
||
cmcrdef:
|
||
call print
|
||
db cr,lf,' 2. Enter R if Row/Column or C for Column/Row: ',0
|
||
call capine
|
||
cpi 'C' ;col/row
|
||
jz cmdef1
|
||
cpi 'R'
|
||
jz cmdef1
|
||
call print
|
||
db ' - Invalid',0
|
||
jmp cmcrdef
|
||
cmdef1:
|
||
sta rcfirst ;set flag
|
||
call print
|
||
db cr,lf,' 3. Enter Equation for Row: ',0
|
||
xra a ;no caps
|
||
call bbline ;get input
|
||
call sksp ;skip spaces
|
||
xchg
|
||
lhld reqn
|
||
xchg
|
||
call copy0
|
||
call print
|
||
db cr,lf,' 4. Enter Equation for Column: ',0
|
||
xra a ;no caps
|
||
call bbline ;get input
|
||
call sksp ;skip spaces
|
||
xchg
|
||
lhld ceqn
|
||
xchg
|
||
call copy0
|
||
call print
|
||
db cr,lf,' 5. Enter Prefix Byte Sequence',0
|
||
lhld cmbadr ;beginning
|
||
call getstr
|
||
call print
|
||
db cr,lf,' 6. Enter Middle Byte Sequence',0
|
||
lhld cmmadr ;middle
|
||
call getstr
|
||
call print
|
||
db cr,lf,' 7. Enter Suffix Byte Sequence',0
|
||
lhld cmeadr ;ending
|
||
call getstr
|
||
jmp create
|
||
;
|
||
; Copy HL to DE until 0
|
||
;
|
||
copy0:
|
||
mov a,m ;copy
|
||
stax d
|
||
cpi qch ;quote?
|
||
jz copyq
|
||
ora a ;done if 0
|
||
rz
|
||
inx h ;pt to next
|
||
inx d
|
||
jmp copy0
|
||
copyq:
|
||
inx h ;copy quoted char
|
||
inx d
|
||
mov a,m ;copy
|
||
stax d
|
||
inx h ;advance
|
||
inx d
|
||
jmp copy0
|
||
;
|
||
; Review CM Data
|
||
;
|
||
cmreview:
|
||
call print
|
||
db cr,lf,'Review of Cursor Motion Data'
|
||
db cr,lf,' 1. Timing Delay = ',0
|
||
lda cmd
|
||
call pafdc
|
||
call print
|
||
db ' Milliseconds'
|
||
db cr,lf,' 2. Row or Column First: ',0
|
||
lda rcfirst
|
||
call cout
|
||
call print
|
||
db cr,lf,' 3. Row Equation: -->',0
|
||
lhld reqn
|
||
call pstr
|
||
call print
|
||
db '<--'
|
||
db cr,lf,' 4. Column Equation: -->',0
|
||
lhld ceqn
|
||
call pstr
|
||
call print
|
||
db '<--'
|
||
db cr,lf,' 5. Prefix Byte Sequence: ',0
|
||
lhld cmbadr
|
||
call prtstr
|
||
call print
|
||
db cr,lf,' 6. Middle Byte Sequence: ',0
|
||
lhld cmmadr
|
||
call prtstr
|
||
call print
|
||
db cr,lf,' 7. Suffix Byte Sequence: ',0
|
||
lhld cmeadr
|
||
call prtstr
|
||
ret
|
||
|
||
;
|
||
; Status Display
|
||
;
|
||
rstatus:
|
||
call print
|
||
db cr,lf,' Strike Any Key to Continue - ',0
|
||
call cin
|
||
status:
|
||
call print
|
||
db cr,lf,' ** Z3TCAP Status',0
|
||
call prfdata ;file data
|
||
call print
|
||
db cr,lf
|
||
db cr,lf,'Review: 1. Clear Screen Definition'
|
||
db cr,lf,' 2. Cursor Motion Definition'
|
||
db cr,lf,' 3. Clear to End of Line Definition'
|
||
db cr,lf,' 4. Standout Mode Definition'
|
||
db cr,lf,' 5. Terminal Init/Deinit Definition'
|
||
db cr,lf,' 6. Arrow Key Definition'
|
||
db cr,lf,' 7. Terminal Name Definition'
|
||
db cr,lf
|
||
db cr,lf,'Exit: X. Exit to Main Menu'
|
||
db cr,lf
|
||
db cr,lf,'Command? ',0
|
||
call capine
|
||
lxi h,rtable
|
||
call tscan
|
||
call print
|
||
db cr,lf,' Invalid Command: ',0
|
||
call cout
|
||
jmp status
|
||
;
|
||
; Review Name
|
||
;
|
||
rname:
|
||
call print
|
||
db cr,lf,'Terminal Name: ',0
|
||
lxi h,tname
|
||
mvi b,16
|
||
rname1:
|
||
mov a,m ;get char
|
||
call cout
|
||
inx h ;pt to next
|
||
dcr b ;count down
|
||
jnz rname1
|
||
jmp rstatus
|
||
;
|
||
; Review CL
|
||
;
|
||
rcl:
|
||
call clreview
|
||
jmp rstatus
|
||
;
|
||
; Review CE
|
||
;
|
||
rce:
|
||
call cereview
|
||
jmp rstatus
|
||
;
|
||
; Review CM
|
||
;
|
||
rcm:
|
||
call cmreview
|
||
jmp rstatus
|
||
;
|
||
; Review SO
|
||
;
|
||
rso:
|
||
call soreview
|
||
jmp rstatus
|
||
;
|
||
; Review TI
|
||
;
|
||
rti:
|
||
call tireview
|
||
jmp rstatus
|
||
;
|
||
; Review Arrow Keys
|
||
;
|
||
rarrow:
|
||
call arrowrev
|
||
jmp rstatus
|
||
;
|
||
; Status Review Commands
|
||
;
|
||
rtable:
|
||
db '1'
|
||
dw rcl
|
||
db '2'
|
||
dw rcm
|
||
db '3'
|
||
dw rce
|
||
db '4'
|
||
dw rso
|
||
db '5'
|
||
dw rti
|
||
db '6'
|
||
dw rarrow
|
||
db '7'
|
||
dw rname
|
||
db 'X'
|
||
dw create
|
||
db 0
|
||
|
||
;
|
||
; Scan Command Table
|
||
;
|
||
tscan:
|
||
mov b,a ;save char in B
|
||
tscan1:
|
||
mov a,m ;get char
|
||
ora a ;end of table?
|
||
jz tscanx ;exit
|
||
cmp b ;compare
|
||
jz tscanf ;found
|
||
inx h ;skip to next
|
||
inx h
|
||
inx h
|
||
jmp tscan1
|
||
tscanx:
|
||
mov a,b ;restore char and exit - not found
|
||
ret
|
||
tscanf:
|
||
inx h ;get address
|
||
mov a,m
|
||
inx h
|
||
mov h,m
|
||
mov l,a
|
||
pop psw ;clear stack
|
||
pchl ;branch to routine
|
||
;
|
||
; Command Table
|
||
;
|
||
ctable:
|
||
db '1' ;CL
|
||
dw cldef
|
||
db '2' ;CM
|
||
dw cmdef
|
||
db '3' ;CE
|
||
dw cedef
|
||
db '4' ;SO
|
||
dw sodef
|
||
db '5' ;TI
|
||
dw tidef
|
||
db '6' ;arrows
|
||
dw arrowdef
|
||
db '7' ;name
|
||
dw namedef
|
||
db 'S' ;status
|
||
dw status
|
||
db 'Q' ;quit
|
||
dw crquit
|
||
db 'X' ;exit
|
||
dw crexit
|
||
db 0
|
||
;
|
||
; Routine to Input Delay Constant
|
||
;
|
||
getdelay:
|
||
call print
|
||
db cr,lf,' Enter Delay Time in Milliseconds: ',0
|
||
mvi a,0ffh ;caps
|
||
call bbline
|
||
call sksp
|
||
call eval ;convert to binary
|
||
ret
|
||
;
|
||
; Routine to Define Text String
|
||
;
|
||
getstr:
|
||
shld firstch ;set ptr to first char
|
||
getfirst:
|
||
mvi b,1 ;set count
|
||
lhld firstch ;set next char to first
|
||
shld nxtchar
|
||
getnext:
|
||
call print
|
||
db cr,lf,' Char #',0
|
||
mov a,b ;get char number
|
||
call pafdc ;print it
|
||
inr b ;increment count
|
||
push b ;save it
|
||
;
|
||
; Prompt for Type of Input
|
||
;
|
||
call print
|
||
db ' - Type Char, .=Number, or <CR>=Done: ',0
|
||
call cin ;get response
|
||
cpi cr ;exit
|
||
jz getx
|
||
cpi '.' ;number?
|
||
jz getnum
|
||
;
|
||
; Input Character
|
||
;
|
||
call print
|
||
db 'Char ',0
|
||
call ccout ;echo character
|
||
jmp putch
|
||
;
|
||
; Input Number
|
||
;
|
||
getnum:
|
||
call print
|
||
db 'Enter Number: ',0
|
||
mvi a,0ffh ;caps
|
||
call bbline ;get input
|
||
call sksp ;skip spaces
|
||
call eval ;convert
|
||
;
|
||
; Save Character with Quoting
|
||
;
|
||
putch:
|
||
lhld nxtchar ;pt to next char
|
||
ora a ;quote if null
|
||
jz quote
|
||
cpi qch ;quote if quote
|
||
jz quote
|
||
putch1:
|
||
mov m,a ;store it
|
||
inx h ;pt to next
|
||
shld nxtchar ;set ptr
|
||
pop b ;get count
|
||
jmp getnext ;get next char
|
||
;
|
||
; Quote the Character
|
||
;
|
||
quote:
|
||
mvi m,qch ;save quote char
|
||
inx h
|
||
jmp putch1
|
||
;
|
||
; Exit
|
||
;
|
||
getx:
|
||
pop psw ;clear stack
|
||
lhld nxtchar ;store ending 0
|
||
mvi m,0
|
||
ret
|
||
;
|
||
; Print String Pted to by HL
|
||
;
|
||
prtstr:
|
||
mvi b,0 ;set count
|
||
call crlf ;new line
|
||
mov a,m ;empty?
|
||
ora a
|
||
jnz prts0
|
||
call print
|
||
db ' -- Empty --',0
|
||
ret
|
||
prts0:
|
||
mov a,m ;get next char
|
||
ora a ;done?
|
||
rz
|
||
call print
|
||
db ' (',0
|
||
mov a,b ;print count
|
||
inr a
|
||
call pafdc
|
||
call print
|
||
db ') ',0
|
||
mov a,m ;get next char
|
||
inx h ;pt to next
|
||
cpi qch ;check for quote
|
||
jnz prts1
|
||
mov a,m ;get char that is quoted
|
||
inx h ;pt to next
|
||
prts1:
|
||
call ccout
|
||
call print
|
||
db ' ',0
|
||
call pa2hc ;print as 2 hex chars
|
||
call print
|
||
db 'H ',0
|
||
inr b ;increment count
|
||
mov a,b ;get count
|
||
ani 3
|
||
cz crlf ;new line
|
||
jmp prts0
|
||
|
||
;
|
||
; Create Target File
|
||
;
|
||
wrfile:
|
||
lxi d,fcb ;pt to FCB
|
||
call z3log ;log into proper directory
|
||
call f$exist ;test of presence of file
|
||
jz make2 ;create file
|
||
call gfa ;get file attributes
|
||
ani 1 ;R/O?
|
||
jz make1
|
||
call print
|
||
db cr,lf,'File ',0
|
||
lxi d,fcb+1
|
||
call pfn1
|
||
call print
|
||
db ' is Read/Only - Saving as $$$.Z3T',0
|
||
lxi h,tempfcb ;set $$$.Z3T
|
||
lxi d,fcb+1
|
||
mvi b,11 ;11 chars
|
||
call moveb
|
||
lxi d,fcb ;reinit
|
||
call initfcb ;resume
|
||
make1:
|
||
call f$delete ;delete file
|
||
make2:
|
||
call f$make ;create file
|
||
cpi 0ffh ;error
|
||
jnz writef
|
||
call print
|
||
db cr,lf,'File Create Error',0
|
||
ret
|
||
;
|
||
; Write Block to File
|
||
;
|
||
writef:
|
||
lhld scratch ;pt to entry
|
||
lxi d,tbuff ;copy into buffer
|
||
mvi b,128 ;128 bytes
|
||
call moveb
|
||
lxi d,fcb ;pt to FCB
|
||
call f$write ;write block
|
||
jnz werr
|
||
call f$close ;close file
|
||
call print
|
||
db cr,lf,'File ',0
|
||
lxi d,fcb+1
|
||
call pfn1
|
||
call print
|
||
db ' Created',0
|
||
ret
|
||
;
|
||
; Can't Write File
|
||
;
|
||
werr:
|
||
call print
|
||
db cr,lf,'File Write Error',0
|
||
ret
|
||
;
|
||
; Print Entry Name Pted to by HL
|
||
;
|
||
prent:
|
||
mvi b,16 ;16 chars
|
||
prtname:
|
||
mov a,m ;get char
|
||
call cout
|
||
inx h ;advance
|
||
dcr b ;count down
|
||
jnz prtname
|
||
ret
|
||
;
|
||
; Print Char in A with Control Char Processing
|
||
;
|
||
ccout:
|
||
push psw ;save char
|
||
ani 7fh ;mask MSB
|
||
cpi 7fh ;DEL?
|
||
jz ccout2
|
||
cpi ' '
|
||
jnc ccout1
|
||
push psw ;save char
|
||
mvi a,'^'
|
||
call cout
|
||
pop psw
|
||
adi '@' ;convert to char
|
||
ccout1:
|
||
call cout
|
||
pop psw
|
||
ret
|
||
ccout2:
|
||
call print
|
||
db '<DEL>',0
|
||
pop psw
|
||
ret
|
||
|
||
;
|
||
; Buffers
|
||
;
|
||
crcmd:
|
||
db '%r',0
|
||
tempfcb:
|
||
db '$$$ '
|
||
db 'Z3T'
|
||
tname:
|
||
db '** Empty Name **' ;16 chars
|
||
ku:
|
||
ds 1 ;cursor up
|
||
kd:
|
||
ds 1 ;cursor down
|
||
kr:
|
||
ds 1 ;cursor right
|
||
kl:
|
||
ds 1 ;cursor left
|
||
cld:
|
||
ds 1 ;CL delay
|
||
cmd:
|
||
ds 1 ;CM delay
|
||
ced:
|
||
ds 1 ;CE delay
|
||
cladr:
|
||
ds 2 ;CL address
|
||
cmadr:
|
||
ds 2 ;CM address
|
||
ceadr:
|
||
ds 2 ;CE address
|
||
soadr:
|
||
ds 2 ;SO address
|
||
seadr:
|
||
ds 2 ;SE address
|
||
tiadr:
|
||
ds 2 ;TI address
|
||
teadr:
|
||
ds 2 ;TE address
|
||
cmbadr:
|
||
ds 2 ;CM Beginning
|
||
cmmadr:
|
||
ds 2 ;CM Middle
|
||
cmeadr:
|
||
ds 2 ;CM Ending
|
||
reqn:
|
||
ds 2 ;Row Equation
|
||
ceqn:
|
||
ds 2 ;Column Equation
|
||
rcfirst:
|
||
ds 1 ;R if Row First, C if Col First
|
||
deftyp:
|
||
db 'Z3T' ;default file type
|
||
firstch:
|
||
ds 2 ;ptr to first char in string
|
||
nxtchar:
|
||
ds 2 ;ptr to next char in string
|
||
scratch:
|
||
ds 2 ;ptr to scratch area
|
||
|
||
end
|
||
|