home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
enterprs
/
cpm
/
terms
/
qtpatch.arc
/
QT-ALB.Z
< prev
next >
Wrap
Text File
|
1989-09-08
|
8KB
|
323 lines
; QT-ALB.Z - Ampro Little Board overlay for QTERM 4.X
; Written By Larry Schnitger
; adapted for ZSM by David Goodenough.
; baud rate code added from IMP overlay by David Goodenough
;
; This overlay file was modeled after the Ampro Little Board overlay
; for use with MEX, the communications software from NiteOwl Software.
; The patch points indicated by the QTERM documentation have been
; worked into the overlay, some routines have been moved around to fit
; the QTERM architecture, and others have been deleted since they do
; not apply to the QTERM program.
;
; TO USE: First edit this file with your favorite ASCII editor, changing
; routines to conform to your hardware and changing
; equates to conform to your implementation selections.
; Then assemble with ZSM, to create a .O file, finally
; apply the overlay using ZPATCH to the original .COM
; file to produce the patched .COM file.
;
; Commands to do the above are:
;
; A>ZSM QT-ALB
; A>ZPATCH QTERM QT-ALB
;
.var yes -1
.var no 0
;
.var sioc 0x8c ; sio control port
.var siod 0x88 ; sio data port
.var rxrdy 1 ; receiver ready
.var txrdy 4 ; transmitter ready
.var baud 0x50 ; baud rate port - CTC
;
.var scrout 0x0109 ; QTERM print char routine address
.var decout 0x010c ; QTERM print number routine address
;
; Code begins here...
;
; Modem input status routine:
;
.org 0x0110
modist: in a,(sioc) ;get modem input status
and rxrdy
ret
.org 0x0120
modin: in a,(siod) ;read modem input character
ret
.org 0x0130
modost: in a,(sioc) ;get modem output status
and txrdy
ret
.org 0x0140
modout: out (siod),a ;write modem output char.
ret
.org 0x0150
sbreak: ld a,(setf) ;start "break"
or a ;do we have valid data in r3,r4,r5
ret z ;no - don't do it
ld hl,r5
set 4,(hl)
jp sioout
.org 0x0160
ebreak: ld a,(setf) ;end "break"
or a
ret z ; don't do it unless r3, r4, r5 are valid
ld hl,r5
res 4,(hl)
jp sioout
.org 0x0170
dtroff: ld a,(setf) ;drop DTR (actually CTS)
or a
ret z ; don't do it unless r3, r4, r5 are valid
ld hl,r5
res 7,(hl)
jp sioout
.org 0x0180
dtron: ld a,(setf) ;raise DTR
or a
ret z ; don't do it unless r3, r4, r5 are valid
ld hl,r5
set 7,(hl)
jp sioout
;
; Set Baud Rate routine:
;
.org 0x0190
setbd:
jp opctc ; index into our table, and talk to the CTC
;
; Baud rate table:
;
.org 0x01a0
baudtb:
b38400: db 0,no ; 38400 baud
b19200: db 0,no ; 19200
b9600: db 8,yes ; 9600
b4800: db 6,yes ; 4800
b2400: db 4,yes ; 2400
b1200: db 2,yes ; 1200
b600: db 0,no ; 600
b300: db 0,yes ; 300 baud
;
; Communications mode setting routine:
;
;.org 0x01b0 ; don't need this - table above is 16 bytes
setmod: ld (setf),a ; flag we've done a set
jp domod ; have to do this elsewhere
; Communication Mode Table. Single byte values for 12 combinations of
; number-of-bits(7/8), parity(none/even/odd), number-of-stop-bits(1/2).
.org 0x1c0
modetb:
n17: db 0b10000000 ;0x80, 7n1
n18: db 0b11000000 ;0xc0, 8n1
n27: db 0b10001000 ;0x88, 7n2
n28: db 0b11001000 ;0xc8, 8n2
e17: db 0b10000011 ;0x83, 7e1
e18: db 0b11000011 ;0xc3, 8e1
e27: db 0b10001011 ;0x8b, 7e2
e28: db 0b11001011 ;0xcb, 8e2
o17: db 0b10000001 ;0x81, 7o1
o18: db 0b11000001 ;0xc8, 8o1
o27: db 0b10001001 ;0x89, 7o2
o28: db 0b11001001 ;0xc9, 8o2
;.org 0x01cc ; don't need this - we're contiguous
resrvd: db 0 ; reserved for future use.
;.org 0x01cd
xfersz: db 8 ;number of K to read/write during file xfers
;Must be 1 / 2 / 4 / 8. Best left as 8 unless
; disk is verrrrry slow. Drop to smaller value
; if too many timeouts occur during "protocol"
; file transfers (xmodem or kermit).
;.org 0x01ce
speed: db 4 ;cpu speed
;.org 0x01cf
escape: db '\\' & 0x1f ;escape character (1ch=^\ Control-Backslash)
; signon message - terminate with a null byte
;.org 0x01d0
signon: ;signon message
db 'Ampro Little Board\0'
; From here on down, the stuff is terminal dependant. I've made three .vars
; one each for Televideo, VT52 and ANSI (i.e. VT100 / VT220 etc)
; set _EXACTLY_ one to be true, this will provide a bare bones overlay.
; If the spirit moves, feel free to alter the terminal capabilities at the
; bottom
.var tvi yes ; Televideo: also C128, Kaypro, ADM 3A
; ADM 31, Wyse (all models), Liberty
; Freedom (all models)
.var vt52 no ; Heath / Zenith 19 / 89 / 90, Intertec
; superbrain
.var vt100 no ; Any ansi compatible tube
.org 0x01f0
clrs:
.if tvi
db 'z' & 0x1f, 0 ;clear screen string (Control-Z)
.elif vt52
db '\eE\0'
.elif vt100
db '\e[H\e[2J\0'
.endif
.org 0x0200
.if tvi | vt52
moveto: push hl ;move cursor to position in HL (Row,Col)
ld c,'\e' ; lead-in with Esc (the ASCII one; not QTERM's)
call scrout
ld c,[ tvi ? '=' : 'Y' ] ; 2nd lead-in is '=' or 'Y'
call scrout
pop hl
push hl
ld a,h ; row value (top row is 0.)
call poff ; add offset and send it to screen
pop hl
ld a,l ; col value (leftmost col is 0.)
poff: add a,' ' ; (adds 20h)
ld c,a
jp scrout ; (scrout returns from 'moveto's call)
.elif vt100
push hl
ld c,'\e'
call scrout
ld c,'['
call scrout
pop hl
push hl
ld h,0
inc l
call decout
ld c,';'
call scrout
pop hl
ld l,h
ld h,0
inc l
call decout
ld c,'H'
jp scrout
.endif
.org 0x22f
tcbits:
db 0b00000000 ; must be zero for "generic" overlay
; ||||||||
; |||||||+------ bright (end highlight)
; ||||||+------- dim (start highlight)
; |||||+-------- delete line
; ||||+--------- insert line
; |||+---------- delete character
; ||+----------- insert character
; |+------------ clear to end of line
; +------------- clear to end of screen
;
;
;.org 0x0230
brites: db 0 ;bright string
.org 0x0238
dims: db 0 ;dim string
.org 0x0240
dlstr: db 0 ;delete line
.org 0x0248
ilstr: db 0 ;insert line
.org 0x0250
dcstr: db 0 ;delete character
.org 0x0258
icstr: db 0 ;insert character
.org 0x0260
ceol: db 0 ;clear to end of line
.org 0x0268
ceos: db 0 ;clear to end-of-screen
; Entry and Exit hooks. These are provided to perform custom initialisation
; on startup and on exit from QTERM. They are invoked before any use is made
; of the screen or the port hardware.
.org 0x0270
entry: jp do_ent ; entry hook (270h .. 272h)
;.org 0x0273 ; exit hook (273h .. 275h)
exit: ret ; don't need anything.
; Extra patch area if needed. 276h .. 2ffh
.org 0x0276
patcha:
do_ent: ld a,(b1200) ; entry hook (from 270h)
call setbd ; setup for 1200 baud
ld a,(n18) ; and 8n1 communications mode.
call setmod
ret
domod: ld c,a ; save byte in c
ld hl,r3 ; look at byte for wr3
res 7,(hl) ; turn off ms bit (Rx # bits / char)
add a,a ; move bit from 6 to 7 in a
and 0x80 ; mask off the rest
or (hl) ; or in the remainder
ld (hl),a ; and save it back
inc hl
inc hl ; point hl at r4
ld a,(hl)
and 0xf4 ; mask out bits we don't want
ld b,a ; save in b
ld a,c ; get set byte back
and 0x0b ; get bits out of set byte that we want
or b ; or in the other bits
ld (hl),a ; and save it back
inc hl
inc hl ; point hl at r5
ld a,c
and 0x40 ; get the bit we want from c
res 6,(hl) ; clear the bit in r5
or (hl)
ld (hl),a ; put new composite value back
sioout: ld hl,siodat
ld bc,6 * 256 + sioc
otir
ret
siodat: db 3
r3: db 0b11000001 ; value for wr3 (0xc1)
db 4
r4: db 0b01000100 ; value for wr4 (0x44)
db 5
r5: db 0b11101010 ; value for wr5 (0xe5)
setf: db 0 ; flag if we've done a set mode command
bv300: dw 0x0734
bv1200: dw 0x4768
bv2400: dw 0x4734
bv4800: dw 0x471a
bv9600: dw 0x470d