summaryrefslogtreecommitdiffstats
path: root/private/mvdm/sim16/sim16.inc
blob: 6c1e33ff80177c6325280fbb81d6015a581720a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
;
;
;   Serial driver for COM1 to be used by Sim16 layer.
;
;
CharDev     EQU     8000h
StatusError EQU     8000h
StatusBusy  EQU     0200h
StatusDone  EQU     0100h
ErrorGenF   EQU     12

;
;   PIC Addresses
;

PIC	    EQU     20h
PIC_IntEnable EQU   21h
EOI	    EQU     20h

;
;   UART Port Addresses
;

SERIALPORT  EQU     3F8h	; default serial port to be used, change this
				; to 2F8h if you want to use COM2.

RxBuf	    EQU     0F8h	; base address
Baud1	    EQU     RxBuf+1	; baud divisor high byte
IER	    EQU     RxBuf+1	; int. enable register
IIR	    EQU     RxBuf+2	; int. identification register
LCR	    EQU     RxBuf+3	;
MCR	    EQU     RxBuf+4	;
LSR	    EQU     RxBuf+5	;
MSR	    EQU     RxBuf+6	;

;   UART Interrupt Identification Register Equates

IntPending  EQU     00000001b	; interrupt is pending

;   UART Line Control Register Equates

DLAB	    EQU     10000000b	; divisor latch access bit
SetBrk	    EQU     01000000b	; send break control bit
StkParity   EQU     00100000b	; stick parity control bit
EvenParity  EQU     00010000b	; even parity bit
GenParity   EQU     00001000b	; generate parity bit
XStopBit    EQU     00000100b	; extra stop bit
WordLen8    EQU     00000011b	; word len = 8
WordLen7    EQU     00000010b	; word len = 7
WordLen6    EQU     00000001b	; word len = 6

;   UART Line Status Register Equates

TransShReg  EQU     01000000b	; tranmit shift register empty
TransHReg   EQU     00100000b	; transmit holding register empty
BrkRcv	    EQU     00010000b	; break received
FrameErr    EQU     00001000b	; framing error
ParityErr   EQU     00000100b	; parity error
OverRunErr  EQU     00000010b	; overrun error
RcvData     EQU     00000001b	; received data ready

RcvError    EQU     BrkRcv+FrameErr+ParityErr+OverRunErr

;   UART Modem Control Register Equates

OUT1	    EQU     00000100b	;
OUT2	    EQU     00001000b	; allow 8250 ints in
SetRTS	    EQU     00000010b	; set RTS
SetDTR	    EQU     00000001b	; set DTR


;   UART Modem Status Register Equates

CD	    EQU     10000000b	; carrier detect
RI	    EQU     01000000b	; ring indicator
DSR	    EQU     00100000b	; data set ready
CTS	    EQU     00010000b	; CTS
CDC	    EQU     00001000b	; carrier dectect change
RIC	    EQU     00000100b	; ring indicator change
DSRC	    EQU     00000010b	; DSR change
CTSC	    EQU     00000001b	; CTS change

;   UART Interrupt Enable Register Equates

RxInt	    EQU     00000001b	; receive interrupt
TxInt	    EQU     00000010b	; transmit interrupt
LSInt	    EQU     00000100b	; line status interrupt
MSInt	    EQU     00001000b	; modem status interrupt
AllInt	    EQU     RxInt+LSInt+MSInt

CR	    EQU     0dh
LF	    EQU     0ah
EOM	    EQU     '$'


INT21	    =	21h
DISPLAY_FUNCTION    =	9h
DOS_OPEN    =	3Dh
DOS_CLOSE   =	3Eh
DOS_DONE    =	0100h
DOS_SUCCESS =	0h
DOS_ERROR   =	8000h
DOS_GENFAIL =	0Ch
EXPR_TYPE_SEG		equ	0001b	    ; address type segment:offset
OPEN_FLAG   = 40h

InitLCR     EQU      03h		    ; initial LCR settings
InitMCR     EQU      OUT2+SetRTS+SetDTR     ; initial MCR settings
BaudRate    EQU     12			    ; set it to 9600 BPS

SOH	    EQU     1			   ; start of header
EOT	    EQU     4			   ; end of transmission
ToWOW32     EQU     1
GETMEM	    EQU     2
SETMEM	    EQU     3
WAKEUP	    EQU     4
RESP	    EQU     5
ACK	    EQU     6
NAK	    EQU     7
PSZ	    EQU     8

MAXCOUNT    EQU     10

Packet1 STRUC
    Start   DB	    ?
    Command DB	    ?
    Len     DW	    ?
    ToWOW32_OFF DW  ?
    ToWOW32_SEL DW  ?
Packet1 ENDS

Packet2 STRUC
	    DD	    ?
    MEM_OFF DW	    ?
    MEM_SEL DW	    ?
    MEM_LENGTH DW   ?
    DataM   DB	    ?
Packet2 ENDS

junk1	STRUC
    _off    DW	?
    _sel    DW	?
junk1	ENDS