home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
enterprs
/
cpm
/
terms
/
qtpatch.arc
/
QT-JOYCE.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-09-08
|
4KB
|
179 lines
; This is a patch for QTERM and the Joyce/PCW8256 with serial
; interface CPS8256. It is developed out of other patches and by digging
; into the OS routines, since I don't have the proper documentation. As
; far as I know this information isn't available at bookstores etc.
; I even had to guess the right SIO and timer type...
;
; It seems to work fine, altough I can't promise it will work on every
; Joyce with every configuration. The only problem is that the the
; program and/or the computer are a bit too slow for speeds above 1200
; baud. After a clear-screen the emulator misses some characters, and
; sometimes after a return it misses one character. On Unix systems this
; is no problem, since pading can be properly specified. But on a lot of
; systems padding is unknown, so if someone knows the answer to this
; problems I'd like to hear. Also if there are bugs, missing features
; or other terrible shortcommings please contact me.
;
; Greetings, Otto Moerbeek
TRUE equ 0ffh
FALSE equ 0
ESC equ '['-40h
scrout equ 109h ; Address of routine to put a char on screen
siod equ 0e0h ; Data port
sioc equ port+1 ; Control port
siobs equ 0e4h ; Send baudrate port
siobr equ siobs+1 ; Receive baudrate port
siot equ 0e7h ; Timer port
modist org 110h ; Check input status
in sioc
ani 1 ; Bit 0 is 'char available' bit
ret
modin org 120h ; Get char
in siod
ret
modost org 130h ; Check output status
in sioc
ani 4 ; Bit 2 is 'ready to send' bit
ret
modout org 140h ; Put char
out siod
ret
sbreak org 150h ; Set break bit
mvi a,5 ; Break bit is controlled by register 5
out sioc
lda r5 ; Get old value
ori 10h ; Set bit 4
out sioc
ret
ebreak org 160h ; Restore old situation
mvi a,5
out sioc
lda r5
out sioc
ret
dtroff org 170h ; Drop DTR
mvi a,5
out sioc
lda r5 ; Get old value
ani 7fh ; Clear bit 7
out sioc
ret
dtron org 180h
jmp ebreak
setbd org 190h ; Set baudrate
call compbaud ; First get right value in bc
mov a,b ; Low byte to send-baudrate port
out siobs
mov a,c ; And high byte
out siobs
mov a,b ; Same for receive-baudrate port
out siobr
mov a,c
out siobr
ret
brtab org 1a0h ; offsets into table
db 0,FALSE,0,FALSE,0,TRUE,2,TRUE,4,TRUE,6,TRUE,8,TRUE,10,TRUE
setmod org 1b0h
jmp domod
r5 db 0aah ; Save value for reg 5
modtab org 1c0h
db 00h,0c0h,08h,0c8h,03h,0c3h,0bh,0cbh,01h,0c1h,09h,0c9h
xfersz org 1cdh
db 8
speed org 1ceh
db 4
escape org 1cfh
db '\'-40h
signon org 1d0h
db 'Joyce',0
clrscr org 1f0h
db ESC,'H',ESC,'E',0
moveto org 200h
push h
mvi c,ESC
call scrout
mvi c,'Y'
call scrout
pop h
push h
mov a,h
call poff
pop h
mov a,l
poff adi ' '
mov c,a
jmp scrout
baudtab dw 13,26,52,104,208,416 ; Here some space remained for
; baudrate table
tcbits org 22fh
db 0dfh ; We miss insert char
brites org 230h ; Various string for screen
db ESC,'q',0
dims org 238h
db ESC,'p',0
dlstr org 240h
db ESC,'M',0
ilstr org 248h
db ESC,'L',0
dcstr org 250h
db ESC,'N',0
icstr org 258h
db 0
ceol org 260h
db ESC,'K',0
ceos org 268h
db ESC,'J',0
entry org 270h
jmp init
exit org 273h
ret
patch org 276h
init mvi a,0 ; Reset SIO
out sioc
mvi a,18h
out sioc
mvi a,0c0h ; Init on 8 bits, no parity and 1 stop bit
call domod
mvi a,6 ; 1200 baud
call setbd
ret
compbaud ; Compute offset into baudrate table
mov e,a
mvi a,36h ; But first init timer
out siot
lxi h,baudtab
mvi d,0
dad d
mov b,m ; Move offset to bc
inx h
mov c,m
ret
domod mov c,a ; Do mode change, save code in c
mvi a,3 ; Firts reg 3
out sioc
mov a,c ; Retrieve code
ani 80h ; Only bit for receive bits/char
ori 41h ; Rest stays 41h
out sioc
mvi a,4 ; Now reg 4
out sioc
mov a,c ; Retrieve code
ani 0bh ; We only wants bits 0,1 and 3 to be
ori 44h ; changed, rest stays 44h
out sioc
mvi a,5 ; Reg 5
out sioc
mov a,c ; Restrieve code
ani 40h ; Only send bits/char
ori 0aah ; Rest of bits stay 0aah
sta r5 ; Store value for break and DTR routines
out sioc
ret