Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
;;
2
;; Copyright (c) 2016 Marco Granati <mg@unet.bz>
3
;;
4
;; Permission to use, copy, modify, and distribute this software for any
5
;; purpose with or without fee is hereby granted, provided that the above
6
;; copyright notice and this permission notice appear in all copies.
7
;;
8
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
;;
16
 
17
;; name: sp.inc
18
;; rev.: 2016/07/28
19
;; bios C816 version v1.0
20
 
21
.LIST on
22
 
23
SOH		.EQU	$01
24
STX		.EQU	$02
25
ETX		.EQU	$03
26
EOT		.EQU	$04
27
ENQ		.EQU	$05
28
ACK		.EQU	$06
29
DLE		.EQU	$10
30
SYN		.EQU	$16
31
 
32
SOBUFSIZ	.EQU	$2000	; dimensione coda TX1/TX2 ACIA (8K)
33
;SOBUFSIZ	.EQU	$0100	; dimensione coda TX1/TX2 ACIA (8K)
34
SIBUFSIZ	.EQU	$4000	; dimensione coda RX1/RX2 ACIA (16K)
35
;SIBUFSIZ	.EQU	$0100	; dimensione coda RX1/RX2 ACIA (16K)
36
 
37
NGUARD1		.EQU	$80	; numero bytes di guardia buffer RX XON/XOFF
38
NGUARD2		.EQU	$40	; numero bytes di guardia buffer RX handshake
39
;NGUARD1		.EQU	$40	; numero bytes di guardia buffer RX XON/XOFF
40
;NGUARD2		.EQU	$20	; numero bytes di guardia buffer RX handshake
41
NFREE1		.EQU	$1000	; minimo posto in coda RX per cancellare pausa remota
42
NFREE2		.EQU	$0800
43
;NGUARD3		.EQU	$F0
44
;NGUARD4		.EQU	$F8
45
 
46
;---------------------------------------------------------------------------
47
; direct page var's for serial ports handling
48
;---------------------------------------------------------------------------
49
 
50
DPSP:	.SECTION page0, common, ref_only, offset spwrk	;ACIA D.P.
51
 
52
_DPSP_START	.DS	0
53
 
54
; WARNING: not change order and type of the following variables
55
 
56
; acia 1 var's
57
splin		.DB		; interrupt status register
58
spcsr		.DB		; control status register
59
spfr		.DB		; format register
60
spout		.DB		; XON/XOFF send flag
61
 
62
; acia 2 var's
63
splin2		.DB		; interrupt status register
64
spcsr2		.DB		; control status register
65
spfr2		.DB		; format register
66
spout2		.DB		; XON/XOFF send flag
67
 
68
; serial port's mode & status
69
spmode		.DB		; <7>: 0=no handshake, 1=handshake
70
				; <6>: 0=software/1=hardware handshake
71
				; <5>: not used
72
				; <4>: baud rate: 0=19200, 1=38400
73
				; <3>: 0=odd parity, 1=even parity
74
				; <2>: 0=no parity, 1=parity as specified
75
				;      by bit <3>
76
				; <1>: interface type: 0=RS232, 1=RS485
77
				; <0>: RS232: uplink flow control (RTS/DCD)
78
				;      RS485: 120 ohm termination on
79
				; if bit 7=1 and bit 1=1, bit 6 is forced to 0
80
 
81
spstat		.DB		; serial port status
82
				; <7>: rx error (data discarded)
83
				; <6>: rx buffer overflow
84
				; <5>: remote disconnession (DSR line = 1)
85
				; <4>: output buffer overflow
86
				; <3>: not used
87
				; <2>: framing error
88
				; <1>: parity error
89
				; <0>: overrun error
90
 
91
sppause		.DB		; local/remote pause flag's
92
				; <7>: remote pause (sent an XON or set RTS=1)
93
				; <6>: local pause (received an XON or CTS=1)
94
 
95
sptmp		.DB		; temp. byte used while get data
96
 
97
; serial port's mode & status
98
spmode2		.DB		; <7>: 0=no handshake, 1=handshake
99
				; <6>: 0=software/1=hardware handshake
