-
Notifications
You must be signed in to change notification settings - Fork 0
/
dv.asm
856 lines (737 loc) · 21.7 KB
/
dv.asm
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
BINARY_EQUAL = 1
; ---------------------------------------------------------------------------
ptr16_t struc ; (sizeof=0x4) ; XREF: seg000:stru_10204r
; seg000:stru_1020Br ...
ofs dw ?
segm dw ?
ptr16_t ends
; ---------------------------------------------------------------------------
exec_param_block_t struc ; (sizeof=0x4) ; XREF: seg000:exec_paramr
load_seg dw ? ; XREF: start_0+2Cw
relocation_factor dw ? ; XREF: start_0+2Ew ; only if EXE
exec_param_block_t ends
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2013 Hex-Rays, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : 40EE2A00BDCCFCBB0D43FCE59AEF6859
; Input CRC32 : F92F7BA3
; File Name : C:\temp\device_com\DEVICE.COM
; Format : MS-DOS COM-file
; Base Address: 1000h Range: 10100h-10748h Loaded length: 648h
.286
.model tiny
; ===========================================================================
; Segment type: Pure code
seg000 segment byte public 'CODE'
assume cs:seg000
org 100h
assume es:nothing, ss:nothing, ds:seg000
; =============== S U B R O U T I N E =======================================
; Attributes: thunk
public start
start proc near
jmp start_0
start endp
; ---------------------------------------------------------------------------
driver_file_name db 41h dup(0) ; 0 ; DATA XREF: print_file_name_sub_10221+2o
; parse_command_line_sub_106DB+1o ...
exec_param exec_param_block_t <0> ; DATA XREF: start_0+29o
byte_10148 db 17h, 0Dh dup(0) ; DATA XREF: start_0-468o
word_10156 dw 0 ; DATA XREF: start_0-434r
word_10158 dw 0 ; DATA XREF: start_0-429r start_0+19w
word_1015A dw 0 ; DATA XREF: parse_command_line_sub_106DB+21w
word_1015C dw 0 ; DATA XREF: start_0+12w
db 0
aDevice db 'DEVICE: $' ; DATA XREF: start_0-4CEo
aCouldNotLoad db 'Could not load $' ; DATA XREF: start_0-474o
aPressAnyKeyToE db 0Dh,0Ah ; DATA XREF: start_0:loc_1025Eo
db 'Press any key to exit ... $'
aIsABlockDevice db ' is a block device.',0Dh,0Ah ; DATA XREF: start_0-3DCo
db 'It must be loaded in CONFIG.SYS.$'
aItMayBeDangero db 0Dh,0Ah ; DATA XREF: start_0-4B2o
db 'It may be dangerous to continue running this session.$'
string_end db 24h ; $ ; DATA XREF: start_0-471o
; start_0:loc_1032Ao
stru_10204 ptr16_t <0> ; DATA XREF: start_0-456w start_0-450r ...
byte_10208 db 0 ; DATA XREF: start_0-4B9r start_0-4A0r ...
word_10209 dw 0 ; DATA XREF: start_0-496r start_0-407w
stru_1020B ptr16_t <0> ; DATA XREF: sub_10375+Br sub_103AF+9r ...
stru_1020F ptr16_t <0> ; DATA XREF: sub_103AF+2r
; sub_1058F+37w ...
stru_10213 ptr16_t <0> ; DATA XREF: sub_10375+27w
; sub_103A6+2r ...
old_interrupt_2F ptr16_t <0> ; DATA XREF: restore_interrupt_F2_sub_10410+Br
; set_interrupt_2F_sub_10529+14w ...
stru_1021B ptr16_t <0> ; DATA XREF: seg000:03CEr
; sub_105DA:loc_105F1w ...
byte_1021F db 0 ; DATA XREF: seg000:loc_103C7r
; sub_105DA+27r ...
byte_10220 db 0Dh ; DATA XREF: sub_10333+12r
; sub_10333:loc_1035Ar ...
; =============== S U B R O U T I N E =======================================
print_file_name_sub_10221 proc near ; CODE XREF: start_0-4C1p
push ds
pop es
assume es:seg000
mov di, offset driver_file_name
mov dx, di
xor al, al
mov cx, 41h ; max size of filename
repne scasb ; search for 0
mov byte ptr [di-1], '$' ; set DOS print end char at end
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
retn
print_file_name_sub_10221 endp
; ---------------------------------------------------------------------------
; START OF FUNCTION CHUNK FOR start_0
loc_10238: ; CODE XREF: start_0-46Ej start_0-3D9j
push cs
pop ds
push dx
mov dx, offset aDevice ; "DEVICE: $"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
pop dx
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
push di
call print_file_name_sub_10221
pop dx
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
cmp byte_10208, 0
jz short loc_1025E
mov dx, offset aItMayBeDangero ; "\r\nIt may be dangerous to continue run"...
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
loc_1025E: ; CODE XREF: start_0-4B4j
mov dx, offset aPressAnyKeyToE ; "\r\nPress any key to exit ... $"
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov ah, 0
int 16h ; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY
; Return: AH = scan code, AL = character
cmp byte_10208, 0
jz short loc_1027C
call close_filehandles_0_to_4_sub_10284
mov dx, word_10209
mov ax, 3101h
int 21h ; DOS - DOS 2+ - TERMINATE BUT STAY RESIDENT
; AL = exit code, DX = program size, in paragraphs
; ---------------------------------------------------------------------------
loc_1027C: ; CODE XREF: start_0-49Bj
call restore_interrupt_F2_sub_10410
mov ax, 4C01h
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
; END OF FUNCTION CHUNK FOR start_0 ; AL = exit code
; =============== S U B R O U T I N E =======================================
close_filehandles_0_to_4_sub_10284 proc near ; CODE XREF: start_0-499p
; start_0-3EFp
xor bx, bx ; file handle = 0?
loc_10286: ; CODE XREF: close_filehandles_0_to_4_sub_10284+Aj
mov ah, 3Eh
int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE
; BX = file handle
inc bx
cmp bx, 5 ; closes handle 0,1,2,3,4
jb short loc_10286
retn
close_filehandles_0_to_4_sub_10284 endp
; ---------------------------------------------------------------------------
; START OF FUNCTION CHUNK FOR start_0
loc_10291: ; CODE XREF: start_0+3Cj
int 21h ; DOS - 2+ - LOAD OR EXECUTE (EXEC)
; DS:DX -> ASCIZ filename
; ES:BX -> parameter block
; AL = subfunc: called by MSC spawn(P_NOWAIT,...) when running DOS 4.x.
jnb short loc_1029D
mov dx, offset aCouldNotLoad ; "Could not load $"
mov di, offset string_end
jmp short loc_10238
; ---------------------------------------------------------------------------
loc_1029D: ; CODE XREF: start_0-476j
xor si, si
loc_1029F: ; CODE XREF: start_0-40Dj
push cs
pop es
mov bx, offset byte_10148
mov ds, stru_10204.segm
test byte ptr [si+5], 80h
jnz short loc_102B0
jmp short loc_1032A
; ---------------------------------------------------------------------------
loc_102B0: ; CODE XREF: start_0-45Dj
mov ax, [si+6]
mov cs:stru_10204.ofs, ax
push si
push ds
call dword ptr cs:stru_10204.ofs
pop ds
pop si
mov ax, [si+8]
mov cs:stru_10204.ofs, ax
push si
call dword ptr cs:stru_10204.ofs
pop si
push cs
pop ds
mov byte_10208, 1
mov bx, word_10156
add bx, 0Fh
mov cl, 4
shr bx, cl
add bx, word_10158
mov ax, stru_10204.segm
mov dx, bx
sub bx, ax
jbe short loc_10322
call sub_10333
mov es, ax
assume es:nothing
push word ptr es:[si]
call sub_10375
pop si
cmp si, 0FFFFh
jnz short loc_1029F
mov ax, cs
sub dx, ax
mov word_10209, dx
mov es, word ptr ds:2Ch
mov ah, 49h
int 21h ; DOS - 2+ - FREE MEMORY
; ES = segment address of area to be freed
mov es, stru_10204.segm
test byte ptr es:5, 80h
jz short loc_1032A
call close_filehandles_0_to_4_sub_10284
mov ax, 3100h
int 21h ; DOS - DOS 2+ - TERMINATE BUT STAY RESIDENT
; AL = exit code, DX = program size, in paragraphs
; ---------------------------------------------------------------------------
loc_10322: ; CODE XREF: start_0-41Ej
call restore_interrupt_F2_sub_10410
mov ax, 4C01h
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
; AL = exit code
; ---------------------------------------------------------------------------
loc_1032A: ; CODE XREF: start_0-45Bj start_0-3F1j
mov dx, offset string_end
mov di, offset aIsABlockDevice ; " is a block device.\r\nIt must be loade"...
jmp loc_10238
; END OF FUNCTION CHUNK FOR start_0
; =============== S U B R O U T I N E =======================================
sub_10333 proc near ; CODE XREF: start_0-41Cp
push ax
push bx
push ds
push es
mov ds, ax
assume ds:nothing
mov ah, 52h
int 21h ; DOS - 2+ internal - GET LIST OF LISTS
; Return: ES:BX -> DOS list of lists
mov ax, [si+4]
test ah, 80h
jz short loc_10370
test cs:byte_10220, 4
jz short loc_1035A
test al, 1
jz short loc_1035A
cli
mov es:[bx+0Ch], si
mov word ptr es:[bx+0Eh], ds
loc_1035A: ; CODE XREF: sub_10333+18j
; sub_10333+1Cj
test cs:byte_10220, 8
jz short loc_1036F
test al, 8
jz short loc_1036F
cli
mov es:[bx+8], si
mov word ptr es:[bx+0Ah], ds
loc_1036F: ; CODE XREF: sub_10333+2Dj
; sub_10333+31j
sti
loc_10370: ; CODE XREF: sub_10333+10j
pop es
pop ds
assume ds:seg000
pop bx
pop ax
retn
sub_10333 endp
; =============== S U B R O U T I N E =======================================
sub_10375 proc near ; CODE XREF: start_0-414p
test cs:byte_10220, 1
jz short locret_103A5
push ax
push bx
push ds
lds bx, dword ptr cs:stru_1020B.ofs
cli
mov ax, [bx]
mov es:[si], ax
mov ax, [bx+2]
mov es:[si+2], ax
mov word ptr [bx+2], es
mov [bx], si
mov cs:stru_10213.segm, es
mov cs:stru_10213.ofs, si
sti
pop ds
pop bx
pop ax
locret_103A5: ; CODE XREF: sub_10375+6j
retn
sub_10375 endp
; =============== S U B R O U T I N E =======================================
sub_103A6 proc near ; CODE XREF: seg000:040Cp
push si
push es
les si, dword ptr cs:stru_10213.ofs
jmp short loc_103B6
sub_103A6 endp
; =============== S U B R O U T I N E =======================================
sub_103AF proc near ; CODE XREF: seg000:03E0p
push si
push es
les si, dword ptr cs:stru_1020F.ofs
loc_103B6:: ; CODE XREF: sub_103A6+7j
push bx
push ds
lds bx, dword ptr cs:stru_1020B.ofs
mov word ptr [bx+2], es
mov [bx], si
pop ds
pop bx
pop es
pop si
retn
sub_103AF endp
; ---------------------------------------------------------------------------
loc_103C7: ; DATA XREF: set_interrupt_2F_sub_10529+1Co
cmp ah, cs:byte_1021F
jz short loc_103D3
jmp dword ptr cs:stru_1021B.ofs
; ---------------------------------------------------------------------------
loc_103D3: ; CODE XREF: seg000:03CCj
sti
cmp al, 0
jz short loc_103E8
cmp al, 9
jz short loc_10406
cmp al, 8
jnz short near ptr byte_103E3
call sub_103AF
; ---------------------------------------------------------------------------
byte_103E3 db 0EAh ; CODE XREF: seg000:03DEj
stru_103E4 ptr16_t <0> ; DATA XREF: seg000:0407r
; sub_105DA+1Fw ...
; ---------------------------------------------------------------------------
loc_103E8: ; CODE XREF: seg000:03D6j
mov al, 0FFh
cmp bx, 4456h
jnz short do_iret
cmp cx, 5844h
jnz short do_iret
cmp dx, 4931h
jnz short do_iret
mov bx, 4845h
mov cx, 5245h
mov dx, 4456h
do_iret: ; CODE XREF: seg000:03EEj seg000:03F4j ...
iret
; ---------------------------------------------------------------------------
loc_10406: ; CODE XREF: seg000:03DAj
pushf
call dword ptr cs:stru_103E4.ofs
call sub_103A6
iret
; =============== S U B R O U T I N E =======================================
restore_interrupt_F2_sub_10410 proc near ; CODE XREF: start_0:loc_1027Cp
; start_0:loc_10322p
test cs:byte_10220, 2
jz short exit
push ax
push dx
push ds
lds dx, dword ptr cs:old_interrupt_2F.ofs
mov ax, 252Fh
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
pop ds
pop dx
pop ax
exit: ; CODE XREF: restore_interrupt_F2_sub_10410+6j
retn
restore_interrupt_F2_sub_10410 endp
; ---------------------------------------------------------------------------
db 100h dup(0) ; 0 ; stack data
; =============== S U B R O U T I N E =======================================
set_interrupt_2F_sub_10529 proc near ; CODE XREF: start_0+Cp
; DATA XREF: start_0o
test cs:byte_10220, 2
jz short exit
push ax
push bx
push dx
push ds
push es
push cs
pop ds
mov ax, 352Fh
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov old_interrupt_2F.ofs, bx
mov old_interrupt_2F.segm, es
mov dx, offset loc_103C7
mov ax, 252Fh
int 21h ; DOS - SET INTERRUPT VECTOR
; AL = interrupt number
; DS:DX = new vector to be used for specified interrupt
pop es
pop ds
pop dx
pop bx
pop ax
exit: ; CODE XREF: set_interrupt_2F_sub_10529+6j
retn
set_interrupt_2F_sub_10529 endp
; =============== S U B R O U T I N E =======================================
check_for_desq_view_sub_10553 proc near ; CODE XREF: start_0+3p
push ax
push bx
push bx
push cx
push dx
mov ax, 2B01h
xor bx, bx
mov cx, 'DE'
mov dx, 'SQ'
int 21h ; DOS - SET CURRENT DATE
; DL = day, DH = month, CX = year
; Return: AL = 00h if no error /= FFh if bad value sent to routine
;
; RBIL: INTERRUP.F, line: 4703
;
; INT 21 - DESQview - INSTALLATION CHECK
; AH = 2Bh
; CX = 4445h ('DE')
; DX = 5351h ('SQ')
; AL = subfunction (DV v2.00+)
; 01h get version
; Return: BX = version (BH = major, BL = minor)
; Note: early copies of v2.00 return 0002h
; Return: AL = FFh if DESQview not installed
; Notes: in DESQview v1.x, there were no subfunctions; this call only identified
; whether or not DESQview was loaded. DESQview v2.52 performs function
; 01h for all subfunction requests 0Ch and higher and appears to ignore
; all lower-numbered functions not listed here.
; DESQview versions 2.50-2.52 are part of DESQview/X v1.0x; version 2.53
; is part of DESQview/X v1.10; and version 2.63 is part of DESQview/X
; v2.00.
mov ax, bx
IFDEF BINARY_EQUAL
db 3Dh, 02h, 00h
ELSE
cmp ax, 2 ; DESQview Version=2?
ENDIF
jnz short loc_1056E
xchg ah, al
loc_1056E: ; CODE XREF: check_for_desq_view_sub_10553+17j
pop dx
pop cx
pop bx
test ax, ax
jz short loc_1058C
mov bl, 0
cmp ax, 21Ah
jb short loc_10587
or bl, 5
cmp ax, 232h
jnb short loc_10587
or bl, 2
loc_10587: ; CODE XREF: check_for_desq_view_sub_10553+27j
; check_for_desq_view_sub_10553+2Fj
mov cs:byte_10220, bl
loc_1058C: ; CODE XREF: check_for_desq_view_sub_10553+20j
pop bx
pop ax
retn
check_for_desq_view_sub_10553 endp
; =============== S U B R O U T I N E =======================================
sub_1058F proc near ; CODE XREF: start_0+6p
push ax
push bx
push di
push es
mov ah, 52h
int 21h ; DOS - 2+ internal - GET LIST OF LISTS
; Return: ES:BX -> DOS list of lists
sub bx, 2
push bx
mov di, 19h
mov ah, 30h
int 21h ; DOS - GET DOS VERSION
; Return: AL = major version number (00h for DOS 1.x)
cmp al, 2
jz short loc_105B1
mov di, 24h
IFDEF BINARY_EQUAL
db 3Dh, 03h, 00h
ELSE
cmp ax, 3
ENDIF
jnz short loc_105B1
mov di, 2Ah
loc_105B1: ; CODE XREF: sub_1058F+15j
; sub_1058F+1Dj
pop bx
add bx, di
mov cs:stru_1020B.segm, es
mov cs:stru_1020B.ofs, bx
les bx, es:[bx]
mov cs:stru_1020F.segm, es
mov cs:stru_1020F.ofs, bx
mov cs:stru_10213.segm, es
mov cs:stru_10213.ofs, bx
pop es
pop di
pop bx
pop ax
retn
sub_1058F endp
; =============== S U B R O U T I N E =======================================
sub_105DA proc near ; CODE XREF: sub_10696+Ap
push ax
push bx
push cx
push dx
push di
push si
push es
mov ax, 352Fh
int 21h ; DOS - 2+ - GET INTERRUPT VECTOR
; AL = interrupt number
; Return: ES:BX = value of interrupt vector
mov cx, es
test cx, cx
jnz short loc_105F1
mov bx, offset do_iret
mov cx, ds
loc_105F1: ; CODE XREF: sub_105DA+10j
mov stru_1021B.ofs, bx
mov stru_1021B.segm, cx
mov stru_103E4.ofs, bx
mov stru_103E4.segm, cx
mov ah, byte_1021F
test ah, ah
jnz short loc_1060B
mov ah, 0DEh ; ax = 0xDE00 - for DESQview check
loc_1060B: ; CODE XREF: sub_105DA+2Dj
mov cx, es
jcxz short loc_10660
mov al, 0
loc_10611: ; CODE XREF: sub_105DA+78j
mov bx, 'DV'
mov cx, 'XD'
mov dx, 'I1'
push ax
push ds
int 2Fh ; RBIL: DVINT.LST, line: 4459
;
; INT 2F - DESQview v2.26+ External Device Interface - INSTALLATION CHECK
; AX = DE00h
; BX = 4456h ("DV")
; CX = 5844h ("XD")
; DX = 4931h ("I1")
; Return: AL = FFh if installed (even if other registers do not match)
; if BX,CX, and DX were as specified on entry,
; BX = 4845h ("HE")
; CX = 5245h ("RE")
; DX = 4456h ("DV")
; Range: AH=C0h to AH=FFh, selected by scanning AH=DEh-FFh, then AH=C0h-DDh
; Note: the XDI handler should not issue any DOS or BIOS calls, nor should it
; issue DESQview API calls other than those allowed from hardware ints
mov di, ax
and di, 0FFh
pop ds
pop ax
jz short loc_10656
cmp di, 0FFh
jnz short loc_10642
cmp bx, 'HE'
jnz short loc_10642
cmp cx, 'RE'
jnz short loc_10642
cmp dx, 'DV'
jnz short loc_10642
jmp short loc_10660
; ---------------------------------------------------------------------------
loc_10642: ; CODE XREF: sub_105DA+52j
; sub_105DA+58j ...
cmp byte_1021F, 0
jnz short loc_10656
inc ah
jnz short loc_1064F
mov ah, 0C0h
loc_1064F: ; CODE XREF: sub_105DA+71j
cmp ah, 0DEh
jnz short loc_10611
xor ah, ah
loc_10656: ; CODE XREF: sub_105DA+4Cj
; sub_105DA+6Dj
mov stru_103E4.ofs, offset do_iret
mov stru_103E4.segm, ds
loc_10660: ; CODE XREF: sub_105DA+33j
; sub_105DA+66j
mov byte_1021F, ah
pop es
pop si
pop di
pop dx
pop cx
pop bx
pop ax
retn
sub_105DA endp
; ---------------------------------------------------------------------------
aErrorAccessing db 'Error accessing XDI. Terminating . . .',0Dh,0Ah,'$'
; DATA XREF: sub_10696+14o
; =============== S U B R O U T I N E =======================================
sub_10696 proc near ; CODE XREF: start_0+9p
push ds
push cs
pop ds
test byte_10220, 2
jz short loc_106B6
call sub_105DA
cmp byte_1021F, 0
jnz short loc_106B6
mov dx, offset aErrorAccessing ; "Error accessing XDI. Terminating . . ."...
mov ah, 9
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov ax, 4C01h
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
; AL = exit code
; ---------------------------------------------------------------------------
loc_106B6: ; CODE XREF: sub_10696+8j
; sub_10696+12j
pop ds
retn
sub_10696 endp
; =============== S U B R O U T I N E =======================================
sub_106B8 proc near ; CODE XREF: parse_command_line_sub_106DB:loc_106F9p
push ax
push si
push di
push es
push ds
pop es
assume es:seg000
cld
lea di, [si-1]
loc_106C2: ; CODE XREF: sub_106B8+18j
lodsb
cmp al, 20h
jz short loc_106D2
cmp al, 0Dh
jz short loc_106D2
cmp al, 0Ah
jz short loc_106D2
stosb
jmp short loc_106C2
; ---------------------------------------------------------------------------
loc_106D2: ; CODE XREF: sub_106B8+Dj
; sub_106B8+11j ...
mov al, 20h
stosb
pop es
assume es:nothing
pop di
pop si
pop ax
dec si
retn
sub_106B8 endp
; =============== S U B R O U T I N E =======================================
parse_command_line_sub_106DB proc near ; CODE XREF: start_0+Fp
cld
mov di, offset driver_file_name
loc_106DF: ; Command-line tail (terminated by a 0Dh)
mov si, 81h
mov cl, ds:80h ; Number of bytes on command-line
xor ch, ch
jcxz short locret_106F8
mov bx, cx
mov byte ptr [bx+si+1], 0Ah ; newline?
loc_106F0: ; CODE XREF: parse_command_line_sub_106DB+1Bj
cmp byte ptr [si], 20h ; blank
jnz short loc_106F9
inc si
loop loc_106F0
locret_106F8: ; CODE XREF: parse_command_line_sub_106DB+Dj
retn
; ---------------------------------------------------------------------------
loc_106F9: ; CODE XREF: parse_command_line_sub_106DB+18j
call sub_106B8
mov word_1015A, si
loc_10700: ; CODE XREF: parse_command_line_sub_106DB+2Bj
cmp byte ptr [si], 20h ; blank
jz short locret_10708
movsb
loop loc_10700
locret_10708: ; CODE XREF: parse_command_line_sub_106DB+28j
retn
parse_command_line_sub_106DB endp
; =============== S U B R O U T I N E =======================================
start_0 proc near ; CODE XREF: startj
; FUNCTION CHUNK AT 0238 SIZE 0000004C BYTES
; FUNCTION CHUNK AT 0291 SIZE 000000A2 BYTES
mov sp, offset set_interrupt_2F_sub_10529 ; start of stack data: db 100 dup(0)
call check_for_desq_view_sub_10553
call sub_1058F
call sub_10696
call set_interrupt_2F_sub_10529
call parse_command_line_sub_106DB
mov word_1015C, cs
mov ax, ds:2 ; ?? PSP: Segment of the first byte beyond the memory allocated to the program // https://github.com/open-watcom/open-watcom-v2/blob/master/bld/clib/process/h/psp.h
mov word_10158, ax
mov bx, sp
add bx, 0Fh
mov cl, 4
shr bx, cl
mov ax, cs
add ax, bx
mov bx, offset exec_param
mov [bx+exec_param_block_t.load_seg], ax
mov [bx+exec_param_block_t.relocation_factor], ax ; only needed for exe
mov stru_10204.segm, ax
mov dx, offset driver_file_name
push ds
pop es
assume es:seg000
mov ax, 4B03h ; DOS: LOAD OR EXECUTE (EXEC) --> 03h = load overlay
;
; Format of EXEC parameter block for AL=03h:
; Offset Size Description (Table 01591)
; 00h WORD segment at which to load overlay
; 02h WORD relocation factor to apply to overlay if in .EXE format
jmp loc_10291 ; DS:DX -> ASCIZ filename
start_0 endp ; ES:BX -> parameter block
; AL = subfunc: called by MSC spawn(P_NOWAIT,...) when running DOS 4.x.
seg000 ends
end start