summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/MODE/MODECOM.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/MODE/MODECOM.ASM')
-rw-r--r--v4.0/src/CMD/MODE/MODECOM.ASM592
1 files changed, 592 insertions, 0 deletions
diff --git a/v4.0/src/CMD/MODE/MODECOM.ASM b/v4.0/src/CMD/MODE/MODECOM.ASM
new file mode 100644
index 0000000..7ab77f0
--- /dev/null
+++ b/v4.0/src/CMD/MODE/MODECOM.ASM
@@ -0,0 +1,592 @@
1PAGE ,132 ; ;AN000;
2TITLE MODECOM.ASM - RS232 SUPPORT FOR THE MODE COMMAND ;AN000;
3 ;AN000;
4.XLIST ;AN000;
5INCLUDE STRUC.INC ;AN000;
6.LIST ;AN000;
7
8;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
9;º º ;AN000;
10 ;AN000;
11; AC000 - P2852: Loading resident code trashed CX which was used as a shift
12; count.
13
14; AC001 - P3540: PS/2 only parms other than baud not being treated properly.
15
16;º º ;AN000;
17;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
18 ;AN000;
19 ;AN000;
20DISPLAY MACRO MESSAGE ;AN000;
21 MOV DX,OFFSET MESSAGE ;AN000;
22 CALL PRINTF ;AN000;
23ENDM ;AN000;
24 ;AN000;
25;------------------------------------------------------------------------ ;AN000;
26 ;AN000;
27ABORT MACRO ;AN000;
28 JMP ENDIF01 ;AN000;
29ENDM ;AN000;
30 ;AN000;
31 ;AN000;
32;------------------------------------------------------------------------ ;AN000;
33 ;AN000;
34INCLUDE common.stc ;contains the following structure ;AN000;
35 ;AN000;
36 ;AN000;
37;parm_list_entry STRUC ;used by parse_parameters and invoke ;AN000;
38; ;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;
44; ;AN000;
45;parm_list_entry ENDS ;AN000;
46 ;AN000;
47 ;AN000;
48 ;AN000;
49;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
50;º º ;AN000;
51 ;AN000;
52
53INCLUDE modequat.inc ;AN000;include definition of false, machine types
54
55 ;AN000;
56AT_family EQU 0FCH ;model byte for 286 boxes ;AN000;
57DEV1 EQU "1" ;CHAR IN "COM1:" ;AN000;
58DEV2 EQU "2" ;CHAR IN "COM2:" ;AN000;
59DEV3 EQU "3" ;CHAR IN "COM3:" ;AN000;
60DEV4 EQU "4" ;CHAR IN "COM4:" ;AN000;
61OFFTO EQU modeto ;OFFSET OF MODETO IN RESIDENT CODE FROM SEGMENT ;AN000;
62 ; STORED AT 530H BY MODELOAD ;AN000;
63not_specified EQU 0 ;AN000;
64parm_list EQU [BP] ;AN000;
65;Roughrider EQU 05 ;sub model byte ;AN000;
66SPACE EQU " " ;BLANK CHARACTER ;AN000;
67;Trailboss EQU 04 ;sub model byte for 'Trailboss' ;AN000;
68true EQU 0FFH ;AN000;
69;Wrangler EQU 0F8H ;primary model byte ;AN000;
70 ;AN000;
71 ;AN000;
72;º º ;AN000;
73;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
74
75 ; BEGINNING OF PROC MODETO) ;AN000;
76ROM SEGMENT AT 0 ;AN000;
77 ORG 50H ;AN000;
78VECT14H LABEL DWORD ;RS232 CALL, POINTS TO PROC MODETO WHEN ;AN000;
79 ; WHEN CODE IS RESIDENT ;AN000;
80 ORG 400H ;AN000;
81SERIAL_BASE LABEL WORD ;SERIAL PORT ADDRESSES ;AN000;
82 ORG 530H ;AN000;
83RESSEG LABEL DWORD ;VECTOR OF MODETO, WHEN RESIDENT ;AN000;
84ROM ENDS ;AN000;
85PAGE ;AN000;
86PRINTF_CODE SEGMENT PUBLIC ;AN000;
87 ASSUME CS:PRINTF_CODE,DS:PRINTF_CODE ;AN000;
88 ;AN000;
89;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
90;º º ;AN000;
91 ;AN000;
92EXTRN B_item_tag:ABS ;see modepars ;AN000;
93EXTRN baud_19200:BYTE ;AN000;
94EXTRN busy_retry_active:ABS ;see invoke.asm ;AN000;
95EXTRN E_item_tag:ABS ;see modepars ;AN000;
96EXTRN eight_item_tag:ABS ;see modepars ;AN000;
97EXTRN ERR1:WORD ;AN000;
98EXTRN even_item_tag:ABS ;see modepars ;AN000;
99EXTRN error_retry_active:ABS ;see invoke.asm ;AN000;
100EXTRN five_item_tag:ABS ;see modepars ;AN000;
101EXTRN fourtyeighthundred_item_tag:ABS ;see modepars.asm ;AN000;
102EXTRN fourtyeighthundred_str:BYTE ;AN000;
103EXTRN illegal_device_ptr:WORD ;see modesubs.inc ;AN000;
104EXTRN INITMSG:BYTE,DEVICE:BYTE,PPARITY:BYTE,PDATA:BYTE,PSTOP:BYTE,PPARM:BYTE ;AN000;
105EXTRN keyword:ABS ;AN000;
106EXTRN machine_type:BYTE ;see 'rescode' ;AN000;
107EXTRN mark_item_tag:ABS ;see modepars ;AN000;
108EXTRN MODELOAD:NEAR ;AN000;
109EXTRN MODETO:WORD ;AN000;
110EXTRN new_com_initialize:BYTE ;flag indicating that a PS/2 only parm was specified ;AC001;
111EXTRN nineteentwohundred_item_tag:ABS ;see modepars.asm ;AN000;
112EXTRN nineteentwohundred_str:BYTE ;see modepars.asm ;AN000;
113EXTRN ninetysixhundred_item_tag:ABS ;AC001;
114EXTRN ninetysixhundred_str:BYTE ;AN000;
115EXTRN no_retry_active:ABS ;see invoke.asm ;AN000;
116EXTRN noerror:byte ;boolean indicating success of previous actions ;AN000;
117EXTRN none_item_tag:ABS ;see modepars ;AN000;
118EXTRN onefifty_str:BYTE ;AN000;
119EXTRN oneten_item_tag:ABS ;see modepars.asm ;AN000;
120EXTRN oneten_str:BYTE ;AN000;
121EXTRN onefifty_item_tag:ABS ;see modepars.asm ;AN000;
122EXTRN one_point_five_item_tag:ABS ;see modepars.asm ;AN000;
123EXTRN one_point_five_str:BYTE ;see modesubs.inc ;AN000;
124EXTRN p_item_tag:ABS ;see modepars.asm ;AN000;
125EXTRN parm_lst:BYTE ;parm_list_entry max_pos_parms DUP (<>) ;AN000;
126EXTRN parms_form:BYTE ;AN000;
127EXTRN pstop_ptr:WORD ;see modedefs.inc ;AN000;
128EXTRN odd_item_tag:ABS ;see modepars ;AN000;
129EXTRN one_item_tag:ABS ;see modepars ;AN000;
130EXTRN PBAUD_ptr:WORD ;see 'modemes' ;AN000;
131EXTRN PRINTF:NEAR ;AN000;
132EXTRN PARM1:BYTE,PARM2:BYTE,PARM3:BYTE,MODE:BYTE,FLAG:BYTE ;AN000;
133;PARM1 DB 10 DUP(0) ;AN000;
134;PARM2 DB 0 ;AN000;
135;PARM3 DB 0 ;AN000;
136;MODE DB 0 ;AN000;
137;FLAG DB 0 ;AN000;
138EXTRN R_item_tag:ABS ;AN000;
139EXTRN RATEMSG:WORD ;CR,LF,"Invalid baud rate specified",BEEP,CR,LF,"$" ;AN000;
140EXTRN ready_retry_active:ABS ;see invoke.asm ;AN000;
141;EXTRN RES_MODEFLAG:ABS ;RETRY FLAG IN RESIDENT CODE, (OFFSET FROM ;AN000;
142EXTRN res_com_retry_type:ABS ;retry type flag, displacement from address pointed to by 50:30 when code is resident, see rescode
143EXTRN seven_item_tag:ABS ;see modepars ;AN000;
144EXTRN sixhundred_item_tag:ABS ;see modepars.asm ;AN000;
145EXTRN sixhundred_str:BYTE ;AN000;
146EXTRN six_item_tag:ABS ;see modepars ;AN000;
147EXTRN space_item_tag:ABS ;see modepars ;AN000;
148EXTRN submodel_byte:BYTE ;see 'rescode' ;AN000;
149EXTRN threehundred_item_tag:ABS ;see modepars.asm ;AN000;
150EXTRN threehundred_str:BYTE ;AN000;
151EXTRN twelvehundred_item_tag:ABS ;see modepars.asm ;AN000;
152EXTRN twelvehundred_str:BYTE ;AN000;
153EXTRN twentyfourhundred_str:BYTE ;AN000;
154EXTRN twentyfourhundred_item_tag:ABS ;see modepars.asm ;AN000;
155EXTRN two_item_tag:ABS ;see modepars ;AN000;
156 ;AN000;
157 ;AN000;
158;º º ;AN000;
159;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
160 ;AN000;
161 ;AN000;
162;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
163;º º ;AN000;
164 ;AN000;
165PUBLIC baud_index ;holder of the index in the parm list of the baud rate requested ;AN000;
166PUBLIC data_bits_index ;set by invoke ;AN000;
167PUBLIC MODECOM ;AN000;
168PUBLIC parity_index ;set by invoke ;AN000;
169PUBLIC SERIAL_BASE ;Make available to RESCODE and MAIN ;AN000;
170PUBLIC retry_index ;make available to analyze_and_invoke ;AN000;
171PUBLIC setcom ;get it listed in the link map ;AN000;
172PUBLIC setto ;get it listed in link map for debugging ;AN000;
173PUBLIC stop_bits_index ;set by invoke ;AN000;
174 ;AN000;
175;º º ;AN000;
176;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
177 ;AN000;
178 ;AN000;
179 ;AN000;
180;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ;AN000;
181;º º ;AN000;
182 ;AN000;
183 ;AN000;
184;THESE FOLLOWING BAUD RATES REPRESENT THE 1ST 2 CHAR ;AN000;
185baud_index DW TYPE parm_list_entry ;holder of the index into the parm list of the baud rate ;AN000;
186data_bits_index DW 0 ;holder of the index into the parm list of the data bits ;AN000;
187parity_index DW 0 ;holder of the index into the parm list of the parity ;AN000;
188stop_bits_index DW 0 ;holder of the index into the parm list of the stop bits ;AN000;
189retry_index DW 0 ;AN000;
190 ;AN000;
191;INITMSG DB CR,LF ;AN000;
192; DB "COM" ;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;
205 ;AN000;
206 ;AN000;
207;º º ;AN000;
208;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ;AN000;
209 ;AN000;
210 ;AN000;
211SUBTTL SET UP FOR SERIAL RETRY ;AN000;
212PAGE ;AN000;
213;
214;
215;-------------------------------------------------------------------------------
216;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
217;³ ³
218;³ SETTO ³
219;³ ----- ³
220;³ ³
221;³ Set the resident retry flag to type of retry active for comx. ³
222;³ ³
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 ³
227;³ code. ³
228;³ ³
229;³ ³
230;³ RETURN: pparm - set to 'P', 'B', 'R', 'E', or '-' for type of retry active.³
231;³ flag in resident code set ³
232;³ ³
233;³ ³
234;³ MESSAGES: none. ³
235;³ ³
236;³ ³
237;³ REGISTER ³
238;³ USAGE: AL - new setting for resident flag. (see RESCODE.SAL for ³
239;³ format) ³
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 ³
245;³ ³
246;³ ³
247;³ PSUEDO CODE: ³
248;³ ³
249;³ SAVE REGISTERS ³
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 ³
256;³ ENDIF ³
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 ³
263;³ ELSE ³
264;³ SET pparm TO PROPER LETTER FOR CURRENT SETTING ³
265;³ ENDIF ³
266;³ ELSE ³
267;³ SET pparm TO '-' ³
268;³ ENDIF ³
269;³ RESTORE REGISTERS ³
270;³ RETURN ³
271;³ ³
272;³ ³
273;³ ³
274;³ SIDE EFFECT: Loads resident code if it is needed and has not been loaded. ³
275;³ ³
276;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
277;
278SETTO PROC NEAR ;AN663;
279 ;AN663;
280 PUSH ES ;save registers ;AN663;
281 PUSH DI ;AN663;
282 PUSH AX ;AN663;
283 PUSH DX ;AN663;
284 ;AN663;
285 XOR AX,AX ;clear a reg ;AN663;
286 MOV ES,AX ;set to segment at 0 ;AN663;
287 MOV CL,device ;AN663;
288 AND CL,07H ;AN663;
289 DEC CL ;AN663;
290 SHL CL,1 ;AN663;
291 MOV DH,11111100B ;set bit mask to clear old flag setting ;AN663;
292 ROL DH,CL ;AN663;
293 ;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;
311 .ENDSELECT ;AN663;
312 ;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
317 .ENDIF ;AN663;
318 ;AN663;
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;
322 ROL AL,CL ;AN663;
323 AND DL,DH ;AN663;
324 OR DL,AL ;AN663;
325 MOV BYTE PTR ES:res_com_retry_type,DL ;store the new setting ;AN663;
326 ;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;
331 ;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;
336 ;AN663;
337 .ELSE ;else update pparm with ;AN663;
338 ; current retry type ;AN663;
339 NOT DH ;AN663;
340 AND DL,DH ;AN663;
341 SHR DL,CL ;AN663;
342 ;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;
352 .ENDSELECT ;AN663;
353 ;AN663;
354 .ENDIF ;AN663;
355 ;AN663;
356 .ELSE ;no retry, no code resident ;AN663;
357 ;AN663;
358 MOV pparm,'-' ;AN663;
359 ;AN663;
360 .ENDIF ;AN663;
361 ;AN663;
362 POP DX ;AN663;
363 POP AX ;restore registers ;AN663;
364 POP DI ;AN663;
365 POP ES ;AN663;
366 RET ;AN663;
367 ;AN663;
368SETTO ENDP ;AN663;
369
370
371
372SUBTTL SET SERIAL PROTOCOL
373PAGE
374
375;------------------------------------------------------------------------------
376
377;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
378;³ ³
379;³ SETCOM ³
380;³ ------ ³
381;³ ³
382;³ ³
383;³ ³
384;³ INPUT: ³
385;³ ³
386;³ ³
387;³ ³
388;³ ³
389;³ ³
390;³ ³
391;³ RETURN: ³
392;³ ³
393;³ ³
394;³ ³
395;³ MESSAGES: none. ³
396;³ ³
397;³ ³
398;³ REGISTER ³
399;³ USAGE: ³
400;³ ³
401;³ ³
402;³ ASSUMPTIONS: All parms have been checked for validity as being possible and³
403;³ supported on the machine. ³
404;³ ³
405;³ ³
406;³ ³
407;³ SIDE EFFECT: ³
408;³ ³
409;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
410
411SETCOM PROC NEAR ;AN000;
412 ;AN000;
413 ;AN000;
414MOV BP,OFFSET parm_lst ;address the parm list via parm_list which is [BP] ;AN000;
415MOV DI,baud_index ;DI=index into parm list of the baud rate entry ;AN000;
416
417.SELECT ;prepare AL for old init and CL for new init ;AC001;
418
419 .WHEN <parm_list[DI].item_tag EQ oneten_item_tag> ;AC001;
420 MOV AL,0 ;AN000;
421 MOV CL,0
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;
425 MOV CL,1
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;
429 MOV CL,2
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;
433 MOV CL,3
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;
437 MOV CL,4
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;
441 MOV CL,5
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;
445 MOV CL,6
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;
449 MOV CL,7
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;
454
455.ENDSELECT ;AC001;
456; AL IS: XXX00000 for the baud rate, CL has appropriate value for baud
457
458MOV 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;
476.ENDIF ;AN000;
477
478MOV 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;
488 MOV CH,3 ;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;
492.ENDIF ;AN000;
493
494;PUT THE NO. STOP BITS TO AL PARM IN THE 00000X00 POSITION and BL for new init ;AN000
495MOV DI,stop_bits_index ;AN000;
496MOV BL,0 ;assume stop bits was 1, message already set up ;AN000;
497.SELECT
498 ;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;
502
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;
506
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;
513
514; .OTHERWISE specified 1, everything set up
515
516.ENDSELECT ;IF not 1.5 or two, already set up for 1 ;AN000;
517 ;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;
523.ENDIF ;AC001;
524
525 ;AN000;
526;SET DX PARM TO REQUEST WHICH COM DEVICE ;AN000;
527 XOR DX,DX ;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;
536; ;AN000;
537; NOW THAT THE RS232 IS INITIALIZED, ;AN000;
538 CALL SETTO ;LOOK AT P PARM, MAYBE TIMEOUT TO BE RETRIED ;AN000;
539; ;AN000;
540 DISPLAY INITMSG ;TELL USER RS232 IS INITIALIZED ;AN000;
541 .ENDIF ;AN000;
542
543 RET ;AN000;
544SETCOM ENDP ;AN000;
545 ;AN000;
546 ;AN000;
547SUBTTL ;AN000;
548PAGE ;AN000;
549 ;AN000;
550 ;AN000;
551
552MODECOM PROC NEAR
553
554
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)
559 XOR AH,AH ;CLEAR AH
560 MOV SI,AX
561 XOR AL,AL ;CLEAR AX
562 PUSH DS
563 MOV DS,AX
564 CMP WORD PTR DS:SERIAL_BASE[SI],0 ;SEE IF THE COM PORT EXISTS
565 POP DS
566 JNE THEN01A
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;
573 ABORT
574;
575THEN01A:
576
577; DEFINE DEFAULTS:
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
581;
582
583;WE HAVE THE INFORMATION NEEDED TO INITIALIZE THE RS232 DEVICE
584;
585 CALL SETCOM ;SET THE RS232 DEVICE
586;
587; : ELSE ,SINCE COUNT WAS NOT BIG ENUF
588ENDIF01: ;jump to here if the port does not exist
589 RET ;RETURN TO MODE MAIN ROUTINE
590MODECOM ENDP
591PRINTF_CODE ENDS
592 END