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
/
ENTERPRS
/
CPM
/
TERMS
/
QTPATCH.ARC
/
QT-TS802.Z
< prev
next >
Wrap
Text File
|
1989-09-08
|
6KB
|
283 lines
; QT802.Z - patch source for a televideo TS802
.var siod 0x20
.var sioc 0x22
.var baud 0x08
.org 0x0110
modist: in a,(sioc)
and 1
ret
.org 0x0120
modin: in a,(siod)
ret
.org 0x0130
modost: in a,(sioc)
and 4
ret
.org 0x0140
modout: out (siod),a
ret
.org 0x0150
sbreak: ld a,(setf)
or a
ret z
ld hl,r5
set 4,(hl)
jp sioout
.org 0x0160
ebreak: ld a,(setf)
or a
ret z
ld hl,r5
res 4,(hl)
jp sioout
.org 0x0170
dtroff: ld a,(setf)
or a
ret z
ld hl,r5
res 7,(hl)
jp sioout
.org 0x0180
dtron: ld a,(setf)
or a
ret z
ld hl,r5
set 7,(hl)
jp sioout
.org 0x0190
.extern setbd
setbd:
push af
ld a,0x47
out (baud),a
pop af
out (baud),a
ret
; these next eight are byte pairs - the first byte is used by setbd above.
; the second is a yes for an active baud rate entry, and a no for inactive
; the 802 is rated up to 38400 baud, but it is doubtful that QTERM
; will bw able to keep up at that speed. Caveat Emptor
.org 0x01a0
.extern b38400
b38400: db 1,yes
.extern b19200
b19200: db 2,yes
.extern b9600
b9600: db 4,yes
.extern b4800
b4800: db 8,yes
.extern b2400
b2400: db 16,yes
.extern b1200
b1200: db 32,yes
.extern b600
b600: db 64,yes
.extern b300
b300: db 128,yes
;.org 0x01b0
setmod: ld (setf),a
jp domod
.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
.extern resrvd
resrvd:
db 0
; xfersz - number of K to read / write to disk during protocol transfers:
; must be 1 / 2 / 4 / 8. Generally this is best left at 8 unless you have
; a REALLY slow disk (C128 maybe) when writing / reading 8K at a time
; causes timeouts. Drop this to 4 or 2 to do disk access in smaller chunks
; to help avoid the timeout problem
.extern xfersz
xfersz: db 8
; speed - simply the cpu speed for a z80 in mhz.
.extern speed
speed: db 4
; escape - this is the character used as the escape char: since the addresses
; in the table tend to move, we just put the byte here, and then transfer
; to the table later
escape: db '\\' & 0x1f
; the signon message - change this to be appropriate for your system
;.org 0x01d0 ; don't need this: the bytes above do it
signon: db 'Televideo TS802\0'
; now the string for clear screen
.org 0x01f0
.extern clrs
clrs: db 'z' & 0x1f, 0
; moveto - **** - this routine is called with a word in hl - h = row &
; l = column to move to, at 109 is a routine to print a char in c,
; at 10c is a routine to print a decimal number in hl (for ansi tubes)
.var scrout 0x0109
.org 0x0200
.extern moveto
moveto: push hl ; save coords
ld c,'\e'
call scrout ; lead in escape
ld c,'='
call scrout ; leadin '='
pop hl
push hl
ld a,h ; row to a
call poff ; out it goes w/ offset
pop hl
ld a,l ; col to a
poff: add a,' ' ; add offset
ld c,a
jp scrout ; & print it
; these next strings are used to do various screen functions. There are
; eight of them, and immediately preceding them is a flag byte. Each string
; has a bit in the byte, and if a capability is present, its bit should
; be set. This byte is an absolute necessity, as various programs use it
; to tell if various things are present.
.org 0x022f
.extern tcbits
tcbits: db 0b11111111 ; bits are:
; 0: bright b_brite 1
; 1: dim b_dim 2
; 2: delete line b_delln 4
; 3: insert line b_insln 8
; 4: delete character b_delch 16
; 5: insert character b_insch 32
; 6: clear end line b_cleol 64
; 7: clear end screen b_cleos 128
;.org 0x0230 ; don't need this: the byte above does it
.extern brites
brites: db '\e(\0' ; ****
.org 0x0238
.extern dims
dims: db '\e)\0' ; ****
.org 0x0240
.extern dlstr
dlstr: db '\eR\0' ; ****
.org 0x0248
.extern ilstr
ilstr: db '\eE\0' ; ****
.org 0x0250
.extern dcstr
dcstr: db '\eW\0' ; ****
.org 0x0258
.extern icstr
icstr: db '\eQ\0' ; ****
.org 0x0260
.extern ceol
ceol: db '\eT\0' ; ****
.org 0x0268
.extern ceos
ceos: db '\eY\0' ; ****
; Entry and exit hooks. These are provided to perform custom initialisation
; on startup, and also to perform custom code on exit.
.org 0x0270
.extern entry
entry: jp doent
;.org 0x0273
.extern exit
exit: ret ; ****
; finally a patch area that is provided for patching odd systems that need
; a lot of space. This also doubles as a crafty method for making the overlay
; exactly 512 bytes - so a 'SAVE 2 QTERM.XXX' saves the patch area for use
; on later releases.
.org 0x0276
doent:
ld a,(b1200)
call setbd
ld a,(n18)
call setmod
ret
sioout: ld hl,siodat
ld bc,6 * 256 + sioc
otir
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
jp sioout ; go send the values
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