; Program: T3M-AM2.Z80
; Use: Term3 Modem Overlay
; Written by: David McCord
; Last revised: 05/23/86
;
; Term3 Modem Interface for AMPRO "little board" computers (Z80 DART)
; Uses serial channel 'B' for operation
;
; Completely rewritten for TERM III Phase 2; previous versions did not work.
; Supports baud rates of 300, 1200, 2400, and 9600
;
; Recent changes:
; v2 05/23/86 D. McCord
; redid the mi$init routine. v1 did not do anything to the DART, which
; wasn't a problem unless you used another comm program (like IMP or
; BYE), which might have left the DART in an undesireable state.
;
; This program, both source code and executable binary code, is
; copyright 1986 Echelon, Inc. Duplication for non-commercial personal
; use is permitted; all other duplication is prohibited unless authorized
; in writing by the copyright holder.
;
; To use:
; ZAS T3M-AM1 H <- make .HEX file output
; MLOAD MODEM.BIN=T3M-AM1 <- create binary file
; T3INS INSTALL <- install into TERM3 modules
;
; Cabling:
; The AMPRO computer serial ports do not utilize the 'standard'
; control signals DTR and DCD available on the DART; instead, the
; RTS and CTS signals (respectively) are used. This means that the
; following special cable must be used:
;
; TERM3 Modem Application Cable
; (assumes factory default wiring of serial port B)
;
; AMPRO Modem
; 2 ------------------- 3
; 3 ------------------- 2
; 5 ------------------- 20
; 7 ------------------- 7
; 20 ------------------- 8
;
; A T3MASTER/T3SERVER special cable is not required.
;
; Equates - first, port assignments
;
dport equ 88h ; data port for DART channel B
sport equ dport+4 ; status port for DART channel B
bport equ 50h ; CTC baud rate generator port
;
bauds equ 00010111b ; 300, 1200, 2400, 9600 supported
;
org 600h ; all modem interfaces start at 600h
mi$init:
jp smi$init ; set baud rate
mi$istat:
jp smi$istat ; check input status
mi$ostat:
jp smi$ostat ; check output status
mi$in:
jp smi$in ; get input character
mi$out:
jp smi$out ; send output character
mi$break:
jp smi$break ; send BREAK
mi$cst:
jp smi$cst ; check carrier status
mi$sptab:
db bauds
;
; see the TERM III manual, pg 7-8 thru 7-10, for discussion of input and
; output parameters for these subroutines.
;
smi$init:
push af
push hl
cp 1
jr z,set300
cp 2
jr z,set1200
cp 3
jr z,set2400
cp 5
jr z,set9600
noset:
pop hl
pop af
xor a
ret
;
set300:
ld hl,47d0h ; CTC commands for 300 bps
jr setspec
set1200:
ld hl,4768h ; CTC commands for 1200 bps
jr set
set2400:
ld hl,4734h ; CTC commands for 2400 bps
jr set
set9600:
ld hl,470dh ; CTC commands for 9600 bps
setspec:
ld a,18h ; reset DART and set clock divider for x32
out (sport),a
ld a,4
out (sport),a
ld a,86h
jr set1
set:
ld a,18h ; reset DART and set clock divider to x16
out (sport),a
ld a,4
out (sport),a
ld a,46h
set1: out (sport),a
ld a,5
out (sport),a
ld a,6ah
out (sport),a
ld a,3
out (sport),a
ld a,0c1h
out (sport),a
ld a,h ; send command bytes to CTC
out (bport),a
ld a,l
out (bport),a
pop hl
pop af
or a
ret
;
smi$istat:
in a,(sport)
and 1
ret z
or 0ffh
ret
;
smi$ostat:
in a,(sport)
and 4
ret z
or 0ffh
ret
;
smi$in:
call smi$istat
jr z,smi$in
in a,(dport)
ret
;
smi$out:
push af
smi$outloop:
call smi$ostat
jr z,smi$outloop
pop af
out (dport),a
ret
;
smi$break:
xor a ; BREAK not supported (although the DART
ret ; can do it)
;
smi$cst:
or 255
ret
; ld a,10h
; out (sport),a ; reset status
; in a,(sport)
; and 20h
; ret z
; or 0ffh
; ret
;
; end of this modem interface
;
db 'Copyright 1986 Echelon, Inc.'