2 TITLE MODECOM
.ASM
- RS232 SUPPORT FOR THE MODE COMMAND
;AN000;
5 INCLUDE STRUC.INC ;AN000;
8 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
11 ; AC000 - P2852: Loading resident code trashed CX which was used as a shift
14 ; AC001 - P3540: PS/2 only parms other than baud not being treated properly.
17 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
20 DISPLAY MACRO MESSAGE
;AN000;
21 MOV DX,OFFSET MESSAGE
;AN000;
25 ;------------------------------------------------------------------------ ;AN000;
32 ;------------------------------------------------------------------------ ;AN000;
34 INCLUDE common.stc ;contains the following structure ;AN000;
37 ;parm_list_entry STRUC ;used by parse_parameters and invoke ;AN000;
39 ;parm_type DB bogus ;AN000;
40 ;item_tag DB 0FFH ;AN000;
41 ;value1 DW bogus ;used only for filespecs and code page numbers ;AN000;
42 ;value2 DW bogus ;used only for filespecs and code page numbers ;AN000;
43 ;keyword_switch_ptr DW 0 ;AN000;
45 ;parm_list_entry ENDS ;AN000;
49 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
53 INCLUDE modequat
.inc ;AN000;include definition of false, machine types
56 AT_family EQU
0FCH ;model byte for 286 boxes ;AN000;
57 DEV1 EQU
"1" ;CHAR IN "COM1:" ;AN000;
58 DEV2 EQU
"2" ;CHAR IN "COM2:" ;AN000;
59 DEV3 EQU
"3" ;CHAR IN "COM3:" ;AN000;
60 DEV4 EQU
"4" ;CHAR IN "COM4:" ;AN000;
61 OFFTO EQU modeto
;OFFSET OF MODETO IN RESIDENT CODE FROM SEGMENT ;AN000;
62 ; STORED AT 530H BY MODELOAD ;AN000;
63 not_specified EQU
0 ;AN000;
64 parm_list EQU
[BP] ;AN000;
65 ;Roughrider EQU 05 ;sub model byte ;AN000;
66 SPACE EQU
" " ;BLANK CHARACTER ;AN000;
67 ;Trailboss EQU 04 ;sub model byte for 'Trailboss' ;AN000;
69 ;Wrangler EQU 0F8H ;primary model byte ;AN000;
73 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
75 ; BEGINNING OF PROC MODETO) ;AN000;
76 ROM
SEGMENT AT 0 ;AN000;
78 VECT14H
LABEL DWORD ;RS232 CALL, POINTS TO PROC MODETO WHEN ;AN000;
79 ; WHEN CODE IS RESIDENT ;AN000;
81 SERIAL_BASE
LABEL WORD ;SERIAL PORT ADDRESSES ;AN000;
83 RESSEG
LABEL DWORD ;VECTOR OF MODETO, WHEN RESIDENT ;AN000;
86 PRINTF_CODE
SEGMENT PUBLIC ;AN000;
87 ASSUME
CS:PRINTF_CODE
,DS:PRINTF_CODE
;AN000;
89 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
92 EXTRN B_item_tag
:ABS
;see modepars ;AN000;
93 EXTRN baud_19200
:BYTE ;AN000;
94 EXTRN busy_retry_active
:ABS
;see invoke.asm ;AN000;
95 EXTRN E_item_tag
:ABS
;see modepars ;AN000;
96 EXTRN eight_item_tag
:ABS
;see modepars ;AN000;
97 EXTRN ERR1
:WORD ;AN000;
98 EXTRN even_item_tag
:ABS
;see modepars ;AN000;
99 EXTRN error_retry_active
:ABS
;see invoke.asm ;AN000;
100 EXTRN five_item_tag
:ABS
;see modepars ;AN000;
101 EXTRN fourtyeighthundred_item_tag
:ABS
;see modepars.asm ;AN000;
102 EXTRN fourtyeighthundred_str
:BYTE ;AN000;
103 EXTRN illegal_device_ptr
:WORD ;see modesubs.inc ;AN000;
104 EXTRN INITMSG
:BYTE,DEVICE
:BYTE,PPARITY
:BYTE,PDATA
:BYTE,PSTOP
:BYTE,PPARM
:BYTE ;AN000;
105 EXTRN keyword
:ABS
;AN000;
106 EXTRN machine_type
:BYTE ;see 'rescode' ;AN000;
107 EXTRN mark_item_tag
:ABS
;see modepars ;AN000;
108 EXTRN MODELOAD
:NEAR ;AN000;
109 EXTRN MODETO
:WORD ;AN000;
110 EXTRN new_com_initialize
:BYTE ;flag indicating that a PS/2 only parm was specified ;AC001;
111 EXTRN nineteentwohundred_item_tag
:ABS
;see modepars.asm ;AN000;
112 EXTRN nineteentwohundred_str
:BYTE ;see modepars.asm ;AN000;
113 EXTRN ninetysixhundred_item_tag
:ABS
;AC001;
114 EXTRN ninetysixhundred_str
:BYTE ;AN000;
115 EXTRN no_retry_active
:ABS
;see invoke.asm ;AN000;
116 EXTRN noerror
:byte ;boolean indicating success of previous actions ;AN000;
117 EXTRN none_item_tag
:ABS
;see modepars ;AN000;
118 EXTRN onefifty_str
:BYTE ;AN000;
119 EXTRN oneten_item_tag
:ABS
;see modepars.asm ;AN000;
120 EXTRN oneten_str
:BYTE ;AN000;
121 EXTRN onefifty_item_tag
:ABS
;see modepars.asm ;AN000;
122 EXTRN one_point_five_item_tag
:ABS
;see modepars.asm ;AN000;
123 EXTRN one_point_five_str
:BYTE ;see modesubs.inc ;AN000;
124 EXTRN p_item_tag
:ABS
;see modepars.asm ;AN000;
125 EXTRN parm_lst
:BYTE ;parm_list_entry max_pos_parms DUP (<>) ;AN000;
126 EXTRN parms_form
:BYTE ;AN000;
127 EXTRN pstop_ptr
:WORD ;see modedefs.inc ;AN000;
128 EXTRN odd_item_tag
:ABS
;see modepars ;AN000;
129 EXTRN one_item_tag
:ABS
;see modepars ;AN000;
130 EXTRN PBAUD_ptr
:WORD ;see 'modemes' ;AN000;
131 EXTRN PRINTF
:NEAR ;AN000;
132 EXTRN PARM1
:BYTE,PARM2
:BYTE,PARM3
:BYTE,MODE
:BYTE,FLAG
:BYTE ;AN000;
133 ;PARM1 DB 10 DUP(0) ;AN000;
138 EXTRN R_item_tag
:ABS
;AN000;
139 EXTRN RATEMSG
:WORD ;CR,LF,"Invalid baud rate specified",BEEP,CR,LF,"$" ;AN000;
140 EXTRN ready_retry_active
:ABS
;see invoke.asm ;AN000;
141 ;EXTRN RES_MODEFLAG:ABS ;RETRY FLAG IN RESIDENT CODE, (OFFSET FROM ;AN000;
142 EXTRN res_com_retry_type
:ABS
;retry type flag, displacement from address pointed to by 50:30 when code is resident, see rescode
143 EXTRN seven_item_tag
:ABS
;see modepars ;AN000;
144 EXTRN sixhundred_item_tag
:ABS
;see modepars.asm ;AN000;
145 EXTRN sixhundred_str
:BYTE ;AN000;
146 EXTRN six_item_tag
:ABS
;see modepars ;AN000;
147 EXTRN space_item_tag
:ABS
;see modepars ;AN000;
148 EXTRN submodel_byte
:BYTE ;see 'rescode' ;AN000;
149 EXTRN threehundred_item_tag
:ABS
;see modepars.asm ;AN000;
150 EXTRN threehundred_str
:BYTE ;AN000;
151 EXTRN twelvehundred_item_tag
:ABS
;see modepars.asm ;AN000;
152 EXTRN twelvehundred_str
:BYTE ;AN000;
153 EXTRN twentyfourhundred_str
:BYTE ;AN000;
154 EXTRN twentyfourhundred_item_tag
:ABS
;see modepars.asm ;AN000;
155 EXTRN two_item_tag
:ABS
;see modepars ;AN000;
159 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
162 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
165 PUBLIC baud_index
;holder of the index in the parm list of the baud rate requested ;AN000;
166 PUBLIC data_bits_index
;set by invoke ;AN000;
167 PUBLIC MODECOM
;AN000;
168 PUBLIC parity_index
;set by invoke ;AN000;
169 PUBLIC SERIAL_BASE
;Make available to RESCODE and MAIN ;AN000;
170 PUBLIC retry_index
;make available to analyze_and_invoke ;AN000;
171 PUBLIC setcom
;get it listed in the link map ;AN000;
172 PUBLIC setto
;get it listed in link map for debugging ;AN000;
173 PUBLIC stop_bits_index
;set by invoke ;AN000;
176 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
180 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
184 ;THESE FOLLOWING BAUD RATES REPRESENT THE 1ST 2 CHAR ;AN000;
185 baud_index
DW TYPE parm_list_entry
;holder of the index into the parm list of the baud rate ;AN000;
186 data_bits_index
DW 0 ;holder of the index into the parm list of the data bits ;AN000;
187 parity_index
DW 0 ;holder of the index into the parm list of the parity ;AN000;
188 stop_bits_index
DW 0 ;holder of the index into the parm list of the stop bits ;AN000;
189 retry_index
DW 0 ;AN000;
191 ;INITMSG DB CR,LF ;AN000;
193 ;DEVICE DB " " ;AN000;
194 ; DB ": " ;SEPARATOR BLANK ;AN000;
195 ;PBAUD DB 4 DUP(" ") ;AN000;
196 ; DB "," ;SEPARATOR ;AN000;
197 ;PPARITY DB "e" ;DEFAULT IS EVEN PARITY ;AN000;
198 ; DB "," ;SEPARATOR ;AN000;
199 ;PDATA DB "7" ;DEFAULT IS 7 DATA BITS PER BYTE ;AN000;
200 ; DB "," ;SEPARATOR ;AN000;
201 ;PSTOP DB "1" ;DEFAULT FOR BAUD > 110, CHANGED TO 2 FOR 110 ;AN000;
202 ; DB "," ;SEPARATOR ;AN000;
203 ;PPARM DB " " ;AN000;
204 ; DB CR,LF,"$" ;END OF 'INITMSG' ;AN000;
208 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
211 SUBTTL SET UP FOR SERIAL RETRY
;AN000;
215 ;-------------------------------------------------------------------------------
216 ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
221 ;³ Set the resident retry flag to type of retry active for comx. ³
223 ;³ INPUT: device - holds '1', '2', '3' or '4' (ascii) for x of lptx. ³
224 ;³ retry_index - holds index value for the parsed retry parameter. ³
225 ;³ resseg - holds offset of resident code in memory ³
226 ;³ res_com_retry_type - holds offset of com retry flag in resident ³
230 ;³ RETURN: pparm - set to 'P', 'B', 'R', 'E', or '-' for type of retry active.³
231 ;³ flag in resident code set ³
238 ;³ USAGE: AL - new setting for resident flag. (see RESCODE.SAL for ³
240 ;³ CL - shift bit count ³
241 ;³ ES - holds segment of resident code ³
242 ;³ BP - offset of parameter list ³
243 ;³ DI - offset of retry index within parameter list ³
244 ;³ DL - current resident flag setting ³
250 ;³ SET UP SEGMENT REGISTER AND BIT MASKS ³
251 ;³ IF <RETRY REQUESTED> ³
252 ;³ SET UP PARAMETER LIST STRUCTURE ³
253 ;³ SET BIT MASK FOR TYPE OF RETRY AND SET pparm TO PROPER LETTER ³
254 ;³ IF <RESIDENT CODE IS NOT LOADED> ³
255 ;³ LOAD RESIDENT CODE ³
257 ;³ GET CURRENT com_lpt_retry_type ³
258 ;³ SET AND STORE NEW com_lpt_retry_type ³
259 ;³ ELSEIF <RESIDENT CODE ALREADY LOADED> ³
260 ;³ GET CURRENT com_lpt_retry_type ³
261 ;³ IF <POSITIONAL PARAMETER SPECIFIED> ³
262 ;³ SET FLAG TO ZERO, SET pparm TO PROPER LETTER ³
264 ;³ SET pparm TO PROPER LETTER FOR CURRENT SETTING ³
267 ;³ SET pparm TO '-' ³
269 ;³ RESTORE REGISTERS ³
274 ;³ SIDE EFFECT: Loads resident code if it is needed and has not been loaded. ³
276 ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
278 SETTO PROC
NEAR ;AN663;
280 PUSH ES ;save registers ;AN663;
285 XOR AX,AX ;clear a reg ;AN663;
286 MOV ES,AX ;set to segment at 0 ;AN663;
287 MOV CL,device
;AN663;
291 MOV DH,11111100B ;set bit mask to clear old flag setting ;AN663;
294 .IF <retry_index NE
0> THEN
;retry specified, set ;AN663;
295 ; byte in resident code ;AN663;
296 MOV DI,retry_index
; to proper setting. ;AN663;
297 ; if code is not loaded, ;AN663;
298 .SELECT
; loaded it. ;AN663;
299 .WHEN
<parm_list
[DI].item_tag
EQ P_item_tag
> ;AN663;
300 MOV AL,busy_retry_active
;AN663;
301 MOV pparm
,'p' ;AN663;
302 .WHEN
<parm_list
[DI].item_tag
EQ E_item_tag
> ;AN663;
303 MOV AL,error_retry_active
;AN663;
304 MOV pparm
,'e' ;AN663;
305 .WHEN
<parm_list
[DI].item_tag
EQ B_item_tag
> ;AN663;
306 MOV AL,busy_retry_active
;AN663;
307 MOV pparm
,'b' ;AN663;
308 .WHEN
<parm_list
[DI].item_tag
EQ R_item_tag
> ;AN663;
309 MOV AL,ready_retry_active
;AN663;
310 MOV pparm
,'r' ;AN663;
313 .IF <<WORD PTR ES:resseg
> EQ 0000H> THEN
;AN663;
314 PUSH CX ;save shift count
315 CALL modeload
;load the resident code ;AN663;
316 POP CX ;restore shift count
319 MOV ES,ES:WORD PTR resseg
[2] ;AN663;
320 MOV DL,BYTE PTR ES:res_com_retry_type
;AN663;
321 ;get the old setting ;AN663;
325 MOV BYTE PTR ES:res_com_retry_type
,DL ;store the new setting ;AN663;
327 .ELSEIF
<<WORD PTR ES:resseg
> NE
0000H> THEN
;if code is loaded but no ;AN663;
328 ; retry is specified then ;AN663;
329 MOV ES,ES:WORD PTR resseg
[2] ;AN663;
330 MOV DL,BYTE PTR ES:res_com_retry_type
;AN663;
332 .IF <parms_form NE keyword
> ;if 'NONE' was specified ;AN663;
333 ; with positional parameter ;AN663;
334 AND DL,DH ; set bits to zero ;AN663;
335 MOV BYTE PTR ES:res_com_retry_type
,DL ;AN663;
337 .ELSE ;else update pparm with ;AN663;
338 ; current retry type ;AN663;
343 .SELECT
;set pparm to proper letter ;AN663;
344 .WHEN
<DL EQ no_retry_active
> ;AN663;
345 MOV pparm
,'-' ;AN663;
346 .WHEN
<DL EQ error_retry_active
> ;AN663;
347 MOV pparm
,'e' ;AN663;
348 .WHEN
<DL EQ busy_retry_active
> ;AN663;
349 MOV pparm
,'b' ;AN663;
350 .WHEN
<DL EQ ready_retry_active
> ;AN663;
351 MOV pparm
,'r' ;AN663;
356 .ELSE ;no retry, no code resident ;AN663;
358 MOV pparm
,'-' ;AN663;
363 POP AX ;restore registers ;AN663;
372 SUBTTL SET SERIAL PROTOCOL
375 ;------------------------------------------------------------------------------
377 ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
402 ;³ ASSUMPTIONS: All parms have been checked for validity as being possible and³
403 ;³ supported on the machine. ³
409 ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
411 SETCOM PROC
NEAR ;AN000;
414 MOV BP,OFFSET parm_lst
;address the parm list via parm_list which is [BP] ;AN000;
415 MOV DI,baud_index
;DI=index into parm list of the baud rate entry ;AN000;
417 .SELECT
;prepare AL for old init and CL for new init ;AC001;
419 .WHEN
<parm_list
[DI].item_tag
EQ oneten_item_tag
> ;AC001;
422 MOV pbaud_ptr
,OFFSET oneten_str
;AN000;
423 .WHEN
<parm_list
[DI].item_tag
EQ onefifty_item_tag
> THEN
;AN000;
424 MOV AL,00100000B ;AN000;
426 MOV pbaud_ptr
,OFFSET onefifty_str
;AN000;
427 .WHEN
<parm_list
[DI].item_tag
EQ threehundred_item_tag
> THEN
;AN000;
428 MOV AL,01000000B ;AN000;
430 MOV pbaud_ptr
,OFFSET threehundred_str
;AN000;
431 .WHEN
<parm_list
[DI].item_tag
EQ sixhundred_item_tag
> THEN
;AN000;
432 MOV AL,01100000B ;AN000;
434 MOV pbaud_ptr
,OFFSET sixhundred_str
;AN000;
435 .WHEN
<parm_list
[DI].item_tag
EQ twelvehundred_item_tag
> THEN
;AN000;
436 MOV AL,10000000B ;AN000;
438 MOV pbaud_ptr
,OFFSET twelvehundred_str
;AN000;
439 .WHEN
<parm_list
[DI].item_tag
EQ twentyfourhundred_item_tag
> THEN
;AN000;
440 MOV AL,10100000B ;AN000;
442 MOV pbaud_ptr
,OFFSET twentyfourhundred_str
;AN000;
443 .WHEN
<parm_list
[DI].item_tag
EQ fourtyeighthundred_item_tag
> THEN
;AN000;
444 MOV AL,11000000B ;AN000;
446 MOV pbaud_ptr
,OFFSET fourtyeighthundred_str
;AN000;
447 .WHEN
<parm_list
[DI].item_tag
EQ ninetysixhundred_item_tag
> THEN
;AN000;
448 MOV AL,11100000B ;AN000;
450 MOV pbaud_ptr
,OFFSET ninetysixhundred_str
;AN000;
451 .WHEN
<parm_list
[DI].item_tag
EQ nineteentwohundred_item_tag
> NEAR THEN
;handle 19200 case if 19, 19200, 19.2 or 19.2K specified
452 MOV CL,8 ;value for 19200 baud, no old equivalent ;AC001;
453 MOV pbaud_ptr
,OFFSET nineteentwohundred_str
;AC001;
456 ; AL IS: XXX00000 for the baud rate, CL has appropriate value for baud
458 MOV DI,parity_index
;AN000;
459 .IF <parm_list
[DI].item_tag
EQ none_item_tag
> THEN
;AN000;
460 MOV PPARITY
,"n" ;set up message for no PARITY ;AN000;
461 MOV BH,0 ;AL already set properly for old init ;AN000;
462 .ELSEIF
<parm_list
[DI].item_tag
EQ odd_item_tag
> THEN
;AN000;
463 MOV PPARITY
,"o" ;set up message for odd PARITY ;AN000;
464 OR AL,08H ;PUT THE 000XX000 BITS TO AL PARM WHERE XX=01 FOR PARITY=ODD ;AN000
465 MOV BH,1 ;new initialize ;AN000;
466 .ELSEIF
<parm_list
[DI].item_tag
EQ space_item_tag
> THEN
;AN000;
467 MOV PPARITY
,"s" ;set up message for space PARITY ;AN000;
468 MOV BH,4 ;SPACE not supported in old init ;AN000;
469 .ELSEIF
<parm_list
[DI].item_tag
EQ mark_item_tag
> THEN
;AN000;
470 MOV PPARITY
,"m" ;set up message for mark PARITY ;AN000;
471 MOV BH,3 ;MARK parity not supported in old init ;AN000;
472 .ELSE ;not specified or asked for even ;AN000;
473 MOV PPARITY
,"e" ;set up message for even PARITY, the default if not specified ;AN000;
474 OR AL,18H
;PUT THE 000XX000 BITS TO AL PARM WHERE XX=11 FOR PARITY=EVEN ;AN000
475 MOV BH,2 ;even parity for new initialize ;AN000;
478 MOV DI,data_bits_index
;AN000;
479 .IF <parm_list
[DI].item_tag
EQ five_item_tag
> THEN
;AN000;
480 MOV pdata
,"5" ;set up message for 5 bits ;AN000;
481 MOV CH,0 ;not old init for 5 data bits ;AN000;
482 .ELSEIF
<parm_list
[DI].item_tag
EQ six_item_tag
> THEN
;AN000;
483 MOV pdata
,"6" ;set up message for 6 bits ;AN000;
484 MOV CH,1 ;no old init for 6 data bits ;AN000;
485 .ELSEIF
<parm_list
[DI].item_tag
EQ eight_item_tag
> THEN
;AN000;
486 MOV pdata
,"8" ;set up message for 8 bits ;AN000;
487 OR AL,03H ;IN THE 000000XX POSITION, SET XX=11 TO MEAN 8 DATA BITS ;AN000;
489 .ELSE ;asked for 7 or skipped the parm and will get 7 as default ;AN000;
490 OR AL,02H ;IN THE 000000XX POSITION, SET XX=10 TO MEAN 7 DATA BITS ;AN000;
491 MOV CH,2 ;message already set up for 7 bits ;AN000;
494 ;PUT THE NO. STOP BITS TO AL PARM IN THE 00000X00 POSITION and BL for new init ;AN000
495 MOV DI,stop_bits_index
;AN000;
496 MOV BL,0 ;assume stop bits was 1, message already set up ;AN000;
499 .WHEN
<parm_list
[DI].item_tag
EQ two_item_tag
> ;AN000;
500 MOV pstop
,"2" ;set up message for 2 stop bits ;AN000;
501 MOV BL,1 ;value for two or 1.5 ;AN000;
503 .WHEN
<parm_list
[DI].item_tag
EQ one_point_five_item_tag
> ;AN000; ;AN000;
504 MOV pstop_ptr
,OFFSET one_point_five_str
;set up message for 1.5 stop bits ;AN000;
505 MOV BL,1 ;new init for 1.5 ;AN000;
507 .WHEN
<stop_bits_index
EQ not_specified
> ;if stop bits not specified ;AN000;
508 MOV DI,baud_index
;AC000;
509 .IF <parm_list
[DI].item_tag
EQ oneten_item_tag
> ;BAUD=110 SPECIFIED THEN SET DEFAULT STOP BITS TO TWO ;AC000;
510 OR AL,04H ;TURN ON BIT IN 00000X00 POSITION TO REQUEST 2 STOP BITS ;AN000;
511 MOV pstop
,"2" ;set up message for 2 stop bits ;AN000;
512 .ENDIF
;FOR STOPBITS=1, LEAVE THAT BIT OFF, message already set by modecom ;AN000;
514 ; .OTHERWISE specified 1, everything set up
516 .ENDSELECT
;IF not 1.5 or two, already set up for 1 ;AN000;
518 .IF <new_com_initialize
EQ true
> THEN
;AC001;
519 XOR AL,AL ;ask for no break ;AN000;
520 MOV AH,4 ;new set baud BIOS call ;AN001;
521 .ELSE ;old style com initialization ;AN000; ;AC001;
522 XOR AH,AH ;AH=0 requests initialization ;AC001;
526 ;SET DX PARM TO REQUEST WHICH COM DEVICE ;AN000;
528 MOV DL,DEVICE
;device set by modepars in first_parm_case: ;AN000;
529 AND DL,07 ;convert to binary 1 thru 4 ;AN000;
530 DEC DL ;put in BIOS digestable 0 thru 3 ;AN000;
531 ; AH ALREADY IS 0 or 4, WHICH REQUESTS ;AN000;
532 ; INITIALIZATION OF THE RS232 ;AN000;
533 ; ACCORDING TO PARMS IN AL and/or BX and CX. ;AN000;
534 .IF <noerror
EQ true
> THEN
;AN000;
535 INT 14H
;INIT THE RS232 ;AN000;
537 ; NOW THAT THE RS232 IS INITIALIZED, ;AN000;
538 CALL SETTO
;LOOK AT P PARM, MAYBE TIMEOUT TO BE RETRIED ;AN000;
540 DISPLAY INITMSG
;TELL USER RS232 IS INITIALIZED ;AN000;
555 MOV AL,DEVICE
;AL= DEVICE ID OF "1", "2", "3" or "4"
556 AND AL,07 ;TRANSLATE TO BINARY
557 DEC AL ;PUT IN ZERO BASE
558 SAL AL,1 ;POSITION OF PORT ADDRESS WORD (2*AL)
564 CMP WORD PTR DS:SERIAL_BASE
[SI],0 ;SEE IF THE COM PORT EXISTS
567 MOV DI,0 ;the device name is always the first parm ;AN000;
568 MOV BP,OFFSET parm_lst
;address the parm list via parm_list which is [BP] ;AN000;
569 MOV CX,parm_list
[DI].value1
;AN000;
570 MOV illegal_device_ptr
,CX
571 DISPLAY err1
;AN000;"Illegal device name - COMX"
572 MOV noerror
,false
;AN000;
578 MOV PSTOP
,"1" ;ONE STOP BIT, OK FOR BAUD>110
579 MOV PDATA
,"7" ;7 DATA BITS
580 MOV PPARM
,"-" ;NO SERIAL TIMEOUT RETRY
583 ;WE HAVE THE INFORMATION NEEDED TO INITIALIZE THE RS232 DEVICE
585 CALL SETCOM
;SET THE RS232 DEVICE
587 ; : ELSE ,SINCE COUNT WAS NOT BIG ENUF
588 ENDIF01: ;jump to here if the port does not exist
589 RET ;RETURN TO MODE MAIN ROUTINE