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
/
CPM
/
22RSX
/
BYERSX.ARK
/
BRTV3-1.BYE
< prev
next >
Wrap
Text File
|
1986-02-17
|
8KB
|
273 lines
; BRTV3-1.INC - Televideo 803 insert for BYERSX (85/12/6)
;
; Name this file RSXIO.INC for use with the BYERSX system
;
; This is an adaptation of BRGP-1 to adapt the Televideo 803 to
; BYERSX.
;
; Such an insert may be used with any auto-answer modem such as the
; Hayes Smartmodem 300 or 1200, the Cermetek Infomate 212A, etc.
; Other modems may be used with suitable auxiliary programs.
;
; This may have an anomalous connection to DODELAY in the main system
; which delays (de) millisecs, preserving bc and hl. The RSX delay
; mechanism cannot be used because these routines may be called by
; the RSX, and the switched stack would then be overwritten.
;
; Note: This is an insert, not an overlay. It is normally
; included automatically by "include" statements in the main
; program. If your assembler cannot handle this you will have
; have to concatenate files, starting with RSXMAST.MAC. Regs
; that may be altered by the routines are shown as "a,f" etc.
;
; ------------------------------------------------------------------
;
; 85/11/16 Created, for general referance. C.B. Falconer
; The resemblence to BYE inserts is not accidental.
;
; ------------------------------------------------------------------
;
; Televideo 803 port equates, using MOSTEK 3801
data equ 02fh; in/out
;
outstat equ 02eh; output ready/output control
outrdybit equ 080h; output port clear
txenbl equ 05h; enable transmission
;
instat equ 02dh; input ready/input control
rxenbl equ 001h; enable reception
inrdybit equ 080h; input data ready
;
uartcmd equ 02ch; command to uart
paroff81 equ 088h; parity off, 8 bits, 1 stop
;
bdratep equ 02bh; baud rate control
b9600 equ 9600/9600; baud rate values
b4800 equ 9600/4800
b2400 equ 9600/2400
b1200 equ 9600/1200
b600 equ 9600/600
b300 equ 9600/300
;
uartimer equ 029h; uart timer port? in/out
;
uartint equ 027h; uart interrupt control
dsint equ 0fh; disable interrupts
;
; Do a complete reset of the port.
; Hang up in case carrier present. Wait, and then assert DTR.
; This may initialize an interrupt driven system. Some programs
; may call this more than once, so if the system should not be
; re-initialized this must take care of the situation.
; mdquit should reverse the operation of this routine.
; Return 0ffh for success, 0 for failure, with flags set
; a,f
mdinit: in uartimer
push psw; save timer value
mvi a,dsint
out uartint; disable interrupts
pop psw
out uartimer; restart timer
mvi a,paroff81
out uartcmd; set configuration
mvi a,rxenbl
out instat; enable input
mvi a,txenbl
out outstat; enable output
ori 0ffh; signal success
ret
;
; Deinitialize the Modem and hang up the phone by dropping DTR and
; leaving it inactive. Usually just falls into MDSTOP. This may
; inactivate any interrupt driven systems, so that the whole system
; can be removed. Inverse of mdinit.
; a,f (allowed)
mdquit:
; " "
; Drop DTR to the modem and hang up. An interrupt system remains up.
; This is the inverse of mdgo.
; a,f (allowed)
mdstop:
ret
;
; Re-enable the line. This is the inverse operation to mdstop
; return 0ffh for success, 0 for failure, with flags set
; a,f
mdgo: ori 0ffh; Success
ret
;
; -----------------------------------
;
; Check for carrier. If there is no carrier, return 0 with the
; Z flag set, else 0ffh with the NZ flag.
; a,f
mdcarck:
nop; allow patch to ori 0ffh.
xra a; No carrier
ret
;
; Input one character from the modem port.
; If no char. is ready this will return garbage... so use the
; MDINST routine first. Do not strip parity for BYERSX
; a,f
mdinp: in data
ret
;
; Determines if there is a character waiting to be received.
; If no character is waiting the Zero flag will be
; set and 0 returned, else 0FFH will be returned in register 'A'.
; a,f
mdinst: in instat
ani inrdybit
rz; nothing ready
ori 0ffh; something ready
ret
;
; Output one character from register 'A' to the modem. Disturb no
; registers. Application should check MDOUTST first for empty buffer.
; f (allowed)
mdoutp: out data
ret; discard it for the outline
;
; Determine if the transmit buffer is empty. If empty, return 0ffh and
; the NZ flag. If the transmitter is busy, return 0 with Z flag.
; a,f
mdoutst:
in outstat
ani outrdybit
rz; not ready
ori 0ffh; ready for output
ret
;
; Send an (a) millisec break thru the modem.
; Return 0ffh and nz flag if capable, 0 and z flag if not capable
; a,f
sendbk: xra a; not capable
ret
;
; Generalized baud setting per (a).
; Return 0 and zero flag if good, else 0ffh and non-zero flag.
; input (a) 1..10 for 110,300,450,600,710,1200,2400,9600,19200 baud
; if input a = 0 do nothing (high order bits used for stops/parity)
; The high 2 bits set stop bits (0..3 for no change, 1, 1.5, 2 stops)
; and the next set parity (0..3 for no change, no, odd, even parity).
; Success flags are based on baud rate only. Parity/stop settings
; may be ignored if desired.
; a,f
setbaud:
call sstops
ani 0fh
rz
push h
lxi h,btbl
add l
mov l,a
adc h
sub l
mov h,a
mov a,m
pop h
ora a
jnz sb2; valid input
sb1: ori 0ffh; signal invalid
ret
sb2: out bdratep
xra a; signal success
ret
;
; zero entries for invalid speeds
btbl: db 0, 0, b300, 0; 0,110,300,450
db b600, 0, b1200,b2400; 600,710,1200,2400
db b4800, b9600, 0, 0; 4800,9600,19200,0
db 0, 0, 0, 0; zeroes for invalid values.
;
; set stop bits/parity on hi bits of (a). Preserve registers.
sstops: ret
;
; For non-intelligent modems. Go off hook and connect.
; Return 0ffh if performed, 0 if not, with flags set
; a,f
mdansw:
xra a; couldn't do it
ret
;
; For non intelligent modems. Is the phone ringing
; 0 and z flag if not, 0ffh and nz flag if ringing
mdring: xra a; not ringing
ret
;
; For disk control, the following indicates that the application
; will not require disk access in the immediate future. If possible
; drive motors should be stopped. No harm if unable to perform
; a,f
dskstp: ret
;
; For disk control, the following indicates that the application
; will require disk access in the immediate future. If possible
; drive motors should be started. No harm if unable to perform
; a,f
dskrun: ret
;
; ----------------------- Timer interface --------------------------
;
; These two routines are called with either
; de = 0ffffh for a query (return current value in hl) )
; de = other to set the appropriate value, and return in (hl)
; The returned value should be 0ffffh if no timer system installed.
;
; The date is kept in the following format (note 0ffffh is invalid)
; MSbit yyyyyyy mmmm ddddd LSbit
; with y field (0..127) the offset from 1980 (dates to 2107)
; m field (1..12) the numerical month (Jan to Dec)
; d field (1..31) the day of month
; (Identical to MSDOS format)
; a,f,h,l
sgdate: lxi h,0ffffh; Not implemented
ret
;
; The time is kept in the following format (note 0ffffh is invalid)
; MSbit hhhhh mmmmmm sssss LS bit
; with h field (0..23) hour of day (0 is midnight)
; m field (0..59) minute of hour
; s field (0..29) seconds DIV 2 (resolution 2 seconds)
; (Identical to MSDOS format)
; a,f,h,l
sgtime: lxi h,0ffffh; Not implemented
ret
;
; This is used only where the host system has no real-time clock.
; This allows simulation of that clock, with lousy accuracy.
; Adds 1 minute to the internally stored time value. If a clock
; system exists this should simply return.
; a,f,h,l (allowed)
add1min:
ret
;
; ------------ I/O Dependant Function Key actions -------------
;
; The following are called when the ATTN char is followed by one
; of the digits '0' thru '9'. It is suggested that the digit '0'
; be reserved for performing screen dumps. A simple "ret"
; eliminates any key from the function repetoire.
; a,f,h,l (allowed)
f0k:
f1k:
f2k:
f3k:
f4k:
f5k:
f6k:
f7k:
f8k:
f9k: ret; eliminate all these
;
; end of insert
; ------------------------------------------------------------------
;
; Following special mechanism for SLRMAC assembler. For others omit
; and patch the initialization area
org imsg
db ' installing on Televideo 803$'
org
╒δ