100
				; <5>: not used
101
				; <4>: baud rate: 0=19200, 1=38400
102
				; <3>: 0=odd parity, 1=even parity
103
				; <2>: 0=no parity, 1=parity as specified
104
				;      by bit <3>
105
				; <1>: interface type: 0=RS232, 1=RS485
106
				; <0>: RS232: uplink flow control (RTS/DCD)
107
				;      RS485: 120 ohm termination on
108
				; if bit 7=1 and bit 1=1, bit 6 is forced to 0
109
 
110
spstat2		.DB		; serial port status
111
				; <7>: rx error (data discarded)
112
				; <6>: rx buffer overflow
113
				; <5>: remote disconnession (DSR line = 1)
114
				; <4>: output buffer overflow
115
				; <3>: not used
116
				; <2>: framing error
117
				; <1>: parity error
118
				; <0>: overrun error
119
 
120
sppause2	.DB		; local/remote pause flag's
121
				; <7>: remote pause (sent XOFF/XON or RTS=1/0)
122
				; <6>: local pause (rx XOFF/XON or CTS=0/1)
123
 
124
sppost		.DB		; after POST must hold $C0
125
 
126
ibuftail	.DW		; pointer to tail of input buffer
127
ibufhead	.DW		; pointer to head of input buffer
128
ibuftail2	.DW
129
ibufhead2	.DW
130
 
131
obuftail	.DW		; pointer to tail of output buffer
132
obufhead	.DW		; pointer to head of output buffer
133
obuftail2	.DW
134
obufhead2	.DW
135
 
136
ibufcnt		.DW		; count of bytes in input buffer
137
obufcnt		.DW		; count of bytes in output buffer
138
ibufcnt2	.DW
139
obufcnt2	.DW
140
 
141
icntmin		.DW		; min. count for clear remote pause
142
icntmax		.DW		; max. count for set remote pause
143
icntmin2	.DW
144
icntmax2	.DW
145
 
146
_DPSP_END	.DS	0
147
DPSPSIZ		.EQU	(_DPSP_END - _DPSP_START)
148
 
149
 
150
	.ENDS
151
 
152
ACIArxe_1	.EQU	spstat
153
ACIArxe_2	.EQU	spstat2
154
ACIAhsk_1	.EQU	spmode
155
ACIAhsk_2	.EQU	spmode2
156
ACIAPause_1	.EQU	sppause
157
ACIAPause_2	.EQU	sppause2
158
ACIAcsr_1	.EQU	spcsr
159
ACIAcsr_2	.EQU	spcsr2
160
ACIAfr_1	.EQU	spfr
161
ACIAfr_2	.EQU	spfr2
162
ACIAOut_1	.EQU	sppause
163
ACIAOut_2	.EQU	sppause2
164
ACIAICnt_1	.EQU	ibufcnt
165
ACIAICnt_2	.EQU	ibufcnt2
166
ACIAIHead_1	.EQU	ibufhead
167
ACIAIHead_2	.EQU	ibufhead2
168
ACIAITail_1	.EQU	ibuftail
169
ACIAITail_2	.EQU	ibuftail2
170
ACIAOCnt_1	.EQU	obufcnt
171
ACIAOCnt_2	.EQU	obufcnt2
172
ACIAOHead_1	.EQU	obufhead
173
ACIAOHead_2	.EQU	obufhead2
174
ACIAOTail_1	.EQU	obuftail
175
ACIAOTail_2	.EQU	obuftail2
176
 
177
ACIAOBUFLEN	.EQU	SOBUFSIZ
178
ACIAIBUFLEN	.EQU	SIBUFSIZ
179
ACIAOUTBUF1	.EQU	SPOUTBUFF
180
ACIAOUTBUF2	.EQU	SPOUTBUFF2
181
ACIAINBUF1	.EQU	SPINBUFF
182
ACIAINBUF2	.EQU	SPINBUFF2
183
 
184
ACIATmp		.EQU	sptmp
185
 
186
.LIST off