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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
| ; Serial Status Terminal v0.1b by Kim Jansen
; http://www.kimjansen.tk/
;
; After altering the source code to your specific needs, please send me
; a copy of your source code and a brief description of the enhancements.
; When publishing your source code or program based on this source code,
; please, do also state my name in your source code.
;
; Have fun, comments are very welcome
POORT EQU 0 ;COM1
PARAMETERDATA EQU 11000111b ;110=4800 Baud, 00=No Parity, 1=2 Stop Bits, 11=8 Data Bits
STARTKARAKTER EQU '^'
STAT1 EQU '!'
STAT2 EQU '#'
STAT3 EQU '$'
STAT4 EQU '&'
STAT5 EQU '*'
STAT6 EQU '?'
STAT7 EQU '`'
STAT8 EQU '{'
STAT9 EQU '}'
STAT10 EQU '~'
STAT11 EQU '('
STAT12 EQU ')'
.386
.MODEL SMALL
.DATA
DATA DB 32
.CODE
ORG 4000H
MOV AX, @DATA
MOV DS, AX
SERIALERROR:
INIT:
CALL INITCOM
START:
CALL ONTVANG
CMP AL, STARTKARAKTER
JNZ RUN
CALL START
RUN:
CALL ONTVANG
CMP AL, STAT1
JNZ STATUS1
CMP AL, STAT2
JNZ STATUS2
CMP AL, STAT3
JNZ STATUS3
CMP AL, STAT4
JNZ STATUS4
CMP AL, STAT5
JNZ STATUS5
CMP AL, STAT6
JNZ STATUS6
CMP AL, STAT7
JNZ STATUS7
CMP AL, STAT8
JNZ STATUS8
CMP AL, STAT9
JNZ STATUS9
CMP AL, STAT10
JNZ STATUS10
CMP AL, STAT11
JNZ STATUS11
CMP AL, STAT12
JNZ STATUS12
CALL START
INITCOM:
MOV AH, 0
MOV AL, PARAMETERDATA
MOV DX, POORT
INT 14H
RET
;ZEND:
; MOV DX, POORT
; MOV AL, KARAKTER
; MOV AH, 1
; INT 14H ;karakter uit AL op geselecteerde poort
; TEST AH,80H
; JNZ SERIALERROR
; RET
ONTVANG:
MOV DX, POORT
MOV AH, 2
INT 14H ;karakter van geselecteerde poort in AL
TEST AH, 80H
JNZ SERIALERROR
RET
STATUS1:
CALL ONTVANG
MOV CH, AL
CALL ONTVANG
MOV CL, AL
CALL ONTVANG
CMP AL, STAT1
JNZ ONTVANG
CALL START
CALL SCHRIJFSTATUS1
CALL GEEFSTATUS1
SCHRIJFSTATUS1:
MOV BX, OFFSET DATA
ADD BX, CX
MOV [BX], AL
DEC CX
CMP CX, 1
JNZ RUN
CALL ONTVANG
CALL SCHRIJFSTATUS1
RET
GEEFSTATUS1:
CALL EINDE
STATUS2:
CALL ONTVANG
MOV CH, AL
CALL ONTVANG
MOV CL, AL
CALL ONTVANG
CMP AL, STAT2
JNZ ONTVANG
CALL START
CALL SCHRIJFSTATUS2
CALL GEEFSTATUS2
SCHRIJFSTATUS2:
MOV BX, OFFSET DATA
ADD BX, CX
MOV [BX], AL
DEC CX
CMP CX, 1
JNZ RUN
CALL ONTVANG
CALL SCHRIJFSTATUS2
RET
GEEFSTATUS2:
CALL EINDE |