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-SB180.Z
< prev
next >
Wrap
Text File
|
1989-09-08
|
6KB
|
282 lines
; QT-SB180.Z - 'QTERM Overlay for the SB180'
;
; Adapted from the Echelon source provided by:
; Author: W. Gonnason (U. of Calgary Electrical Engineering)
; (D. Goodenough - 8-8-89)
;
; - Based on the MEX Overlay for the Micromint SB180, external modem.
;
; Date: January 04, 1989
;
;
; Original MEX Overlay Credits:
;
; M7KP-1 overlay structure by Irv Hoff
; Adapted for the SB180 by Ken Davidson
;
.var yes 0xff
.var no 0
;
; Since the SB-180 requires an external terminal, I can't do too much
; in the way of terminal configuration. What I've done is to create
; three .vars: tvi, vt52, and vt100. If you're on a Televideo
; compatible (clear with '^Z', 'ESC' '=' to move) set tvi to yes, and
; the others to no. Similarly for VT52 terminals (H19 etc.) set vt52 to
; yes - and set vt100 if you have an ansi compatible. Unfortunately
; I've assumed a worst case scenario, and disabled all the neat
; screen functions that QTERM can use - you may wish to add in your
; own if you know how to drive your screen. Check QTERM.PAT for
; an explanation of tcbits, and the strings that follow it.
;
; EXACTLY ONE of these three must be yes, otherwise strange things will
; happen
;
.var tvi yes
.var vt52 no
.var vt100 no
;
; Since the SB-180 can have the CPU clocked at 6, 9, or 12 MHz, set your
; clock speed in clock. It MUST be 6, 9, or 12, otherwise strange things
; will happen
;
.var clock 6
;
; macros to fake out the HD64180 in0 and out0 instructions
;
.macro in0 port
dw 0x38ed
db port
.endm
;
.macro out0 port
dw 0x39ed
db port
.endm
;
.var extctl 0 ;external modem control port
.var exstat 4 ;external modem status port
.var exdato 6 ;external modem data out port
.var exdati 8 ;external modem data in port
.var baudrp 2 ;external modem baud rate port
.org 0x0110
modist: ; get modem input status
in0 exstat ; return Z clear if character ready
bit 7,a
ret
.org 0x0120
modin: ; Read a modem character
in0 exdati
ret
.org 0x0130
modost: ; get modem output status
in0 exstat ; return Z clear if OK to send character
bit 1,a
ret
.org 0x0140
modout: ; Write a character to modem
out0 exdato
ret
.org 0x0150
sbreak: ; Start a break condition
ret ; not supported
.org 0x0160
ebreak: ; End a break condition
ret ; not supported
.org 0x0170
dtroff: ; Drop the DTR line
in0 extctl ;Get current setting
or 0x10 ;Turn off DTR/RTS
out0 extctl
ret
.org 0x0180
dtron: ; Raise the DTR line
in0 extctl
and 0xef ;Turn 'em back on again
out0 extctl
ret
.org 0x0190
setbd: ; set serial port baud rate
push af
ld a,(baudstor)
and 0b11111000
pop bc
or b
out0 baudrp ; set it...
ld (baudstor),a
ret
.org 0x01a0
baudtb:
.if clock == 12
db 1,yes ; 38400
db 2,yes ; 19200
db 3,yes ; 9600
db 0,no ; 4800 is probably 4,yes
db 5,yes ; 2400
db 6,yes ; 1200
db 0,no ; 600
db 14,yes ; 300
.elif clock == 9
db 0,no ; No 38400 on 9 MHz system...
db 0x20,yes ; 19200 baud
db 0x21,yes ; 9600 baud
db 0x22,yes ; 4800 baud
db 0x23,yes ; 2400 baud
db 0x24,yes ; 1200 baud
db 0x25,yes ; 600 baud
db 0x26,yes ; 300 baud
.else
db 0,no ; No 38400
db 1,yes ; 19200
db 2,yes ; 9600
db 0,no ; 4800 is probably 3,yes
db 4,yes ; 2400
db 5,yes ; 1200
db 0,no ; 600
db 13,yes ; 300
.endif
.org 0x01b0
setmod: ; set communication mode
jp dosetmod ; not enough room here...
.org 0x01c0 ; communication mode table
modtab:
db 0x60 ; 7 N 1
db 0x64 ; 8 N 1
db 0x61 ; 7 N 2
db 0x65 ; 8 N 2
db 0x62 ; 7 E 1
db 0x66 ; 8 E 1
db 0x63 ; 7 E 2
db 0x67 ; 8 E 2
db 0x72 ; 7 O 1
db 0x76 ; 8 O 1
db 0x73 ; 7 O 2
db 0x77 ; 8 O 2
resrvd: db 0 ; reserved for future use
xfersz: db 8 ; size of data transfers to/from disk
; during protocol transfer. Leave as 8
; unless your disk is very slow
speed: db clock
escchr: db '\\' & 0x1f
;.org 0x01d0
signon: db 'Micromint SB-180\0'
.org 0x01f0 ; clear screen sequence
clrs:
.if tvi
db 'z' & 0x1f, 0
.elif vt52
db '\eE\0'
.else
db '\e[H\e[2J\0'
.endif
.var scrout 0x0109
.var decout 0x010c
.org 0x0200 ; move cursor to X,Y
moveto:
push hl
ld c,'\e'
call scrout
ld c,[tvi ? '=' : [vt52 ? 'Y' : '[']]
call scrout
.if vt100
pop hl
push hl
ld h,0
inc l
call decout
ld c,';'
call scrout
pop hl
ld l,h
inc l
ld h,0
call decout
ld c,'H'
jp scrout
.else
pop hl
push hl
ld a,h
call poff
pop hl
ld a,l
poff: add a,' '
ld c,a
jp scrout
.endif
.org 0x022f
tcbits:
db 0
;.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
.org 0x0270
entry: ; entry hook
ret
.org 0x0273
exit: ; exit hook
ret
.org 0x0276 ; Extra Patch Area
dosetmod:
push af
ld a,(baudstor)
pop bc
push bc
bit 4,b
set 4,a
jr nz,norst
res 4,a
norst: out0 baudrp ;set even/odd
ld (baudstor),a
pop af
res 4,a ;bring up DTR
out0 extctl ;set parity/noparity
ret
baudstor:
db 0 ; storage for current baud rate.