summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/XMA2EMS/PARMPARS.INC
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/DEV/XMA2EMS/PARMPARS.INC')
-rw-r--r--v4.0/src/DEV/XMA2EMS/PARMPARS.INC530
1 files changed, 530 insertions, 0 deletions
diff --git a/v4.0/src/DEV/XMA2EMS/PARMPARS.INC b/v4.0/src/DEV/XMA2EMS/PARMPARS.INC
new file mode 100644
index 0000000..42ea6e8
--- /dev/null
+++ b/v4.0/src/DEV/XMA2EMS/PARMPARS.INC
@@ -0,0 +1,530 @@
1 PAGE
2;-----------------------------------------------------------------------;
3; GET_PARMS extracts parameters from the command line buffer ;
4; ;
5; On entry: all letters after 'Device=' have been changed ;
6; to upper case ;
7; ;
8; On exit: (zf)=0 if syntax error ;
9; if (zf)=1 then... ;
10; ;
11; EMM_START_BLOCK has been updated ;
12; ;
13; AX,BX,CX,DX,DI,SI,DS are destroyed ;
14;-----------------------------------------------------------------------;
15
16include xma2emsp.inc ; include parser things
17include parse.asm
18
19GET_PARMS PROC
20 LDS BX,CS:RH_PTRA ;make ds:bx point to request header
21
22 LDS SI,RH.RH0_BPBA ;make ds:si point to bios paramter buffer
23 CLD
24 mov cs:EMS_Pgs_Parm,E_Parm_Def ;default to all of memory ;an000; dms;
25
26;-------------------------------------------------------------------
27; parser support added by GGA
28;-------------------------------------------------------------------
29 push cs ; make ES:DI point to parm block
30 pop es
31 lea di,p_block
32
33 xor cx,cx ; cx = 0, ordinal
34 xor dx,dx ; dx = 0, reserved
35
36 push ds ; save ds
37
38get_args:
39 pop ds ; restore ds
40 call SysParse ; call the parser
41 cmp ax,0 ; end of line?
42 je check_frame ; no, find out what we got this time
43 cmp ax,-1 ; end of parse?
44 je end_of_input_line1 ; yes
45 cmp ax,-1 ; flag an error
46 ret ; return to caller
47
48end_of_input_line1:
49
50 jmp end_of_input_line ;
51
52; find out which arg was processed this time
53
54check_frame:
55
56; make ds point to data area for these comparisons, must restore before
57; calling parser again
58
59 push ds ; save ds
60 push es ; make ds point to save areas
61 pop ds
62
63 cmp frame_result.$P_Type,2 ; was there a FRAME= in this pass?
64 jne check_p0 ; no, look for a P0
65
66 mov parse_flag,1 ; set parse flag
67
68 mov byte ptr frame_ctl+9,0 ; turn this off so we don't allow another
69 mov frame_result.$P_Type,0 ; clear this so we don't get fooled later
70
71 mov byte ptr p0_ctl+9,0 ; turn these off so we don't allow any
72 mov byte ptr p1_ctl+9,0 ; others that would conflict
73 mov byte ptr p2_ctl+9,0
74 mov byte ptr p3_ctl+9,0
75
76 push si ;save regs
77
78 mov si,word ptr frame_result.$P_Picked_Val[+0]
79
80 mov word ptr ds:[si+0],0 ;clear the
81 mov word ptr ds:[si+4],0 ; pages
82 mov word ptr ds:[si+8],0
83 mov word ptr ds:[si+12],0
84
85 pop si ;restore regs
86
87
88; set flags for later code to fill in map_table
89
90 or page_flags,frame_flag ; set frame flag
91
92 jmp get_args ; go get another argument
93
94check_p0:
95 cmp p0_result.$P_Type,2 ; was there a P0= in this pass?
96 jne check_p1 ; no, look for a P0
97
98 mov parse_flag,1 ; set parse flag
99
100 mov byte ptr p0_ctl+9,0 ; turn this off so we don't allow another
101 mov p0_result.$P_Type,0 ; clear this so we don't get fooled later
102
103 mov byte ptr frame_ctl+9,0 ; turn this off so we don't allow another
104
105 push si ;save regs
106
107 mov si,word ptr p0_result.$P_Picked_Val[+0]
108
109 mov word ptr ds:[si+0],0
110
111 pop si ;restore regs
112; set flags for later code to fill in map_table
113
114 or page_flags,p0_flag ; set p0 flag
115
116 jmp get_args ; go get another argument
117
118check_p1:
119 cmp p1_result.$P_Type,2 ; was there a p1= in this pass?
120 jne check_p2 ; no, look for a P2
121
122 mov parse_flag,1 ; set parse flag
123
124 mov byte ptr p1_ctl+9,0 ; turn this off so we don't allow another
125 mov p1_result.$P_Type,0 ; clear this so we don't get fooled later
126
127 mov byte ptr frame_ctl+9,0 ; turn this off so we don't allow another
128
129 push si ;save regs
130
131 mov si,word ptr p1_result.$P_Picked_Val[+0]
132
133 mov word ptr ds:[si+0],0
134
135 pop si ;restore regs
136; set flags for later code to fill in map_table
137
138 or page_flags,p1_flag ; set p1 flag
139
140 jmp get_args ; go get another argument
141
142check_p2:
143 cmp p2_result.$P_Type,2 ; was there a p2= in this pass?
144 jne check_p3 ; no, look for a p3
145
146 mov parse_flag,1 ; set parse flag
147
148 mov byte ptr p2_ctl+9,0 ; turn this off so we don't allow another
149 mov p2_result.$P_Type,0 ; clear this so we don't get fooled later
150
151 mov byte ptr frame_ctl+9,0 ; turn this off so we don't allow another
152
153 push si ;save regs
154
155 mov si,word ptr p2_result.$P_Picked_Val[+0]
156
157 mov word ptr ds:[si+0],0
158
159 pop si ;restore regs
160; set flags for later code to fill in map_table
161
162 or page_flags,p2_flag ; set p2 flag
163
164 jmp get_args ; go get another argument
165
166check_p3:
167 cmp p3_result.$P_Type,2 ; was there a p3= in this pass?
168 jne check_p254 ; no, look for a P254
169
170 mov parse_flag,1 ; set parse flag
171
172 mov byte ptr p3_ctl+9,0 ; turn this off so we don't allow another
173 mov p3_result.$P_Type,0 ; clear this so we don't get fooled later
174
175 mov byte ptr frame_ctl+9,0 ; turn this off so we don't allow another
176
177 push si ;save regs
178
179 mov si,word ptr p3_result.$P_Picked_Val[+0]
180
181 mov word ptr ds:[si+0],0
182
183 pop si ;restore regs
184; set flags for later code to fill in map_table
185
186 or page_flags,p3_flag ; set p3 flag
187
188 jmp get_args ; go get another argument
189
190check_p254:
191 cmp p254_result.$P_Type,2 ; was there a p254= in this pass?
192 jne check_p255 ; no, look for a P255
193
194 mov parse_flag,1 ; set parse flag
195
196 mov byte ptr p254_ctl+9,0 ; turn this off so we don't allow another
197 mov p254_result.$P_Type,0 ; clear this so we don't get fooled later
198
199 push si ;save regs
200
201 mov si,word ptr p254_result.$P_Picked_Val[+0]
202
203 mov word ptr ds:[si+0],0
204
205 pop si ;restore regs
206; set flags for later code to fill in map_table
207
208 or page_flags,p254_flag ; set p254 flag
209
210 jmp get_args ; go get another argument
211
212check_p255:
213 cmp p255_result.$P_Type,2 ; was there a P255= in this pass?
214 je do_p255 ; yes, process it
215 jmp Check_X ; no, find out if /X was included
216
217do_p255:
218 mov parse_flag,1 ; set parse flag
219
220 mov byte ptr p255_ctl+9,0 ; turn this off so we don't allow another
221 mov p255_result.$P_Type,0 ; clear this so we don't get fooled later
222
223 push si ;save regs
224
225 mov si,word ptr p255_result.$P_Picked_Val[+0]
226
227 mov word ptr ds:[si+0],0
228
229 pop si ;restore regs
230; set flags for later code to fill in map_table
231
232 or page_flags,p255_flag ; set p255 flag
233
234 jmp get_args ; go get another argument
235
236Check_X:
237 cmp es:X_Result.$P_SYNONYM_Ptr,offset es:X_Switch.$P_KeyorSW ; switch Ptr ;an000; dms;
238 je Do_X ; yes, process it
239 jmp get_args ; no, must have been the positional, ignore it and go on
240
241Do_X:
242
243 push ax ; save regs
244 mov ax,es:word ptr X_Result.$P_Picked_Val ;get low word of result ;an000; dms;
245 mov cs:EMS_Pgs_Parm,ax ; pass to program ;an000; dms;
246 pop ax ; restore regs
247
248 jmp get_args ; go get another argument
249
250
251
252
253; getting here means invalid argument, figure out what to do later
254
255end_of_input_line:
256
257 cmp parse_flag,null ; were there command line args?
258 jne cmd_line_args ; yes, process them
259 jmp null_cmd_line ; no, skip processing
260
261cmd_line_args:
262
263; put the stuff into map_table, this is done by looking at flags set
264; by the above code and putting the addresses into map_table
265
266 push ax ; save some regs
267 push bx
268 push cx
269 push dx
270 push di
271
272 xor di,di ; clear index pointer
273
274 mov map_count,null ; clear map count default
275
276 test page_flags,frame_flag ; was FRAME= included?
277 jz chk_p0 ; no, try p0
278
279; yes, fix up page count and fill in map_table
280
281 mov map_count,4 ; FRAME= takes up 4 map entries
282
283; convert the item tag into a segment address
284
285 xor ah,ah ; make 0
286 mov al,frame_result.$P_Item_Tag ; get item tag
287 mov cx,8 ; need to shift left eight bits
288 shl ax,cl ; to convert to a segment address
289
290; do some math with di
291
292 xor di,di ; clear index pointer
293
294; save the segment addresses in map_table
295
296 mov map_table.phys_page_segment[di],ax ; store p0 segment
297 mov map_table.phys_page_number[di],0 ; p0 page number
298 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
299 ; diags.
300
301 add ax,400h ; increase segment ID by 16K
302 add di,type mappable_phys_page_struct
303
304 mov map_table.phys_page_segment[di],ax ; store p1 segment
305 mov map_table.phys_page_number[di],1 ; p1 page number
306
307 add ax,400h ; increase segment ID by 16K
308 add di,type mappable_phys_page_struct
309
310 mov map_table.phys_page_segment[di],ax ; store p2 segment
311 mov map_table.phys_page_number[di],2 ; p2 page number
312
313 add ax,400h ; increase segment ID by 16K
314 add di,type mappable_phys_page_struct
315
316 mov map_table.phys_page_segment[di],ax ; store p3 segment
317 mov map_table.phys_page_number[di],3 ; p3 page number
318
319; do some math with di, this will be used as a pointer into map_table
320
321 add di,type mappable_phys_page_struct
322
323 jmp chk_p254 ; FRAME= implies that p0 - p3 were not present,
324 ; skip ahead and look for p254 and p255
325
326; check for p0
327
328chk_p0:
329
330 test page_flags,p0_flag ; was p0= included?
331 jz chk_p1 ; no, try p1
332
333; yes, fix up page count and fill in map_table
334
335 add map_count,1 ; one extra map entry
336
337; convert the item tag into a segment address
338
339 xor ah,ah ; make 0
340 mov al,p0_result.$P_Item_Tag; get item tag
341 mov cx,8 ; need to shift left eight bits
342 shl ax,cl ; to convert to a segment address
343
344
345; save the segment addresses in map_table
346
347 mov map_table.phys_page_segment[di],ax ; store p0 segment
348 mov map_table.phys_page_number[di],0 ; p0 page number
349 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
350 ; diags.
351
352; do some math with di, this will be used as a pointer into map_table
353
354 add di,type mappable_phys_page_struct
355
356;------------------------
357; check for p1
358;------------------------
359
360chk_p1:
361
362 test page_flags,p1_flag ; was p1= included?
363 jz chk_p2 ; no, try p2
364
365; yes, fix up page count and fill in map_table
366
367 add map_count,1 ; one extra map entry
368
369; convert the item tag into a segment address
370
371 xor ah,ah ; make 0
372 mov al,p1_result.$P_Item_Tag; get item tag
373 mov cx,8 ; need to shift left eight bits
374 shl ax,cl ; to convert to a segment address
375
376
377; save the segment addresses in map_table
378
379 mov map_table.phys_page_segment[di],ax ; store p1 segment
380 mov map_table.phys_page_number[di],1 ; p0 page number
381 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
382 ; diags.
383
384; do some math with di, this will be used as a pointer into map_table
385
386 add di,type mappable_phys_page_struct
387
388;------------------------
389; check for p2
390;------------------------
391
392chk_p2:
393
394 test page_flags,p2_flag ; was p2= included?
395 jz chk_p3 ; no, try p3
396
397; yes, fix up page count and fill in map_table
398
399 add map_count,1 ; one extra map entry
400
401; convert the item tag into a segment address
402
403 xor ah,ah ; make 0
404 mov al,p2_result.$P_Item_Tag; get item tag
405 mov cx,8 ; need to shift left eight bits
406 shl ax,cl ; to convert to a segment address
407
408
409; save the segment addresses in map_table
410
411 mov map_table.phys_page_segment[di],ax ; store p2 segment
412 mov map_table.phys_page_number[di],2 ; p2 page number
413 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
414 ; diags.
415
416; do some math with di, this will be used as a pointer into map_table
417
418 add di,type mappable_phys_page_struct
419
420;------------------------
421; check for p3
422;------------------------
423
424chk_p3:
425
426 test page_flags,p3_flag ; was p3= included?
427 jz chk_p254 ; no, try p254
428
429; yes, fix up page count and fill in map_table
430
431 add map_count,1 ; one extra map entry
432
433; convert the item tag into a segment address
434
435 xor ah,ah ; make 0
436 mov al,p3_result.$P_Item_Tag; get item tag
437 mov cx,8 ; need to shift left eight bits
438 shl ax,cl ; to convert to a segment address
439
440
441; save the segment addresses in map_table
442
443 mov map_table.phys_page_segment[di],ax ; store p3 segment
444 mov map_table.phys_page_number[di],3 ; p3 page number
445 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
446 ; diags.
447
448; do some math with di, this will be used as a pointer into map_table
449
450 add di,type mappable_phys_page_struct
451
452;------------------------
453; check for p254
454;------------------------
455
456chk_p254:
457
458 test page_flags,p254_flag ; was p254= included?
459 jz chk_p255 ; no, try p255
460
461; yes, fix up page count and fill in map_table
462
463 add map_count,1 ; one extra map entry
464
465; convert the item tag into a segment address
466
467 xor ah,ah ; make 0
468 mov al,p254_result.$P_Item_Tag; get item tag
469 mov cx,8 ; need to shift left eight bits
470 shl ax,cl ; to convert to a segment address
471
472
473; save the segment addresses in map_table
474
475 mov map_table.phys_page_segment[di],ax ; store p254 segment
476 mov map_table.phys_page_number[di],0feh ; p254 page number
477 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
478 ; diags.
479
480; do some math with di, this will be used as a pointer into map_table
481
482 add di,type mappable_phys_page_struct
483
484;------------------------
485; check for p255
486;------------------------
487
488chk_p255:
489
490 test page_flags,p255_flag ; was p255= included?
491 jz Chk_X ; no, /X switch
492
493; yes, fix up page count and fill in map_table
494
495 add map_count,1 ; one extra map entry
496
497; convert the item tag into a segment address
498
499 xor ah,ah ; make 0
500 mov al,p255_result.$P_Item_Tag; get item tag
501 mov cx,8 ; need to shift left eight bits
502 shl ax,cl ; to convert to a segment address
503
504
505; save the segment addresses in map_table
506
507 mov map_table.phys_page_segment[di],ax ; store p255 segment
508 mov map_table.phys_page_number[di],0ffh ; p255 page number
509 mov cs:Page_Frame_Sta,ax ;save our page for XMA1 ;an000; dms;
510 ; diags.
511
512; do some math with di, this will be used as a pointer into map_table
513
514 add di,type mappable_phys_page_struct
515
516Chk_X:
517
518 pop di ; restore some regs
519 pop dx
520 pop cx
521 pop bx
522 pop ax
523
524
525null_cmd_line:
526 CMP AL,AL ; else set zf to indicate no error
527 ret ; return to calling routine
528
529
530GET_PARMS ENDP