253 lines
5.0 KiB
Plaintext
253 lines
5.0 KiB
Plaintext
|
; QT-ADAM.Z - QTERM patch area for the Coleco ADAM
|
|||
|
;
|
|||
|
; Version 1.0
|
|||
|
|
|||
|
.var no 0 ; false value
|
|||
|
.var yes 0xff ; true value
|
|||
|
|
|||
|
.var datap 0x44
|
|||
|
.var statp 0x45
|
|||
|
.var baudp 0x46
|
|||
|
.var ctrlp 0x47
|
|||
|
|
|||
|
.var rxrdy 2
|
|||
|
.var txrdy 1
|
|||
|
|
|||
|
.var break 0x3f
|
|||
|
.var dtr 0x3d
|
|||
|
.var norm 0x37
|
|||
|
|
|||
|
.org 0x0110 ; modem input status
|
|||
|
modist: in a,(statp)
|
|||
|
and rxrdy
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0120 ; modem input
|
|||
|
modin: in a,(datap)
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0130 ; modem output status
|
|||
|
modost: in a,(statp)
|
|||
|
and txrdy
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0140 ; modem output
|
|||
|
modout: out (datap),a
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0150
|
|||
|
sbreak: ld a,break
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0160
|
|||
|
ebreak: ld a,norm
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0170
|
|||
|
dtroff: ld a,dtr
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0180
|
|||
|
dtron: ld a,norm
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
.org 0x0190
|
|||
|
setbd: jp finbd
|
|||
|
|
|||
|
; The Baud Rate Table has entries from 38400 baud down to 300 baud.
|
|||
|
; There are 2 bytes per entry. The second byte determines if the entry is
|
|||
|
; enabled or disabled (ffh=enabled; 00=disabled). The first byte is passed
|
|||
|
; as the A value to the setbd subroutine.
|
|||
|
|
|||
|
.org 0x01a0
|
|||
|
baudtb:
|
|||
|
b38400: db 0,no ; 38400
|
|||
|
b19200: db 0x3f,yes ; 19200
|
|||
|
b9600: db 0x3e,yes ; 9600
|
|||
|
b4800: db 0x3c,yes ; 4800
|
|||
|
b2400: db 0x3a,yes ; 2400
|
|||
|
b1200: db 0x37,yes ; 1200
|
|||
|
b600: db 0x36,yes ; 600
|
|||
|
b300: db 0x35,yes ; 300
|
|||
|
|
|||
|
.org 0x01b0
|
|||
|
setmod: jp finmod
|
|||
|
|
|||
|
; Communication Mode Table.
|
|||
|
|
|||
|
.org 0x01c0 ; communication mode table
|
|||
|
modetb:
|
|||
|
n17: db 0x4a
|
|||
|
n18: db 0x4e
|
|||
|
n27: db 0xca
|
|||
|
n28: db 0xce
|
|||
|
e17: db 0x7a
|
|||
|
e18: db 0x7e
|
|||
|
e27: db 0xfa
|
|||
|
e28: db 0xfe
|
|||
|
o17: db 0x5a
|
|||
|
o18: db 0x5e
|
|||
|
o27: db 0xda
|
|||
|
o28: db 0xde
|
|||
|
|
|||
|
.org 0x01cc
|
|||
|
resrvd: db 0 ; reserved for later use
|
|||
|
|
|||
|
.org 0x01cd ; protocol transfer size
|
|||
|
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 ; processor speed
|
|||
|
speed: db 4 ; cpu speed in Mhz;
|
|||
|
|
|||
|
.org 0x01cf ; escape character
|
|||
|
escape: db '\e'
|
|||
|
|
|||
|
.org 0x01d0 ; signon message
|
|||
|
signon: db 'Adam w/80col & RS232\0'
|
|||
|
|
|||
|
|
|||
|
.org 0x01f0 ; clear screen
|
|||
|
clrs: db 'z' & 0x1f, 0 ; clear screen string is Control-Z
|
|||
|
|
|||
|
.var scrout 0x0109 ; (a routine to print to CON: the
|
|||
|
; character in C)
|
|||
|
.var decout 0x010c ; (a routine to print to CON: a decimal value
|
|||
|
; in HL. Is available for VT100 and the like.)
|
|||
|
|
|||
|
.org 0x0200 ; moveto routine
|
|||
|
moveto: push hl ; save row,col
|
|||
|
ld c,'\e' ; send escape
|
|||
|
call scrout
|
|||
|
ld c,'=' ; send =
|
|||
|
call scrout
|
|||
|
pop hl ; get row,col
|
|||
|
ld de,0x2020 ; add offset
|
|||
|
add hl,de
|
|||
|
push hl ; and save
|
|||
|
ld c,h ; send row+offset
|
|||
|
call scrout
|
|||
|
pop bc ; get col+offset
|
|||
|
jp scrout ; send
|
|||
|
|
|||
|
; Terminal Capability Bits. The eight bits stand for each of the following
|
|||
|
; strings. They count from 01h=bright to 80h=clear-to-end-of-screen.
|
|||
|
|
|||
|
.var b_brit 0b00000001 ; 0: bright -- NOT mandatory
|
|||
|
.var b_dim 0b00000010 ; 1: dim -- NOT mandatory
|
|||
|
.var b_ldel 0b00000100 ; 2: delete line -- important
|
|||
|
.var b_lins 0b00001000 ; 3: insert line -- important
|
|||
|
.var b_cdel 0b00010000 ; 4: delete character -- unused by QTERM
|
|||
|
.var b_cins 0b00100000 ; 5: insert character -- unused by QTERM
|
|||
|
.var b_ceol 0b01000000 ; 6: clear to end-of-line -- important
|
|||
|
.var b_ceos 0b10000000 ; 7: clear to end-of-screen-- important
|
|||
|
|
|||
|
.org 0x022f ; terminal capability bit map
|
|||
|
tcbits: db 0xff ; ff = support all bits
|
|||
|
|
|||
|
.org 0x0230
|
|||
|
brites: db '\e(\0' ;bright
|
|||
|
|
|||
|
.org 0x0238
|
|||
|
dims: db '\e)\0' ;dim
|
|||
|
|
|||
|
.org 0x0240
|
|||
|
dlstr: db '\eR\0' ;delete line
|
|||
|
|
|||
|
.org 0x0248
|
|||
|
ilstr: db '\eE\0' ;insert line
|
|||
|
|
|||
|
.org 0x0250
|
|||
|
dcstr: db '\eW\0' ;Delete character
|
|||
|
|
|||
|
.org 0x0258
|
|||
|
icstr: db '\eQ\0' ;Insert character
|
|||
|
|
|||
|
.org 0x0260
|
|||
|
ceol: db '\eT\0' ;Clear to end of line
|
|||
|
|
|||
|
.org 0x0268
|
|||
|
ceos: db '\eY\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: jp do_exit ; exit hook (273h .. 275h)
|
|||
|
|
|||
|
.org 0x0276
|
|||
|
user: ret ; user subroutine (276h .. 278h)
|
|||
|
|
|||
|
.org 0x0279
|
|||
|
kbmap: ret ; keyboard map (279h .. 27bh)
|
|||
|
|
|||
|
.var ilprmt 0x027c ; entry to in line prompt subroutine.
|
|||
|
|
|||
|
; Extra patch area if needed. 280h .. 4ffh
|
|||
|
|
|||
|
.org 0x0280
|
|||
|
|
|||
|
finbd:
|
|||
|
ld b,a
|
|||
|
in a,(baudp)
|
|||
|
ld c,a
|
|||
|
in a,(baudp)
|
|||
|
ld a,0x22
|
|||
|
out (ctrlp),a
|
|||
|
ld a,c
|
|||
|
out (baudp),a
|
|||
|
ld a,b
|
|||
|
out (baudp),a
|
|||
|
ld a,0x27
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
finmod:
|
|||
|
ld b,a
|
|||
|
in a,(baudp)
|
|||
|
in a,(baudp)
|
|||
|
ld c,a
|
|||
|
ld a,0x22
|
|||
|
out (ctrlp),a
|
|||
|
ld a,b
|
|||
|
out (baudp),a
|
|||
|
ld a,c
|
|||
|
out (baudp),a
|
|||
|
ld a,0x27
|
|||
|
out (ctrlp),a
|
|||
|
ret
|
|||
|
|
|||
|
do_ent:
|
|||
|
ld e,0x19
|
|||
|
ld c,2
|
|||
|
call 5
|
|||
|
in a,(baudp)
|
|||
|
ld b,a
|
|||
|
in a,(baudp)
|
|||
|
ld a,b
|
|||
|
or a
|
|||
|
ret nz
|
|||
|
ld a,(n18)
|
|||
|
call setmod
|
|||
|
ld a,(b2400)
|
|||
|
call setbd
|
|||
|
ret
|
|||
|
|
|||
|
do_exit:
|
|||
|
ld e,0x19
|
|||
|
ld c,2
|
|||
|
call 5
|
|||
|
ret
|
|||
|
|
|||
|
|