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
/
QTPAT42.LBR
/
QT-C128.ZY
/
QT-C128.ZY
Wrap
Text File
|
2000-06-30
|
6KB
|
255 lines
; QT-C128.Z - patch code for QTERM on the Commodore C128
; added break code 12/31/89, D.Goodenough, and upgraded to work with QTERM 4.2
; written 7/8/89 D. Goodenough from the IMP patch
; modist - return with z flag clear iff there is a char waiting at modem port
.org 0x0110
modist: ld a,(0xfd4f)
and 1
ret
; modin - read char from modem port: modist has been used to check it's there
.org 0x0120
modin: ld a,(0xfd51)
ld hl,0xfd4f
res 0,(hl)
ret
; modost - return with z flag clear iff the modem can accept another char
.org 0x0130
modost: ld a,(0xfd4f)
cpl
and 0x80
ret
; modout - send char to modem port
.org 0x0140
modout: ld (0xfd50),a
ld hl,0xfd4f
set 7,(hl)
ret
; sbreak - start a break condition on line
.org 0x0150
sbreak: ld a,1 ; we'll set the baud rate to 50 BPS
call baudns ; do it, but leave original baud alone
xor a
jr modout ; now send a null
; ebreak - terminate break condition
.org 0x0160
ebreak: call modost
jr z,ebreak ; make sure the 50 BPS char is gone
ld a,(origb)
jp dobaud ; and reset the baud rate
; dtroff - disable dtr to cause modem to hang up
.org 0x0170
dtroff: ret ; 1670 doesn't grok dtr, but it's
db 10 ; Hayes compatible, so we send the stock
db 0xfe ; Hayes hangup string to it
db '+++'
db 0xfe
db 'ATH0\r'
; dtron - re-enable dtr - not needed with string above
.org 0x0180
dtron: ret ; but it's here for the sake of completeness
; setbd - take byte in a, from baud table, use it to set baud rate
.org 0x0190
setbd: jp dobaud ; done elsewhere - see patch area
; these next eight are byte pairs - the first byte is used by setbd above.
; the second is a -1 for an active baud rate entry, and a 0 for inactive
.org 0x01a0
b38400: db 0,0
b19200: db 0,0
b9600: db 0,0
b4800: db 0,0
b2400: db 0,0
b1200: db 8,-1 ; we only talk 1200 .....
b600: db 0,0
b300: db 6,-1 ; and 300
; setmod - take a byte from the mode table, use it to set the uart mode
.org 0x01b0
setmod: ret ; no mode setting
; now the twelve mode bytes for setting comm format
.org 0x01c0
modtab:
n17: db 0
n18: db 0
n27: db 0
n28: db 0
e17: db 0
e18: db 0
e27: db 0
e28: db 0
o17: db 0
o18: db 0
o27: db 0
o28: db 0 ; empty table
.org 0x01cc
resrvd: db 0 ; reserved
; 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, 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
.org 0x01cd
xfersz: db 2 ; send 2K at a time: CBM disks are slooowww.
; this can be bumped to 8 if you're using a
; 1750 REU as drive M:
; speed - simply the cpu speed for a z80 in mhz.
.org 0x01ce
speed: db 1 ; A slow CPU (which is odd, because they
; put a Z80B in there)
; 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
.org 0x01cf
escape: db 'o' & 0x1f ; use ^O on the 128
; the signon message - change this to be appropriate for your system
.org 0x01d0
signon: db 'Commodore 128 / 1670 Modem\0'
; now the string for clear screen
.org 0x01f0
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
.var decout 0x010c
.org 0x0200
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
; 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
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
brites: db '\e(\0'
.org 0x0238
dims: db '\e)\0'
.org 0x0240
dlstr: db '\eR\0'
.org 0x0248
ilstr: db '\eE\0'
.org 0x0250
dcstr: db '\eW\0'
.org 0x0258
icstr: db '\eQ\0'
.org 0x0260
ceol: db '\eT\0'
.org 0x0268
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
entry: jp doent
.org 0x0273
exit: jp doexit
.org 0x0276
user: ret
.org 0x0279
kbmap: ret
.var prompt 0x027c
; finally a patch area that is provided for patching odd systems that need
; a lot of space.
.org 0x0280
doexit: ld a,1 ; slow the scan right down to get some
jr baudns ; performance from the kbd
doent: ld a,1
ld (0xfd4e),a
ld a,8
dobaud: ld (origb),a ; save the new baud rate
baudns: push af ; and put it on the stack
ld hl,(1)
ld l,0x3c
call cbios
ld de,0x37
add hl,de
pop af
ld (hl),a
ld hl,(1)
ld l,0x3f
ld c,6
cbios: jp (hl)
origb: db 8 ; original baud rate
; MUST terminate by 0x04ff