summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/DEBUG
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/CMD/DEBUG
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/CMD/DEBUG')
-rw-r--r--v4.0/src/CMD/DEBUG/DEBASM.ASM1441
-rw-r--r--v4.0/src/CMD/DEBUG/DEBCOM1.ASM969
-rw-r--r--v4.0/src/CMD/DEBUG/DEBCOM2.ASM1308
-rw-r--r--v4.0/src/CMD/DEBUG/DEBCOM3.ASM678
-rw-r--r--v4.0/src/CMD/DEBUG/DEBCONST.ASM1128
-rw-r--r--v4.0/src/CMD/DEBUG/DEBDATA.ASM227
-rw-r--r--v4.0/src/CMD/DEBUG/DEBEMS.ASM1127
-rw-r--r--v4.0/src/CMD/DEBUG/DEBEQU.ASM164
-rw-r--r--v4.0/src/CMD/DEBUG/DEBERR.ASM183
-rw-r--r--v4.0/src/CMD/DEBUG/DEBMES.ASM1524
-rw-r--r--v4.0/src/CMD/DEBUG/DEBUASM.ASM954
-rw-r--r--v4.0/src/CMD/DEBUG/DEBUG.ASM1236
-rw-r--r--v4.0/src/CMD/DEBUG/DEBUG.LNK13
-rw-r--r--v4.0/src/CMD/DEBUG/DEBUG.SKL125
-rw-r--r--v4.0/src/CMD/DEBUG/MAKEFILE107
-rw-r--r--v4.0/src/CMD/DEBUG/SYSVER.FAL10
-rw-r--r--v4.0/src/CMD/DEBUG/SYSVER.INC10
-rw-r--r--v4.0/src/CMD/DEBUG/SYSVER.TRU10
18 files changed, 11214 insertions, 0 deletions
diff --git a/v4.0/src/CMD/DEBUG/DEBASM.ASM b/v4.0/src/CMD/DEBUG/DEBASM.ASM
new file mode 100644
index 0000000..8f34c52
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBASM.ASM
@@ -0,0 +1,1441 @@
1 PAGE 80,132 ;
2 TITLE DEBASM.ASM
3; CODE FOR THE ASSEMBLE COMMAND IN THE DEBUGGER
4
5 IF1
6 %OUT COMPONENT=DEBUG, MODULE=DEBASM
7 ENDIF
8.XLIST
9.XCREF
10 INCLUDE DOSSYM.INC
11 INCLUDE DEBEQU.ASM
12.CREF
13.LIST
14
15
16CODE SEGMENT PUBLIC BYTE
17CODE ENDS
18
19CONST SEGMENT PUBLIC BYTE
20
21 EXTRN DBMN:BYTE,CSSAVE:WORD,REG8:BYTE,REG16:BYTE,SIZ8:BYTE
22 EXTRN SYNERR_PTR:BYTE,OPTAB:BYTE,MAXOP:ABS
23
24CONST ENDS
25
26CSTACK SEGMENT STACK
27CSTACK ENDS
28
29DATA SEGMENT PUBLIC BYTE
30
31 EXTRN HINUM:WORD,LOWNUM:WORD,ASSEM_CNT:BYTE
32 EXTRN ASSEM1:BYTE,ASSEM2:BYTE,ASSEM3:BYTE,ASSEM4:BYTE,ASSEM5:BYTE
33 EXTRN ASSEM6:BYTE,OPBUF:BYTE,OPCODE:WORD,REGMEM:BYTE,INDEX:WORD
34 EXTRN ASMADD:BYTE,ASMSP:WORD,MOVFLG:BYTE,SEGFLG:BYTE,TSTFLG:BYTE
35 EXTRN NUMFLG:BYTE,DIRFLG:BYTE,BYTEBUF:BYTE,F8087:BYTE,DIFLG:BYTE
36 EXTRN SIFLG:BYTE,BXFLG:BYTE,BPFLG:BYTE,NEGFLG:BYTE,MEMFLG:BYTE
37 EXTRN REGFLG:BYTE,AWORD:BYTE,MIDFLD:BYTE,MODE:BYTE
38 EXTRN ARG_BUF:BYTE,HEX_PTR:BYTE
39
40DATA ENDS
41
42DG GROUP CODE,CONST,CSTACK,DATA
43
44CODE SEGMENT PUBLIC BYTE
45ASSUME CS:DG,DS:DG,ES:DG,SS:DG
46
47 PUBLIC ASSEM
48 PUBLIC DB_OPER,DW_OPER,ASSEMLOOP,GROUP2,AA_OPER,DCINC_OPER
49 PUBLIC GROUP1,ESC_OPER,FGROUPP,FGROUPX,FDE_OPER,FGROUPZ
50 PUBLIC FD9_OPER,FGROUP,FDB_OPER,FGROUPB,FGROUP3,FGROUP3W
51 PUBLIC FGROUPDS,INT_OPER,IN_OPER,DISP8_OPER,JMP_OPER,NO_OPER
52 PUBLIC OUT_OPER,L_OPER,MOV_OPER,POP_OPER,PUSH_OPER,ROTOP
53 PUBLIC TST_OPER,EX_OPER,GET_DATA16,CALL_OPER, DOORG
54
55 EXTRN INBUF:NEAR,SCANB:NEAR,SCANP:NEAR,GETHX:NEAR,GET_ADDRESS:NEAR
56 EXTRN DEFAULT:NEAR,OUTDI:NEAR,BLANK:NEAR,TAB:NEAR
57 EXTRN STD_PRINTF:NEAR,PRINTF_CRLF:NEAR
58
59; Line by line assembler
60
61MASKMOD EQU 11000000B
62SHMOD EQU 6
63MASKREG EQU 00111000B
64SHREG EQU 3
65MASKRM EQU 00000111B
66SHRM EQU 0
67
68ASSEM:
69 MOV BP,[CSSAVE] ; Default code segment
70 MOV DI,OFFSET DG:ASMADD ; Default address
71 CALL DEFAULT
72 MOV WORD PTR [ASMADD],DX ; Displacement of disassembly
73 MOV WORD PTR [ASMADD+2],AX ; Segment
74 MOV [ASMSP],SP ; Save sp in case of error
75
76ASSEMLOOP:
77 MOV SP,[ASMSP] ; Restore sp in case of error
78 LES DI,DWORD PTR ASMADD ; GET PC
79 CALL OUTDI ; OUTPUT ADDRESS
80 PUSH CS
81 POP ES
82 PUSH DI
83 MOV DI,OFFSET DG:ARG_BUF
84; No spacing is needed. The format string already has one.
85; CALL BLANK ; SKIP A SPACE
86 XOR AL,AL
87 STOSB
88 MOV DX,OFFSET DG:HEX_PTR
89 CALL STD_PRINTF
90 POP DI
91 CALL INBUF ; GET A BUFFER
92 CALL SCANB
93 JNZ OPLOOK
94 RET ; if empty just return
95
96; At this point ds:si points to the opcode mnemonic...
97OPLOOK:
98 XOR CX,CX ; OP-CODE COUNT = 0
99 MOV DI,OFFSET DG:DBMN
100OPSCAN:
101 XOR BX,BX
102OPLOOP:
103 MOV AL,[DI+BX]
104 CMP AL,[SI+BX]
105 JZ OPMATCH
106 INC CX ; INCREMENT OP-CODE COUNT
107 CMP CX,MAXOP ; CHECK FOR END OF LIST
108 JB OP1
109 JMP ASMERR
110OP1:
111 INC DI ; SCAN FOR NEXT OP-CODE...
112 CMP BYTE PTR [DI-1],0
113 JNZ OP1
114 JMP OPSCAN
115
116OPMATCH:
117 INC BX ; COMPARE NEXT CHAR
118 CMP BYTE PTR [DI+BX],0 ; ARE WE DONE?
119 JNZ OPLOOP ; ..IF NOT KEEP COMPARING
120 XCHG BX,CX
121 MOV AX,BX
122 SHL AX,1
123 ADD AX,BX
124 ADD AX,OFFSET DG:OPTAB
125 MOV BX,AX
126
127; CX = COUNT OF CHARS IN OPCODE
128; BX = POINTER INTO OPCODE TABLE
129
130 XOR AX,AX
131 MOV BYTE PTR [AWORD],AL
132 MOV WORD PTR [MOVFLG],AX ; MOVFLG + TSTFLG
133 MOV BYTE PTR [SEGFLG],AL ; ZERO SEGMENT REGISTER FLAG
134 MOV AH,00001010B ; SET UP FOR AA_OPER
135 MOV AL,BYTE PTR [BX]
136 MOV WORD PTR [ASSEM1],AX
137 MOV BYTE PTR [ASSEM_CNT],1
138
139 ADD SI,CX ; SI POINTS TO OPERAND
140 JMP WORD PTR [BX+1]
141
142; 8087 INSTRUCTIONS WITH NO OPERANDS
143
144FDE_OPER:
145 MOV AH,0DEH
146 JMP SHORT FDX_OPER
147FDB_OPER:
148 MOV AH,0DBH
149 JMP SHORT FDX_OPER
150FD9_OPER:
151 MOV AH,0D9H
152FDX_OPER:
153 XCHG AL,AH
154 MOV WORD PTR [ASSEM1],AX
155
156; AAD AND AAM INSTRUCIONS
157
158AA_OPER:
159 INC BYTE PTR [ASSEM_CNT]
160
161; INSTRUCTIONS WITH NO OPERANDS
162
163NO_OPER:
164 CALL STUFF_BYTES
165 CALL SCANP
166 PUSH CS
167 POP ES
168 JNZ OPLOOK
169 JMP ASSEMLOOP
170
171; PUSH INSTRUCTION
172
173PUSH_OPER:
174 MOV AH,11111111B
175 JMP SHORT POP1
176
177; POP INSTRUCTION
178
179POP_OPER:
180 MOV AH,10001111B
181POP1:
182 MOV [ASSEM1],AH
183 MOV [MIDFLD],AL
184 INC BYTE PTR [MOVFLG] ; ALLOW SEGMENT REGISTERS
185 MOV BYTE PTR [AWORD],2 ; MUST BE 16 BITS
186 CALL GETREGMEM
187 CALL BUILDIT
188 MOV AL,[DI+2]
189 CMP AL,11000000B
190 JB DATRET
191 MOV BYTE PTR [DI],1
192 CMP BYTE PTR [MOVFLG],2
193 JNZ POP2
194 AND AL,00011000B
195 OR AL,00000110B
196 CMP BYTE PTR [MIDFLD],0
197 JNZ POP3
198 OR AL,00000001B
199 JMP SHORT POP3
200
201POP2:
202 AND AL,MASKRM
203 OR AL,01010000B
204 CMP BYTE PTR [MIDFLD],0
205 JNZ POP3
206 OR AL,01011000B
207POP3:
208 MOV BYTE PTR [DI+1],AL
209 JMP ASSEM_EXIT
210
211; RET AND RETF INSTRUCTIONS
212
213GET_DATA16:
214 CALL SCANB
215 MOV CX,4
216 CALL GETHX
217 JC DATRET
218 DEC BYTE PTR [ASSEM1] ; CHANGE OP-CODE
219 ADD BYTE PTR [ASSEM_CNT],2 ; UPDATE LENGTH
220 MOV WORD PTR [ASSEM2],DX ; SAVE OFFSET
221DATRET:
222 JMP ASSEM_EXIT
223
224
225; INT INSTRUCTION
226
227INT_OPER:
228 CALL SCANB
229 MOV CX,2
230 CALL GETHX
231 JC ERRV1
232 MOV AL,DL
233 CMP AL,3
234 JZ DATRET
235 INC BYTE PTR [ASSEM1]
236 JMP DISPX
237
238; IN INSTRUCTION
239
240IN_OPER:
241 CALL SCANB
242 LODSW
243 CMP AX,'A'+4C00H ; "AL"
244 JZ IN_1
245 CMP AX,'A'+5800H ; "AX"
246 JZ IN_0
247ERRV1:
248 JMP ASMERR
249IN_0:
250 INC BYTE PTR [ASSEM1]
251IN_1:
252 CALL SCANP
253 CMP WORD PTR [SI],'D'+5800H ; "DX"
254 JZ DATRET
255 MOV CX,2
256 CALL GETHX
257 JC ERRV1
258 AND BYTE PTR [ASSEM1],11110111B
259 MOV AL,DL
260 JMP DISPX
261
262; OUT INSTRUCTION
263
264OUT_OPER:
265 CALL SCANB
266 CMP WORD PTR [SI],'D'+5800H ; "DX"
267 JNZ OUT_0
268 INC SI
269 INC SI
270 JMP SHORT OUT_1
271OUT_0:
272 AND BYTE PTR [ASSEM1],11110111B
273 MOV CX,2
274 CALL GETHX
275 JC ERRV1
276 INC BYTE PTR [ASSEM_CNT]
277 MOV BYTE PTR [ASSEM2],DL
278OUT_1:
279 CALL SCANP
280 LODSW
281 CMP AX,'A'+4C00H ; "AL"
282 JZ DATRET
283 CMP AX,'A'+5800H ; "AX"
284 JNZ ERRV1
285 INC BYTE PTR [ASSEM1]
286 JMP DATRET
287
288
289; JUMP INSTRUCTION
290
291JMP_OPER:
292 INC BYTE PTR [TSTFLG]
293
294; CALL INSTRUCTION
295
296CALL_OPER:
297 MOV BYTE PTR [ASSEM1],11111111B
298 MOV BYTE PTR [MIDFLD],AL
299 CALL GETREGMEM
300 CALL BUILD3
301 CMP BYTE PTR [MEMFLG],0
302 JNZ CALLJ1
303 CMP BYTE PTR [REGMEM],-1
304 JZ CALLJ2
305
306; INDIRECT JUMPS OR CALLS
307
308CALLJ1:
309 CMP BYTE PTR [AWORD],1
310ERRZ4:
311 JZ ERRV1
312 CMP BYTE PTR [AWORD],4
313 JNZ ASMEX4
314 OR BYTE PTR [DI+2],1000B
315 JMP SHORT ASMEX4
316
317; DIRECT JUMPS OR CALLS
318
319CALLJ2:
320 MOV AX,[LOWNUM]
321 MOV DX,[HINUM]
322 MOV BL,[AWORD]
323 CMP BYTE PTR [NUMFLG],0
324 JZ ERRZ4
325
326; BL = NUMBER OF BYTES IN JUMP
327; DX = OFFSET
328; AX = SEGMENT
329
330CALLJ3:
331 MOV BYTE PTR [DI],5
332 MOV [DI+2],AX
333 MOV [DI+4],DX
334
335 MOV AL,10011010B ; SET UP INTER SEGMENT CALL
336 CMP BYTE PTR [TSTFLG],0
337 JZ CALLJ5
338 MOV AL,11101010B ; FIX UP FOR JUMP
339CALLJ5:
340 MOV BYTE PTR [DI+1],AL
341 CMP BL,4 ; FAR SPECIFIED?
342 JZ ASMEX4
343 OR BL,BL
344 JNZ CALLJ6
345 CMP DX,WORD PTR [ASMADD+2] ; DIFFERENT SEGMENT?
346 JNZ ASMEX4
347
348CALLJ6:
349 MOV BYTE PTR [DI],3
350 MOV AL,11101000B ; SET UP FOR INTRASEGMENT
351 OR AL,[TSTFLG]
352 MOV BYTE PTR [DI+1],AL
353
354 MOV AX,[LOWNUM]
355 SUB AX,WORD PTR [ASMADD]
356 SUB AX,3
357 MOV [DI+2],AX
358 CMP BYTE PTR [TSTFLG],0
359 JZ ASMEX4
360 CMP BL,2
361 JZ ASMEX4
362
363 INC AX
364 MOV CX,AX
365 CBW
366 CMP AX,CX
367 JNZ ASMEX3
368 MOV BYTE PTR [DI+1],11101011B
369 MOV [DI+2],AX
370 DEC BYTE PTR [DI]
371ASMEX4:
372 JMP ASSEM_EXIT
373
374; CONDITIONAL JUMPS AND LOOP INSTRUCTIONS
375
376DISP8_OPER:
377 MOV BP,WORD PTR [ASMADD+2] ; GET DEFAULT DISPLACEMENT
378 CALL GET_ADDRESS
379 SUB DX,WORD PTR [ASMADD]
380 DEC DX
381 DEC DX
382 CALL CHKSIZ
383 CMP CL,1
384 JNZ ERRV2
385DISPX:
386 INC [ASSEM_CNT]
387 MOV BYTE PTR [ASSEM2],AL
388ASMEX3:
389 JMP ASSEM_EXIT
390
391; LDS, LES, AND LEA INSTRUCTIONS
392
393L_OPER:
394 CALL SCANB
395 LODSW
396 MOV CX,8
397 MOV DI,OFFSET DG:REG16
398 CALL CHKREG
399 JZ ERRV2 ; CX = 0 MEANS NO REGISTER
400 SHL AL,1
401 SHL AL,1
402 SHL AL,1
403 MOV BYTE PTR [MIDFLD],AL
404 CALL SCANP
405 CALL GETREGMEM
406 CMP BYTE PTR [AWORD],0
407 JNZ ERRV2
408 CALL BUILD2
409 JMP SHORT ASEXV
410
411; DEC AND INC INSTRUCTIONS
412
413DCINC_OPER:
414 MOV BYTE PTR [ASSEM1],11111110B
415 MOV BYTE PTR [MIDFLD],AL
416 CALL GETREGMEM
417 CALL BUILDIT
418 TEST BYTE PTR [DI+1],1
419 JZ ASEXV
420 MOV AL,[DI+2]
421 CMP AL,MASKMOD
422 JB ASEXV
423 AND AL,1111B
424 OR AL,01000000B
425 MOV [DI+1],AL
426 DEC BYTE PTR [DI]
427ASEXV:
428 JMP ASSEM_EXIT
429
430ERRV2:
431 JMP ASMERR
432
433; ESC INSTRUCTION
434
435ESC_OPER:
436 INC BYTE PTR [AWORD]
437 CALL SCANB
438 MOV CX,2
439 CALL GETHX
440 CMP DX,64
441 JAE ERRV2
442 CALL SCANP
443 MOV AX,DX
444 MOV CL,3
445 SHR DX,CL
446 OR [ASSEM1],DL
447 AND AL,111B
448 SHL AL,CL
449 JMP GROUPE
450
451; 8087 ARITHMETIC INSTUCTIONS
452
453; OPERANDS THAT ALLOW THE REVERSE BIT
454
455FGROUPDS:
456 CALL SETMID
457 CALL GETREGMEM2
458 CALL BUILD3
459 CMP BYTE PTR [MODE],11000000B
460 JNZ FGROUP1
461 MOV AL,[DIRFLG]
462 OR AL,AL
463 JZ FEXIT
464 OR [DI+1],AL ; IF D=1...
465 XOR BYTE PTR [DI+2],00001000B ; ...REVERSE THE SENSE OF R
466 JMP SHORT FEXIT
467
468; HERE WHEN INSTRUCTION COULD HAVE MEMORY OR REGISTER OPERAND
469
470FGROUPX:
471 CALL SETMID ; THIS ENTRY POINT FOR 1 MEM OPER
472 MOV BYTE PTR [DIRFLG],0
473 JMP SHORT FGRP2
474FGROUP:
475 CALL SETMID
476FGRP2:
477 CALL GETREGMEM2
478 CALL BUILD3
479 CMP BYTE PTR [MODE],11000000B
480 JNZ FGROUP1
481 MOV AL,[DIRFLG]
482 OR [DI+1],AL
483 JMP SHORT FEXIT
484FGROUP1:
485 CALL SETMF
486FEXIT:
487 JMP ASSEM_EXIT
488
489; THESE 8087 INSTRUCTIONS REQUIRE A MEMORY OPERAND
490FGROUPB:
491 MOV AH,5 ; MUST BE TBYTE
492 JMP SHORT FGROUP3E
493FGROUP3W:
494 MOV AH,2 ; MUST BE WORD
495 JMP SHORT FGROUP3E
496FGROUP3:
497 MOV AH,-1 ; SIZE CANNOT BE SPECIFIED
498FGROUP3E:
499 MOV [AWORD],AH
500 CALL SETMID
501 CALL GETREGMEM
502 CMP BYTE PTR [MODE],11000000B
503 JZ FGRPERR
504FGRP:
505 CALL BUILD3
506 JMP FEXIT
507
508; THESE 8087 INSTRUCTIONS REQUIRE A REGISTER OPERAND
509FGROUPP: ; 8087 POP OPERANDS
510 MOV BYTE PTR [AWORD],-1
511 CALL SETMID
512 CALL GETREGMEM2
513 CMP BYTE PTR [DIRFLG],0
514 JNZ FGRP
515FGRPERR:
516 JMP ASMERR
517
518FGROUPZ: ; ENTRY POINT WHERE ARG MUST BE MEM
519 CALL SETMID
520 MOV BYTE PTR [DIRFLG],0
521 CALL GETREGMEM
522 CMP BYTE PTR [MODE],11000000B
523 JZ FGRPERR
524 CALL BUILD3
525 CALL SETMF
526 JMP FEXIT
527
528; NOT, NEG, MUL, IMUL, DIV, AND IDIV INSTRUCTIONS
529
530GROUP1:
531 MOV [ASSEM1],11110110B
532GROUPE:
533 MOV BYTE PTR [MIDFLD],AL
534 CALL GETREGMEM
535 CALL BUILDIT
536 JMP FEXIT
537
538; SHIFT AND ROTATE INSTRUCTIONS
539
540ROTOP:
541 MOV [ASSEM1],11010000B
542 MOV BYTE PTR [MIDFLD],AL
543 CALL GETREGMEM
544 CALL BUILDIT
545 CALL SCANP
546 CMP BYTE PTR [SI],'1'
547 JZ ASMEXV1
548 CMP WORD PTR [SI],"LC" ; CL
549 JZ ROTOP1
550ROTERR:
551 JMP ASMERR
552ROTOP1:
553 OR BYTE PTR [ASSEM1],10B
554ASMEXV1:
555 JMP ASSEM_EXIT
556
557; XCHG INSTRUCTION
558
559EX_OPER:
560 INC BYTE PTR [TSTFLG]
561
562; TEST INSTRUCTION
563
564TST_OPER:
565 INC BYTE PTR [TSTFLG]
566 JMP SHORT MOVOP
567
568; MOV INSTRUCTION
569
570MOV_OPER:
571 INC BYTE PTR [MOVFLG]
572MOVOP:
573 XOR AX,AX
574 JMP SHORT GROUPM
575
576; ADD, ADC, SUB, SBB, CMP, AND, OR, XOR instructions
577
578GROUP2:
579 MOV BYTE PTR [ASSEM1],10000000B
580GROUPM:
581 MOV BYTE PTR [MIDFLD],AL
582
583 PUSH AX
584 CALL GETREGMEM
585 CALL BUILD2
586 CALL SCANP ; POINT TO NEXT OPERAND
587 MOV AL,BYTE PTR [ASSEM_CNT]
588 PUSH AX
589 CALL GETREGMEM
590 POP AX
591 MOV BYTE PTR [DI],AL
592 POP AX
593 MOV BL,BYTE PTR [AWORD]
594 OR BL,BL
595 JZ ERRV5
596 DEC BL
597 AND BL,1
598 OR BYTE PTR [DI+1],BL
599
600 CMP BYTE PTR [MEMFLG],0
601 JNZ G21V
602 CMP BYTE PTR [NUMFLG],0 ; TEST FOR IMMEDIATE DATA
603 JZ G21V
604 CMP BYTE PTR [SEGFLG],0
605 JNZ ERRV5
606 CMP BYTE PTR [TSTFLG],2 ; XCHG?
607 JNZ IMMED1
608ERRV5:
609 JMP ASMERR
610G21V:
611 JMP GRP21
612
613; SECOND OPERAND WAS IMMEDIATE
614
615IMMED1:
616 MOV AL,BYTE PTR [DI+2]
617 CMP BYTE PTR [MOVFLG],0
618 JZ NOTMOV1
619 AND AL,11000000B
620 CMP AL,11000000B
621 JNZ GRP23 ; not to a register
622 ; MOVE IMMEDIATE TO REGISTER
623 MOV AL,BYTE PTR [DI+1]
624 AND AL,1 ; SET SIZE
625 PUSHF
626 SHL AL,1
627 SHL AL,1
628 SHL AL,1
629 OR AL,BYTE PTR [DI+2] ; SET REGISTER
630 AND AL,00001111B
631 OR AL,10110000B
632 MOV BYTE PTR [DI+1],AL
633 MOV AX,WORD PTR [LOWNUM]
634 MOV WORD PTR [DI+2],AX
635 POPF
636 JZ EXVEC
637 INC BYTE PTR [DI]
638EXVEC:
639 JMP GRPEX
640
641NOTMOV1:
642 AND AL,11000111B
643 CMP AL,11000000B
644 JZ IMMACC ; IMMEDIATE TO ACC
645
646 CMP BYTE PTR [TSTFLG],0
647 JNZ GRP23
648 CMP BYTE PTR [MIDFLD],1*8 ; OR?
649 JZ GRP23
650 CMP BYTE PTR [MIDFLD],4*8 ; AND?
651 JZ GRP23
652 CMP BYTE PTR [MIDFLD],6*8 ; XOR?
653 JZ GRP23
654 TEST BYTE PTR [DI+1],1 ; TEST IF BYTE OPCODE
655 JZ GRP23
656
657 MOV AX,[LOWNUM]
658 MOV BX,AX
659 CBW
660 CMP AX,BX
661 JNZ GRP23 ; SMALL ENOUGH?
662
663 MOV BL,[DI]
664 DEC BYTE PTR [DI]
665 OR BYTE PTR [DI+1],10B
666 JMP SHORT GRP23X
667
668IMMACC:
669 MOV AL,BYTE PTR [DI+1]
670 AND AL,1
671 CMP BYTE PTR [TSTFLG],0
672 JZ NOTTST
673 OR AL,10101000B
674 JMP SHORT TEST1
675NOTTST:
676 OR AL,BYTE PTR [MIDFLD]
677 OR AL,100B
678TEST1:
679 MOV BYTE PTR [DI+1],AL
680 DEC BYTE PTR [DI]
681
682GRP23:
683 MOV BL,BYTE PTR [DI]
684GRP23X:
685 XOR BH,BH
686 ADD BX,DI
687 INC BX
688 MOV AX,WORD PTR [LOWNUM]
689 MOV WORD PTR [BX],AX
690 INC BYTE PTR [DI]
691 TEST BYTE PTR [DI+1],1
692 JZ GRPEX1
693 INC BYTE PTR [DI]
694GRPEX1:
695 JMP GRPEX
696
697; SECOND OPERAND WAS MEMORY OR REGISTER
698
699GRP21:
700 CMP BYTE PTR [SEGFLG],0
701 JZ GRP28 ; FIRST OPERAND WAS A SEGMENT REG
702 MOV AL,BYTE PTR [REGMEM]
703 TEST AL,10000B
704 JZ NOTSEG1
705ERRV3:
706 JMP ASMERR
707NOTSEG1:
708 AND AL,111B
709 OR BYTE PTR [DI+2],AL
710 AND BYTE PTR [DI+1],11111110B
711 CMP BYTE PTR [MEMFLG],0
712 JNZ G22V
713 JMP GRPEX
714
715GRP28:
716 AND BYTE PTR [DI+2],11000111B
717 MOV AL,BYTE PTR [DI+1] ; GET FIRST OPCODE
718 AND AL,1B
719 CMP BYTE PTR [MOVFLG],0
720 JZ NOTMOV2
721 OR AL,10001000B
722 JMP SHORT MOV1
723NOTMOV2:
724 CMP BYTE PTR [TSTFLG],0
725 JZ NOTTST2
726 OR AL,10000100B
727 CMP BYTE PTR [TSTFLG],2
728 JNZ NOTTST2
729 OR AL,10B
730NOTTST2:
731 OR AL,BYTE PTR [MIDFLD] ; MIDFLD IS ZERO FOR TST
732MOV1:
733 MOV BYTE PTR [DI+1],AL
734 CMP BYTE PTR [MEMFLG],0
735G22V:
736 JZ NotGRP22
737 JMP GRP22
738NotGRP22:
739
740; SECOND OPERAND WAS A REGISTER
741
742 MOV AL,BYTE PTR [REGMEM]
743 TEST AL,10000B ; SEGMENT REGISTER?
744 JZ NOTSEG
745 CMP BYTE PTR [MOVFLG],0
746 JZ ERRV3
747 MOV BYTE PTR [DI+1],10001100B
748
749NOTSEG:
750 AND AL,111B
751 SHL AL,1
752 SHL AL,1
753 SHL AL,1
754 OR BYTE PTR [DI+2],AL
755; ARR 2.4
756; In the case of the XCHG reg,reg and TEST reg,reg we have just built the
757; instruction backwards. This is because these two instructions do not have
758; the D bit. We need to switch R/S and REG
759;
760; Good comment Aaron, except that we do NOT switch if a memory operand was
761; present for precisely the reason that the D bit is not present
762;
763 CMP BYTE PTR [TSTFLG],0
764 JZ NOSWITCH ; Not XCHG or TEST
765;
766; See if there is a memory operand specified. If the MOD field is 11, then
767; we do perform the exchange.
768;
769 MOV AH,[DI+2]
770 AND AH,MASKMOD
771 CMP AH,MASKMOD
772 JNZ NOSWITCH
773 MOV AH,BYTE PTR [DI+2]
774 AND AH,MASKRM
775 SHL AH,1 ; Low three bits to middle three
776 SHL AH,1
777 SHL AH,1
778 MOV AL,BYTE PTR [DI+2]
779 AND AL,MASKREG
780 SHR AL,1 ; Middle three to low three
781 SHR AL,1
782 SHR AL,1
783 OR AL,AH ; Re combine
784 AND BYTE PTR [DI+2],MASKMOD ; Zap original
785 OR BYTE PTR [DI+2],AL ; New low 6 bits
786NOSWITCH:
787
788
789; SPECIAL FORM OF THE EXCHANGE COMMAND
790
791 CMP BYTE PTR [TSTFLG],2
792 JNZ GRPEX
793 TEST BYTE PTR [DI+1],1
794 JZ GRPEX
795 PUSH AX
796 MOV AL,BYTE PTR [DI+2]
797 AND AL,MASKMOD
798 CMP AL,MASKMOD ; MUST BE REGISTER TO REGISTER
799 POP AX
800 JB GRPEX
801 OR AL,AL
802 JZ SPECX
803 MOV AL,[DI+2]
804 AND AL,MASKRM
805 JNZ GRPEX
806 MOV CL,3
807 SHR BYTE PTR [DI+2],CL
808SPECX:
809 MOV AL,[DI+2]
810 AND AL,MASKRM
811 OR AL,10010000B
812 MOV BYTE PTR [DI+1],AL
813 DEC BYTE PTR [DI]
814 JMP SHORT GRPEX
815
816; SECOND OPERAND WAS A MEMORY REFERENCE
817
818GRP22:
819 CMP BYTE PTR [TSTFLG],0
820 JNZ TST2
821 OR BYTE PTR [DI+1],10B
822TST2:
823 MOV AL,BYTE PTR [DI+2]
824 CMP AL,MASKMOD ; MUST BE A REGISTER
825 JB ASMERR
826 CMP BYTE PTR [SEGFLG],0
827 JZ GRP223
828 AND AL,00011000B
829 JMP SHORT GRP222
830GRP223:
831 AND AL,MASKRM
832 SHL AL,1
833 SHL AL,1
834 SHL AL,1
835GRP222:
836 OR AL,BYTE PTR [MODE]
837 OR AL,BYTE PTR [REGMEM]
838 MOV BYTE PTR [DI+2],AL
839 MOV AX,WORD PTR [LOWNUM]
840 MOV WORD PTR [DI+3],AX
841GRPSIZ:
842 MOV BYTE PTR [DI],2
843 MOV AL,BYTE PTR [DI+2]
844 AND AL,11000111B
845 CMP AL,00000110B
846 JZ GRP24
847 AND AL,MASKMOD
848 CMP AL,01000000B
849 JZ GRP25
850 CMP AL,10000000B
851 JNZ GRPEX
852GRP24:
853 INC BYTE PTR [DI]
854GRP25:
855 INC BYTE PTR [DI]
856
857GRPEX:
858 CMP BYTE PTR [MOVFLG],0
859 JZ ASSEM_EXIT
860
861; TEST FOR SPECIAL FORM OF MOV AX,[MEM] OR MOV [MEM],AX
862
863 MOV AL,[DI+1] ; GET OP-CODE
864 AND AL,11111100B
865 CMP AL,10001000B
866 JNZ ASSEM_EXIT
867 CMP BYTE PTR [DI+2],00000110B ; MEM TO AX OR AX TO MEM
868 JNZ ASSEM_EXIT
869 MOV AL,BYTE PTR [DI+1]
870 AND AL,11B
871 XOR AL,10B
872 OR AL,10100000B
873 MOV BYTE PTR [DI+1],AL
874 DEC BYTE PTR [DI]
875 MOV AX,[DI+3]
876 MOV WORD PTR [DI+2],AX
877
878ASSEM_EXIT:
879 CALL STUFF_BYTES
880 JMP ASSEMLOOP
881
882; Assem error. SI points to character in the input buffer
883; which caused error. By subtracting from start of buffer,
884; we will know how far to tab over to appear directly below
885; it on the terminal. Then print "^ Error".
886
887ASMERR:
888 SUB SI,OFFSET DG:(BYTEBUF-10) ; How many char processed so far?
889 MOV CX,SI ; Parameter for TAB in CX
890 MOV DI,OFFSET DG:ARG_BUF
891 CALL TAB ; Directly below bad char
892 MOV BYTE PTR [DI],0
893 MOV DX,OFFSET DG:SYNERR_PTR ; Error message
894 CALL PRINTF_CRLF
895 JMP ASSEMLOOP
896;
897; assemble the different parts into an instruction
898;
899BUILDIT:
900 MOV AL,BYTE PTR [AWORD]
901 OR AL,AL
902 JNZ BUILD1
903BLDERR:
904 JMP ASMERR
905
906BUILD1:
907 DEC AL
908 OR BYTE PTR [DI+1],AL ; SET THE SIZE
909
910BUILD2:
911 CMP BYTE PTR [NUMFLG],0 ; TEST FOR IMMEDIATE DATA
912 JZ BUILD3
913 CMP BYTE PTR [MEMFLG],0
914 JZ BLDERR
915
916BUILD3:
917 MOV AL,BYTE PTR [REGMEM]
918 CMP AL,-1
919 JZ BLD1
920 TEST AL,10000B ; TEST IF SEGMENT REGISTER
921 JZ BLD1
922 CMP BYTE PTR [MOVFLG],0
923 JZ BLDERR
924 MOV WORD PTR [DI+1],10001110B
925 INC BYTE PTR [MOVFLG]
926 INC BYTE PTR [SEGFLG]
927 AND AL,00000011B
928 SHL AL,1
929 SHL AL,1
930 SHL AL,1
931 OR AL,MASKMOD
932 MOV BYTE PTR [DI+2],AL
933 RET
934
935BLD1:
936 AND AL,00000111B
937BLD4:
938 OR AL,BYTE PTR [MODE]
939 OR AL,BYTE PTR [MIDFLD]
940 MOV BYTE PTR [DI+2],AL
941 MOV AX,WORD PTR [LOWNUM]
942 MOV WORD PTR [DI+3],AX
943 RET
944
945GETREGMEM:
946 MOV BYTE PTR [F8087],0
947GETREGMEM2:
948 CALL SCANP
949 XOR AX,AX
950 MOV WORD PTR [LOWNUM],AX ; OFFSET
951 MOV WORD PTR [DIFLG],AX ; DIFLG+SIFLG
952 MOV WORD PTR [BXFLG],AX ; BXFLG+BPFLG
953 MOV WORD PTR [NEGFLG],AX ; NEGFLG+NUMFLG
954 MOV WORD PTR [MEMFLG],AX ; MEMFLG+REGFLG
955 DEC AL
956 CMP BYTE PTR [F8087],0
957 JZ PUTREG
958 MOV AL,1 ; DEFAULT 8087 REG IS 1
959PUTREG:
960 MOV BYTE PTR [REGMEM],AL
961
962GETLOOP:
963 MOV BYTE PTR [NEGFLG],0
964GETLOOP1:
965 MOV AX,WORD PTR [SI]
966 CMP AL,','
967 JZ GOMODE
968 CMP AL,13
969 JZ GOMODE
970 CMP AL,';'
971 JZ GOMODE
972 CMP AL,9
973 JZ GETTB
974 CMP AL,' '
975 JNZ GOGET
976GETTB:
977 INC SI
978 JMP GETLOOP1
979GOGET:
980 JMP GETINFO
981
982; DETERMINE THE MODE BITS
983
984GOMODE:
985 MOV DI,OFFSET DG:ASSEM_CNT
986 MOV BYTE PTR [MODE],11000000B
987 MOV BYTE PTR [ASSEM_CNT],2
988 CMP BYTE PTR [MEMFLG],0
989 JNZ GOMODE1
990 MOV AL,[NUMFLG]
991 OR AL,[REGFLG]
992 JNZ MORET
993 OR AL,[F8087]
994 JZ ERRET
995 MOV AL,[DI+1]
996 OR AL,[DIRFLG]
997 CMP AL,0DCH ; ARITHMETIC?
998 JNZ MORET
999 MOV BYTE PTR [DI+1],0DEH ; ADD POP TO NULL ARG 8087
1000MORET:
1001 RET
1002ERRET:
1003 JMP ASMERR
1004
1005GOMODE1:
1006 MOV BYTE PTR [MODE],0
1007 CMP BYTE PTR [NUMFLG],0
1008 JZ GOREGMEM
1009
1010 MOV BYTE PTR [DI],4
1011 MOV AX,WORD PTR [DIFLG]
1012 OR AX,WORD PTR [BXFLG]
1013 JNZ GOMODE2
1014 MOV BYTE PTR [REGMEM],00000110B
1015 RET
1016
1017GOMODE2:
1018 MOV BYTE PTR [MODE],10000000B
1019 CALL CHKSIZ1
1020 CMP CL,2
1021 JZ GOREGMEM
1022 DEC BYTE PTR [DI]
1023 MOV BYTE PTR [MODE],01000000B
1024
1025; DETERMINE THE REG-MEM BITS
1026
1027GOREGMEM:
1028 MOV BX,WORD PTR [BXFLG]
1029 MOV CX,WORD PTR [DIFLG]
1030 XOR DX,DX
1031GOREG0:
1032 MOV AL,BL ; BX
1033 ADD AL,CH ; SI
1034 CMP AL,2
1035 JZ GOGO
1036 INC DL
1037 MOV AL,BL
1038 ADD AL,CL
1039 CMP AL,2
1040 JZ GOGO
1041 INC DL
1042 MOV AL,BH
1043 ADD AL,CH
1044 CMP AL,2
1045 JZ GOGO
1046 INC DL
1047 MOV AL,BH
1048 ADD AL,CL
1049 CMP AL,2
1050 JZ GOGO
1051 INC DL
1052 OR CH,CH
1053 JNZ GOGO
1054 INC DL
1055 OR CL,CL
1056 JNZ GOGO
1057 INC DL ; BP+DISP
1058 OR BH,BH
1059 JZ GOREG1
1060 CMP BYTE PTR [MODE],0
1061 JNZ GOGO
1062 MOV BYTE PTR [MODE],01000000B
1063 INC BYTE PTR [DI]
1064 DEC DL
1065GOREG1:
1066 INC DL ; BX+DISP
1067GOGO:
1068 MOV BYTE PTR [REGMEM],DL
1069 RET
1070
1071GETINFO:
1072 CMP AX,'EN' ; NEAR
1073 JNZ GETREG3
1074GETREG0:
1075 MOV DL,2
1076GETRG01:
1077 CALL SETSIZ1
1078GETREG1:
1079 CALL SCANS
1080 MOV AX,WORD PTR [SI]
1081 CMP AX,"TP" ; PTR
1082 JZ GETREG1
1083 JMP GETLOOP
1084
1085GETREG3:
1086 MOV CX,5
1087 MOV DI,OFFSET DG:SIZ8
1088 CALL CHKREG ; LOOK FOR BYTE, WORD, DWORD, ETC.
1089 JZ GETREG41
1090 INC AL
1091 MOV DL,AL
1092 JMP GETRG01
1093
1094GETREG41:
1095 MOV AX,[SI]
1096 CMP BYTE PTR [F8087],0
1097 JZ GETREG5
1098 CMP AX,"TS" ; 8087 STACK OPERAND
1099 JNZ GETREG5
1100 CMP BYTE PTR [SI+2],','
1101 JNZ GETREG5
1102 MOV BYTE PTR [DIRFLG],0
1103 ADD SI,3
1104 JMP GETLOOP
1105
1106GETREG5:
1107 CMP AX,"HS" ; SHORT
1108 JZ GETREG1
1109
1110 CMP AX,"AF" ; FAR
1111 JNZ GETRG51
1112 CMP BYTE PTR [SI+2],'R'
1113 JNZ GETRG51
1114 ADD SI,3
1115 MOV DL,4
1116 JMP GETRG01
1117
1118GETRG51:
1119 CMP AL,'['
1120 JNZ GETREG7
1121GETREG6:
1122 INC BYTE PTR [MEMFLG]
1123GETREGADD:
1124 INC SI
1125 JMP GETLOOP
1126
1127GETREG7:
1128 CMP AL,']'
1129 JZ GETREG6
1130 CMP AL,'.'
1131 JZ GETREG6
1132 CMP AL,'+'
1133 JZ GETREGAdd
1134 CMP AL,'-'
1135 JNZ GETREG8
1136 INC BYTE PTR [NEGFLG]
1137 INC SI
1138 JMP GETLOOP1
1139
1140GETREG8: ; LOOK FOR A REGISTER
1141 CMP BYTE PTR [F8087],0
1142 JZ GETREGREG
1143 CMP AX,"TS"
1144 JNZ GETREGREG
1145 CMP BYTE PTR [SI+2],'('
1146 JNZ GETREGREG
1147 CMP BYTE PTR [SI+4],')'
1148 JNZ ASMPOP
1149 MOV AL,[SI+3]
1150 SUB AL,'0'
1151 JB ASMPOP
1152 CMP AL,7
1153 JA ASMPOP
1154 MOV [REGMEM],AL
1155 INC BYTE PTR [REGFLG]
1156 ADD SI,5
1157 CMP WORD PTR [SI],"S,"
1158 JNZ ZLOOP
1159 CMP BYTE PTR [SI+2],'T'
1160 JNZ ZLOOP
1161 ADD SI,3
1162ZLOOP:
1163 JMP GETLOOP
1164
1165GETREGREG:
1166 MOV CX,20
1167 MOV DI,OFFSET DG:REG8
1168 CALL CHKREG
1169 JZ GETREG12 ; CX = 0 MEANS NO REGISTER
1170 MOV BYTE PTR [REGMEM],AL
1171 INC BYTE PTR [REGFLG] ; TELL EVERYONE WE FOUND A REG
1172 CMP BYTE PTR [MEMFLG],0
1173 JNZ NOSIZE
1174 CALL SETSIZ
1175INCSI2:
1176 ADD SI,2
1177 JMP GETLOOP
1178
1179NOSIZE:
1180 CMP AL,11 ; BX REGISTER?
1181 JNZ GETREG9
1182 CMP WORD PTR [BXFLG],0
1183 JZ GETOK
1184ASMPOP:
1185 JMP ASMERR
1186
1187GETOK:
1188 INC BYTE PTR [BXFLG]
1189 JMP INCSI2
1190GETREG9:
1191 CMP AL,13 ; BP REGISTER?
1192 JNZ GETREG10
1193 CMP WORD PTR [BXFLG],0
1194 JNZ ASMPOP
1195 INC BYTE PTR [BPFLG]
1196 JMP INCSI2
1197GETREG10:
1198 CMP AL,14 ; SI REGISTER?
1199 JNZ GETREG11
1200 CMP WORD PTR [DIFLG],0
1201 JNZ ASMPOP
1202 INC BYTE PTR [SIFLG]
1203 JMP INCSI2
1204GETREG11:
1205 CMP AL,15 ; DI REGISTER?
1206 JNZ ASMPOP ; *** error
1207 CMP WORD PTR [DIFLG],0
1208 JNZ ASMPOP
1209 INC BYTE PTR [DIFLG]
1210 JMP INCSI2
1211
1212GETREG12: ; BETTER BE A NUMBER!
1213 MOV BP,WORD PTR [ASMADD+2]
1214 CMP BYTE PTR [MEMFLG],0
1215 JZ GTRG121
1216GTRG119:
1217 MOV CX,4
1218GTRG120:
1219 CALL GETHX
1220 JMP SHORT GTRG122
1221GTRG121:
1222 MOV CX,2
1223 CMP BYTE PTR [AWORD],1
1224 JZ GTRG120
1225 CMP BYTE PTR [AWORD],CL
1226 JZ GTRG119
1227 CALL GET_ADDRESS
1228GTRG122:
1229 JC ASMPOP
1230 MOV [HINUM],AX
1231 CMP BYTE PTR [NEGFLG],0
1232 JZ GETREG13
1233 NEG DX
1234GETREG13:
1235 ADD WORD PTR [LOWNUM],DX
1236 INC BYTE PTR [NUMFLG]
1237GETLOOPV:
1238 JMP GETLOOP
1239
1240CHKREG:
1241 PUSH CX
1242 INC CX
1243 REPNZ SCASW
1244 POP AX
1245 SUB AX,CX
1246 OR CX,CX
1247 RET
1248
1249STUFF_BYTES:
1250 PUSH SI
1251 LES DI,DWORD PTR ASMADD
1252 MOV SI,OFFSET DG:ASSEM_CNT
1253 XOR AX,AX
1254 LODSB
1255 MOV CX,AX
1256 JCXZ STUFFRET
1257 REP MOVSB
1258 MOV WORD PTR [ASMADD],DI
1259STUFFRET:
1260 POP SI
1261 RET
1262
1263SETSIZ:
1264 MOV DL,1
1265 TEST AL,11000B ; 16 BIT OR SEGMENT REGISTER?
1266 JZ SETSIZ1
1267 INC DL
1268SETSIZ1:
1269 CMP BYTE PTR [AWORD],0
1270 JZ SETSIZ2
1271 CMP BYTE PTR [AWORD],DL
1272 JZ SETSIZ2
1273SETERR:
1274 POP DX
1275 JMP ASMPOP
1276SETSIZ2:
1277 MOV BYTE PTR [AWORD],DL
1278 RET
1279
1280; DETERMINE IF NUMBER IN AX:DX IS 8 BITS, 16 BITS, OR 32 BITS
1281
1282CHKSIZ:
1283 MOV CL,4
1284 CMP AX,BP
1285 JNZ RETCHK
1286CHKSIZ1:
1287 MOV CL,2
1288 MOV AX,DX
1289 CBW
1290 CMP AX,DX
1291 JNZ RETCHK
1292 DEC CL
1293RETCHK:
1294 RET
1295
1296; get first character after first space
1297
1298SCANS:
1299 CMP BYTE PTR [SI],13
1300 JZ RETCHK
1301 CMP BYTE PTR [SI],'['
1302 JZ RETCHK
1303 LODSB
1304 CMP AL,' '
1305 JZ SCANBV
1306 CMP AL,9
1307 JNZ SCANS
1308SCANBV:
1309 JMP SCANB
1310
1311; Set up for 8087 op-codes
1312
1313SETMID:
1314 MOV BYTE PTR [ASSEM1],0D8H
1315 MOV AH,AL
1316 AND AL,111B ; SET MIDDLE BITS OF SECOND BYTE
1317 SHL AL,1
1318 SHL AL,1
1319 SHL AL,1
1320 MOV [MIDFLD],AL
1321 MOV AL,AH ; SET LOWER BITS OF FIRST BYTE
1322 SHR AL,1
1323 SHR AL,1
1324 SHR AL,1
1325 OR [ASSEM1],AL
1326 MOV BYTE PTR [F8087],1 ; INDICATE 8087 OPERAND
1327 MOV BYTE PTR [DIRFLG],100B
1328 RET
1329
1330; Set MF bits for 8087 op-codes
1331
1332SETMF:
1333 MOV AL,[AWORD]
1334 TEST BYTE PTR [DI+1],10B
1335 JNZ SETMFI
1336 AND BYTE PTR [DI+1],11111001B ; CLEAR MF BITS
1337 CMP AL,3 ; DWORD?
1338 JZ SETMFRET
1339 CMP AL,4 ; QWORD?
1340 JZ SETMFRET2
1341 TEST BYTE PTR [DI+1],1
1342 JZ SETMFERR
1343 CMP AL,5 ; TBYTE?
1344 JZ SETMFRET3
1345 JMP SHORT SETMFERR
1346
1347SETMFI:
1348 CMP AL,3 ; DWORD?
1349 JZ SETMFRET
1350 CMP AL,2 ; WORD?
1351 JZ SETMFRET2
1352 TEST BYTE PTR [DI+1],1
1353 JZ SETMFERR
1354 CMP AL,4 ; QWORD?
1355 JNZ SETMFERR
1356 OR BYTE PTR [DI+1],111B
1357SETMFRET3:
1358 OR BYTE PTR [DI+1],011B
1359 OR BYTE PTR [DI+2],101000B
1360 JMP SHORT SETMFRET
1361SETMFRET2:
1362 OR BYTE PTR [DI+1],100B
1363SETMFRET:
1364 RET
1365
1366SETMFERR:
1367 JMP ASMPOP
1368
1369
1370DW_OPER:
1371 MOV BP,1
1372 JMP SHORT DBEN
1373
1374DB_OPER:
1375 XOR BP,BP
1376DBEN:
1377 MOV DI,OFFSET DG:ASSEM_CNT
1378 DEC BYTE PTR [DI]
1379 INC DI
1380DB0:
1381 XOR BL,BL
1382 CALL SCANP
1383 JNZ DB1
1384DBEX:
1385 JMP ASSEM_EXIT
1386DB1:
1387 OR BL,BL
1388 JNZ DB3
1389 MOV BH,BYTE PTR [SI]
1390 CMP BH,"'"
1391 JZ DB2
1392 CMP BH,'"'
1393 JNZ DB4
1394DB2:
1395 INC SI
1396 INC BL
1397DB3:
1398 LODSB
1399 CMP AL,13
1400 JZ DBEX
1401 CMP AL,BH
1402 JZ DB0
1403 STOSB
1404 INC BYTE PTR [ASSEM_CNT]
1405 JMP DB3
1406DB4:
1407 MOV CX,2
1408 CMP BP,0
1409 JZ DB41
1410 MOV CL,4
1411DB41:
1412 PUSH BX
1413 CALL GETHX
1414 POP BX
1415 JNC DB5
1416 JMP ASMERR
1417DB5:
1418 MOV AX,DX
1419 CMP BP,0
1420 JZ DB6
1421 STOSW
1422 INC BYTE PTR [ASSEM_CNT]
1423 JMP SHORT DB7
1424DB6:
1425 STOSB
1426DB7:
1427 INC BYTE PTR [ASSEM_CNT]
1428 JMP DB0
1429
1430; ORG pseudo op
1431
1432DOORG:
1433 MOV BP,WORD PTR ASMADD+2
1434 CALL GET_ADDRESS
1435 MOV WORD PTR ASMADD,DX
1436 MOV WORD PTR ASMADD+2,AX
1437 JMP ASSEMLOOP
1438
1439CODE ENDS
1440 END ASSEM
1441 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBCOM1.ASM b/v4.0/src/CMD/DEBUG/DEBCOM1.ASM
new file mode 100644
index 0000000..fda97c0
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBCOM1.ASM
@@ -0,0 +1,969 @@
1 PAGE 60,132 ;
2 TITLE DEBCOM1.ASM - PART1 DEBUGGER COMMANDS PC DOS
3;======================= START OF SPECIFICATIONS =========================
4;
5; MODULE NAME: DECOM1.SAL
6;
7; DESCRIPTIVE NAME: DEBUGGING TOOL
8;
9; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS.
10;
11; ENTRY POINT: ANY CALLED ROUTINE
12;
13; INPUT: NA
14;
15; EXIT NORMAL: NA
16;
17; EXIT ERROR: NA
18;
19; INTERNAL REFERENCES:
20;
21; EXTERNAL REFERENCES:
22;
23; ROUTINE: DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG
24; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG
25; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG
26; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG
27; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG
28;
29; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
30; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
31; DEBCONST+DEBDATA+DEBMES
32;
33; REVISION HISTORY:
34;
35; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
36;
37; - IMPLEMENT DBCS HANDLING DMS:6/17/87
38; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87
39; - IMPLEMENT > 32MB SUPPORT DMS:6/17/87
40;
41; COPYRIGHT: "MS DOS DEBUG UTILITY"
42; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
43; "LICENSED MATERIAL - PROPERTY OF Microsoft "
44;
45;======================= END OF SPECIFICATIONS ===========================
46
47; Routines to perform debugger commands except ASSEMble and UASSEMble
48
49 IF1
50 %OUT COMPONENT=DEBUG, MODULE=DEBCOM1
51 ENDIF
52.XLIST
53.XCREF
54 INCLUDE DOSSYM.INC
55 INCLUDE DEBEQU.ASM
56.CREF
57.LIST
58
59CODE SEGMENT PUBLIC BYTE
60CODE ENDS
61
62CONST SEGMENT PUBLIC BYTE
63 EXTRN SYNERR_PTR:BYTE
64 EXTRN DISPB:WORD,DSIZ:BYTE,DSSAVE:WORD
65 IF SYSVER
66 EXTRN CIN:DWORD,PFLAG:BYTE
67 ENDIF
68CONST ENDS
69
70CSTACK SEGMENT STACK
71CSTACK ENDS
72
73DATA SEGMENT PUBLIC BYTE
74 EXTRN DEFLEN:WORD,BYTEBUF:BYTE,DEFDUMP:BYTE
75 EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE
76 EXTRN ONE_CHAR_BUF:BYTE,ONE_CHAR_BUF_PTR:WORD
77DATA ENDS
78
79DG GROUP CODE,CONST,CSTACK,DATA
80
81CODE SEGMENT PUBLIC BYTE
82ASSUME CS:DG,DS:DG,ES:DG,SS:DG
83 PUBLIC HEXCHK,GETHEX1,PRINT,DSRANGE,ADDRESS,HEXIN,PERROR
84 PUBLIC GETHEX,GET_ADDRESS,GETEOL,GETHX,PERR
85 PUBLIC PERR,MOVE,DUMP,ENTERDATA,FILL,SEARCH,DEFAULT
86 IF SYSVER
87 PUBLIC IN
88 EXTRN DISPREG:NEAR,DEVIOCALL:NEAR
89 ENDIF
90 EXTRN CRLF:NEAR,OUTDI:NEAR,OUTSI:NEAR,SCANP:NEAR
91 EXTRN SCANB:NEAR,BLANK:NEAR,TAB:NEAR,COMMAND:NEAR
92 EXTRN HEX:NEAR,BACKUP:NEAR
93 EXTRN PRINTF_CRLF:NEAR,HEX_ADDRESS_ONLY:NEAR,HEX_ADDRESS_STR:NEAR
94 EXTRN STD_PRINTF:NEAR
95DEBCOM1:
96; RANGE - Looks for parameters defining an address range.
97; The first parameter is the starting address. The second parameter
98; may specify the ending address, or it may be preceded by
99; "L" and specify a length (4 digits max), or it may be
100; omitted and a length of 128 bytes is assumed. Returns with
101; segment in AX, displacement in DX, and length in CX.
102DSRANGE:
103 MOV BP,[DSSAVE] ; Set default segment to DS
104 MOV [DEFLEN],128 ; And default length to 128 bytes
105RANGE:
106 CALL ADDRESS
107
108 PUSH AX ; Save segment
109 PUSH DX ; Save offset
110 CALL SCANP ; Get to next parameter
111
112 MOV AL,[SI]
113 CMP AL,UPPER_L ; Length indicator?
114 JE GETLEN
115
116 MOV DX,[DEFLEN] ; Default length
117 CALL HEXIN ; Second parameter present?
118
119 JC GETDEF ; If not, use default
120
121 MOV CX,4
122 CALL GETHEX ; Get ending address (same segment)
123
124 MOV CX,DX ; Low 16 bits of ending addr.
125 POP DX ; Low 16 bits of starting addr.
126 SUB CX,DX ; Compute range
127 JAE DSRNG2
128
129DSRNG1:
130 JMP PERROR ; Negative range
131DSRNG2:
132 INC CX ; Include last location
133; JCXZ DSRNG1 ; Wrap around error
134; Removing this instruction allows 0 FFFF to valid range
135 POP AX ; Restore segment
136 RET
137GETDEF:
138 POP CX ; get original offset
139 PUSH CX ; save it
140 NEG CX ; rest of segment
141 JZ RNGRET ; use default
142
143 CMP CX,DX ; more room in segment?
144 JAE RNGRET ; yes, use default
145
146 JMP RNGRET1 ; no, length is in CX
147
148GETLEN:
149 INC SI ; Skip over "L" to length
150 MOV CX,4 ; Length may have 4 digits
151 CALL GETHEX ; Get the range
152
153RNGRET:
154 MOV CX,DX ; Length
155RNGRET1:
156 POP DX ; Offset
157 MOV AX,CX
158 ADD AX,DX
159 JNC OKRET
160
161 CMP AX,1
162 JAE DSRNG1 ; Look for wrap error
163
164OKRET:
165 POP AX ; Segment
166 RET
167DEFAULT:
168; DI points to default address and CX has default length
169 CALL SCANP
170
171 JZ USEDEF ; Use default if no parameters
172
173 MOV [DEFLEN],CX
174 CALL RANGE
175
176 JMP GETEOL
177
178USEDEF:
179 MOV SI,DI
180 LODSW ; Get default displacement
181 MOV DX,AX
182 LODSW ; Get default segment
183 RET
184
185; Dump an area of memory in both hex and ASCII
186DUMP:
187 MOV BP,[DSSAVE]
188 MOV CX,DISPB
189 MOV DI,OFFSET DG:DEFDUMP
190 CALL DEFAULT ; Get range if specified
191
192 MOV DS,AX ; Set segment
193 ASSUME DS:NOTHING
194
195 MOV SI,DX ; SI has displacement in segment
196 PUSH SI ; save SI away
197 MOV AL,DSIZ
198 XOR AH,AH
199 XOR AX,-1
200 AND SI,AX ; convert to para number
201 MOV DI,OFFSET DG:ARG_BUF ; Build the output str in arg_buf
202 CALL OUTSI ; display location
203
204 POP SI ; get SI back
205; Determine where the registers display should begin.
206 MOV AX,SI ; move offset
207 MOV AH,3 ; spaces per byte
208 AND AL,DSIZ ; convert to real offset
209 MUL AH ; 3 char positions per byte of output
210 OR AL,AL ; at beginning?
211 JZ INROW ; if so, then no movement.
212
213 PUSH CX
214 MOV CX,AX
215 CALL TAB
216
217 POP CX
218INROW:
219 PUSH SI ; Save address for ASCII dump
220BYTE0:
221 CALL BLANK ; Space between bytes
222BYTE1:
223 LODSB ; Get byte to dump
224 CALL HEX ; and display it
225
226 POP DX ; DX has start addr. for ASCII dump
227 DEC CX ; Drop loop count
228 JZ ASCII ; If through do ASCII dump
229
230 MOV AX,SI
231 TEST AL,DSIZ ; On row boundary?
232 JZ ENDROW
233
234 PUSH DX ; Didn't need ASCII addr. yet
235 TEST AL,7 ; On 8-byte boundary?
236 JNZ BYTE0
237
238 MOV AL,CHAR_MINUS ; Mark every 8 bytes with "-"
239 STOSB
240 JMP SHORT BYTE1
241
242ENDROW:
243 CALL ASCII ; Show it in ASCII
244
245 MOV DI,OFFSET DG:ARG_BUF ; Build the output str in arg_buf
246 CALL OUTSI ; Get the address at start of line
247
248 JMP INROW ; Loop until count is zero
249
250; Produce a dump of the ascii text characters. We take the current SI which
251; contains the byte after the last one dumped. From this we determine how
252; many spaces we need to output to get to the ascii column. Then we look at
253; the beginning address of the dump to tsee how many spaces we need to indent.
254ASCII:
255 PUSH CX ; Save count of remaining bytes
256; Determine how many spaces to go until the ASCII column.
257 MOV AX,SI ; get offset of next byte
258 DEC AL
259 AND AL,DSIZ
260 INC AL
261; AX now has the number of bytes that we have displayed: 1 to Dsiz+1.
262; Compute characters remaining to be displayed. We *always* put the ASCII
263; dump in column 51 (or whereever)
264 SUB AL,10H ; get negative of number
265 DEC AL ;
266 NEG AL ; convert to positive
267 CBW ; convert to word
268; 3 character positions for each byte displayed.
269 MOV CX,AX
270 SHL AX,1
271 ADD CX,AX
272; Compute indent for ascii dump
273 MOV AX,DX
274 AND AL,DSIZ
275 XOR AH,AH
276 ADD CX,AX
277; Tab over
278 CALL TAB
279
280; Set up for true dump
281 MOV CX,SI
282 MOV SI,DX
283 SUB CX,SI
284ASCDMP:
285 LODSB ; Get ASCII byte to dump
286 CMP AL,CHAR_RUBOUT
287 JAE NOPRT ; Don't print RUBOUT or above
288
289 CMP AL,CHAR_BLANK
290 JAE PRIN ; print space through RUBOUT-1
291
292NOPRT:
293 MOV AL,CHAR_PERIOD ; If unprintable character
294PRIN:
295 STOSB
296 LOOP ASCDMP ; CX times
297 MOV AL,0
298 STOSB
299 PUSH DS
300 PUSH CS
301 POP DS
302 ASSUME DS:DG
303
304 CALL HEX_ADDRESS_STR
305
306 CALL CRLF
307
308 POP DS
309 ASSUME DS:NOTHING
310
311 POP CX ; Restore overall dump len
312 MOV WORD PTR [DEFDUMP],SI
313 MOV WORD PTR [DEFDUMP+WORD],DS ; Save last address as def
314 RET
315
316 ASSUME DS:DG
317; Block move one area of memory to another Overlapping moves are performed
318; correctly, i.e., so that a source byte is not overwritten until after it has
319; been moved.
320MOVE:
321 CALL DSRANGE ; Get range of source area
322
323 PUSH CX ; Save length
324 PUSH AX ; Save segment
325 PUSH DX ; Save source displacement
326 CALL ADDRESS ; Get destination address (sam
327
328 CALL GETEOL ; Check for errors
329
330 POP SI
331 MOV DI,DX ; Set dest. displacement
332 POP BX ; Source segment
333 MOV DS,BX
334 MOV ES,AX ; Destination segment
335 POP CX ; Length
336 CMP DI,SI ; Check direction of move
337 SBB AX,BX ; Extend the CMP to 32 bits
338 JB COPYLIST ; Move forward into lower mem.
339
340; Otherwise, move backward. Figure end of source and destination
341; areas and flip direction flag.
342 DEC CX
343 ADD SI,CX ; End of source area
344 ADD DI,CX ; End of destination area
345 STD ; Reverse direction
346 INC CX
347COPYLIST:
348 MOVSB ; Do at least 1 - Range is 1-1
349 DEC CX
350 REP MOVSB ; Block move
351RET1:
352 RET
353
354; Fill an area of memory with a list values. If the list
355; is bigger than the area, don't use the whole list. If the
356; list is smaller, repeat it as many times as necessary.
357FILL:
358 CALL DSRANGE ; Get range to fill
359
360 PUSH CX ; Save length
361 PUSH AX ; Save segment number
362 PUSH DX ; Save displacement
363 CALL LIST ; Get list of values to fill w
364
365 POP DI ; Displacement in segment
366 POP ES ; Segment
367 POP CX ; Length
368 CMP BX,CX ; BX is length of fill list
369 MOV SI,OFFSET DG:BYTEBUF ; List is in byte buffer
370 JCXZ BIGRNG
371
372 JAE COPYLIST ; If list is big, copy part of
373
374BIGRNG:
375 SUB CX,BX ; How much bigger is area than
376 XCHG CX,BX ; CX=length of list
377 PUSH DI ; Save starting addr. of area
378 REP MOVSB ; Move list into area
379 POP SI
380; The list has been copied into the beginning of the
381; specified area of memory. SI is the first address
382; of that area, DI is the end of the copy of the list
383; plus one, which is where the list will begin to repeat.
384; All we need to do now is copy [SI] to [DI] until the
385; end of the memory area is reached. This will cause the
386; list to repeat as many times as necessary.
387 MOV CX,BX ; Length of area minus list
388 PUSH ES ; Different index register
389 POP DS ; requires different segment r
390 JMP SHORT COPYLIST ; Do the block move
391
392; Search a specified area of memory for given list of bytes.
393; Print address of first byte of each match.
394SEARCH:
395 CALL DSRANGE ; Get area to be searched
396
397 PUSH CX ; Save count
398 PUSH AX ; Save segment number
399 PUSH DX ; Save displacement
400 CALL LIST ; Get search list
401
402 DEC BX ; No. of bytes in list-1
403 POP DI ; Displacement within segment
404 POP ES ; Segment
405 POP CX ; Length to be searched
406 SUB CX,BX ; minus length of list
407SCAN:
408 MOV SI,OFFSET DG:BYTEBUF ; List kept in byte buffer
409 LODSB ; Bring first byte into AL
410DOSCAN:
411 SCASB ; Search for first byte
412 LOOPNE DOSCAN ; Do at least once by using LO
413
414 JNZ RET1 ; Exit if not found
415
416 PUSH BX ; Length of list minus 1
417 XCHG BX,CX
418 PUSH DI ; Will resume search here
419 REPE CMPSB ; Compare rest of string
420 MOV CX,BX ; Area length back in CX
421 POP DI ; Next search location
422 POP BX ; Restore list length
423 JNZ TTEST ; Continue search if no match
424
425 DEC DI ; Match address
426 CALL OUTDI ; Print it
427
428 INC DI ; Restore search address
429 CALL HEX_ADDRESS_ONLY ; Print the addresss
430
431 CALL CRLF
432
433TTEST:
434 JCXZ RET1
435
436 JMP SHORT SCAN ; Look for next occurrence
437
438; Get the next parameter, which must be a hex number.
439; CX is maximum number of digits the number may have.
440
441;=========================================================================
442; GETHX: This routine calculates the binary representation of an address
443; entered in ASCII by a user. GETHX has been modified to provide
444; support for sector addresses > 32mb. To do this the bx register
445; has been added to provide a 32 bit address. BX is the high word
446; and DX is the low word. For routines that rely on DX for a 16
447; bit address, the use of BX will have no effect.
448;
449; Date : 6/16/87
450;=========================================================================
451
452GETHX:
453 CALL SCANP
454GETHX1:
455 XOR DX,DX ; Initialize the number
456 xor bx,bx ;an000;initialize high word for
457 ; sector address
458 CALL HEXIN ; Get a hex digit
459
460 JC HXERR ; Must be one valid digit
461
462 MOV DL,AL ; First 4 bits in position
463GETLP:
464 INC SI ; Next char in buffer
465 DEC CX ; Digit count
466 CALL HEXIN ; Get another hex digit?
467
468 JC RETHX ; All done if no more digits
469
470 STC
471 JCXZ HXERR ; Too many digits?
472
473
474 call ADDRESS_32_BIT ;an000;multiply by 32
475 JMP SHORT GETLP ; Get more digits
476
477GETHEX:
478 CALL GETHX ; Scan to next parameter
479
480 JMP SHORT GETHX2
481
482GETHEX1:
483 CALL GETHX1
484GETHX2:
485 JC PERROR
486RETHX:
487 CLC
488HXERR:
489 RET
490
491; Check if next character in the input buffer is a hex digit
492; and convert it to binary if it is. Carry set if not.
493HEXIN:
494 MOV AL,[SI]
495; Check if AL is a hex digit and convert it to binary if it
496; is. Carry set if not.
497HEXCHK:
498 SUB AL,CHAR_ZERO ; Kill ASCII numeric bias
499 JC RET2
500
501 CMP AL,10
502 CMC
503 JNC RET2 ; OK if 0-9
504
505 AND AL,5FH
506 SUB AL,7 ; Kill A-F bias
507 CMP AL,10
508 JC RET2
509
510 CMP AL,16
511 CMC
512RET2:
513 RET
514
515; Process one parameter when a list of bytes is
516; required. Carry set if parameter bad. Called by LIST.
517LISTITEM:
518 CALL SCANP ; Scan to parameter
519
520 CALL HEXIN ; Is it in hex?
521
522 JC STRINGCHK ; If not, could be a string
523
524 MOV CX,2 ; Only 2 hex digits for bytes
525 push bx ;an000;save it - we stomp it
526 CALL GETHEX ; Get the byte value
527 pop bx ;an000;restore it
528
529 MOV [BX],DL ; Add to list
530 INC BX
531GRET:
532 CLC ; Parameter was OK
533 RET
534
535STRINGCHK:
536 MOV AL,[SI] ; Get first character of param
537 CMP AL,SINGLE_QUOTE ; String?
538 JZ STRING
539
540 CMP AL,DOUBLE_QUOTE ; Either quote is all right
541 JZ STRING
542
543 STC ; Not string, not hex - bad
544 RET
545STRING:
546 MOV AH,AL ; Save for closing quote
547 INC SI
548STRNGLP:
549 LODSB ; Next char of string
550 CMP AL,CR ; Check for end of line
551 JZ PERR ; Must find a close quote
552
553 CMP AL,AH ; Check for close quote
554 JNZ STOSTRG ; Add new character to list
555
556 CMP AH,[SI] ; Two quotes in a row?
557 JNZ GRET ; If not, we're done
558
559 INC SI ; Yes - skip second one
560STOSTRG:
561 MOV [BX],AL ; Put new char in list
562 INC BX
563 JMP SHORT STRNGLP ; Get more characters
564
565; Get a byte list for ENTER, FILL or SEARCH. Accepts any number
566; of 2-digit hex values or character strings in either single
567; (') or double (") quotes.
568LIST:
569 MOV BX,OFFSET DG:BYTEBUF ; Put byte list in the byte buffer
570LISTLP:
571 CALL LISTITEM ; Process a parameter
572
573 JNC LISTLP ; If OK, try for more
574
575 SUB BX,OFFSET DG:BYTEBUF ; BX now has no. of bytes in list
576 JZ PERROR ; List must not be empty
577
578; Make sure there is nothing more on the line except for
579; blanks and carriage return. If there is, it is an
580; unrecognized parameter and an error.
581GETEOL:
582 CALL SCANB ; Skip blanks
583
584 JNZ PERROR ; Better be a RETURN
585RET3:
586 RET
587
588; Command error. SI has been incremented beyond the command letter so it must
589; decremented for the error pointer to work.
590PERR:
591 DEC SI
592; Syntax error. SI points to character in the input buffer which caused
593; error. By subtracting from start of buffer, we will know how far to tab
594; over to appear directly below it on the terminal. Then print "^ Error".
595PERROR:
596 SUB SI,OFFSET DG:(BYTEBUF-1) ; How many char processed so far?
597 MOV CX,SI ; Parameter for TAB in CX
598 MOV DI,OFFSET DG:ARG_BUF ;
599 CALL TAB ; Directly below bad char
600
601 MOV BYTE PTR [DI],0 ; nul terminate the tab
602 MOV DX,OFFSET DG:SYNERR_PTR ; Error message
603; Print error message and abort to command level
604PRINT:
605 CALL PRINTF_CRLF
606
607 JMP COMMAND
608
609; Gets an address in Segment:Displacement format. Segment may be omitted
610; and a default (kept in BP) will be used, or it may be a segment
611; register (DS, ES, SS, CS). Returns with segment in AX, OFFSET in DX.
612ADDRESS:
613 CALL GET_ADDRESS
614
615 JC PERROR
616
617ADRERR:
618 STC
619 RET
620
621GET_ADDRESS:
622 CALL SCANP
623
624 MOV AL,[SI+1]
625 CMP AL,UPPER_S
626 JZ SEGREG
627
628 MOV CX,4
629 CALL GETHX
630
631 JC ADRERR
632
633 MOV AX,BP ; Get default segment
634 CMP BYTE PTR [SI],CHAR_COLON
635 JNZ GETRET
636
637 PUSH DX
638GETDISP:
639 INC SI ; Skip over ":"
640 MOV CX,4
641 CALL GETHX
642
643 POP AX
644 JC ADRERR
645
646GETRET:
647 CLC
648 RET
649
650SEGREG:
651 MOV AL,[SI]
652 MOV DI,OFFSET DG:SEGLET ; SEGLET DB "CSED"
653 MOV CX,4
654 REPNE SCASB
655 JNZ ADRERR
656
657 INC SI
658 INC SI
659 SHL CX,1
660 MOV BX,CX
661 CMP BYTE PTR [SI],CHAR_COLON
662 JNZ ADRERR
663
664 PUSH [BX+DSSAVE]
665 JMP SHORT GETDISP
666
667SEGLET DB "CSED" ; First letter of each of the segregs: CS,SS,ES,DS
668
669; Short form of ENTER command. A list of values from the
670; command line are put into memory without using normal
671; ENTER mode.
672GETLIST:
673 CALL LIST ; Get the bytes to enter
674
675 POP DI ; Displacement within segment
676 POP ES ; Segment to enter into
677 MOV SI,OFFSET DG:BYTEBUF ; List of bytes is in byte buffer
678 MOV CX,BX ; Count of bytes
679 REP MOVSB ; Enter that byte list
680 RET
681
682; Enter values into memory at a specified address. If the line contains
683; nothing but the address we go into "enter mode", where the address and its
684; current value are printed and the user may change it if desired. To change,
685; type in new value in hex. Backspace works to correct errors. If an illegal
686; hex digit or too many digits are typed, the bell is sounded but it is
687; otherwise ignored. To go to the next byte (with or without change), hit
688; space bar. To back CLDto a previous address, type "-". On every 8-byte
689; boundary a new line is started and the address is printed. To terminate
690; command, type carriage return.
691; Alternatively, the list of bytes to be entered may be included on the
692; original command line immediately following the address. This is in regular
693; LIST format so any number of hex values or strings in quotes may be entered.
694ENTERDATA:
695 MOV BP,[DSSAVE] ; Set default segment to DS
696 CALL ADDRESS
697
698 PUSH AX ; Save for later
699 PUSH DX
700 CALL SCANB ; Any more parameters?
701
702 JNZ GETLIST ; If not end-of-line get list
703
704 POP DI ; Displacement of ENTER
705 POP ES ; Segment
706GETROW:
707 CALL OUTDI ; Print address of entry
708
709 PUSH DI
710 PUSH ES
711 PUSH DS
712 POP ES
713 MOV DI,OFFSET DG:ARG_BUF
714 CALL BLANK
715
716 XOR AL,AL
717 STOSB
718 CALL HEX_ADDRESS_STR
719
720 POP ES
721 POP DI
722GETBYTE:
723 MOV AL,ES:[DI] ; Get current value
724 PUSH DI
725 PUSH ES
726 PUSH DS
727 POP ES
728 MOV DI,OFFSET DG:ARG_BUF
729 CALL HEX ; And display it
730
731 MOV AL,CHAR_PERIOD
732 STOSB
733 XOR AL,AL
734 STOSB
735 MOV DX,OFFSET DG:ARG_BUF_PTR
736 CALL STD_PRINTF
737
738 POP ES
739 POP DI
740LOOK_AGAIN:
741 MOV CX,2 ; Max of 2 digits in new value
742 MOV DX,0 ; Intial new value
743GETDIG:
744 CALL INPT ; Get digit from user
745
746 MOV AH,AL ; Save
747 CALL HEXCHK ; Hex digit?
748
749 XCHG AH,AL ; Need original for echo
750 JC NOHEX ; If not, try special command
751
752 MOV DH,DL ; Rotate new value
753 MOV DL,AH ; And include new digit
754 LOOP GETDIG ; At most 2 digits
755
756; We have two digits, so all we will accept now is a command.
757DWAIT:
758 CALL INPT ; Get command character
759NOHEX:
760 CMP AL,CHAR_BACKSPACE ; Backspace
761 JZ BS
762
763 CMP AL,CHAR_RUBOUT ; RUBOUT
764 JZ RUB
765
766 CMP AL,CHAR_MINUS ; Back up to previous address
767 JZ PREV
768
769 CMP AL,CR ; All done with command?
770 JZ EOL
771
772 CMP AL,CHAR_BLANK ; Go to next address
773 JZ NEXT
774
775 MOV AL,CHAR_BACKSPACE
776 CALL OUT_CHAR ; Back up over illegal character
777
778 CALL BACKUP
779
780 JCXZ DWAIT
781
782 JMP SHORT GETDIG
783
784RUB:
785 MOV AL,CHAR_BACKSPACE
786 CALL OUT_char
787BS:
788 CMP CL,2 ; CX=2 means nothing typed yet
789 JZ PUTDOT ; Put back the dot we backed up over
790
791 INC CL ; Accept one more character
792 MOV DL,DH ; Rotate out last digit
793 MOV DH,CH ; Zero this digit
794 CALL BACKUP ; Physical backspace
795
796 JMP SHORT GETDIG ; Get more digits
797
798PUTDOT:
799 MOV AL,CHAR_PERIOD
800 CALL OUT_CHAR
801
802 JMP LOOK_AGAIN
803
804; If new value has been entered, convert it to binary and
805; put into memory. Always bump pointer to next location
806STORE:
807 CMP CL,2 ; CX=2 means nothing typed yet
808 JZ NOSTO ; So no new value to store
809
810; Rotate DH left 4 bits to combine with DL and make a byte value
811 PUSH CX
812 MOV CL,4
813 SHL DH,CL
814 POP CX
815 OR DL,DH ; Hex is now converted to binary
816 MOV ES:[DI],DL ; Store new value
817NOSTO:
818 INC DI ; Prepare for next location
819 RET
820
821NEXT:
822 CALL STORE ; Enter new value
823
824 INC CX ; Leave a space plus two for
825 INC CX ; each digit not entered
826 PUSH DI
827 MOV DI,OFFSET DG:ARG_BUF
828 PUSH ES
829 PUSH DS
830 POP ES
831 CALL TAB
832
833 XOR AL,AL
834 STOSB
835 MOV DX,OFFSET DG:ARG_BUF_PTR
836 CALL STD_PRINTF
837
838 POP ES
839 POP DI
840 MOV AX,DI ; Next memory address
841 AND AL,7 ; Check for 8-byte boundary
842 JZ NEWROW ; Take 8 per line
843
844 JMP GETBYTE
845
846NEWROW:
847 CALL CRLF ; Terminate line
848
849 JMP GETROW ; Print address on new line
850
851PREV:
852 CALL STORE ; Enter the new value
853
854; DI has been bumped to next byte. Drop it 2 to go to previous addr
855 DEC DI
856 DEC DI
857 JMP SHORT NEWROW ; Terminate line after backing CLD
858
859EOL:
860 CALL STORE ; Enter the new value
861
862 JMP CRLF ; CR/LF and terminate
863
864; Console input of single character
865 IF SYSVER
866INPT: ;*** change for build - label to inpt
867 PUSH DS
868 PUSH SI
869 LDS SI,CS:[CIN]
870 MOV AH,4
871 CALL DEVIOCALL
872
873 POP SI
874 POP DS
875 CMP AL,3
876 JNZ NOTCNTC
877
878 INT VEC_CTRL_BREAK ;23H
879
880NOTCNTC:
881 CMP AL,UPPER_P - CHAR_AT_SIGN
882 JZ PRINTON
883
884 CMP AL,UPPER_N - CHAR_AT_SIGN
885 JZ PRINTOFF
886
887 CALL OUT_CHAR
888
889 RET
890
891PRINTOFF:
892PRINTON:
893 NOT [PFLAG]
894 JMP SHORT IN
895
896 ELSE
897INPT: ; Change label for build
898 MOV AH,Std_Con_Input ;OPTION=1, STANDARD CONSOLE INPUT
899 INT 21H
900
901 RET
902
903 ENDIF
904OUT_CHAR:
905 PUSH DI
906 PUSH DX
907 PUSH ES
908 PUSH DS
909 POP ES
910 MOV DI,OFFSET DG:ONE_CHAR_BUF
911 STOSB
912 MOV AL,0
913 STOSB
914 MOV DX,OFFSET DG:ONE_CHAR_BUF_PTR
915 CALL STD_PRINTF
916
917 POP ES
918 POP DX
919 POP DI
920 RET
921
922;=========================================================================
923; ADDRESS_32_BIT: This routine will build an address for 32bit sector
924; addressibility. BX will be the high word, with DX being
925; the low word.
926;
927; Inputs : DX/BX - registers to contain 32bit sector address
928; DX & BX are both initialized to 0 on first call to routine.
929;
930; Outputs: DX/BX - registers to contain 32bit sector address
931;
932; Date : 6/16/87
933;=========================================================================
934
935ADDRESS_32_BIT proc near ;an000;perform 32 bit address
936 ; creation
937 push cx ;an000;save affected regs.
938 mov cx,04h ;an000;initialize to
939 ; nibble shift
940; $do ;an000;while cx not= 0
941$$DO1:
942 cmp cx,00h ;an000;are we done?
943; $leave e ;an000;yes, quit loop
944 JE $$EN1
945 shl bx,1 ;an000;shift bx 1 bit
946 shl dx,1 ;an000;shift dx 1 bit
947; $if c ;an000;did low word carry
948 JNC $$IF3
949 or bx,01h ;an000;set bit 0 of high word
950; $endif ;an000;
951$$IF3:
952 dec cx ;an000;decrease counter
953; $enddo ;an000;end while loop
954 JMP SHORT $$DO1
955$$EN1:
956 or dl, al ;an000;overlay low word
957 ; bits 0-3 with next
958 ; portion of the address
959 pop cx ;an000;restore affected regs.
960
961 ret ;an000;return to caller
962
963ADDRESS_32_BIT endp ;an000;end proc
964
965
966
967CODE ENDS
968 END DEBCOM1
969 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBCOM2.ASM b/v4.0/src/CMD/DEBUG/DEBCOM2.ASM
new file mode 100644
index 0000000..b22795f
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBCOM2.ASM
@@ -0,0 +1,1308 @@
1 PAGE 60,132 ;
2 TITLE DEBCOM2.ASM - PART2 DEBUGGER COMMANDS PC DOS
3;======================= START OF SPECIFICATIONS =========================
4;
5; MODULE NAME: DECOM2.SAL
6;
7; DESCRIPTIVE NAME: DEBUGGING TOOL
8;
9; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS.
10;
11; ENTRY POINT: ANY CALLED ROUTINE
12;
13; INPUT: NA
14;
15; EXIT NORMAL: NA
16;
17; EXIT ERROR: NA
18;
19; INTERNAL REFERENCES:
20;
21; EXTERNAL REFERENCES:
22;
23; ROUTINE: DEBCOM1 - CONTAINS ROUTINES CALLED BY DEBUG
24; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG
25; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG
26; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG
27; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG
28;
29; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
30; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
31; DEBCONST+DEBDATA+DEBMES
32;
33; REVISION HISTORY:
34;
35; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
36; AC000 VERSION 4.00 -
37;
38; - IMPLEMENT DBCS HANDLING DMS:6/17/87
39; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87
40; - IMPLEMENT > 32MB SUPPORT DMS:6/17/87
41;
42; COPYRIGHT: "MS DOS DEBUG UTILITY"
43; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
44; "LICENSED MATERIAL - PROPERTY OF Microsoft "
45;
46;======================= END OF SPECIFICATIONS ===========================
47
48; Routines to perform debugger commands except ASSEMble and UASSEMble
49
50 IF1
51 %OUT COMPONENT=DEBUG, MODULE=DEBCOM2
52 ENDIF
53.XLIST
54.XCREF
55 INCLUDE DOSSYM.INC
56 INCLUDE DEBEQU.ASM
57.CREF
58.LIST
59CODE SEGMENT PUBLIC BYTE
60CODE ENDS
61
62CONST SEGMENT PUBLIC BYTE
63 EXTRN NOTFND_PTR:BYTE,NOROOM_PTR:BYTE,DRVLET:BYTE,ERRMES_PTR:BYTE
64 EXTRN NAMBAD_PTR:BYTE,NOSPACE_PTR:BYTE,TOOBIG_PTR:BYTE
65 EXTRN HEXERR_PTR:BYTE,HEXWRT_PTR:BYTE,ACCMES_PTR:BYTE
66 EXTRN EXEBAD_PTR:BYTE,EXEWRT_PTR:BYTE
67 EXTRN EXECEMES_PTR:BYTE,NONAMESPEC_PTR:BYTE
68
69 EXTRN FLAGTAB:WORD,EXEC_BLOCK:BYTE,COM_LINE:DWORD,COM_FCB1:DWORD
70 EXTRN COM_FCB2:DWORD,COM_SSSP:DWORD,COM_CSIP:DWORD,RETSAVE:WORD
71 EXTRN NEWEXEC:BYTE,HEADSAVE:WORD
72 EXTRN REGTAB:BYTE,TOTREG:BYTE,NOREGL:BYTE
73 EXTRN USER_PROC_PDB:WORD,STACK:BYTE,RSTACK:WORD,AXSAVE:WORD
74 EXTRN BXSAVE:WORD,DSSAVE:WORD,ESSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD
75 EXTRN SSSAVE:WORD,CXSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD
76 EXTRN SREG:BYTE,SEGTAB:WORD,REGDIF:ABS,RDFLG:BYTE
77 EXTRN REGTABEND:WORD
78 EXTRN NAMESPEC:BYTE
79CONST ENDS
80
81CSTACK SEGMENT STACK
82CSTACK ENDS
83
84DATA SEGMENT PUBLIC BYTE
85 EXTRN DEFDUMP:BYTE,TRANSADD:DWORD,INDEX:WORD,BUFFER:BYTE
86 EXTRN ASMADD:BYTE,DISADD:BYTE,NSEG:WORD
87 EXTRN SWITCHAR:BYTE,XNXCMD:BYTE,XNXOPT:BYTE
88 EXTRN AWORD:BYTE,EXTPTR:WORD,HANDLE:WORD,PARSERR:BYTE
89 EXTRN REG_NAME:WORD,REG_CONTENTS:WORD,REGISTER_PTR:BYTE
90 EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE,LOC_ADD:WORD,LOC_PTR:BYTE
91 EXTRN BIG_CONTENTS:WORD,BIG_PTR:BYTE,LITTLE_CONTENTS:WORD,LITTLE_PTR:BYTE
92 EXTRN SINGLE_REG_ARG:WORD,CHANGE_FLAG_PTR:BYTE,DF_ERROR:BYTE
93 EXTRN BR_ERROR:BYTE,BF_ERROR:BYTE,SINGLE_REG_PTR:WORD
94 EXTRN WRT_ARG1:WORD,WRT_ARG2:WORD,WRTMES_PTR:BYTE,BEGSEG:WORD
95 EXTRN FILESTRT:WORD,FILEEND:WORD
96 EXTRN ERR_TYPE:BYTE ;ac000;converted to buffer
97
98 extrn rel_read_write_tab:dword ;an000;primitive I/O
99 extrn rel_rw_add:dword ;an000;transfer address
100 extrn rel_low_sec:word ;an000;low sector word
101 extrn rel_high_sec:word ;an000;high sector word
102 extrn rel_sec_num:word ;an000;# of sectors
103
104fnd_dbcs db 0
105DATA ENDS
106
107DG GROUP CODE,CONST,CSTACK,DATA
108
109CODE SEGMENT PUBLIC BYTE
110ASSUME CS:DG,DS:DG,ES:DG,SS:DG
111 PUBLIC DEFIO,PREPNAME,DEBUG_FOUND
112 PUBLIC REG,LOAD
113 PUBLIC NAMED,DWRITE
114 PUBLIC DISPREG,ERR,DELIM1,DELIM2,delim0
115 public getchrup,open1,open2,open3,open4,oc_file,opnret ;an001;bgb
116 public delete_a_file, parse_a_file, exec_a_file, open_a_file, create_a_file ;an001;bgb
117 public gcur,ifhex ;an001;bgb
118 public comtail ;an001;bgb
119 extrn test_lead:near ;an001;bgb
120 EXTRN OUTSI:NEAR,OUTDI:NEAR,INBUF:NEAR,SCANB:NEAR,SCANP:NEAR
121 EXTRN COMMAND:NEAR,DISASLN:NEAR,SET_TERMINATE_VECTOR:NEAR
122 EXTRN RESTART:NEAR,TERMINATE:NEAR,DRVERR:NEAR
123 EXTRN GETHEX:NEAR,GETEOL:NEAR,SKIP_FILE:NEAR
124 EXTRN HEXCHK:NEAR,GETHEX1:NEAR,PRINT:NEAR
125 EXTRN CRLF:NEAR,BLANK:NEAR
126 EXTRN HEX:NEAR,DIGIT:NEAR
127 EXTRN FIND_DEBUG:NEAR
128 EXTRN ADDRESS:NEAR,PERROR:NEAR
129 EXTRN STD_PRINTF:NEAR,PRINTF_CRLF:NEAR
130DEBCOM2:
131DISPLAY_LINE:
132 mov ax,word ptr [si] ;an000;move reg name to ax
133 MOV [REG_NAME],ax ;ac000;save it in reg_name
134 ADD SI,3
135 MOV AX,[BX]
136 ADD BX,2
137 MOV [REG_CONTENTS],AX
138 MOV DX,OFFSET DG:REGISTER_PTR
139 CALL STD_PRINTF
140
141 LOOP DISPLAY_LINE
142
143 RETURN
144
145DISPLAY_FLAGS:
146 MOV DI,OFFSET DG:ARG_BUF
147 MOV AL,CHAR_BLANK
148 STOSB
149DISPLAY_FLAGS_2:
150 MOV SI,OFFSET DG:FLAGTAB
151 MOV CX,16
152 MOV DX,[FLSAVE]
153DFLAGS:
154 LODS CS:WORD PTR [SI]
155 SHL DX,1
156 JC FLAGSET
157
158 MOV AX,CS:[SI+30]
159FLAGSET:
160 OR AX,AX
161 JZ NEXT_FLAG
162
163 STOSW
164 MOV AL,CHAR_BLANK
165 STOSB
166NEXT_FLAG:
167 LOOP DFLAGS
168 XOR AL,AL
169 STOSB
170 RETURN
171
172DISPREG:
173 MOV SI,OFFSET DG:REGTAB
174 MOV DI,OFFSET DG:ARG_BUF
175 MOV BX,OFFSET DG:AXSAVE
176 MOV BYTE PTR TOTREG,CR
177 MOV CH,0
178 MOV CL,NOREGL
179SET_DISPLAY:
180REPEAT_DISPLAY:
181 SUB TOTREG,CL
182 CALL DISPLAY_LINE
183
184 CALL CRLF
185
186 XOR CH,CH
187 MOV CL,NOREGL
188 CMP CL,TOTREG
189 JB REPEAT_DISPLAY
190
191 MOV CL,TOTREG
192 CALL DISPLAY_LINE
193
194 CALL DISPLAY_FLAGS
195
196 MOV DX,OFFSET DG:ARG_BUF_PTR
197 CALL PRINTF_CRLF
198
199 MOV AX,[IPSAVE]
200 MOV WORD PTR [DISADD],AX
201 PUSH AX
202 MOV AX,[CSSAVE]
203 MOV WORD PTR [DISADD+WORD],AX
204 PUSH AX
205 MOV [NSEG],-1
206 CALL DISASLN
207
208 POP WORD PTR DISADD+WORD
209 POP WORD PTR DISADD
210 MOV AX,[NSEG]
211 CMP AL,-1
212 JNZ ASSEM_LIN_CONT
213
214 JMP CRLF
215
216ASSEM_LIN_CONT:
217 CMP AH,-1
218 JZ NOOVER
219
220 XCHG AL,AH
221NOOVER:
222 CBW
223 MOV BX,AX
224 SHL BX,1
225 MOV AX,WORD PTR [BX+SREG]
226 MOV DI,OFFSET DG:ARG_BUF
227 STOSB
228 XCHG AL,AH
229 STOSB
230 XOR AL,AL
231 STOSB
232 MOV DX,[INDEX]
233 MOV LOC_ADD,DX
234 MOV DX,OFFSET DG:LOC_PTR
235 CALL STD_PRINTF
236
237 MOV BX,[BX+SEGTAB]
238 PUSH DS
239 MOV DS,[BX]
240 MOV BX,CS:[INDEX]
241 MOV BX,[BX]
242 POP DS
243 MOV BIG_CONTENTS,BX
244 MOV DX,OFFSET DG:BIG_PTR
245 TEST BYTE PTR [AWORD],-1
246 JNZ SHOW_CHARS
247
248 XOR BH,BH
249 MOV LITTLE_CONTENTS,BX
250 MOV DX,OFFSET DG:LITTLE_PTR
251SHOW_CHARS:
252 CALL PRINTF_CRLF
253
254 RETURN
255
256DISPREGJ:
257 JMP DISPREG
258
259; Perform register dump if no parameters or set register if a
260; register designation is a parameter.
261REG:
262 CALL SCANP
263
264 JZ DISPREGJ
265
266 MOV DL,[SI]
267 INC SI
268 MOV DH,[SI]
269 CMP DH,CR
270 JZ FLAG
271
272 INC SI
273 CALL GETEOL
274
275 CMP DH,CHAR_BLANK
276 JZ FLAG
277
278 MOV DI,OFFSET DG:REGTAB
279 XCHG AX,DX
280 PUSH CS
281 POP ES
282 XOR CX,CX
283CHECK_NEXT_REG:
284 CMP AX,WORD PTR[ DI]
285 JZ REG_FOUND
286
287 ADD DI,3
288 INC CX
289 CMP DI,OFFSET DG:REGTABEND
290 JB CHECK_NEXT_REG
291
292 JMP BADREG
293
294REG_FOUND:
295 CMP DI,OFFSET DG:REGTABEND
296 JNZ NOTPC
297
298 DEC DI
299 DEC DI
300 DEC DI
301 MOV AX,CS:[DI-WORD]
302NOTPC:
303 PUSH DI
304 MOV DI,OFFSET DG:ARG_BUF
305 STOSB
306 XCHG AL,AH
307 STOSB
308 XOR AL,AL
309 STOSB
310 POP DI
311 PUSH DS
312 POP ES
313 LEA BX,[DI+REGDIF]
314 SUB BX,CX
315 MOV DX,[BX]
316 MOV SINGLE_REG_ARG,DX
317 MOV DX,OFFSET DG:SINGLE_REG_PTR
318 CALL STD_PRINTF
319
320 CALL INBUF
321
322 CALL SCANB
323
324 RETZ
325
326 push bx ;an000;save bx - we stomp it
327 MOV CX,4
328 CALL GETHEX1
329 pop bx ;an000;restore it
330
331 CALL GETEOL
332
333 MOV [BX],DX
334 RETURN
335BADREG:
336 MOV DX,OFFSET DG:BR_ERROR ; BR ERROR
337 JMP ERR
338
339FLAG:
340 CMP DL,UPPER_F
341 JNZ BADREG
342
343 MOV DI,OFFSET DG:ARG_BUF
344 CALL DISPLAY_FLAGS_2
345
346 MOV DX,OFFSET DG:CHANGE_FLAG_PTR
347 CALL STD_PRINTF
348
349 CALL INBUF
350
351 CALL SCANB
352
353 XOR BX,BX
354 MOV DX,[FLSAVE]
355GETFLG:
356 LODSW
357 CMP AL,CR
358 JZ SAVCHG
359
360 CMP AH,CR
361 JZ FLGERR
362
363 MOV DI,OFFSET DG:FLAGTAB
364 MOV CX,32
365 PUSH CS
366 POP ES
367 REPNE SCASW
368 JNZ FLGERR
369
370 MOV CH,CL
371 AND CL,0FH
372 MOV AX,1
373 ROL AX,CL
374 TEST AX,BX
375 JNZ REPFLG
376
377 OR BX,AX
378 OR DX,AX
379 TEST CH,16
380 JNZ NEXFLG
381
382 XOR DX,AX
383NEXFLG:
384 CALL SCANP
385
386 JMP SHORT GETFLG
387
388REPFLG:
389 MOV DX,OFFSET DG:DF_ERROR ; DF ERROR
390FERR:
391 CALL SAVCHG
392ERR:
393 push si ;an000;save affected registers
394 push di ;an000;
395 push cx ;an000;
396 mov cx,03h ;an000;move only three bytes
397 mov di,offset dg:err_type ;an000;point to buffer
398 mov si,dx ;an000;dx holds the string
399 rep movsb ;an000;fill up the buffer
400 pop cx ;an000;restore registers
401 pop di ;an000;
402 pop si ;an000;
403 MOV DX,OFFSET DG:ERRMES_PTR
404 JMP PRINT
405
406SAVCHG:
407 MOV [FLSAVE],DX
408 RETURN
409
410FLGERR:
411 MOV DX,OFFSET DG:BF_ERROR ; BF ERROR
412 JMP SHORT FERR
413
414PREPNAME:
415 MOV ES,DSSAVE
416 PUSH SI
417 MOV DI,81H
418COMTAIL:
419 LODSB
420 STOSB
421 CMP AL,CR
422 JNZ COMTAIL
423
424 SUB DI,82H
425 XCHG AX,DI
426 MOV ES:(BYTE PTR [80H]),AL
427 POP SI
428 MOV DI,FCB ;05cH
429 MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION ;AL=01H
430 INT 21H
431
432 MOV BYTE PTR [AXSAVE],AL ; Indicate analysis of first parm
433 CALL SKIP_FILE
434
435 MOV DI,6CH
436 MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION ;AL=01H
437 INT 21H
438
439 MOV BYTE PTR [AXSAVE+1],AL ; Indicate analysis of second parm
440 RETURN
441
442; OPENS A XENIX PATHNAME SPECIFIED IN THE UNFORMATTED PARAMETERS
443; VARIABLE [XNXCMD] SPECIFIES WHICH COMMAND TO OPEN IT WITH
444
445; VARIABLE [HANDLE] CONTAINS THE HANDLE
446; VARIABLE [EXTPTR] POINTS TO THE FILES EXTENSION
447DELETE_A_FILE:
448 MOV BYTE PTR [XNXCMD],UNLINK
449 JMP SHORT OC_FILE
450
451PARSE_A_FILE:
452 MOV BYTE PTR [XNXCMD],0
453 JMP SHORT OC_FILE
454
455EXEC_A_FILE:
456 MOV BYTE PTR CS:[XNXCMD],EXEC
457 MOV BYTE PTR CS:[XNXOPT],1
458 JMP SHORT OC_FILE
459
460OPEN_A_FILE:
461 MOV BYTE PTR [XNXCMD],OPEN
462 MOV BYTE PTR [XNXOPT],2 ; Try read write
463 CALL OC_FILE
464
465 RETNC
466 MOV BYTE PTR [XNXCMD],OPEN
467 MOV BYTE PTR [XNXOPT],0 ; Try read only
468 JMP SHORT OC_FILE
469
470CREATE_A_FILE:
471 MOV BYTE PTR [XNXCMD],CREAT
472OC_FILE:
473 PUSH DS
474 PUSH ES
475 PUSH AX
476 PUSH BX
477 PUSH CX
478 PUSH DX
479 PUSH SI
480 XOR AX,AX
481 MOV CS:[EXTPTR],AX ; INITIALIZE POINTER TO EXTENSIONS
482 MOV AH,CHAR_OPER
483 INT 21H
484
485 MOV CS:[SWITCHAR],DL ; GET THE CURRENT SWITCH CHARACTER
486 MOV SI,81H
487
488open1: CALL GETCHRUP ;convert 1 byte to uppercase
489 CALL DELIM2 ; END OF LINE?
490 JZ OPEN4
491
492 CALL DELIM1 ; SKIP LEADING DELIMITERS
493 JZ OPEN1
494
495 MOV DX,SI ; SAVE POINTER TO BEGINNING
496 cmp fnd_dbcs,1
497; $if z
498 JNZ $$IF1
499 dec dx ;dec it twice if dbcs
500; $endif
501$$IF1:
502 DEC DX
503open2: CMP AL,CHAR_PERIOD ; LAST CHAR A "."?
504 JNZ OPEN3
505
506 MOV CS:[EXTPTR],SI ; SAVE POINTER TO THE EXTENSION
507OPEN3:
508 CALL GETCHRUP
509
510 CALL DELIM1 ; LOOK FOR END OF PATHNAME
511
512 JZ OPEN4
513
514 CALL DELIM2
515
516 JNZ OPEN2
517
518OPEN4: DEC SI ; POINT BACK TO LAST CHAR
519 PUSH [SI] ; SAVE TERMINATION CHAR
520 MOV BYTE PTR [SI],0 ; NULL TERMINATE THE STRING
521 MOV AL,CS:[XNXOPT]
522 MOV AH,CS:[XNXCMD] ; OPEN OR CREATE FILE
523 OR AH,AH
524 JZ OPNRET
525
526 MOV CS:[FILESTRT],DX ; Set values for later call on this file
527 MOV CS:[FILEEND],SI
528 PUSH CS
529 POP ES ; Set ES seg for EXEC_BLOCK
530 MOV BX,OFFSET DG:EXEC_BLOCK
531 XOR CX,CX
532 INT 21H
533
534 MOV CS:[HANDLE],AX ; SAVE ERROR CODE OR HANDLE
535OPNRET:
536 POP [SI]
537 POP SI
538 POP DX
539 POP CX
540 POP BX
541 POP AX ; blow away error code...
542 POP ES
543 POP DS
544 RETURN
545
546GETCHRUP: ;an001;bgb
547 lodsb ;get the character from [si] ;an001;bgb
548 call test_lead ;is it a dbcs lead byte? ;an001;bgb
549; $IF C ;yes ;an001;bgb
550 JNC $$IF3
551 inc si ;bump ptr to past 2nd dbcs byte ;an001;bgb
552 mov fnd_dbcs,1 ;found a dbcs char
553 jmp gcur ;dont capitalize it ;an001;bgb
554; $ENDIF ;an001;bgb
555$$IF3:
556 ; ;an001;bgb
557 mov fnd_dbcs,0 ;did not find a dbcs char
558 cmp al,lower_a ;is it >= "a" ? ;an001;bgb
559 jb gcur ;no - exit ;an001;bgb
560 ;an001;bgb
561 cmp al,lower_z ;is it =< "z" ? ;an001;bgb
562 ja gcur ;no - exit ;an001;bgb
563 ;an001;bgb
564;if we get here, the char is lowercase, so change it ;an001;bgb
565 sub al,32 ;convert to uppercase ;an001;bgb
566 mov [si-1],al ;move it back (si points 1 past) ;an001;bgb
567gcur: return ;an001;bgb
568
569DELIM0:
570 CMP AL,CHAR_LEFT_BRACKET
571 RETZ
572DELIM1:
573 CMP AL,CHAR_BLANK ; SKIP THESE GUYS
574 RETZ
575
576 CMP AL,CHAR_SEMICOLON
577 RETZ
578
579 CMP AL,CHAR_EQUAL
580 RETZ
581
582 CMP AL,CHAR_TAB
583 RETZ
584
585 CMP AL,CHAR_COMMA
586 RETURN
587
588DELIM2:
589 CMP AL,CS:[SWITCHAR] ; STOP ON THESE GUYS
590 RETZ
591
592 CMP AL,CR
593 RETURN
594
595NAMED:
596 OR [NAMESPEC],1 ; Flag a name command executed
597 CALL PREPNAME
598
599 MOV AL,BYTE PTR AXSAVE
600 MOV PARSERR,AL
601 PUSH ES
602 POP DS
603 PUSH CS
604 POP ES
605 MOV SI,FCB ; DS:SI points to user FCB
606 MOV DI,SI ; ES:DI points to DEBUG FCB
607 MOV CX,82
608 REP MOVSW
609 RETURN
610
611BADNAM:
612 MOV DX,OFFSET DG:NAMBAD_PTR
613 JMP RESTART
614
615IFHEX:
616 CMP BYTE PTR [PARSERR],-1 ; Invalid drive specification?
617 JZ BADNAM
618
619 CALL PARSE_A_FILE
620
621 MOV BX,[EXTPTR]
622 CMP WORD PTR DS:[BX],"EH" ; "HE"
623 RETNZ
624
625 CMP BYTE PTR DS:[BX+WORD],UPPER_X
626 RETURN
627
628IFEXE:
629 PUSH BX
630 MOV BX,[EXTPTR]
631 CMP WORD PTR DS:[BX],"XE" ; "EX"
632 JNZ RETIF
633
634 CMP BYTE PTR DS:[BX+WORD],UPPER_E
635RETIF:
636 POP BX
637 RETURN
638
639LOAD:
640 MOV BYTE PTR [RDFLG],READ
641 JMP SHORT DSKIO
642
643DWRITE:
644 MOV BYTE PTR [RDFLG],WRITE
645DSKIO:
646 MOV BP,[CSSAVE]
647 CALL SCANB
648
649 JNZ PRIMIO
650
651 JMP DEFIO
652
653PRIMIO:
654 CALL ADDRESS
655
656 CALL SCANB
657
658 JNZ PRMIO
659
660 JMP FILEIO
661
662;=========================================================================
663; PRMIO: This routine builds the necessary table for the new
664; generic IOCtl primitive read/write logical sector function.
665;
666; Inputs : Binary addresses and values converted by GETHEX
667;
668; Outputs: REL_READ_WRITE_TAB - Table needed by IOCtl function to
669; perform 32 bit sector addressing.
670;
671; Date : 6/17/87
672;=========================================================================
673
674PRMIO:
675 mov word ptr dg:[rel_rw_add],dx ;ac000;save transfer address
676 ; in table
677 mov word ptr dg:[rel_rw_add+2],ax ;ac000;save segment of transfer
678 ; address
679 MOV CX,2
680 CALL GETHEX ; Drive number must be 2 digits or less
681
682 PUSH DX ;save drive number
683 MOV CX,8 ;ac000;allow 32 bit addressibilty
684 CALL GETHEX ; Logical record number
685 mov word ptr dg:[rel_low_sec],dx ;ac000;save low word of logical
686 ; sector address
687 mov word ptr dg:[rel_high_sec],bx ;ac000;save high word of
688 ; logical sector address
689
690 MOV CX,3
691 CALL GETHEX ; Number of records
692 mov word ptr dg:[rel_sec_num],dx ;ac000;save number of sectors
693 ; to read/write
694
695 CALL GETEOL
696
697 POP BX ;ac000;drive number
698 CBW ; Turn off verify after write
699 MOV BYTE PTR DRVLET,bl ;ac000;save drive in case of error
700 PUSH BX
701 MOV DL,bL ;ac000;move drive to dl
702; Clean off the buffer cache for physical I/O
703 push ds
704 MOV AH,DISK_RESET
705 INT 21H
706
707 INC DL
708 MOV AH,GET_DPB
709 INT 21H
710 pop ds
711
712 or al,al ;ac000;see if an error occurred
713 pop ax ;ac000;restore drive
714
715 JNZ DRVERRJ
716
717 CMP CS:BYTE PTR [RDFLG],WRITE
718; $if z ;an000;we will write to sector(s)
719 JNZ $$IF5
720 call ABSWRT ;an000;logical sector write
721; $else ;an000;
722 JMP SHORT $$EN5
723$$IF5:
724 call ABSREAD ;an000;we will read sector(s)
725; $endif ;an000;
726$$EN5:
727
728
729ENDABS:
730 JNC RET0
731
732DRVERRJ:
733 JMP DRVERR
734
735RET0:
736; Clean cache again...
737 MOV AH,DISK_RESET
738 INT 21H
739
740 RETURN
741
742
743;called from debug.sal
744DEFIO:
745 MOV AX,[CSSAVE] ; Default segment
746 MOV DX,100H ; Default file I/O offset
747 CALL IFHEX
748 JNZ EXECHK
749 XOR DX,DX ; If HEX file, default OFFSET is zero
750HEX2BINJ:
751 JMP HEX2BIN
752
753FILEIO:
754; AX and DX have segment and offset of transfer, respectively
755 CALL IFHEX
756 JZ HEX2BINJ
757
758EXECHK:
759 CALL IFEXE
760 JNZ BINFIL
761 CMP BYTE PTR [RDFLG],READ
762 JZ EXELJ
763 MOV DX,OFFSET DG:EXEWRT_PTR
764 JMP RESTART ; Can't write .EXE files
765
766BINFIL:
767 CMP BYTE PTR [RDFLG],WRITE
768 JZ BINLOAD
769 CMP WORD PTR DS:[BX],4F00H + UPPER_C ;"CO"
770 JNZ BINLOAD
771 CMP BYTE PTR DS:[BX+WORD],UPPER_M
772 JNZ BINLOAD
773
774EXELJ:
775 DEC SI
776 CMP DX,100H
777 JNZ PRER
778
779 CMP AX,[CSSAVE]
780 JZ OAF
781
782PRER:
783 JMP PERROR
784
785OAF:
786 CALL OPEN_A_FILE
787
788 JNC GDOPEN
789
790 MOV AX,ERROR_FILE_NOT_FOUND
791 JMP EXECERR
792
793GDOPEN:
794 XOR DX,DX
795 XOR CX,CX
796 MOV BX,[HANDLE]
797 MOV AL,2
798 MOV AH,LSEEK
799 INT 21H
800
801 CALL IFEXE ; SUBTRACT 512 BYTES FOR EXE
802
803 JNZ BIN2 ; FILE LENGTH BECAUSE OF
804
805 SUB AX,512 ; THE HEADER
806BIN2:
807 MOV [BXSAVE],DX ; SET UP FILE SIZE IN DX:AX
808 MOV [CXSAVE],AX
809 MOV AH,CLOSE
810 INT 21H
811
812 JMP EXELOAD
813
814NO_MEM_ERR:
815 MOV DX,OFFSET DG:TOOBIG_PTR
816 CALL PRINTF_CRLF
817
818 JMP COMMAND
819
820WRTFILEJ:
821 JMP WRTFILE
822NOFILEJ:
823 JMP NOFILE
824
825BINLOAD:
826 PUSH AX
827 PUSH DX
828 CMP BYTE PTR [RDFLG],WRITE
829 JZ WRTFILEJ
830
831 CALL OPEN_A_FILE
832
833 JC NOFILEJ
834
835 MOV BX,[HANDLE]
836 MOV AX,(LSEEK SHL 8) OR LSEEK_EOF_OPTION
837 XOR DX,DX ;CX:DX=DISTANCE (OFFSET) TO MOVE IN BYTES
838 MOV CX,DX
839 INT 21H ; GET SIZE OF FILE
840
841 MOV SI,DX
842 MOV DI,AX ; SIZE TO SI:DI
843 MOV AX,(LSEEK SHL 8) OR LSEEK_FROM_START
844 XOR DX,DX
845 MOV CX,DX
846 INT 21H ; RESET POINTER BACK TO BEGINNING
847
848 POP AX
849 POP BX
850 PUSH BX
851 PUSH AX ; TRANS ADDR TO BX:AX
852 ADD AX,15
853 RCR AX,1
854 MOV CL,3
855 MOV CL,4
856 SHR AX,CL
857 ADD BX,AX ; Start of transfer rounded up to seg
858 MOV DX,SI
859 MOV AX,DI ; DX:AX is size
860 cmp dx,10h
861 jnc no_mem_err
862 MOV CX,16
863 DIV CX
864 OR DX,DX
865 JZ NOREM
866
867 INC AX
868NOREM: ; AX is number of paras in transfer
869 ADD AX,BX ; AX is first seg that need not exist
870 jc no_mem_err
871 CMP AX,CS:[PDB_BLOCK_LEN]
872 JA NO_MEM_ERR
873
874 MOV CXSAVE,DI
875 MOV BXSAVE,SI
876 POP DX
877 POP AX
878; AX:DX is disk transfer address (segment:offset)
879; SI:DI is length (32-bit number)
880RDWR:
881RDWRLOOP:
882 MOV BX,DX ; Make a copy of the offset
883 AND DX,000FH ; Establish the offset in 0H-FH range
884 MOV CL,4
885 SHR BX,CL ; Shift offset and
886 ADD AX,BX ; Add to segment register to get new Seg:offset
887 PUSH AX
888 PUSH DX ; Save AX,DX register pair
889 MOV WORD PTR [TRANSADD],DX
890 MOV WORD PTR [TRANSADD+WORD],AX
891 MOV CX,0FFF0H ; Keep request in segment
892 OR SI,SI ; Need > 64K?
893 JNZ BIGRDWR
894
895 MOV CX,DI ; Limit to amount requested
896BIGRDWR:
897 PUSH DS
898 PUSH BX
899 MOV BX,[HANDLE]
900 MOV AH,[RDFLG]
901 LDS DX,[TRANSADD]
902 INT 21H ; Perform read or write
903
904 POP BX
905 POP DS
906 JC BADWR
907
908 CMP BYTE PTR [RDFLG],WRITE
909 JNZ GOODR
910
911 CMP CX,AX
912 JZ GOODR
913
914BADWR:
915 MOV CX,AX
916 STC
917 POP DX ; READ OR WRITE BOMBED OUT
918 POP AX
919 RETURN
920
921GOODR:
922 MOV CX,AX
923 SUB DI,CX ; Request minus amount transferred
924 SBB SI,0 ; Ripple carry
925 OR CX,CX ; End-of-file?
926 POP DX ; Restore DMA address
927 POP AX
928 JZ DOCLOSE
929
930 ADD DX,CX ; Bump DMA address by transfer length
931 MOV BX,SI
932 OR BX,DI ; Finished with request
933 JNZ RDWRLOOP
934
935DOCLOSE:
936 SAVEREG <AX,BX>
937 MOV BX,HANDLE
938 MOV AH,CLOSE
939 INT 21H
940
941 RESTOREREG <BX,AX>
942 RETURN
943
944NOFILE:
945 MOV DX,OFFSET DG:NOTFND_PTR
946 JMP RESTART
947
948NO_NAME_GIVEN:
949 MOV DX,OFFSET DG:NONAMESPEC_PTR
950RESTARTJMP:
951 JMP RESTART
952
953WRTFILE:
954 CMP [NAMESPEC],0
955 JZ NO_NAME_GIVEN ; Hey User, you forgot to specify a name
956
957 CALL CREATE_A_FILE ; Create file we want to write to
958
959 JC CHECKREADONLY ; ARR 2.4
960
961 MOV SI,BXSAVE ; Get high order number of bytes to transfer
962 CMP SI,000FH
963 JLE WRTSIZE ; Is bx less than or equal to FH
964
965 XOR SI,SI ; Ignore BX if greater than FH - set to zero
966WRTSIZE:
967 MOV WRT_ARG2,SI
968 MOV DI,CXSAVE
969 MOV WRT_ARG1,DI
970 MOV DX,OFFSET DG:WRTMES_PTR
971 CALL PRINTF_CRLF
972
973 POP DX
974 POP AX
975 CALL RDWR
976
977 JNC CLSFLE
978
979 CALL CLSFLE
980
981 CALL DELETE_A_FILE
982
983 MOV DX,OFFSET DG:NOSPACE_PTR
984 JMP RESTARTJMP
985
986 CALL CLSFLE ;is this dead code? - edk
987
988 JMP COMMAND
989
990CHECKREADONLY: ; ARR 2.4
991 MOV DX,[FILESTRT]
992 MOV SI,[FILEEND]
993 PUSH [SI]
994 MOV BYTE PTR [SI],0
995 MOV AX,CHMOD SHL 8 ;AL=0,REQUEST FILE'S CURRENT
996 ; ATTRIBUTE BE RETURNED IN CX
997 INT 21H
998
999 POP [SI]
1000 MOV DX,OFFSET DG:NOROOM_PTR ; Creation error - report error
1001 JC RESTARTJMP
1002
1003 TEST CX,ATTR_READ_ONLY+ATTR_HIDDEN+ATTR_SYSTEM
1004 JZ RESTARTJMP
1005
1006 MOV DX,OFFSET DG:ACCMES_PTR ; Write on read only file
1007 JMP RESTARTJMP
1008
1009CLSFLE:
1010 MOV AH,CLOSE
1011 MOV BX,[HANDLE]
1012 INT 21H
1013
1014 RETURN
1015
1016EXELOAD:
1017 POP [RETSAVE] ; Suck up return addr
1018 INC BYTE PTR [NEWEXEC]
1019 MOV BX,[USER_PROC_PDB]
1020 MOV AX,BEGSEG
1021 MOV DS,AX
1022 ASSUME DS:NOTHING
1023
1024 CMP AX,BX
1025 JZ DEBUG_CURRENT
1026
1027 JMP FIND_DEBUG
1028
1029DEBUG_CURRENT:
1030 MOV AX,CS:[DSSAVE]
1031DEBUG_FOUND:
1032 MOV CS:BYTE PTR [NEWEXEC],0
1033 MOV CS:[HEADSAVE],AX
1034 PUSH CS:[RETSAVE] ; Get the return address back
1035 PUSH AX
1036 MOV BX,CS
1037 SUB AX,BX
1038 PUSH ES
1039 MOV ES,CS:BEGSEG
1040 ASSUME ES:NOTHING
1041
1042 MOV BX,AX ; size of debug in para.
1043 ADD BX,10H
1044 MOV AX,CS ; and the size of printf in para.
1045 SUB AX,CS:BEGSEG
1046 ADD BX,AX
1047 MOV AH,SETBLOCK
1048 INT 21H
1049
1050 POP ES
1051 POP AX
1052 MOV CS:WORD PTR [COM_LINE+WORD],AX
1053 MOV CS:WORD PTR [COM_FCB1+WORD],AX
1054 MOV CS:WORD PTR [COM_FCB2+WORD],AX
1055 PUSH DS
1056 PUSH CS
1057 POP DS
1058 CALL EXEC_A_FILE
1059
1060 POP DS
1061 MOV AX,CS:[HANDLE]
1062 JC EXECERR
1063
1064 CALL SET_TERMINATE_VECTOR ; Reset int 22
1065
1066 MOV AH,GET_CURRENT_PDB
1067 INT 21H
1068
1069 MOV CS:[USER_PROC_PDB],BX
1070 MOV CS:[DSSAVE],BX
1071 MOV CS:[ESSAVE],BX
1072 MOV ES,BX
1073 MOV WORD PTR ES:[PDB_EXIT],OFFSET DG:TERMINATE
1074 MOV WORD PTR ES:[PDB_EXIT+WORD],CS
1075 LES DI,CS:[COM_CSIP]
1076 MOV CS:[CSSAVE],ES
1077 MOV CS:[IPSAVE],DI
1078 MOV CS:WORD PTR [DISADD+WORD],ES
1079 MOV CS:WORD PTR [DISADD],DI
1080 MOV CS:WORD PTR [ASMADD+WORD],ES
1081 MOV CS:WORD PTR [ASMADD],DI
1082 MOV CS:WORD PTR [DEFDUMP+WORD],ES
1083 MOV CS:WORD PTR [DEFDUMP],DI
1084 MOV BX,DS
1085 MOV AH,SET_CURRENT_PDB
1086 INT 21H
1087
1088 LES DI,CS:[COM_SSSP]
1089 MOV AX,ES:[DI]
1090 INC DI
1091 INC DI
1092 MOV CS:[AXSAVE],AX
1093 MOV CS:[SSSAVE],ES
1094 MOV CS:[SPSAVE],DI
1095 RETURN
1096
1097EXECERR:
1098 PUSH CS
1099 POP DS
1100 MOV DX,OFFSET DG:NOTFND_PTR
1101 CMP AX,ERROR_FILE_NOT_FOUND
1102 JZ GOTEXECEMES
1103
1104 MOV DX,OFFSET DG:ACCMES_PTR
1105 CMP AX,ERROR_ACCESS_DENIED
1106 JZ GOTEXECEMES
1107
1108 MOV DX,OFFSET DG:TOOBIG_PTR
1109 CMP AX,ERROR_NOT_ENOUGH_MEMORY
1110 JZ GOTEXECEMES
1111
1112 MOV DX,OFFSET DG:EXEBAD_PTR
1113 CMP AX,ERROR_BAD_FORMAT
1114 JZ GOTEXECEMES
1115
1116 MOV DX,OFFSET DG:EXECEMES_PTR
1117GOTEXECEMES:
1118 CALL PRINTF_CRLF
1119
1120 JMP COMMAND
1121
1122HEX2BIN:
1123 MOV [INDEX],DX
1124 MOV DX,OFFSET DG:HEXWRT_PTR
1125 CMP BYTE PTR [RDFLG],WRITE
1126 JNZ RDHEX
1127
1128 JMP RESTARTJ2
1129
1130RDHEX:
1131 MOV ES,AX
1132 CALL OPEN_A_FILE
1133
1134 MOV DX,OFFSET DG:NOTFND_PTR
1135 JNC HEXFND
1136
1137 JMP RESTART
1138
1139HEXFND:
1140 XOR BP,BP
1141 MOV SI,OFFSET DG:(BUFFER+BUFSIZ) ; Flag input buffer as empty
1142READHEX:
1143 CALL GETCH
1144
1145 CMP AL,CHAR_COLON ; Search for : to start line
1146 JNZ READHEX
1147
1148 CALL GETBYT ; Get byte count
1149
1150 MOV CL,AL
1151 MOV CH,0
1152 JCXZ HEXDONE
1153
1154 CALL GETBYT ; Get high byte of load address
1155
1156 MOV BH,AL
1157 CALL GETBYT ; Get low byte of load address
1158
1159 MOV BL,AL
1160 ADD BX,[INDEX] ; Add in offset
1161 MOV DI,BX
1162 CALL GETBYT ; Throw away type byte
1163
1164READLN:
1165 CALL GETBYT ; Get data byte
1166
1167 STOSB
1168 CMP DI,BP ; Check if this is the largest address so far
1169 JBE HAVBIG
1170
1171 MOV BP,DI ; Save new largest
1172HAVBIG:
1173 LOOP READLN
1174
1175 JMP SHORT READHEX
1176
1177GETCH:
1178 CMP SI,OFFSET DG:(BUFFER+BUFSIZ)
1179 JNZ NOREAD
1180
1181 MOV DX,OFFSET DG:BUFFER
1182 MOV SI,DX
1183 MOV AH,READ
1184 PUSH BX
1185 PUSH CX
1186 MOV CX,BUFSIZ
1187 MOV BX,cs:[HANDLE]
1188 INT 21H
1189
1190 POP CX
1191 POP BX
1192 OR AX,AX
1193 JZ HEXDONE
1194
1195NOREAD:
1196 LODSB
1197 CMP AL,CHAR_EOF
1198 JZ HEXDONE
1199
1200 OR AL,AL
1201 RETNZ
1202
1203HEXDONE:
1204 MOV [CXSAVE],BP
1205 MOV BXSAVE,0
1206 RETURN
1207
1208HEXDIG:
1209 CALL GETCH
1210
1211 CALL HEXCHK
1212
1213 RETNC
1214
1215 MOV DX,OFFSET DG:HEXERR_PTR
1216RESTARTJ2:
1217 JMP RESTART
1218
1219GETBYT:
1220 CALL HEXDIG
1221
1222 MOV BL,AL
1223 CALL HEXDIG
1224
1225 SHL BL,1
1226 SHL BL,1
1227 SHL BL,1
1228 SHL BL,1
1229 OR AL,BL
1230 RETURN
1231
1232;=========================================================================
1233; ABSREAD: This routine performs a primitive logical sector read of
1234; the specified drive. This routine replaces the old
1235; INT 25h function which only allowed 16 bit addressibility.
1236; The new generic IOCtl logical sector read will permit
1237; 32 bit addressibility on a disk device.
1238;
1239; Inputs : REL_READ_WRITE_TAB - Table provides dword sector
1240; addressibility.
1241;
1242; Outputs: Data located at specified transfer address.
1243;
1244; Error : Carry is set on error.
1245;
1246; Date : 6/17/87
1247;=========================================================================
1248
1249ABSREAD proc near ;an000;read logical sector(s)
1250
1251 push ds ;an000;save affected regs
1252 push cx ;an000;save affected regs
1253 push bx ;an000;
1254
1255 mov cx,-1 ;an000;extended format
1256 mov bx,offset dg:rel_read_write_tab ;an000;point to read/write table
1257 int 25h ;an000;invoke relative sector read
1258 pop bx ;an000;discard stack word
1259
1260 pop bx ;an000;restore regs
1261 pop cx ;an000;
1262 pop ds ;an000;
1263
1264 ret ;an000;return to caller
1265
1266ABSREAD endp ;an000;end proc
1267
1268
1269;=========================================================================
1270; ABSWRT: This routine performs a primitive logical sector write of
1271; the specified drive. This routine replaces the old
1272; INT 26h function which only allowed 16 bit addressibility.
1273; The new generic IOCtl logical sector write will permit
1274; 32 bit addressibility on a disk device.
1275;
1276; Inputs : REL_READ_WRITE_TAB - Table provides dword sector
1277; addressibility.
1278;
1279; Outputs: Data moved from transfer address to applicable sector(s).
1280;
1281; Error : Carry is set on error.
1282;
1283; Date : 6/17/87
1284;=========================================================================
1285
1286ABSWRT proc near ;an000;write logical sector(s)
1287
1288 push ds ;an000;save affected regs
1289 push cx ;an000;
1290 push bx ;an000;
1291
1292 mov cx,-1 ;an000;extended format
1293 mov bx,offset dg:rel_read_write_tab ;an000;point to read/write table
1294 int 26h ;an000;invoke relative sector write
1295 pop bx ;an000;discard stack word
1296
1297 pop bx ;an000;restore regs
1298 pop cx ;an000;
1299 pop ds ;an000;
1300
1301 ret ;an000;return to caller
1302
1303ABSWRT endp ;an000;end proc
1304
1305
1306CODE ENDS
1307 END DEBCOM2
1308 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBCOM3.ASM b/v4.0/src/CMD/DEBUG/DEBCOM3.ASM
new file mode 100644
index 0000000..21e971c
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBCOM3.ASM
@@ -0,0 +1,678 @@
1 PAGE 80,132 ;
2 TITLE DEBCOM3.ASM - PART3 DEBUGGER COMMANDS
3; ROUTINES TO PERFORM DEBUGGER COMMANDS
4
5 IF1
6 %OUT COMPONENT=DEBUG, MODULE=DEBCOM3
7 ENDIF
8.XLIST
9.XCREF
10 INCLUDE DOSSYM.INC
11 INCLUDE DEBEQU.ASM
12 INCLUDE DPL.ASM
13.CREF
14.LIST
15CODE SEGMENT PUBLIC BYTE
16CODE ENDS
17
18CONST SEGMENT PUBLIC BYTE
19 EXTRN USER_PROC_PDB:WORD,RSTACK:WORD,STACK:BYTE
20 EXTRN DSSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD,axSAVE:WORD,dxSAVE:WORD
21 EXTRN SSSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD
22 EXTRN NEXTCS:WORD,NEXTIP:WORD, RSETFLAG:BYTE
23CONST ENDS
24
25CSTACK SEGMENT STACK
26CSTACK ENDS
27
28DATA SEGMENT PUBLIC BYTE
29 EXTRN BRKCNT:WORD,TCOUNT:WORD,SWITCHAR:BYTE,BPTAB:BYTE
30 EXTRN BP_ERROR:BYTE,COMP_ARG1:WORD,COMP_ARG2:WORD,COMP_ARG3:WORD
31 EXTRN COMP_ARG4:WORD,COMP_ARG5:WORD,COMP_ARG6:WORD,COMP_PTR:BYTE
32 EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE
33 EXTRN FZTRACE:BYTE, SYNERR_PTR:BYTE
34 EXTRN BEGSEG:WORD
35 IF IBMVER
36 EXTRN OLD_MASK:BYTE
37 ENDIF
38 EXTRN SAVESTATE:BYTE
39DATA ENDS
40
41DG GROUP CODE,CONST,CSTACK,DATA
42
43CODE SEGMENT PUBLIC BYTE
44ASSUME CS:DG,DS:DG,ES:DG,SS:DG
45 PUBLIC COMPARE,INPUT,OUTPUT,GO
46 PUBLIC TRACE,ZTRACE,SKIP_FILE
47 EXTRN GETHEX:NEAR,GETEOL:NEAR,CRLF:NEAR,ERR:NEAR, PERR:NEAR
48 EXTRN HEX:NEAR,DIGIT:NEAR,SCANP:NEAR,DISPREG:NEAR
49 EXTRN COMMAND:NEAR,DABORT:NEAR,DELIM1:NEAR,DELIM2:NEAR
50 EXTRN NMIINT:NEAR,NMIINTEND:NEAR,PRINTF_CRLF:NEAR
51 EXTRN ADDRESS:NEAR,HEXIN:NEAR,DSRANGE:NEAR
52; just like trace except skips OVER next INT or CALL.
53DEBCOM3:
54ZTRACE:
55 MOV FZTRACE,-1
56 CALL SETADD
57 CALL SCANP
58 CALL HEXIN
59 MOV DX,1
60 JC ZSTOCNT
61 MOV CX,4
62 CALL GETHEX
63 CALL CHECKNONE
64ZSTOCNT:
65 MOV [TCOUNT],DX
66 CALL GETEOL
67 MOV DX,NEXTCS
68 MOV CSSAVE,DX
69 MOV DX,NEXTIP
70 MOV IPSAVE,DX
71ZSTEP:
72 MOV ES,[CSSAVE] ; point to instruction to execute
73 MOV DI,[IPSAVE] ; include offset in segment
74 XOR DX,DX ; where to place breakpoint
75get_opcode:
76 MOV AL,ES:[DI] ; get the opcode
77 cmp al,0f0h ; lock
78 je is_override
79 cmp al,26h ; es:
80 je is_override
81 cmp al,2eh ; cs:
82 je is_override
83 cmp al,36h ; ss:
84 je is_override
85 cmp al,3eh ; ds:
86 jne not_override
87Is_override:
88; inc dx ; this seemed to put us in an endless
89 inc di ; loop, try this.
90 jmp get_opcode
91Not_override:
92 CMP AL,11101000B ; direct intra call
93 JZ ZTRACE3 ; yes, 3 bytes
94 CMP AL,10011010B ; direct inter call
95 JZ ZTRACE5 ; yes, 5 bytes
96 CMP AL,11111111B ; indirect?
97 JZ ZTRACEMODRM ; yes, go figure length
98 CMP AL,11001100B ; short interrupt?
99 JZ ZTRACE1 ; yes, 1 byte
100 CMP AL,11001101B ; long interrupt?
101 JZ ZTRACE2 ; yes, 2 bytes
102 CMP AL,11100010B ; loop
103 JZ ZTRACE2 ; 2 byter
104 CMP AL,11100001B ; loopz/loope
105 JZ ZTRACE2 ; 2 byter
106 CMP AL,11100000B ; loopnz/loopne
107 JZ ZTRACE2 ; 2 byter
108 AND AL,11111110B ; check for rep
109 CMP AL,11110010B ; perhaps?
110 JZ FOO1
111 JMP STEP ; can't do anything special, step
112FOO1:
113 MOV AL,ES:[DI+1] ; next instruction
114 AND AL,11111110B ; ignore w bit
115 CMP AL,10100100B ; MOVS
116 JZ ZTRACE2 ; two byte
117 CMP AL,10100110B ; CMPS
118 JZ ZTRACE2 ; two byte
119 CMP AL,10101110B ; SCAS
120 JZ ZTRACE2 ; two byte
121 CMP AL,10101100B ; LODS
122 JZ ZTRACE2 ; two byte
123 CMP AL,10101010B ; STOS
124 JZ ZTRACE2 ; two byte
125 JMP STEP ; bogus, do single step
126
127ZTRACEMODRM:
128 MOV AL,ES:[DI+1] ; get next byte
129 AND AL,11111000B ; get mod and type
130 CMP AL,01010000B ; indirect intra 8 bit offset?
131 JZ ZTRACE3 ; yes, three byte whammy
132 CMP AL,01011000B ; indirect inter 8 bit offset
133 JZ ZTRACE3 ; yes, three byte guy
134 CMP AL,10010000B ; indirect intra 16 bit offset?
135 JZ ZTRACE4 ; four byte offset
136 CMP AL,10011000B ; indirect inter 16 bit offset?
137 JZ ZTRACE4 ; four bytes
138 CMP AL,11010000B ; indirect through reg?
139 JZ ZTRACE2 ; two byte instruction
140 JMP STEP ; can't figger out what this is!
141ZTRACE5:
142 INC DX
143ZTRACE4:
144 INC DX
145ZTRACE3:
146 INC DX
147ZTRACE2:
148 INC DX
149ZTRACE1:
150 INC DX
151 ADD DI,DX ; offset to breakpoint instruction
152 MOV WORD PTR [BPTAB],DI ; save offset
153 MOV WORD PTR [BPTAB+2],ES ; save segment
154 MOV AL,ES:[DI] ; get next opcode byte
155 MOV BYTE PTR [BPTAB+4],AL ; save it
156 MOV BYTE PTR ES:[DI],0CCH ; break point it
157 MOV [BRKCNT],1 ; only this breakpoint
158 JMP DEXIT ; start the operation!
159
160; Trace 1 instruction or the number of instruction specified
161; by the parameter using 8086 trace mode. Registers are all
162; set according to values in save area
163TRACE:
164 MOV FZTRACE,0
165 CALL SETADD
166 CALL SCANP
167 CALL HEXIN
168 MOV DX,1
169 JC STOCNT
170 MOV CX,4
171 CALL GETHEX
172 CALL CHECKNONE
173STOCNT:
174 MOV [TCOUNT],DX
175 CALL GETEOL
176 MOV DX,NEXTCS
177 MOV CSSAVE,DX
178 MOV DX,NEXTIP
179 MOV IPSAVE,DX
180STEP:
181 MOV [BRKCNT],0
182; The 286 has a problem with trace mode and software interrupt instructions;
183; it treats them as atomic operations. We simulate the operation in software.
184 MOV ES,[CSSAVE] ; Get next instruction pointer
185 MOV DI,[IPSAVE]
186 MOV AL,ES:[DI] ; get next opcode
187 cmp al,0e4h ; check for 'IN' opcode
188 jne not_inal_op
189 cmp es:byte ptr[di+1],21h
190 jne not_mask_op
191 add [ipsave],2
192 JMP SETalmask
193
194not_inal_op:
195 cmp al,0ech ; in al,DX ?
196 jne not_mask_op
197 cmp dxsave,21h
198 jne not_mask_op
199 add [ipsave],1
200SETalmask:
201 mov ax,[axsave]
202 in al,21h
203 mov [axsave],ax
204 JMP SETENVIRON
205
206not_mask_op:
207 CMP AL,0CDH ; trace over an interrupt?
208 JZ DOINT ; no, check for other special cases
209 CMP AL,0CEH ; how about int overflow
210 JNZ CHECKCC
211 TEST FLSAVE,F_OVERFLOW ; see it overflow is present
212 JZ CHECKOP
213 MOV BX,4 ; INTO = INT 4
214 DEC IPSAVE ; INTO is a singel byte
215 JMP SHORT DOVAL
216CHECKCC:
217 CMP AL,0CCH
218 JNZ CHECKOP
219 MOV BX,3 ; INT 3 = CC
220 DEC IPSAVE
221 JMP SHORT DOVAL
222DOINT:
223; We have a software interrupt. Get destination vector
224 MOV BL,BYTE PTR ES:[DI+1] ; get vector number
225 XOR BH,BH ; clear out upper
226DOVAL:
227 SHL BX,1 ; word index
228 SHL BX,1 ; dword index
229 XOR DI,DI ; interrupt table
230 MOV ES,DI
231 MOV AX,ES:[BX] ; point to vector
232 MOV BX,ES:[BX+2] ; point to vector
233; AX:BX is the vector. Swap it with currect CS:IP
234 XCHG AX,IPSAVE ; new CS:IP
235 XCHG BX,CSSAVE
236; AX:BX is old CS:IP. We 'PUSH' flags, oldCS and oldIP, reset flags (ifl) and
237; set CS:IP to point to interrupt instruction.
238 MOV ES,SSSAVE ; point to user stack
239 MOV DI,SPSAVE
240; Take old flags and PUSH the flags.
241 MOV CX,FLSAVE ; get flags
242 SUB DI,2 ; PUSHF
243 MOV ES:[DI],CX ; rest of push
244; Push the old CS
245 SUB DI,2 ; PUSH CS
246 MOV ES:[DI],BX ; rest of push
247; Push the old IP
248 SUB DI,2 ; PUSH IP
249 ADD AX,2 ; increment IP
250 MOV ES:[DI],AX ; rest of push
251; Update stack
252 MOV SPSAVE,DI ; store
253; Take flags and turn interrupts off and trace mode off
254 AND CX,NOT F_INTERRUPT ; CLI
255 AND CX,NOT F_TRACE ; no trace
256 MOV FLSAVE,CX ; rest of CLI
257; Set up correct process and go to normal reentry code.
258 IF NOT SYSVER
259 MOV BX,[USER_PROC_PDB]
260 MOV AH,SET_CURRENT_PDB
261 INT 21H
262 ENDIF
263 JMP SETENVIRON
264; We need to special case the following instructions that may push a TRACE bit
265; on the stack: PUSHF (9C)
266
267; Save the opcode in A Special place
268CHECKOP:
269 MOV RSETFLAG,AL ; no bits to turn off
270SETTRACE:
271 OR FLSAVE,F_TRACE ; Turn on trace bit
272 IF IBMVER
273 CLI
274 IN AL,MASK_PORT ; Get current mask
275 JMP SHORT FOO
276FOO:
277 MOV [OLD_MASK],AL ; Save it
278 MOV AL,INT_MASK ; New mask
279 OUT MASK_PORT,AL ; Set it
280 STI
281 ENDIF
282DEXIT:
283 IF NOT SYSVER
284 MOV BX,[USER_PROC_PDB]
285 MOV AH,SET_CURRENT_PDB
286 INT 21H
287 ENDIF
288; Unfortunately, any system call we issue will muck with the current extended
289; errors. Here we must restore the extended error state so that if the user
290; program gets it, we do not interfere.
291 MOV AX,(SERVERCALL SHL 8) + 10
292 MOV DX,OFFSET DG:SAVESTATE
293 INT 21H
294 PUSH DS
295 XOR AX,AX
296 MOV DS,AX
297 MOV WORD PTR DS:[12],OFFSET DG:BREAKFIX ; Set vector 3--breakpoint instruction
298 MOV WORD PTR DS:[14],CS
299 MOV WORD PTR DS:[4],OFFSET DG:REENTER ; Set vector 1--Single step
300 MOV WORD PTR DS:[6],CS
301 CLI
302 IF SETCNTC
303 MOV WORD PTR DS:[8CH],OFFSET DG:CONTC ; Set vector 23H (CTRL-C)
304 MOV WORD PTR DS:[8EH],CS
305 ENDIF
306 POP DS
307 MOV SP,OFFSET DG:STACK
308 POP AX
309 POP BX
310 POP CX
311 POP DX
312 POP BP
313 POP BP
314 POP SI
315 POP DI
316 POP ES
317 POP ES
318 POP SS
319 MOV SP,[SPSAVE]
320 PUSH [FLSAVE]
321 PUSH [CSSAVE]
322 PUSH [IPSAVE]
323 MOV DS,[DSSAVE]
324 IRET
325STEP1:
326 CALL CRLF
327 CALL DISPREG
328 TEST FZTRACE,-1
329 JNZ STEPZ
330 JMP STEP
331STEPZ: JMP ZSTEP
332
333; Re-entry point from CTRL-C. Top of stack has address in 86-DOS for
334; continuing, so we must pop that off.
335CONTC:
336 ADD SP,6
337 JMP SHORT REENTERREAL
338
339; Re-entry point from breakpoint. Need to decrement instruction
340; pointer so it points to location where breakpoint actually
341; occured.
342BREAKFIX:
343 PUSH BP
344 MOV BP,SP
345 DEC WORD PTR [BP].OLDIP
346 POP BP
347 JMP REENTERREAL
348
349; Re-entry point from trace mode or interrupt during execution. All registers
350; are saved so they can be displayed or modified.
351INTERRUPT_FRAME STRUC
352OLDBP DW ?
353OLDIP DW ?
354OLDCS DW ?
355OLDF DW ?
356OLDERIP DW ?
357OLDERCS DW ?
358OLDERF DW ?
359INTERRUPT_FRAME ENDS
360
361ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:NOTHING
362; ReEnter is the main entry point for breakpoint interrupts and for trace mode
363; interrupts. We treat both of these cases identically: save state, display
364; registers and go for another command. If we get NMI's, we skip them or if
365; it turns out that we are debugging ourselves, we skip them.
366
367; Due to bogosities in the 808x chip, Consider tracing over an interrupt and
368; then setting a breakpoint to where the interrupt returns. You get the INT 3
369; and then trace mode gets invoked! This is why we ignore interrupts within
370; ourselves.
371REENTER:
372 PUSH BP
373 MOV BP,SP ; get a frame to address from
374 PUSH AX
375; MOV AX,CS
376; CMP AX,[BP].OLDCS ; Did we interrupt ourselves?
377; JNZ GOREENTER ; no, go reenter
378 IF IBMJAPAN
379 MOV AX,[BP].OLDIP
380 CMP AX,OFFSET DG:NMIINT ; interrupt below NMI interrupt?
381 JB GOREENTER ; yes, go reenter
382 CMP [BP].OLDIP,OFFSET DG:NMIINTEND
383 JAE GOREENTER ; interrupt above NMI interrupt?
384 POP AX ; restore state
385 POP BP
386 SUB SP,6 ; switch TRACE and NMI stack frames
387 PUSH BP
388 MOV BP,SP ; set up frame
389 PUSH AX ; get temp variable
390 MOV AX,[BP].OLDERIP ; get NMI Vector
391 MOV [BP].OLDIP,AX ; stuff in new NMI vector
392 MOV AX,[BP].OLDERCS ; get NMI Vector
393 MOV [BP].OLDCS,AX ; stuff in new NMI vector
394 MOV AX,[BP].OLDERF ; get NMI Vector
395 AND AH,0FEH ; turn off Trace if present
396 MOV [BP].OLDF,AX ; stuff in new NMI vector
397 MOV [BP].OLDERF,AX
398 MOV [BP].OLDERIP,OFFSET DG:REENTER ; offset of routine
399 MOV [BP].OLDERCS,CS ; and CS
400 POP AX
401 POP BP
402 IRET ; go try again
403 ENDIF
404GOREENTER:
405 IF IBMVER
406 MOV AL,CS:[OLD_MASK] ; Recover Old mask
407 OUT MASK_PORT,AL ; Restore it
408 ENDIF
409 MOV AL,CS:[RSETFLAG]
410; Determine, based on the previous instruction, what we are supposed to do
411; to flags on the users stack.
412 CMP AL,09CH ; PUSHF
413 JNZ NOFIX
414; OlderIP = flags. Turn off trace bit
415 AND [BP].OLDERIP,NOT F_TRACE
416NOFIX:
417 POP AX
418 POP BP
419REENTERREAL:
420 MOV CS:[SPSAVE+SEGDIF],SP
421 MOV CS:[SSSAVE+SEGDIF],SS
422 MOV CS:[FLSAVE],CS
423 MOV SS,CS:[FLSAVE]
424 MOV SP,OFFSET DG:RSTACK
425 ASSUME SS:DG
426
427 PUSH ES
428 PUSH DS
429 PUSH DI
430 PUSH SI
431 PUSH BP
432 DEC SP
433 DEC SP
434 PUSH DX
435 PUSH CX
436 PUSH BX
437 PUSH AX
438 PUSH SS
439 POP DS
440 ASSUME DS:DG
441
442 MOV SS,[SSSAVE]
443 MOV SP,[SPSAVE]
444 ASSUME SS:NOTHING
445
446 POP [IPSAVE]
447 POP [CSSAVE]
448 POP AX
449 AND AX,NOT F_TRACE ; TURN OFf trace mode bit
450 MOV [FLSAVE],AX
451 MOV [SPSAVE],SP
452SETENVIRON:
453 PUSH DS
454 POP ES
455 ASSUME ES:DG
456
457 PUSH DS
458 POP SS
459 ASSUME SS:DG
460
461 MOV SP,OFFSET DG:STACK
462 PUSH DS
463 XOR AX,AX
464 MOV DS,AX
465 ASSUME DS:NOTHING
466
467 IF SETCNTC
468 MOV WORD PTR DS:[8CH],OFFSET DG:DABORT ; Set Ctrl-C vector
469 MOV WORD PTR DS:[8EH],CS
470 ENDIF
471 POP DS
472 ASSUME DS:DG
473
474 STI
475 CLD
476; Since we are about to issue system calls, let's grab the current user's
477; extended error info.
478 MOV AH,GETEXTENDEDERROR
479 INT 21H
480 ASSUME DS:NOTHING,ES:NOTHING
481
482 MOV SAVESTATE.DPL_AX,AX
483 MOV SAVESTATE.DPL_BX,BX
484 MOV SAVESTATE.DPL_CX,CX
485 MOV SAVESTATE.DPL_DX,DX
486 MOV SAVESTATE.DPL_SI,SI
487 MOV SAVESTATE.DPL_DI,DI
488 MOV SAVESTATE.DPL_DS,DS
489 MOV SAVESTATE.DPL_ES,ES
490 MOV AX,CS
491 MOV DS,AX
492 MOV ES,AX
493 ASSUME DS:DG,ES:DG
494
495 IF NOT SYSVER
496 MOV AH,GET_CURRENT_PDB
497 INT 21H
498 MOV [USER_PROC_PDB],BX
499 MOV BX,BEGSEG
500 MOV AH,SET_CURRENT_PDB
501 INT 21H
502 ENDIF
503 MOV SI,OFFSET DG:BPTAB
504 MOV CX,[BRKCNT]
505 JCXZ SHOREG
506 PUSH ES
507CLEARBP:
508 LES DI,DWORD PTR [SI]
509 ADD SI,4
510 MOVSB
511 LOOP CLEARBP
512 POP ES
513SHOREG:
514 DEC [TCOUNT]
515 JZ CHECKDISP
516 JMP STEP1
517CHECKDISP:
518 CALL CRLF
519 CALL DISPREG
520 JMP COMMAND
521
522; Input from the specified port and display result
523INPUT:
524 MOV CX,4 ; Port may have 4 digits
525 CALL GETHEX ; Get port number in DX
526 CALL GETEOL
527
528 IN AL,DX ; Variable port input
529
530 PUSH CS
531 POP ES
532 MOV DI,OFFSET DG:ARG_BUF
533 CALL HEX ; And display
534
535 XOR AL,AL
536 STOSB
537 MOV DX,OFFSET DG:ARG_BUF_PTR
538 JMP PRINTF_CRLF
539
540; Output a value to specified port.
541OUTPUT:
542 MOV CX,4 ; Port may have 4 digits
543 CALL GETHEX ; Get port number
544 PUSH DX ; Save while we get data
545 MOV CX,2 ; Byte output only
546 CALL GETHEX ; Get data to output
547 CALL GETEOL
548 XCHG AX,DX ; Output data in AL
549 POP DX ; Port in DX
550
551 OUT DX,AL ; Variable port output
552
553 RETURN
554
555SETADD:
556 MOV DX,CSSAVE ; set up start addresses
557 MOV NEXTCS,DX
558 MOV DX,IPSAVE
559 MOV NEXTIP,DX
560 MOV BP,[CSSAVE]
561 CALL SCANP
562 CMP BYTE PTR [SI],"="
563 RETNZ
564 INC SI
565 CALL ADDRESS
566 MOV NEXTCS,AX
567 MOV NEXTIP,DX
568 RETURN
569
570; Jump to program, setting up registers according to the
571; save area. up to 10 breakpoint addresses may be specified.
572GO:
573 MOV RSETFLAG,0
574 CALL SETADD
575 XOR BX,BX
576 MOV DI,OFFSET DG:BPTAB
577GO1:
578 CALL SCANP
579 JZ DEXEC
580 MOV BP,[CSSAVE]
581 PUSH DI
582 PUSH BX ;AN000; DMS;SAVE BX - ADDRESS KILLS IT
583 CALL ADDRESS
584 POP BX ;AN000; DMS;RESTORE BX
585 POP DI
586 MOV [DI],DX ; Save offset
587 MOV [DI+2],AX ; Save segment
588 ADD DI,5 ; Leave a little room
589 INC BX
590 CMP BX,1+BPMAX
591 JNZ GO1
592 MOV DX,OFFSET DG:BP_ERROR ; BP ERROR
593 JMP ERR
594DEXEC:
595 MOV [BRKCNT],BX
596 MOV CX,BX
597 JCXZ NOBP
598 MOV DI,OFFSET DG:BPTAB
599 PUSH DS
600SETBP:
601 LDS SI,ES:DWORD PTR [DI]
602 ADD DI,4
603 MOVSB
604 MOV BYTE PTR [SI-1],0CCH
605 LOOP SETBP
606 POP DS
607NOBP:
608 MOV DX,NEXTCS
609 MOV CSSAVE,DX
610 MOV DX,NEXTIP
611 MOV IPSAVE,DX
612 MOV [TCOUNT],1
613 JMP DEXIT
614
615SKIP_FILE:
616 MOV AH,CHAR_OPER
617 INT 21H
618 MOV CS:[SWITCHAR],DL ; GET THE CURRENT SWITCH CHARACTER
619FIND_DELIM:
620 LODSB
621 CALL DELIM1
622 JZ GOTDELIM
623 CALL DELIM2
624 JNZ FIND_DELIM
625GOTDELIM:
626 DEC SI
627 RETURN
628
629COMPARE:
630 CALL DSRANGE
631 PUSH CX
632 PUSH AX
633 PUSH DX
634 CALL ADDRESS ; Same segment
635 CALL GETEOL
636 POP SI
637 MOV DI,DX
638 MOV ES,AX
639 POP DS
640 POP CX ; Length
641 DEC CX
642 CALL COMP ; Do one less than total
643 INC CX ; CX=1 (do last one)
644COMP:
645 REPE CMPSB
646 RETZ
647; Compare error. Print address, value; value, address.
648 DEC SI
649 MOV CS:COMP_ARG1,DS
650 MOV CS:COMP_ARG2,SI
651 XOR AH,AH
652 LODSB
653 MOV CS:COMP_ARG3,AX
654 DEC DI
655 MOV AL,ES:[DI]
656 MOV CS:COMP_ARG4,AX
657 MOV CS:COMP_ARG5,ES
658 MOV CS:COMP_ARG6,DI
659 INC DI
660 PUSH DS
661 PUSH CS
662 POP DS
663 MOV DX,OFFSET DG:COMP_PTR
664 CALL PRINTF_CRLF
665 POP DS
666 XOR AL,AL
667 JMP SHORT COMP
668
669 PROCEDURE CHECKNONE,NEAR
670 OR DX,DX
671 RETNZ
672 MOV DX,OFFSET DG:SYNERR_PTR ; ERROR MESSAGE
673 JMP PERR
674 ENDPROC CHECKNONE
675
676CODE ENDS
677 END DEBCOM3
678 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBCONST.ASM b/v4.0/src/CMD/DEBUG/DEBCONST.ASM
new file mode 100644
index 0000000..a5f8b97
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBCONST.ASM
@@ -0,0 +1,1128 @@
1 PAGE 80,132 ;
2 TITLE DEBCONST.ASM
3 IF1
4 %OUT COMPONENT=DEBUG, MODULE=DEBCONST
5 ENDIF
6.XLIST
7.XCREF
8INCLUDE DOSSYM.INC
9INCLUDE DEBEQU.ASM
10.LIST
11.CREF
12
13CODE SEGMENT PUBLIC BYTE
14CODE ENDS
15
16CONST SEGMENT PUBLIC BYTE
17CONST ENDS
18
19CSTACK SEGMENT STACK
20CSTACK ENDS
21
22DATA SEGMENT PUBLIC BYTE
23DATA ENDS
24
25DG GROUP CODE,CONST,CSTACK,DATA
26
27CODE SEGMENT PUBLIC BYTE
28
29 EXTRN ALUFROMREG:NEAR, ALUTOREG:NEAR, ACCIMM:NEAR, SEGOP:NEAR
30 EXTRN ESPRE:NEAR, SSPRE:NEAR, CSPRE:NEAR, DSPRE:NEAR
31 EXTRN REGOP:NEAR, NOOPERANDS:NEAR, SAVHEX:NEAR, SHORTJMP:NEAR
32 EXTRN MOVSEGTO:NEAR, WORDTOALU:NEAR, MOVSEGFROM:NEAR
33 EXTRN GETADDR:NEAR, XCHGAX:NEAR, LONGJMP:NEAR, LOADACC:NEAR
34 EXTRN STOREACC:NEAR, REGIMMB:NEAR, SAV16:NEAR, MEMIMM:NEAR
35 EXTRN INT3:NEAR, SAV8:NEAR, CHK10:NEAR, M8087:NEAR
36 EXTRN M8087_D9:NEAR, M8087_DB:NEAR, M8087_DD:NEAR
37 EXTRN M8087_DF:NEAR, INFIXB:NEAR, INFIXW:NEAR, OUTFIXB:NEAR
38 EXTRN OUTFIXW:NEAR, JMPCALL:NEAR, INVARB:NEAR, INVARW:NEAR
39 EXTRN OUTVARB:NEAR, OUTVARW:NEAR, PREFIX:NEAR, IMMED:NEAR
40 EXTRN SIGNIMM:NEAR, SHIFT:NEAR, SHIFTV:NEAR, GRP1:NEAR
41 EXTRN GRP2:NEAR, REGIMMW:NEAR, DOORG:NEAR
42
43
44 EXTRN DB_OPER:NEAR, DW_OPER:NEAR, ASSEMLOOP:NEAR, GROUP2:NEAR
45 EXTRN NO_OPER:NEAR, GROUP1:NEAR, FGROUPP:NEAR, FGROUPX:NEAR
46 EXTRN FGROUPZ:NEAR, FD9_OPER:NEAR, FGROUPB:NEAR, FGROUP:NEAR
47 EXTRN FGROUPDS:NEAR, DCINC_OPER:NEAR, INT_OPER:NEAR
48 EXTRN IN_OPER:NEAR, DISP8_OPER:NEAR, JMP_OPER:NEAR, L_OPER:NEAR
49 EXTRN MOV_OPER:NEAR, OUT_OPER:NEAR, PUSH_OPER:NEAR
50 EXTRN GET_DATA16:NEAR, FGROUP3:NEAR, FGROUP3W:NEAR
51 EXTRN FDE_OPER:NEAR, ESC_OPER:NEAR, AA_OPER:NEAR
52 EXTRN CALL_OPER:NEAR, FDB_OPER:NEAR, POP_OPER:NEAR, ROTOP:NEAR
53 EXTRN TST_OPER:NEAR, EX_OPER:NEAR
54
55CODE ENDS
56
57CONST SEGMENT PUBLIC BYTE
58
59 PUBLIC REG8, REG16, SREG, SIZ8, DISTAB, DBMN, ADDMN, ADCMN, SUBMN
60 PUBLIC SBBMN, XORMN, ORMN, ANDMN, AAAMN, AADMN, AASMN, CALLMN, CBWMN
61 PUBLIC UPMN, DIMN, CMCMN, CMPMN, CWDMN, DAAMN, DASMN, DECMN, DIVMN
62 PUBLIC ESCMN, HLTMN, IDIVMN, IMULMN, INCMN, INTOMN, INTMN, INMN
63 PUBLIC IRETMN, JAMN, JCXZMN, JNCMN, JBEMN, JZMN, JGEMN, JGMN, JLEMN
64 PUBLIC JLMN, JMPMN, JNZMN, JPEMN, JNZMN, JPEMN, JPOMN, JNSMN, JNOMN
65 PUBLIC JOMN, JSMN, LAHFMN, LDSMN, LEAMN, LESMN, LOCKMN, LODBMN
66 PUBLIC LODWMN, LOOPNZMN, LOOPZMN, LOOPMN, MOVBMN, MOVWMN, MOVMN
67 PUBLIC MULMN, NEGMN, NOPMN, NOTMN, OUTMN, POPFMN, POPMN, PUSHFMN
68 PUBLIC PUSHMN, RCLMN, RCRMN, REPZMN, REPNZMN, RETFMN, RETMN, ROLMN
69 PUBLIC RORMN, SAHFMN, SARMN, SCABMN, SCAWMN, SHLMN, SHRMN, STCMN
70 PUBLIC DOWNMN, EIMN, STOBMN, STOWMN, TESTMN, WAITMN, XCHGMN, XLATMN
71 PUBLIC ESSEGMN, CSSEGMN, SSSEGMN, DSSEGMN, BADMN
72
73 PUBLIC M8087_TAB, FI_TAB, SIZE_TAB, MD9_TAB, MD9_TAB2, MDB_TAB
74 PUBLIC MDB_TAB2, MDD_TAB, MDD_TAB2, MDF_TAB, OPTAB, MAXOP, SHFTAB
75 PUBLIC IMMTAB, GRP1TAB, GRP2TAB, SEGTAB, REGTAB, REGTABEND, FLAGTAB
76 PUBLIC STACK
77
78 PUBLIC AXSAVE, BXSAVE, CXSAVE, DXSAVE, BPSAVE, SPSAVE, SISAVE
79 PUBLIC DISAVE, DSSAVE, ESSAVE, SSSAVE, CSSAVE, IPSAVE, FLSAVE, RSTACK
80 PUBLIC REGDIF, RDFLG, TOTREG, DSIZ, NOREGL, DISPB, LBUFSIZ, LBUFFCNT
81 PUBLIC LINEBUF, PFLAG, COLPOS, RSETFLAG
82
83 IF SYSVER
84 PUBLIC CONFCB, POUT, COUT, CIN, IOBUFF, IOADDR, IOCALL, IOCOM
85 PUBLIC IOSTAT, IOCHRET, IOSEG, IOCNT
86 ENDIF
87
88 PUBLIC QFLAG, NEWEXEC, RETSAVE, USER_PROC_PDB, HEADSAVE, EXEC_BLOCK
89 PUBLIC COM_LINE, COM_FCB1, COM_FCB2, COM_SSSP, COM_CSIP, NEXTCS
90 PUBLIC NEXTIP, NAMESPEC
91
92REG8 DB "ALCLDLBLAHCHDHBH"
93REG16 DB "AXCXDXBXSPBPSIDI"
94SREG DB "ESCSSSDS",0,0
95SIZ8 DB "BYWODWQWTB",0,0
96; 0
97DISTAB DW OFFSET DG:ADDMN,ALUFROMREG
98 DW OFFSET DG:ADDMN,ALUFROMREG
99 DW OFFSET DG:ADDMN,ALUTOREG
100 DW OFFSET DG:ADDMN,ALUTOREG
101 DW OFFSET DG:ADDMN,ACCIMM
102 DW OFFSET DG:ADDMN,ACCIMM
103 DW OFFSET DG:PUSHMN,SEGOP
104 DW OFFSET DG:POPMN,SEGOP
105 DW OFFSET DG:ORMN,ALUFROMREG
106 DW OFFSET DG:ORMN,ALUFROMREG
107 DW OFFSET DG:ORMN,ALUTOREG
108 DW OFFSET DG:ORMN,ALUTOREG
109 DW OFFSET DG:ORMN,ACCIMM
110 DW OFFSET DG:ORMN,ACCIMM
111 DW OFFSET DG:PUSHMN,SEGOP
112 DW OFFSET DG:POPMN,SEGOP
113; 10H
114 DW OFFSET DG:ADCMN,ALUFROMREG
115 DW OFFSET DG:ADCMN,ALUFROMREG
116 DW OFFSET DG:ADCMN,ALUTOREG
117 DW OFFSET DG:ADCMN,ALUTOREG
118 DW OFFSET DG:ADCMN,ACCIMM
119 DW OFFSET DG:ADCMN,ACCIMM
120 DW OFFSET DG:PUSHMN,SEGOP
121 DW OFFSET DG:POPMN,SEGOP
122 DW OFFSET DG:SBBMN,ALUFROMREG
123 DW OFFSET DG:SBBMN,ALUFROMREG
124 DW OFFSET DG:SBBMN,ALUTOREG
125 DW OFFSET DG:SBBMN,ALUTOREG
126 DW OFFSET DG:SBBMN,ACCIMM
127 DW OFFSET DG:SBBMN,ACCIMM
128 DW OFFSET DG:PUSHMN,SEGOP
129 DW OFFSET DG:POPMN,SEGOP
130; 20H
131 DW OFFSET DG:ANDMN,ALUFROMREG
132 DW OFFSET DG:ANDMN,ALUFROMREG
133 DW OFFSET DG:ANDMN,ALUTOREG
134 DW OFFSET DG:ANDMN,ALUTOREG
135 DW OFFSET DG:ANDMN,ACCIMM
136 DW OFFSET DG:ANDMN,ACCIMM
137 DW OFFSET DG:ESSEGMN,ESPRE
138 DW OFFSET DG:DAAMN,NOOPERANDS
139 DW OFFSET DG:SUBMN,ALUFROMREG
140 DW OFFSET DG:SUBMN,ALUFROMREG
141 DW OFFSET DG:SUBMN,ALUTOREG
142 DW OFFSET DG:SUBMN,ALUTOREG
143 DW OFFSET DG:SUBMN,ACCIMM
144 DW OFFSET DG:SUBMN,ACCIMM
145 DW OFFSET DG:CSSEGMN,CSPRE
146 DW OFFSET DG:DASMN,NOOPERANDS
147; 30H
148 DW OFFSET DG:XORMN,ALUFROMREG
149 DW OFFSET DG:XORMN,ALUFROMREG
150 DW OFFSET DG:XORMN,ALUTOREG
151 DW OFFSET DG:XORMN,ALUTOREG
152 DW OFFSET DG:XORMN,ACCIMM
153 DW OFFSET DG:XORMN,ACCIMM
154 DW OFFSET DG:SSSEGMN,SSPRE
155 DW OFFSET DG:AAAMN,NOOPERANDS
156 DW OFFSET DG:CMPMN,ALUFROMREG
157 DW OFFSET DG:CMPMN,ALUFROMREG
158 DW OFFSET DG:CMPMN,ALUTOREG
159 DW OFFSET DG:CMPMN,ALUTOREG
160 DW OFFSET DG:CMPMN,ACCIMM
161 DW OFFSET DG:CMPMN,ACCIMM
162 DW OFFSET DG:DSSEGMN,DSPRE
163 DW OFFSET DG:AASMN,NOOPERANDS
164; 40H
165 DW OFFSET DG:INCMN,REGOP
166 DW OFFSET DG:INCMN,REGOP
167 DW OFFSET DG:INCMN,REGOP
168 DW OFFSET DG:INCMN,REGOP
169 DW OFFSET DG:INCMN,REGOP
170 DW OFFSET DG:INCMN,REGOP
171 DW OFFSET DG:INCMN,REGOP
172 DW OFFSET DG:INCMN,REGOP
173 DW OFFSET DG:DECMN,REGOP
174 DW OFFSET DG:DECMN,REGOP
175 DW OFFSET DG:DECMN,REGOP
176 DW OFFSET DG:DECMN,REGOP
177 DW OFFSET DG:DECMN,REGOP
178 DW OFFSET DG:DECMN,REGOP
179 DW OFFSET DG:DECMN,REGOP
180 DW OFFSET DG:DECMN,REGOP
181; 50H
182 DW OFFSET DG:PUSHMN,REGOP
183 DW OFFSET DG:PUSHMN,REGOP
184 DW OFFSET DG:PUSHMN,REGOP
185 DW OFFSET DG:PUSHMN,REGOP
186 DW OFFSET DG:PUSHMN,REGOP
187 DW OFFSET DG:PUSHMN,REGOP
188 DW OFFSET DG:PUSHMN,REGOP
189 DW OFFSET DG:PUSHMN,REGOP
190 DW OFFSET DG:POPMN,REGOP
191 DW OFFSET DG:POPMN,REGOP
192 DW OFFSET DG:POPMN,REGOP
193 DW OFFSET DG:POPMN,REGOP
194 DW OFFSET DG:POPMN,REGOP
195 DW OFFSET DG:POPMN,REGOP
196 DW OFFSET DG:POPMN,REGOP
197 DW OFFSET DG:POPMN,REGOP
198; 60H
199 DW OFFSET DG:DBMN,SAVHEX
200 DW OFFSET DG:DBMN,SAVHEX
201 DW OFFSET DG:DBMN,SAVHEX
202 DW OFFSET DG:DBMN,SAVHEX
203 DW OFFSET DG:DBMN,SAVHEX
204 DW OFFSET DG:DBMN,SAVHEX
205 DW OFFSET DG:DBMN,SAVHEX
206 DW OFFSET DG:DBMN,SAVHEX
207 DW OFFSET DG:DBMN,SAVHEX
208 DW OFFSET DG:DBMN,SAVHEX
209 DW OFFSET DG:DBMN,SAVHEX
210 DW OFFSET DG:DBMN,SAVHEX
211 DW OFFSET DG:DBMN,SAVHEX
212 DW OFFSET DG:DBMN,SAVHEX
213 DW OFFSET DG:DBMN,SAVHEX
214 DW OFFSET DG:DBMN,SAVHEX
215; 70H
216 DW OFFSET DG:JOMN,SHORTJMP
217 DW OFFSET DG:JNOMN,SHORTJMP
218 DW OFFSET DG:JCMN,SHORTJMP
219 DW OFFSET DG:JNCMN,SHORTJMP
220 DW OFFSET DG:JZMN,SHORTJMP
221 DW OFFSET DG:JNZMN,SHORTJMP
222 DW OFFSET DG:JBEMN,SHORTJMP
223 DW OFFSET DG:JAMN,SHORTJMP
224 DW OFFSET DG:JSMN,SHORTJMP
225 DW OFFSET DG:JNSMN,SHORTJMP
226 DW OFFSET DG:JPEMN,SHORTJMP
227 DW OFFSET DG:JPOMN,SHORTJMP
228 DW OFFSET DG:JLMN,SHORTJMP
229 DW OFFSET DG:JGEMN,SHORTJMP
230 DW OFFSET DG:JLEMN,SHORTJMP
231 DW OFFSET DG:JGMN,SHORTJMP
232; 80H
233 DW 0,IMMED
234 DW 0,IMMED
235 DW 0,IMMED
236 DW 0,SIGNIMM
237 DW OFFSET DG:TESTMN,ALUTOREG ;ARR 2.4
238 DW OFFSET DG:TESTMN,ALUTOREG ;ARR 2.4
239 DW OFFSET DG:XCHGMN,ALUTOREG ;ARR 2.4
240 DW OFFSET DG:XCHGMN,ALUTOREG ;ARR 2.4
241 DW OFFSET DG:MOVMN,ALUFROMREG
242 DW OFFSET DG:MOVMN,ALUFROMREG
243 DW OFFSET DG:MOVMN,ALUTOREG
244 DW OFFSET DG:MOVMN,ALUTOREG
245 DW OFFSET DG:MOVMN,MOVSEGTO
246 DW OFFSET DG:LEAMN,WORDTOALU
247 DW OFFSET DG:MOVMN,MOVSEGFROM
248 DW OFFSET DG:POPMN,GETADDR
249; 90H
250 DW OFFSET DG:NOPMN,NOOPERANDS
251 DW OFFSET DG:XCHGMN,XCHGAX
252 DW OFFSET DG:XCHGMN,XCHGAX
253 DW OFFSET DG:XCHGMN,XCHGAX
254 DW OFFSET DG:XCHGMN,XCHGAX
255 DW OFFSET DG:XCHGMN,XCHGAX
256 DW OFFSET DG:XCHGMN,XCHGAX
257 DW OFFSET DG:XCHGMN,XCHGAX
258 DW OFFSET DG:CBWMN,NOOPERANDS
259 DW OFFSET DG:CWDMN,NOOPERANDS
260 DW OFFSET DG:CALLMN,LONGJMP
261 DW OFFSET DG:WAITMN,NOOPERANDS
262 DW OFFSET DG:PUSHFMN,NOOPERANDS
263 DW OFFSET DG:POPFMN,NOOPERANDS
264 DW OFFSET DG:SAHFMN,NOOPERANDS
265 DW OFFSET DG:LAHFMN,NOOPERANDS
266; A0H
267 DW OFFSET DG:MOVMN,LOADACC
268 DW OFFSET DG:MOVMN,LOADACC
269 DW OFFSET DG:MOVMN,STOREACC
270 DW OFFSET DG:MOVMN,STOREACC
271 DW OFFSET DG:MOVBMN,NOOPERANDS
272 DW OFFSET DG:MOVWMN,NOOPERANDS
273 DW OFFSET DG:CMPBMN,NOOPERANDS
274 DW OFFSET DG:CMPWMN,NOOPERANDS
275 DW OFFSET DG:TESTMN,ACCIMM
276 DW OFFSET DG:TESTMN,ACCIMM
277 DW OFFSET DG:STOBMN,NOOPERANDS
278 DW OFFSET DG:STOWMN,NOOPERANDS
279 DW OFFSET DG:LODBMN,NOOPERANDS
280 DW OFFSET DG:LODWMN,NOOPERANDS
281 DW OFFSET DG:SCABMN,NOOPERANDS
282 DW OFFSET DG:SCAWMN,NOOPERANDS
283; B0H
284 DW OFFSET DG:MOVMN,REGIMMB
285 DW OFFSET DG:MOVMN,REGIMMB
286 DW OFFSET DG:MOVMN,REGIMMB
287 DW OFFSET DG:MOVMN,REGIMMB
288 DW OFFSET DG:MOVMN,REGIMMB
289 DW OFFSET DG:MOVMN,REGIMMB
290 DW OFFSET DG:MOVMN,REGIMMB
291 DW OFFSET DG:MOVMN,REGIMMB
292 DW OFFSET DG:MOVMN,REGIMMW
293 DW OFFSET DG:MOVMN,REGIMMW
294 DW OFFSET DG:MOVMN,REGIMMW
295 DW OFFSET DG:MOVMN,REGIMMW
296 DW OFFSET DG:MOVMN,REGIMMW
297 DW OFFSET DG:MOVMN,REGIMMW
298 DW OFFSET DG:MOVMN,REGIMMW
299 DW OFFSET DG:MOVMN,REGIMMW
300; C0H
301 DW OFFSET DG:DBMN,SAVHEX
302 DW OFFSET DG:DBMN,SAVHEX
303 DW OFFSET DG:RETMN,SAV16
304 DW OFFSET DG:RETMN,NOOPERANDS
305 DW OFFSET DG:LESMN,WORDTOALU
306 DW OFFSET DG:LDSMN,WORDTOALU
307 DW OFFSET DG:MOVMN,MEMIMM
308 DW OFFSET DG:MOVMN,MEMIMM
309 DW OFFSET DG:DBMN,SAVHEX
310 DW OFFSET DG:DBMN,SAVHEX
311 DW OFFSET DG:RETFMN,SAV16
312 DW OFFSET DG:RETFMN,NOOPERANDS
313 DW OFFSET DG:INTMN,INT3
314 DW OFFSET DG:INTMN,SAV8
315 DW OFFSET DG:INTOMN,NOOPERANDS
316 DW OFFSET DG:IRETMN,NOOPERANDS
317; D0H
318 DW 0,SHIFT
319 DW 0,SHIFT
320 DW 0,SHIFTV
321 DW 0,SHIFTV
322 DW OFFSET DG:AAMMN,CHK10
323 DW OFFSET DG:AADMN,CHK10
324 DW OFFSET DG:DBMN,SAVHEX
325 DW OFFSET DG:XLATMN,NOOPERANDS
326 DW 0,M8087 ; d8
327 DW 0,M8087_D9 ; d9
328 DW 0,M8087 ; da
329 DW 0,M8087_DB ; db
330 DW 0,M8087 ; dc
331 DW 0,M8087_DD ; dd
332 DW 0,M8087 ; de
333 DW 0,M8087_DF ; df
334; E0H
335 DW OFFSET DG:LOOPNZMN,SHORTJMP
336 DW OFFSET DG:LOOPZMN,SHORTJMP
337 DW OFFSET DG:LOOPMN,SHORTJMP
338 DW OFFSET DG:JCXZMN,SHORTJMP
339 DW OFFSET DG:INMN,INFIXB
340 DW OFFSET DG:INMN,INFIXW
341 DW OFFSET DG:OUTMN,OUTFIXB
342 DW OFFSET DG:OUTMN,OUTFIXW
343 DW OFFSET DG:CALLMN,JMPCALL
344 DW OFFSET DG:JMPMN,JMPCALL
345 DW OFFSET DG:JMPMN,LONGJMP
346 DW OFFSET DG:JMPMN,SHORTJMP
347 DW OFFSET DG:INMN,INVARB
348 DW OFFSET DG:INMN,INVARW
349 DW OFFSET DG:OUTMN,OUTVARB
350 DW OFFSET DG:OUTMN,OUTVARW
351; F0H
352 DW OFFSET DG:LOCKMN,PREFIX
353 DW OFFSET DG:DBMN,SAVHEX
354 DW OFFSET DG:REPNZMN,PREFIX
355 DW OFFSET DG:REPZMN,PREFIX
356 DW OFFSET DG:HLTMN,NOOPERANDS
357 DW OFFSET DG:CMCMN,NOOPERANDS
358 DW 0,GRP1
359 DW 0,GRP1
360 DW OFFSET DG:CLCMN,NOOPERANDS
361 DW OFFSET DG:STCMN,NOOPERANDS
362 DW OFFSET DG:DIMN,NOOPERANDS
363 DW OFFSET DG:EIMN,NOOPERANDS
364 DW OFFSET DG:UPMN,NOOPERANDS
365 DW OFFSET DG:DOWNMN,NOOPERANDS
366 DW 0,GRP2
367 DW 0,GRP2
368
369DBMN DB "DB",0
370 DB "DW",0
371 DB ";",0
372ORGMN DB "ORG",0
373ADDMN DB "ADD",0
374ADCMN DB "ADC",0
375SUBMN DB "SUB",0
376SBBMN DB "SBB",0
377XORMN DB "XOR",0
378ORMN DB "OR",0
379ANDMN DB "AND",0
380AAAMN DB "AAA",0
381AADMN DB "AAD",0
382AAMMN DB "AAM",0
383AASMN DB "AAS",0
384CALLMN DB "CALL",0
385CBWMN DB "CBW",0
386CLCMN DB "CLC",0
387UPMN DB "CLD",0 ; CLD,0
388DIMN DB "CLI",0
389CMCMN DB "CMC",0
390CMPBMN DB "CMPSB",0 ; CMPSB
391CMPWMN DB "CMPSW",0 ; CMPSW,0
392CMPMN DB "CMP",0
393CWDMN DB "CWD",0
394DAAMN DB "DAA",0
395DASMN DB "DAS",0
396DECMN DB "DEC",0
397DIVMN DB "DIV",0
398ESCMN DB "ESC",0
399 DB "FXCH",0
400 DB "FFREE",0
401 DB "FCOMPP",0
402 DB "FCOMP",0
403 DB "FCOM",0
404 DB "FICOMP",0
405 DB "FICOM",0
406 DB "FNOP",0
407 DB "FCHS",0
408 DB "FABS",0
409 DB "FTST",0
410 DB "FXAM",0
411 DB "FLDL2T",0
412 DB "FLDL2E",0
413 DB "FLDLG2",0
414 DB "FLDLN2",0
415 DB "FLDPI",0
416 DB "FLD1",0
417 DB "FLDZ",0
418 DB "F2XM1",0
419 DB "FYL2XP1",0
420 DB "FYL2X",0
421 DB "FPTAN",0
422 DB "FPATAN",0
423 DB "FXTRACT",0
424 DB "FDECSTP",0
425 DB "FINCSTP",0
426 DB "FPREM",0
427 DB "FSQRT",0
428 DB "FRNDINT",0
429 DB "FSCALE",0
430 DB "FINIT",0
431 DB "FDISI",0
432 DB "FENI",0
433 DB "FCLEX",0
434 DB "FBLD",0
435 DB "FBSTP",0
436 DB "FLDCW",0
437 DB "FSTCW",0
438 DB "FSTSW",0
439 DB "FSTENV",0
440 DB "FLDENV",0
441 DB "FSAVE",0
442 DB "FRSTOR",0
443 DB "FADDP",0
444 DB "FADD",0
445 DB "FIADD",0
446 DB "FSUBRP",0
447 DB "FSUBR",0
448 DB "FSUBP",0
449 DB "FSUB",0
450 DB "FISUBR",0
451 DB "FISUB",0
452 DB "FMULP",0
453 DB "FMUL",0
454 DB "FIMUL",0
455 DB "FDIVRP",0
456 DB "FDIVR",0
457 DB "FDIVP",0
458 DB "FDIV",0
459 DB "FIDIVR",0
460 DB "FIDIV",0
461 DB "FWAIT",0
462 DB "FILD",0
463 DB "FLD",0
464 DB "FSTP",0
465 DB "FST",0
466 DB "FISTP",0
467 DB "FIST",0
468HLTMN DB "HLT",0
469IDIVMN DB "IDIV",0
470IMULMN DB "IMUL",0
471INCMN DB "INC",0
472INTOMN DB "INTO",0
473INTMN DB "INT",0
474INMN DB "IN",0 ; IN
475IRETMN DB "IRET",0
476 DB "JNBE",0
477 DB "JAE",0
478JAMN DB "JA",0
479JCXZMN DB "JCXZ",0
480JNCMN DB "JNB",0
481JBEMN DB "JBE",0
482JCMN DB "JB",0
483 DB "JNC",0
484 DB "JC",0
485 DB "JNAE",0
486 DB "JNA",0
487JZMN DB "JZ",0
488 DB "JE",0
489JGEMN DB "JGE",0
490JGMN DB "JG",0
491 DB "JNLE",0
492 DB "JNL",0
493JLEMN DB "JLE",0
494JLMN DB "JL",0
495 DB "JNGE",0
496 DB "JNG",0
497JMPMN DB "JMP",0
498JNZMN DB "JNZ",0
499 DB "JNE",0
500JPEMN DB "JPE",0
501JPOMN DB "JPO",0
502 DB "JNP",0
503JNSMN DB "JNS",0
504JNOMN DB "JNO",0
505JOMN DB "JO",0
506JSMN DB "JS",0
507 DB "JP",0
508LAHFMN DB "LAHF",0
509LDSMN DB "LDS",0
510LEAMN DB "LEA",0
511LESMN DB "LES",0
512LOCKMN DB "LOCK",0
513LODBMN DB "LODSB",0 ; LODSB
514LODWMN DB "LODSW",0 ; LODSW,0
515LOOPNZMN DB "LOOPNZ",0
516LOOPZMN DB "LOOPZ",0
517 DB "LOOPNE",0
518 DB "LOOPE",0
519LOOPMN DB "LOOP",0
520MOVBMN DB "MOVSB",0 ; MOVSB
521MOVWMN DB "MOVSW",0 ; MOVSW,0
522MOVMN DB "MOV",0
523MULMN DB "MUL",0
524NEGMN DB "NEG",0
525NOPMN DB "NOP",0
526NOTMN DB "NOT",0
527OUTMN DB "OUT",0 ; OUT
528POPFMN DB "POPF",0
529POPMN DB "POP",0
530PUSHFMN DB "PUSHF",0
531PUSHMN DB "PUSH",0
532RCLMN DB "RCL",0
533RCRMN DB "RCR",0
534REPZMN DB "REPZ",0
535REPNZMN DB "REPNZ",0
536 DB "REPE",0
537 DB "REPNE",0
538 DB "REP",0
539RETFMN DB "RETF",0
540RETMN DB "RET",0
541ROLMN DB "ROL",0
542RORMN DB "ROR",0
543SAHFMN DB "SAHF",0
544SARMN DB "SAR",0
545SCABMN DB "SCASB",0 ; SCASB
546SCAWMN DB "SCASW",0 ; SCASW,0
547SHLMN DB "SHL",0
548SHRMN DB "SHR",0
549STCMN DB "STC",0
550DOWNMN DB "STD",0 ; STD
551EIMN DB "STI",0 ; STI
552STOBMN DB "STOSB",0 ; STOSB
553STOWMN DB "STOSW",0 ; STOSW,0
554TESTMN DB "TEST",0
555WAITMN DB "WAIT",0
556XCHGMN DB "XCHG",0
557XLATMN DB "XLAT",0
558ESSEGMN DB "ES:",0
559CSSEGMN DB "CS:",0
560SSSEGMN DB "SS:",0
561DSSEGMN DB "DS:",0
562BADMN DB "???",0
563
564M8087_TAB DB "ADD$MUL$COM$COMP$SUB$SUBR$DIV$DIVR$"
565FI_TAB DB "F$FI$F$FI$"
566SIZE_TAB DB "DWORD PTR $DWORD PTR $QWORD PTR $WORD PTR $"
567 DB "BYTE PTR $TBYTE PTR $"
568
569MD9_TAB DB "LD$@$ST$STP$LDENV$LDCW$STENV$STCW$"
570MD9_TAB2 DB "CHS$ABS$@$@$TST$XAM$@$@$LD1$LDL2T$LDL2E$"
571 DB "LDPI$LDLG2$LDLN2$LDZ$@$2XM1$YL2X$PTAN$PATAN$XTRACT$"
572 DB "@$DECSTP$INCSTP$PREM$YL2XP1$SQRT$@$RNDINT$SCALE$@$@$"
573
574MDB_TAB DB "ILD$@$IST$ISTP$@$LD$@$STP$"
575MDB_TAB2 DB "ENI$DISI$CLEX$INIT$"
576
577MDD_TAB DB "LD$@$ST$STP$RSTOR$@$SAVE$STSW$"
578MDD_TAB2 DB "FREE$XCH$ST$STP$"
579
580MDF_TAB DB "ILD$@$IST$ISTP$BLD$ILD$BSTP$ISTP$"
581
582
583OPTAB DB 11111111B ; DB
584 DW DB_OPER
585 DB 11111111B ; DW
586 DW DW_OPER
587 DB 11111111B ; COMMENT
588 DW ASSEMLOOP
589 DB 11111111B ; ORG
590 DW DOORG
591 DB 0 * 8 ; ADD
592 DW GROUP2
593 DB 2 * 8 ; ADC
594 DW GROUP2
595 DB 5 * 8 ; SUB
596 DW GROUP2
597 DB 3 * 8 ; SBB
598 DW GROUP2
599 DB 6 * 8 ; XOR
600 DW GROUP2
601 DB 1 * 8 ; OR
602 DW GROUP2
603 DB 4 * 8 ; AND
604 DW GROUP2
605 DB 00110111B ; AAA
606 DW NO_OPER
607 DB 11010101B ; AAD
608 DW AA_OPER
609 DB 11010100B ; AAM
610 DW AA_OPER
611 DB 00111111B ; AAS
612 DW NO_OPER
613 DB 2 * 8 ; CALL
614 DW CALL_OPER
615 DB 10011000B ; CBW
616 DW NO_OPER
617 DB 11111000B ; CLC
618 DW NO_OPER
619 DB 11111100B ; CLD
620 DW NO_OPER
621 DB 11111010B ; DIM
622 DW NO_OPER
623 DB 11110101B ; CMC
624 DW NO_OPER
625 DB 10100110B ; CMPB
626 DW NO_OPER
627 DB 10100111B ; CMPW
628 DW NO_OPER
629 DB 7 * 8 ; CMP
630 DW GROUP2
631 DB 10011001B ; CWD
632 DW NO_OPER
633 DB 00100111B ; DAA
634 DW NO_OPER
635 DB 00101111B ; DAS
636 DW NO_OPER
637 DB 1 * 8 ; DEC
638 DW DCINC_OPER
639 DB 6 * 8 ; DIV
640 DW GROUP1
641 DB 11011000B ; ESC
642 DW ESC_OPER
643 DB 00001001B ; FXCH
644 DW FGROUPP
645 DB 00101000B ; FFREE
646 DW FGROUPP
647 DB 11011001B ; FCOMPP
648 DW FDE_OPER
649 DB 00000011B ; FCOMP
650 DW FGROUPX ; Exception to normal P instructions
651 DB 00000010B ; FCOM
652 DW FGROUPX
653 DB 00010011B ; FICOMP
654 DW FGROUPZ
655 DB 00010010B ; FICOM
656 DW FGROUPZ
657 DB 11010000B ; FNOP
658 DW FD9_OPER
659 DB 11100000B ; FCHS
660 DW FD9_OPER
661 DB 11100001B ; FABS
662 DW FD9_OPER
663 DB 11100100B ; FTST
664 DW FD9_OPER
665 DB 11100101B ; FXAM
666 DW FD9_OPER
667 DB 11101001B ; FLDL2T
668 DW FD9_OPER
669 DB 11101010B ; FLDL2E
670 DW FD9_OPER
671 DB 11101100B ; FLDLG2
672 DW FD9_OPER
673 DB 11101101B ; FLDLN2
674 DW FD9_OPER
675 DB 11101011B ; FLDPI
676 DW FD9_OPER
677 DB 11101000B ; FLD1
678 DW FD9_OPER
679 DB 11101110B ; FLDZ
680 DW FD9_OPER
681 DB 11110000B ; F2XM1
682 DW FD9_OPER
683 DB 11111001B ; FYL2XP1
684 DW FD9_OPER
685 DB 11110001B ; FYL2X
686 DW FD9_OPER
687 DB 11110010B ; FPTAN
688 DW FD9_OPER
689 DB 11110011B ; FPATAN
690 DW FD9_OPER
691 DB 11110100B ; FXTRACT
692 DW FD9_OPER
693 DB 11110110B ; FDECSTP
694 DW FD9_OPER
695 DB 11110111B ; FINCSTP
696 DW FD9_OPER
697 DB 11111000B ; FPREM
698 DW FD9_OPER
699 DB 11111010B ; FSQRT
700 DW FD9_OPER
701 DB 11111100B ; FRNDINT
702 DW FD9_OPER
703 DB 11111101B ; FSCALE
704 DW FD9_OPER
705 DB 11100011B ; FINIT
706 DW FDB_OPER
707 DB 11100001B ; FDISI
708 DW FDB_OPER
709 DB 11100000B ; FENI
710 DW FDB_OPER
711 DB 11100010B ; FCLEX
712 DW FDB_OPER
713 DB 00111100B ; FBLD
714 DW FGROUPB
715 DB 00111110B ; FBSTP
716 DW FGROUPB
717 DB 00001101B ; FLDCW
718 DW FGROUP3W
719 DB 00001111B ; FSTCW
720 DW FGROUP3W
721 DB 00101111B ; FSTSW
722 DW FGROUP3W
723 DB 00001110B ; FSTENV
724 DW FGROUP3
725 DB 00001100B ; FLDENV
726 DW FGROUP3
727 DB 00101110B ; FSAVE
728 DW FGROUP3
729 DB 00101100B ; FRSTOR
730 DW FGROUP3
731 DB 00110000B ; FADDP
732 DW FGROUPP
733 DB 00000000B ; FADD
734 DW FGROUP
735 DB 00010000B ; FIADD
736 DW FGROUPZ
737 DB 00110100B ; FSUBRP
738 DW FGROUPP
739 DB 00000101B ; FSUBR
740 DW FGROUPDS
741 DB 00110101B ; FSUBP
742 DW FGROUPP
743 DB 00000100B ; FSUB
744 DW FGROUPDS
745 DB 00010101B ; FISUBR
746 DW FGROUPZ
747 DB 00010100B ; FISUB
748 DW FGROUPZ
749 DB 00110001B ; FMULP
750 DW FGROUPP
751 DB 00000001B ; FMUL
752 DW FGROUP
753 DB 00010001B ; FIMUL
754 DW FGROUPZ
755 DB 00110110B ; FDIVRP
756 DW FGROUPP
757 DB 00000111B ; FDIVR
758 DW FGROUPDS
759 DB 00110111B ; FDIVP
760 DW FGROUPP
761 DB 00000110B ; FDIV
762 DW FGROUPDS
763 DB 00010111B ; FIDIVR
764 DW FGROUPZ
765 DB 00010110B ; FIDIV
766 DW FGROUPZ
767 DB 10011011B ; FWAIT
768 DW NO_OPER
769 DB 00011000B ; FILD
770 DW FGROUPZ
771 DB 00001000B ; FLD
772 DW FGROUPX
773 DB 00001011B ; FSTP
774 DW FGROUP ;an000; dms;
775 DB 00101010B ; FST
776 DW FGROUPX
777 DB 00011011B ; FISTP
778 DW FGROUPZ
779 DB 00011010B ; FIST
780 DW FGROUPZ
781 DB 11110100B ; HLT
782 DW NO_OPER
783 DB 7 * 8 ; IDIV
784 DW GROUP1
785 DB 5 * 8 ; IMUL
786 DW GROUP1
787 DB 0 * 8 ; INC
788 DW DCINC_OPER
789 DB 11001110B ; INTO
790 DW NO_OPER
791 DB 11001100B ; INTM
792 DW INT_OPER
793 DB 11101100B ; IN
794 DW IN_OPER
795 DB 11001111B ; IRET
796 DW NO_OPER
797 DB 01110111B ; JNBE
798 DW DISP8_OPER
799 DB 01110011B ; JAE
800 DW DISP8_OPER
801 DB 01110111B ; JA
802 DW DISP8_OPER
803 DB 11100011B ; JCXZ
804 DW DISP8_OPER
805 DB 01110011B ; JNB
806 DW DISP8_OPER
807 DB 01110110B ; JBE
808 DW DISP8_OPER
809 DB 01110010B ; JB
810 DW DISP8_OPER
811 DB 01110011B ; JNC
812 DW DISP8_OPER
813 DB 01110010B ; JC
814 DW DISP8_OPER
815 DB 01110010B ; JNAE
816 DW DISP8_OPER
817 DB 01110110B ; JNA
818 DW DISP8_OPER
819 DB 01110100B ; JZ
820 DW DISP8_OPER
821 DB 01110100B ; JE
822 DW DISP8_OPER
823 DB 01111101B ; JGE
824 DW DISP8_OPER
825 DB 01111111B ; JG
826 DW DISP8_OPER
827 DB 01111111B ; JNLE
828 DW DISP8_OPER
829 DB 01111101B ; JNL
830 DW DISP8_OPER
831 DB 01111110B ; JLE
832 DW DISP8_OPER
833 DB 01111100B ; JL
834 DW DISP8_OPER
835 DB 01111100B ; JNGE
836 DW DISP8_OPER
837 DB 01111110B ; JNG
838 DW DISP8_OPER
839 DB 4 * 8 ; JMP
840 DW JMP_OPER
841 DB 01110101B ; JNZ
842 DW DISP8_OPER
843 DB 01110101B ; JNE
844 DW DISP8_OPER
845 DB 01111010B ; JPE
846 DW DISP8_OPER
847 DB 01111011B ; JPO
848 DW DISP8_OPER
849 DB 01111011B ; JNP
850 DW DISP8_OPER
851 DB 01111001B ; JNS
852 DW DISP8_OPER
853 DB 01110001B ; JNO
854 DW DISP8_OPER
855 DB 01110000B ; JO
856 DW DISP8_OPER
857 DB 01111000B ; JS
858 DW DISP8_OPER
859 DB 01111010B ; JP
860 DW DISP8_OPER
861 DB 10011111B ; LAHF
862 DW NO_OPER
863 DB 11000101B ; LDS
864 DW L_OPER
865 DB 10001101B ; LEA
866 DW L_OPER
867 DB 11000100B ; LES
868 DW L_OPER
869 DB 11110000B ; LOCK
870 DW NO_OPER
871 DB 10101100B ; LODB
872 DW NO_OPER
873 DB 10101101B ; LODW
874 DW NO_OPER
875 DB 11100000B ; LOOPNZ
876 DW DISP8_OPER
877 DB 11100001B ; LOOPZ
878 DW DISP8_OPER
879 DB 11100000B ; LOOPNE
880 DW DISP8_OPER
881 DB 11100001B ; LOOPE
882 DW DISP8_OPER
883 DB 11100010B ; LOOP
884 DW DISP8_OPER
885 DB 10100100B ; MOVB
886 DW NO_OPER
887 DB 10100101B ; MOVW
888 DW NO_OPER
889 DB 11000110B ; MOV
890 DW MOV_OPER
891 DB 4 * 8 ; MUL
892 DW GROUP1
893 DB 3 * 8 ; NEG
894 DW GROUP1
895 DB 10010000B ; NOP
896 DW NO_OPER
897 DB 2 * 8 ; NOT
898 DW GROUP1
899 DB 11101110B ; OUT
900 DW OUT_OPER
901 DB 10011101B ; POPF
902 DW NO_OPER
903 DB 0 * 8 ; POP
904 DW POP_OPER
905 DB 10011100B ; PUSHF
906 DW NO_OPER
907 DB 6 * 8 ; PUSH
908 DW PUSH_OPER
909 DB 2 * 8 ; RCL
910 DW ROTOP
911 DB 3 * 8 ; RCR
912 DW ROTOP
913 DB 11110011B ; REPZ
914 DW NO_OPER
915 DB 11110010B ; REPNZ
916 DW NO_OPER
917 DB 11110011B ; REPE
918 DW NO_OPER
919 DB 11110010B ; REPNE
920 DW NO_OPER
921 DB 11110011B ; REP
922 DW NO_OPER
923 DB 11001011B ; RETF
924 DW GET_DATA16
925 DB 11000011B ; RET
926 DW GET_DATA16
927 DB 0 * 8 ; ROL
928 DW ROTOP
929 DB 1 * 8 ; ROR
930 DW ROTOP
931 DB 10011110B ; SAHF
932 DW NO_OPER
933 DB 7 * 8 ; SAR
934 DW ROTOP
935 DB 10101110B ; SCAB
936 DW NO_OPER
937 DB 10101111B ; SCAW
938 DW NO_OPER
939 DB 4 * 8 ; SHL
940 DW ROTOP
941 DB 5 * 8 ; SHR
942 DW ROTOP
943 DB 11111001B ; STC
944 DW NO_OPER
945 DB 11111101B ; STD
946 DW NO_OPER
947 DB 11111011B ; EI
948 DW NO_OPER
949 DB 10101010B ; STOB
950 DW NO_OPER
951 DB 10101011B ; STOW
952 DW NO_OPER
953 DB 11110110B ; TEST
954 DW TST_OPER
955 DB 10011011B ; WAIT
956 DW NO_OPER
957 DB 10000110B ; XCHG
958 DW EX_OPER
959 DB 11010111B ; XLAT
960 DW NO_OPER
961 DB 00100110B ; ESSEG
962 DW NO_OPER
963 DB 00101110B ; CSSEG
964 DW NO_OPER
965 DB 00110110B ; SSSEG
966 DW NO_OPER
967 DB 00111110B ; DSSEG
968 DW NO_OPER
969
970ZZOPCODE LABEL BYTE
971MAXOP = (ZZOPCODE-OPTAB)/3
972
973SHFTAB DW OFFSET DG:ROLMN,OFFSET DG:RORMN,OFFSET DG:RCLMN
974 DW OFFSET DG:RCRMN,OFFSET DG:SHLMN,OFFSET DG:SHRMN
975 DW OFFSET DG:BADMN,OFFSET DG:SARMN
976
977IMMTAB DW OFFSET DG:ADDMN,OFFSET DG:ORMN,OFFSET DG:ADCMN
978 DW OFFSET DG:SBBMN,OFFSET DG:ANDMN,OFFSET DG:SUBMN
979 DW OFFSET DG:XORMN,OFFSET DG:CMPMN
980
981GRP1TAB DW OFFSET DG:TESTMN,OFFSET DG:BADMN,OFFSET DG:NOTMN
982 DW OFFSET DG:NEGMN,OFFSET DG:MULMN,OFFSET DG:IMULMN
983 DW OFFSET DG:DIVMN,OFFSET DG:IDIVMN
984
985GRP2TAB DW OFFSET DG:INCMN,OFFSET DG:DECMN,OFFSET DG:CALLMN
986 DW OFFSET DG:CALLMN,OFFSET DG:JMPMN,OFFSET DG:JMPMN
987 DW OFFSET DG:PUSHMN,OFFSET DG:BADMN
988
989SEGTAB DW OFFSET DG:ESSAVE,OFFSET DG:CSSAVE,OFFSET DG:SSSAVE
990 DW OFFSET DG:DSSAVE
991
992REGTAB DB "AX",0,"BX",0,"CX",0,"DX",0,"SP",0,"BP",0
993 DB "SI",0,"DI",0,"DS",0,"ES",0,"SS",0,"CS",0,"IP",0,"PC",0
994REGTABEND LABEL WORD
995
996; Flags are ordered to correspond with the bits of the flag
997; register, most significant bit first, zero if bit is not
998; a flag. First 16 entries are for bit set, second 16 for
999; bit reset.
1000
1001FLAGTAB DW 0
1002 DW 0
1003 DW 0
1004 DW 0
1005 DB "OV"
1006 DB "DN"
1007 DB "EI" ; "STI"
1008 DW 0
1009 DB "NG"
1010 DB "ZR"
1011 DW 0
1012 DB "AC"
1013 DW 0
1014 DB "PE"
1015 DW 0
1016 DB "CY"
1017 DW 0
1018 DW 0
1019 DW 0
1020 DW 0
1021 DB "NV"
1022 DB "UP" ; "CLD"
1023 DB "DI"
1024 DW 0
1025 DB "PL"
1026 DB "NZ"
1027 DW 0
1028 DB "NA"
1029 DW 0
1030 DB "PO"
1031 DW 0
1032 DB "NC"
1033
1034 DW 80H DUP(?)
1035STACK LABEL BYTE
1036
1037
1038; Register save area
1039
1040AXSAVE DW 0
1041BXSAVE DW 0
1042CXSAVE DW 0
1043DXSAVE DW 0
1044SPSAVE DW 5AH
1045BPSAVE DW 0
1046SISAVE DW 0
1047DISAVE DW 0
1048DSSAVE DW 0
1049ESSAVE DW 0
1050RSTACK LABEL WORD ; Stack set here so registers can be saved by pushing
1051SSSAVE DW 0
1052CSSAVE DW 0
1053IPSAVE DW 100H
1054FLSAVE DW 0F202H
1055
1056RSETFLAG DB 0
1057
1058REGDIF EQU AXSAVE-REGTAB
1059
1060; This value is initially 0, it is set to non-zero if a file is specified
1061; either at debug invokation, or via the (N)ame command. It is used to
1062; control the printing of the NONAMESPEC message for the (W)rite command.
1063NAMESPEC DB 0
1064
1065; RAM area.
1066
1067RDFLG DB READ
1068TOTREG DB 13
1069DSIZ DB 0FH ;changed to 7 if screen 40 col mode
1070NOREGL DB 8 ;changed to 4 if screen 40 col mode
1071DISPB DW 128 ;changed to 64 if screen 40 col mode
1072
1073LBUFSIZ DB BUFLEN
1074LBUFFCNT DB 0
1075LINEBUF DB 0DH
1076 DB BUFLEN DUP (?)
1077PFLAG DB 0
1078COLPOS DB 0
1079
1080 IF SYSVER
1081CONFCB DB 0
1082 DB "PRN "
1083 DB 25 DUP(0)
1084
1085POUT DD ?
1086COUT DD ?
1087CIN DD ?
1088IOBUFF DB 3 DUP (?)
1089IOADDR DD ?
1090
1091IOCALL DB 22
1092 DB 0
1093IOCOM DB 0
1094IOSTAT DW 0
1095 DB 8 DUP (0)
1096IOCHRET DB 0
1097 DW OFFSET DG:IOBUFF
1098IOSEG DW ?
1099IOCNT DW 1
1100 DW 0
1101 ENDIF
1102
1103QFLAG DB 0
1104NEWEXEC DB 0
1105RETSAVE DW ?
1106
1107USER_PROC_PDB DW ?
1108NextCS DW ?
1109NextIP DW ?
1110
1111HEADSAVE DW ?
1112
1113EXEC_BLOCK LABEL BYTE
1114 DW 0
1115COM_LINE LABEL DWORD
1116 DW 80H
1117 DW ?
1118COM_FCB1 LABEL DWORD
1119 DW FCB
1120 DW ?
1121COM_FCB2 LABEL DWORD
1122 DW FCB + 10H
1123 DW ?
1124COM_SSSP DD ?
1125COM_CSIP DD ?
1126
1127CONST ENDS
1128 END
diff --git a/v4.0/src/CMD/DEBUG/DEBDATA.ASM b/v4.0/src/CMD/DEBUG/DEBDATA.ASM
new file mode 100644
index 0000000..fafae77
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBDATA.ASM
@@ -0,0 +1,227 @@
1 PAGE 60,132 ;
2 TITLE DEBDATA.SAL - PC DOS
3;======================= START OF SPECIFICATIONS =========================
4;
5; MODULE NAME: DEBDATA.SAL
6;
7; DESCRIPTIVE NAME: DATA SEGMENT VALUE DEFINITION
8;
9; FUNCTION: PROVIDES ALL DATA SEGMENT DEFINITIONS.
10;
11; ENTRY POINT: NA
12;
13; INPUT: ANY VALUE IN DATA SEGMENT
14;
15; EXIT NORMAL: NA
16;
17; EXIT ERROR: NA
18;
19; INTERNAL REFERENCES: NA
20;
21; EXTERNAL REFERENCES: NA
22;
23; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
24; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
25; DEBCONST+DEBDATA+DEBMES
26;
27; REVISION HISTORY:
28;
29; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
30;
31; - IMPLEMENT DBCS HANDLING DMS:6/17/87
32; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87
33; - > 32 MB SUPPORT DMS:6/17/87
34;
35; COPYRIGHT: "MS DOS DEBUG UTILITY"
36; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
37; "LICENSED MATERIAL - PROPERTY OF Microsoft "
38;
39;======================= END OF SPECIFICATIONS ===========================
40
41 IF1
42 %OUT COMPONENT=DEBUG, MODULE=DEBDATA
43 ENDIF
44.XLIST
45.XCREF
46 INCLUDE DOSSYM.INC
47 INCLUDE DEBEQU.ASM
48 INCLUDE DPL.ASM
49.LIST
50.CREF
51CODE SEGMENT PUBLIC BYTE
52CODE ENDS
53
54CONST SEGMENT PUBLIC BYTE
55CONST ENDS
56
57DATA SEGMENT PUBLIC BYTE
58DATA ENDS
59
60CSTACK SEGMENT STACK
61CSTACK ENDS
62
63DG GROUP CODE,CONST,CSTACK,DATA
64
65DATA SEGMENT PUBLIC BYTE
66 PUBLIC PARITYFLAG,XNXOPT,XNXCMD,SWITCHAR,EXTPTR,HANDLE,TRANSADD
67 PUBLIC PARSERR,ASMADD,DISADD,DISCNT,ASMSP,INDEX,DEFDUMP,DEFLEN
68 PUBLIC REGSAVE,SEGSAVE,OFFSAVE,TEMP,BUFFER,BYTCNT,OPCODE,AWORD
69 PUBLIC REGMEM,MIDFLD,MODE,NSEG,BRKCNT,TCOUNT,ASSEM_CNT
70 PUBLIC ASSEM1,ASSEM2,ASSEM3,ASSEM4,ASSEM5,ASSEM6,BYTEBUF,BPTAB
71 PUBLIC DIFLG,SIFLG,BXFLG,BPFLG,NEGFLG,NUMFLG,MEMFLG,REGFLG
72 PUBLIC MOVFLG,TSTFLG,SEGFLG,LOWNUM,HINUM,F8087,DIRFLG,DATAEND
73 PUBLIC BEGSEG,CREATE_LONG,ARG_BUF_INDEX
74 PUBLIC FILEEND,FILESTRT,SSINTSAV,BPINTSAV
75 PUBLIC FZTRACE, PREV24, FIN24
76
77 public rel_read_write_tab ;an000;relative read/write
78 ; table
79 public rel_low_sec ;an000;sector add. low word
80 public rel_high_sec ;an000;sector add. high word
81 public rel_sec_num ;an000;# of sectors to access
82 public rel_rw_add ;an000;transfer address
83
84 public lbtbl ;an000;lead byte table pointer
85
86 public xm_page ;an000;
87 public xm_log ;an000;
88 public xm_phy ;an000;
89 public xm_handle ;an000;
90 public xm_handle_ret ;an000;
91 public xm_page_cnt ;an000;
92 public xm_handle_pages_buf ;an000;
93 public xm_frame ;an000;
94 public xm_deall_han ;an000;
95 public xm_alloc_pg ;an000;
96 public xm_total_pg ;an000;
97 public xm_han_total ;an000;
98 public xm_han_alloc ;an000;
99
100;=========================================================================
101; REL_READ_WRITE_TAB : This table provides the new generic IOCTL primitive
102; read/write with its values.
103;
104; Date : 6/17/87
105;=========================================================================
106
107REL_READ_WRITE_TAB label dword ;an000;relative read/write
108 ; table
109 rel_low_sec dw ? ;an000;sector add. low word
110 rel_high_sec dw ? ;an000;sector add. high word
111 rel_sec_num dw ? ;an000;# of sectors to write
112 rel_rw_add dd ? ;an000;holds the segment
113 ; & offset of the
114 ; transfer address
115
116;=========================================================================
117
118lbtbl dd ? ;an000;lead byte table pointer
119
120 xm_page db ? ;an000;page count to allocate
121 xm_log db ? ;an000;log. page to map
122 xm_phy db ? ;an000;phy. page to map
123 xm_deall_han dw ? ;an000;handle to deallocate
124 xm_handle dw ? ;an000;handle to map
125 xm_handle_ret dw ? ;an000;handle created
126
127
128 xm_page_cnt dw ? ;an000;current page count
129
130 xm_handle_pages_buf db 1024 dup(0) ;an000;hold handle pages
131
132 xm_frame dw ? ;an000;holds frame segment
133
134 xm_alloc_pg dw ? ;an000;active page count
135
136 xm_total_pg dw ? ;an000;total possible page cnt.
137
138 xm_han_total dw ? ;an000;total possible handles
139
140 xm_han_alloc dw ? ;an000;handles allocated
141
142 IF IBMVER
143 PUBLIC OLD_MASK
144OLD_MASK DB ?
145 ENDIF
146PREV24 DD ? ; prevvious INT 24 handler
147FIN24 DB 0 ; TRUE => in the process of cleaning up
148FZTRACE DB 0 ; TRUE => in a Ztrace
149FILEEND DW ? ; ARR 2.4
150FILESTRT DW ? ; ARR 2.4
151SSINTSAV DD ? ; ARR 2.4
152BPINTSAV DD ? ; ARR 2.4
153
154PARITYFLAG DB 0
155
156PUBLIC SAVESTATE
157SAVESTATE DPL <> ; storage for extended error info
158
159XNXOPT DB ? ; AL OPTION FOR DOS COMMAND
160XNXCMD DB ? ; DOS COMMAND FOR OPEN_A_FILE TO PERFORM
161SWITCHAR DB ? ; CURRENT SWITCH CHARACTER
162EXTPTR DW ? ; POINTER TO FILE EXTENSION
163HANDLE DW ? ; CURRENT HANDLE
164TRANSADD DD ? ; TRANSFER ADDRESS
165
166PARSERR DB ?
167ASMADD DB 4 DUP (?)
168DISADD DB 4 DUP (?)
169DISCNT DW ?
170ASMSP DW ? ; SP AT ENTRY TO ASM
171INDEX DW ?
172DEFDUMP DB 4 DUP (?)
173DEFLEN DW ?
174REGSAVE DW ?
175SEGSAVE DW ?
176OFFSAVE DW ?
177
178;Do NOT move this dword variable - it sets up a long call for
179;a Create_process_data_block call issued in DEBUG
180CREATE_LONG LABEL DWORD
181 DW 100H
182BEGSEG DW ?
183
184; The following data areas are destroyed during hex file read
185TEMP DB 4 DUP(?)
186BUFFER LABEL BYTE
187BYTCNT DB ?
188ARG_BUF_INDEX DW ?
189OPCODE DW ?
190AWORD DB ?
191REGMEM DB ?
192MIDFLD DB ?
193MODE DB ?
194NSEG DW ?
195BRKCNT DW ? ; Number of breakpoints
196TCOUNT DW ? ; Number of steps to trace
197ASSEM_CNT DB ? ; preserve order of assem_cnt and assem1
198ASSEM1 DB ?
199ASSEM2 DB ?
200ASSEM3 DB ?
201ASSEM4 DB ?
202ASSEM5 DB ?
203ASSEM6 DB ? ; preserve order of assemx and bytebuf
204BYTEBUF DB BUFLEN DUP (?) ; Table used by LIST
205BPTAB DB BPLEN DUP (?) ; Breakpoint table
206DIFLG DB ?
207SIFLG DB ?
208BXFLG DB ?
209BPFLG DB ?
210NEGFLG DB ?
211NUMFLG DB ? ; ZERO MEANS NO NUMBER SEEN
212MEMFLG DB ?
213REGFLG DB ?
214MOVFLG DB ?
215TSTFLG DB ?
216SEGFLG DB ?
217LOWNUM DW ?
218HINUM DW ?
219F8087 DB ?
220DIRFLG DB ?
221 DB BUFFER+BUFSIZ-$ DUP (?)
222
223DATAEND LABEL WORD
224
225DATA ENDS
226 END
227 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBEMS.ASM b/v4.0/src/CMD/DEBUG/DEBEMS.ASM
new file mode 100644
index 0000000..12578f0
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBEMS.ASM
@@ -0,0 +1,1127 @@
1 PAGE 60,132 ;
2 TITLE DEBEMS.SAL - EMS DEBUGGER COMMANDS PC DOS
3;======================= START OF SPECIFICATIONS =========================
4;
5; MODULE NAME: DEBEMS.SAL
6;
7; DESCRIPTIVE NAME: DEBUGGING TOOL
8;
9; FUNCTION: PROVIDES USERS WITH ACCESS TO RUDIMENTARY EMS FACILITIES.
10;
11; ENTRY POINT: ANY CALLED ROUTINE
12;
13; INPUT: NA
14;
15; EXIT NORMAL: NA
16;
17; EXIT ERROR: NA
18;
19; INTERNAL REFERENCES:
20;
21; EXTERNAL REFERENCES:
22;
23; ROUTINE: DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG
24; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG
25; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG
26; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG
27; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG
28;
29; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
30; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
31; DEBCONST+DEBDATA+DEBMES
32;
33; REVISION HISTORY:
34;
35; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
36;
37; - IMPLEMENT EMS FUNCTIONS DSM:6/24/87
38;
39; COPYRIGHT: "MS DOS DEBUG UTILITY"
40; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
41; "LICENSED MATERIAL - PROPERTY OF Microsoft "
42;
43;======================= END OF SPECIFICATIONS ===========================
44
45INCLUDE DOSSYM.INC
46include debequ.asm
47
48
49CODE SEGMENT PUBLIC BYTE
50CODE ENDS
51
52CONST SEGMENT PUBLIC BYTE
53CONST ENDS
54
55CSTACK SEGMENT STACK
56CSTACK ENDS
57
58DATA SEGMENT PUBLIC BYTE
59
60 extrn xm_page:byte ;an000;page count to allocate
61 extrn xm_log:byte ;an000;log. page to map
62 extrn xm_phy:byte ;an000;phy. page to map
63 extrn xm_handle:word ;an000;handle to map
64 extrn xm_handle_ret:word ;an000;handle created
65
66 extrn xm_page_cnt:word ;an000;page count
67 extrn xm_handle_pages_buf:byte ;an000;holds handles and pages
68 extrn xm_frame:word ;an000;EMS frame value
69 extrn xm_deall_han:word ;an000;handle to deallocate
70 extrn xm_alloc_pg:word ;an000;pages allocated
71 extrn xm_total_pg:word ;an000;total pages possible
72 extrn xm_han_alloc:word ;an000;handles allocated
73 extrn xm_han_total:word ;an000;total handles possible
74
75 extrn xm_han_ret_ptr:word ;an000;prints handle created
76 extrn xm_mapped_ptr:word ;an000;prints log/phy pages
77 extrn xm_page_seg_ptr:word ;an000;Frame seg status
78 extrn xm_deall_ptr:word ;an000;Handle deallocation
79 extrn xm_unall_ptr:word ;an000;prints page status
80 extrn xm_han_alloc_ptr:word ;an000;print handle status
81
82 extrn xm_err80_ptr:word ;an000;ems error message
83 extrn xm_err83_ptr:word ;an000;ems error message
84 extrn xm_err84_ptr:word ;an000;ems error message
85 extrn xm_err85_ptr:word ;an000;ems error message
86 extrn xm_err86_ptr:word ;an000;ems error message
87 extrn xm_err87_ptr:word ;an000;ems error message
88 extrn xm_err88_ptr:word ;an000;ems error message
89 extrn xm_err89_ptr:word ;an000;ems error message
90 extrn xm_err8a_ptr:word ;an000;ems error message
91 extrn xm_err8b_ptr:word ;an000;ems error message
92 extrn xm_err8d_ptr:word ;an000;ems error message
93 extrn xm_err8e_ptr:word ;an000;ems error message
94 extrn xm_errff_ptr:word ;an000;ems error message
95 extrn xm_err_gen_ptr:word ;an000;ems error message
96 extrn xm_parse_err_ptr:word ;an000;input error message
97 extrn xm_status_ptr:word ;an000;prints status of EMS
98
99DATA ENDS
100
101DG GROUP CODE,CONST,CSTACK,DATA
102
103CODE SEGMENT PUBLIC BYTE
104ASSUME CS:DG,DS:DG,ES:DG,SS:DG
105
106 public debems ;an000;entry point
107 extrn std_printf:near ;an000;message retriever
108 extrn gethx:near ;an000;ASCII to bin conversion
109 extrn inbuf:near ;an000;input command line
110 extrn scanb:near ;an000;scan off blanks
111 extrn scanp:near ;an000;scan for parm
112 extrn perr:near ;an000;print ^ error
113 extrn geteol:near
114 extrn crlf:near ;an000;prints a cr,lf
115
116 IF SYSVER
117 ENDIF
118
119DEBEMS: ;an000;entry to module
120
121 call SCANP ;an000;scan for M or S parm
122; $if z ;an000;no parms found
123 JNZ $$IF1
124 call XM_PARSE_ERROR ;an000;tell user of error
125; $else ;an000;
126 JMP SHORT $$EN1
127$$IF1:
128 mov al,[si] ;an000;grab parm
129 cmp al,"M" ;an000;is it MAP?
130; $if e ;an000;yes
131 JNE $$IF3
132 inc si ;an000;point to next byte
133 call XM_EMS_MAP ;an000;
134; $else ;an000;
135 JMP SHORT $$EN3
136$$IF3:
137 cmp al,"S" ;an000;is it a status check?
138; $if e ;an000;yes
139 JNE $$IF5
140 inc si ;an000;point to next byte
141 call XM_EMS_STATUS ;an000;
142; $else ;an000;
143 JMP SHORT $$EN5
144$$IF5:
145 cmp al,"D" ;an000;Deallocate pages?
146; $if e ;an000;yes
147 JNE $$IF7
148 inc si ;an000;point to next byte
149 call XM_EMS_DEALL ;an000;
150; $else ;an000;
151 JMP SHORT $$EN7
152$$IF7:
153 cmp al,"A" ;an000;Allocate pages?
154; $if e ;an000;yes
155 JNE $$IF9
156 inc si ;an000;point to next byte
157 call XM_EMS_ALLOC ;an000;
158; $else ;an000;
159 JMP SHORT $$EN9
160$$IF9:
161 call GETEOL ;an000;check out parm
162; $endif ;an000;
163$$EN9:
164; $endif ;an000;
165$$EN7:
166; $endif ;an000;
167$$EN5:
168; $endif ;an000;
169$$EN3:
170; $endif ;an000;
171$$EN1:
172
173 ret ;an000;return to caller
174
175
176
177;=========================================================================
178; XM_EMS_ALLOC : This function will provide the user the
179; capability to set and change EMS logical and
180; physical pages within page frame 0.
181;
182; Inputs: none
183;
184; Outputs: EMS page frames set or altered
185;
186; Date: 6/24/87
187;=========================================================================
188
189XM_EMS_ALLOC proc near ;an000;XM functions
190
191 call XM_GET_MAN_STATUS ;an000;see if EMS active
192; $if nc ;an000;EMS active
193 JC $$IF16
194 call XM_PAGE_PROMPT ;an000;get pages to allocate
195 call XM_GET_HAN_ALLOC ;an000;allocate pages
196 mov dg:XM_HANDLE_RET,dx ;an000;save handle returned
197; $if z ;an000;good return
198 JNZ $$IF17
199 pushf ;an000;save our flags
200 call XM_DISP1 ;an000;tell user results
201 popf ;an000;restore our flags
202; $else ;an000;
203 JMP SHORT $$EN17
204$$IF17:
205 call XM_ERROR ;an000;print error message
206; $endif ;an000;
207$$EN17:
208; $else ;an000;EMS not active
209 JMP SHORT $$EN16
210$$IF16:
211 call XM_ERROR ;an000;say why not active
212; $endif ;an000;
213$$EN16:
214
215 ret ;an000;return to caller
216
217XM_EMS_ALLOC endp ;an000;
218
219
220;=========================================================================
221; XM_EMS_MAP : This function will provide the user the
222; capability to set and change EMS logical and
223; physical pages within page frame 0.
224;
225; Inputs: none
226;
227; Outputs: EMS page frames set or altered
228;
229; Date: 6/24/87
230;=========================================================================
231
232XM_EMS_MAP proc near ;an000;XM functions
233
234 call XM_GET_MAN_STATUS ;an000;see if EMS active
235; $if nc ;an000;EMS active
236 JC $$IF22
237 call XM_LOG_PROMPT ;an000;get logical page
238 call XM_PHY_PROMPT ;an000;get physical page
239 call XM_HAN_PROMPT ;an000;get handle
240 call XM_MAP_MEMORY ;an000;map the page
241; $if z ;an000;good return
242 JNZ $$IF23
243 pushf ;an000;save our flags
244 call XM_DISP2 ;an000;tell user results
245 popf ;an000;restore our flags
246; $else ;an000;
247 JMP SHORT $$EN23
248$$IF23:
249 call XM_ERROR ;an000;tell error
250; $endif ;an000;
251$$EN23:
252; $else ;an000;EMS not active
253 JMP SHORT $$EN22
254$$IF22:
255 call XM_ERROR ;an000;say why not active
256; $endif ;an000;
257$$EN22:
258
259 ret ;an000;return to caller
260
261XM_EMS_MAP endp ;an000;
262
263;=========================================================================
264; XM_GET_MAN_STATUS : This routine will determine if EMS is active for
265; this session.
266;
267; Called Procs: none
268;
269; Inputs: none
270;
271; Outputs: Z - no error
272; NZ - error
273; AH - error message number
274;
275; Date: 6/24/87
276;=========================================================================
277
278XM_GET_MAN_STATUS proc near ;an000;see if EMS active
279
280 push ds ;an000;save ds - we stomp it
281 mov ax,00h ;an000;set ax to 0
282 mov ds,ax ;an000;set ds to 0
283 cmp ds:word ptr[067h*4+0],0 ;an000;see if int 67h is there
284 pop ds ;an000;restore ds
285; $if e ;an000;EMS not installed
286 JNE $$IF28
287 stc ;an000;flag no ems
288 mov ah,XM_NOT_INST ;an000;signal EMS not installed
289; $else ;an000;
290 JMP SHORT $$EN28
291$$IF28:
292 call XM_INSTALL_CHECK ;an000;see if EMS installed
293; $if z ;AN000;IS EMS INSTALLED
294 JNZ $$IF30
295 clc ;AN000;EMS INSTALLED - FLAG IT
296; $else ;an000;
297 JMP SHORT $$EN30
298$$IF30:
299 stc ;AN000;FLAG EMS NOT INSTALLED
300 mov ah,XM_NOT_INST ;an000;signal EMS not installed
301; $endif ;an000;
302$$EN30:
303; $endif ;an000;
304$$EN28:
305
306 RET ;AN000;RETURN TO CALLER
307
308
309XM_GET_MAN_STATUS endp ;an000;
310
311
312
313;=========================================================================
314; XM_PAGE_PROMPT : This routine prompts the user for the number of
315; pages to be allocated, if he desires a new handle.
316; This routine will determine whether or not the other
317; prompt messages will be displayed.
318;
319; Called Procs: STD_PRINTF
320; XM_PARSE
321;
322; Inputs: none
323;
324; Outputs: XM_PAGE_FLAG
325; XM_PAGE_BUF
326; XM_PAGE
327;
328; Date: 6/24/87
329;=========================================================================
330
331XM_PAGE_PROMPT proc near ;an000;prompt user for number
332 ; of pages to allocate
333 call SCANB ;an000;see if parm entered
334; $if nz ;an000;if parm found
335 JZ $$IF34
336 mov cx,02 ;an000;bytes to parse
337 call GETHX ;an000;get hex value
338; $if c ;an000;no an error occurred
339 JNC $$IF35
340 call PERR ;an000;display ^ error
341; $else ;an000;
342 JMP SHORT $$EN35
343$$IF35:
344 mov dg:XM_PAGE,dl ;an000;save page count
345; $endif ;an000;
346$$EN35:
347; $else ;an000;
348 JMP SHORT $$EN34
349$$IF34:
350 call PERR ;an000;display ^ error
351; $endif ;an000;
352$$EN34:
353
354 ret ;an000;return to caller
355
356XM_PAGE_PROMPT endp ;an000;
357
358
359;=========================================================================
360; XM_LOG_PROMPT : This routine prompts the user for the number of the
361; logical page that is to be mapped in EMS. This
362; routine will not be performed if a page count
363; was specified.
364;
365; Called Procs: STD_PRINTF
366; XM_PARSE
367;
368; Inputs: none
369;
370; Outputs: XM_LOG_BUF
371; XM_LOG
372;
373; Date: 6/24/87
374;=========================================================================
375
376
377XM_LOG_PROMPT proc near ;an000;prompt user for the
378 ; logical page to be
379 ; mapped
380 call SCANB ;an000;see if parm entered
381; $if nz ;an000;parm entered
382 JZ $$IF40
383 mov cx,02 ;an000;bytes to parse
384 call GETHX ;an000;get hex value
385; $if c ;an000;no an error occurred
386 JNC $$IF41
387 call PERR ;an000;display ^ error
388; $else ;an000;
389 JMP SHORT $$EN41
390$$IF41:
391 mov dg:XM_LOG,dl ;an000;save logical page
392; $endif ;an000;
393$$EN41:
394; $else ;an000;
395 JMP SHORT $$EN40
396$$IF40:
397 call PERR ;an000;display ^ error
398; $endif ;an000;
399$$EN40:
400
401 ret ;an000;return to caller
402
403XM_LOG_PROMPT endp ;an000;
404
405
406;=========================================================================
407; XM_PHY_PROMPT : This routine prompts the user for the number of the
408; physical page that is to be mapped in EMS. This
409; routine will not be performed if a page count
410; was specified.
411;
412; Called Procs: STD_PRINTF
413; XM_PARSE
414;
415; Inputs: none
416;
417; Outputs: XM_PHY_BUF
418; XM_PHY
419;
420; Date: 6/24/87
421;=========================================================================
422
423
424XM_PHY_PROMPT proc near ;an000;prompt user for the
425 ; physical page to be
426 ; mapped
427 call SCANB ;an000;see if parm entered
428; $if nz ;an000;parm found
429 JZ $$IF46
430 mov cx,02 ;an000;bytes to parse
431 call GETHX ;an000;get hex value
432; $if c ;an000;no an error occurred
433 JNC $$IF47
434 call PERR ;an000;display ^ error
435; $else ;an000;
436 JMP SHORT $$EN47
437$$IF47:
438 mov dg:XM_PHY,dl ;an000;save logical page
439; $endif ;an000;
440$$EN47:
441; $else ;an000;
442 JMP SHORT $$EN46
443$$IF46:
444 call PERR ;an000;
445; $endif ;an000;
446$$EN46:
447
448 ret ;an000;return to caller
449
450XM_PHY_PROMPT endp ;an000;
451
452
453;=========================================================================
454; XM_HAN_PROMPT : This routine prompts the user for the number of the
455; handle that the mapping is to occur on. This
456; routine will not be performed if a page count
457; was specified.
458;
459; Called Procs: STD_PRINTF
460; XM_PARSE
461;
462; Inputs: none
463;
464; Outputs: XM_HAN_BUF
465; XM_HAN
466;
467; Date: 6/24/87
468;=========================================================================
469
470
471XM_HAN_PROMPT proc near ;an000;prompt user for the
472 ; handle to be mapped
473 call SCANB ;an000;see if parm entered
474; $if nz ;an000;prompt found
475 JZ $$IF52
476 mov cx,04 ;an000;bytes to parse
477 call GETHX ;an000;get hex value
478; $if c ;an000;no an error occurred
479 JNC $$IF53
480 call PERR ;an000;display ^ error
481; $else ;an000;
482 JMP SHORT $$EN53
483$$IF53:
484 mov dg:XM_HANDLE,dx ;an000;save logical page
485; $endif ;an000;
486$$EN53:
487; $else ;an000;
488 JMP SHORT $$EN52
489$$IF52:
490 call PERR ;an000;display ^ error
491; $endif ;an000;
492$$EN52:
493
494 ret ;an000;return to caller
495
496XM_HAN_PROMPT endp ;an000;
497
498
499
500;=========================================================================
501; XM_GET_HAN_ALLOC : This routine will get a handle and allocate the
502; requested number of pages to that handle.
503;
504; Called Procs: none
505;
506; Inputs: XM_PAGE - number of pages to allocate to handle
507;
508; Outputs: Z - no error
509; NZ - error
510; DX - handle allocated
511;
512; Date: 6/24/87
513;=========================================================================
514
515XM_GET_HAN_ALLOC proc near ;an000;create handle and alloc.
516 ; requested pages.
517 push bx ;an000;save regs.
518 mov ah,EMS_HAN_ALLOC ;an000;function 43h
519 xor bh,bh ;an000;clear byte
520 mov bl,dg:XM_PAGE ;an000;number of pages to
521 ; allocate
522 int 67h ;an000;call EMS
523 or ah,ah ;an000;was there an error
524 pop bx ;an000;restore regs.
525
526 ret ;an000;return to caller
527
528XM_GET_HAN_ALLOC endp ;an000;
529
530;=========================================================================
531; XM_MAP_MEMORY : This routine will map the requested logical page
532; to the requested physical page in EMS.
533;
534; Called Procs: none
535;
536; Inputs: XM_PHY - physical page to map to
537; XM_HAN - logical page to map
538;
539; Outputs: Z - no error
540; NZ - error
541; page mapped
542;
543; Date: 6/24/87
544;=========================================================================
545
546XM_MAP_MEMORY proc near ;an000;map a logical page to
547 ; a physical page in
548 ; EMS
549 push bx ;an000;save regs.
550 push dx ;an000;
551 mov ah,EMS_MAP_MEMORY ;an000;function 44h
552 mov al,dg:XM_PHY ;an000;physical page to map
553 xor bh,bh ;an000;zero byte
554 mov bl,dg:XM_LOG ;an000;logical page to map
555 mov dx,dg:XM_HANDLE ;an000;handle to map page to
556 int 67h ;an000;call EMS
557 or ah,ah ;an000;was there an error
558 pop dx ;an000;restore regs.
559 pop bx ;an000;
560
561 ret ;an000;return to caller
562
563XM_MAP_MEMORY endp ;an000;
564
565
566;=========================================================================
567; XM_DISP1 : This routine displays the current page frame and
568; the handle created as a result of the allocate pages.
569;
570; Called Procs: STD_PRINTF
571;
572; Inputs: XM_FRAME_SEG - page frame segment
573; XM_HANDLE_RET - created handle
574; XM_PG_FRAME_PTR - pointer to message
575; XM_HAN_RET_PTR - pointer to message
576;
577; Outputs: "Page Frame Segment : %1",0d,0a
578; "Handle Created : %1",0d,0a
579;
580; Date: 6/24/87
581;=========================================================================
582
583XM_DISP1 proc near ;an000;display messages
584
585 mov dx,offset dg:XM_HAN_RET_PTR ;an000;"Handle Created : "
586 call STD_PRINTF ;an000;call message ret.
587
588 ret ;an000;return to caller
589
590XM_DISP1 endp ;an000;
591
592
593;=========================================================================
594; XM_DISP2 : This routine displays the logical page mapped and
595; the physical page it was mapped to.
596;
597; Called Procs: STD_PRINTF
598;
599; Inputs: XM_MAPPED_PTR - pointer to message
600; XM_LOG - logical page mapped
601; XM_PHY - physical page mapped
602;
603; Outputs: "Logical page %1 mapped to physical page %2",0d0a
604;
605; Date: 6/24/87
606;=========================================================================
607
608XM_DISP2 proc near ;an000;display messages
609
610 mov dx,offset dg:XM_MAPPED_PTR ;an000;"Logical page %1 mapped
611 ; to physical page %2"
612 call STD_PRINTF ;an000;call message ret.
613
614 ret ;an000;return to caller
615
616XM_DISP2 endp ;an000;
617
618;=========================================================================
619; XM_ERROR: This routine will determine what error we have by
620; querying the result in the AH register. It will then
621; report the error to the user through STD_PRINTF
622;
623; Called Procs: STD_PRINTF
624;
625; Inputs: AH - error code
626;
627; Outputs: error message
628;
629; Date: 6/24/87
630;=========================================================================
631
632XM_ERROR proc near ;an000;error message printer
633
634 cmp ah,XM_ERR80 ;an000;error message
635; $if e ;an000;found message
636 JNE $$IF58
637 mov dx,offset dg:XM_ERR80_PTR ;an000;point to message
638 jmp XM_ERROR_CONT ;an000;print error
639; $endif
640$$IF58:
641
642 cmp ah,XM_ERR83 ;an000;error message
643; $if e ;an000;found message
644 JNE $$IF60
645 mov dx,offset dg:XM_ERR83_PTR ;an000;point to message
646 jmp XM_ERROR_CONT ;an000;print error
647; $endif
648$$IF60:
649
650 cmp ah,XM_ERR84 ;an000;error message
651; $if e ;an000;found message
652 JNE $$IF62
653 mov dx,offset dg:XM_ERR84_PTR ;an000;point to message
654 jmp XM_ERROR_CONT ;an000;print error
655; $endif
656$$IF62:
657
658 cmp ah,XM_ERR85 ;an000;error message
659; $if e ;an000;found message
660 JNE $$IF64
661 mov dx,offset dg:XM_ERR85_PTR ;an000;point to message
662 jmp XM_ERROR_CONT ;an000;print error
663; $endif
664$$IF64:
665
666
667 cmp ah,XM_ERR86 ;an000;error message
668; $if e ;an000;found message
669 JNE $$IF66
670 mov dx,offset dg:XM_ERR86_PTR ;an000;point to message
671 jmp XM_ERROR_CONT ;an000;print error
672; $endif
673$$IF66:
674
675 cmp ah,XM_ERR87 ;an000;error message
676; $if e ;an000;found message
677 JNE $$IF68
678 mov dx,offset dg:XM_ERR87_PTR ;an000;point to message
679 jmp XM_ERROR_CONT ;an000;print error
680; $endif
681$$IF68:
682
683 cmp ah,XM_ERR88 ;an000;error message
684; $if e ;an000;found message
685 JNE $$IF70
686 mov dx,offset dg:XM_ERR88_PTR ;an000;point to message
687 jmp XM_ERROR_CONT ;an000;print error
688; $endif
689$$IF70:
690
691 cmp ah,XM_ERR89 ;an000;error message
692; $if e ;an000;found message
693 JNE $$IF72
694 mov dx,offset dg:XM_ERR89_PTR ;an000;point to message
695 jmp XM_ERROR_CONT ;an000;print error
696; $endif
697$$IF72:
698
699 cmp ah,XM_ERR8A ;an000;error message
700; $if e ;an000;found message
701 JNE $$IF74
702 mov dx,offset dg:XM_ERR8A_PTR ;an000;point to message
703 jmp XM_ERROR_CONT ;an000;print error
704; $endif
705$$IF74:
706
707 cmp ah,XM_ERR8B ;an000;error message
708; $if e ;an000;found message
709 JNE $$IF76
710 mov dx,offset dg:XM_ERR8B_PTR ;an000;point to message
711 jmp XM_ERROR_CONT ;an000;print error
712; $endif
713$$IF76:
714
715 cmp ah,XM_ERR8D ;an000;error message
716; $if e ;an000;found message
717 JNE $$IF78
718 mov dx,offset dg:XM_ERR8D_PTR ;an000;point to message
719 jmp XM_ERROR_CONT ;an000;print error
720; $endif
721$$IF78:
722
723 cmp ah,XM_ERR8E ;an000;error message
724; $if e ;an000;found message
725 JNE $$IF80
726 mov dx,offset dg:XM_ERR8E_PTR ;an000;point to message
727 jmp XM_ERROR_CONT ;an000;print error
728; $endif
729$$IF80:
730
731 cmp ah,XM_NOT_INST ;an000;EMS not installed
732; $if e ;an000;found message
733 JNE $$IF82
734 mov dx,offset dg:XM_ERRFF_PTR ;an000;point to message
735 jmp XM_ERROR_CONT ;an000;print error
736; $endif ;an000;
737$$IF82:
738
739 mov dx,offset dg:XM_ERR_GEN_PTR ;an000;general error message
740
741XM_ERROR_CONT:
742
743 call STD_PRINTF ;an000;call message ret.
744
745 ret ;an000;return to caller
746
747XM_ERROR endp ;an000;
748
749;=========================================================================
750; XM_PARSE_ERROR : This routine will display that an error has occurred
751; on the input of the requested data.
752;
753; Called Procs: STD_PRINTF
754;
755; Inputs: XM_PARSE_ERR_PTR - error message
756;
757; Outputs: "Invalid value for parameter",0d,0a
758;
759; Date: 6/24/87
760;=========================================================================
761
762XM_PARSE_ERROR proc near ;an000;input error message
763
764 mov dx,offset dg:XM_PARSE_ERR_PTR ;an000;error message
765 call STD_PRINTF ;an000;call message ret.
766 ret ;an000;return to caller
767
768XM_PARSE_ERROR endp ;an000;
769
770
771
772;=========================================================================
773; XM_EMS_STATUS : This function will provide the user with
774; a report the the current status of EMS.
775;
776; Inputs: none
777;
778; Outputs: EMS page frames set or altered
779;
780; Date: 6/24/87
781;=========================================================================
782
783XM_EMS_STATUS proc near ;an000;XM functions
784
785 call XM_GET_MAN_STATUS ;an000;see if EMS active
786; $if nc ;an000;EMS active
787 JC $$IF84
788 call XM_CURR_STATUS ;an000;current status of EMS
789; $else ;an000;EMS not active
790 JMP SHORT $$EN84
791$$IF84:
792 call XM_ERROR ;an000;say why not active
793; $endif ;an000;
794$$EN84:
795
796 ret ;an000;return to caller
797
798XM_EMS_STATUS endp ;an000;
799
800
801;=========================================================================
802; XM_CURR_STATUS : This routine will display the current status of
803; all active EMS handles.
804;
805; Inputs : none
806;
807; Outputs : Current status of all active EMS handles
808; "Handle %1 has %2 pages allocated"
809;
810; Physical page with it associated frame segment
811; "Physical page %1 = Frame segment %2"
812;
813; Date: 8/05/86
814;=========================================================================
815
816XM_CURR_STATUS proc near ;an000;current EMS status
817
818 mov ah,EMS_HANDLE_PAGES ;an000;get handle pages
819 mov di,offset dg:XM_HANDLE_PAGES_BUF ;an000;point to the buffer
820 int 67h ;an000;
821
822 or ah,ah ;an000;see if an error occurred
823; $if z ;an000;no error
824 JNZ $$IF87
825; $do ;an000;do while data in buffer
826$$DO88:
827 cmp bx,0 ;an000;end of buffer?
828; $leave e ;an000;yes
829 JE $$EN88
830 mov ax,word ptr es:[di] ;an000;page handle
831 mov dg:XM_HANDLE_RET,ax ;an000;save in var
832 mov ax,word ptr es:[di+02];an000;page count
833 mov dg:XM_PAGE_CNT,ax ;an000;save in var
834 mov dx,offset dg:XM_STATUS_PTR ;an000;point to message
835 call STD_PRINTF ;an000;print it
836 add di,04h ;an000;next record
837 dec bx ;an000;decrement counter
838; $enddo ;an000;
839 JMP SHORT $$DO88
840$$EN88:
841
842 call CRLF ;an000;place a blank line
843 ; between reports
844
845 call XM_FRAME_BUFFER ;an000;get frame buffer
846 ;ES:DI points to frame buffer
847; $do ;an000;while cx not = 0
848$$DO91:
849 cmp cx,00 ;an000;at end?
850; $leave e ;an000;yes
851 JE $$EN91
852 call XM_GET_FRAME_SEG ;an000;obtain page and seg
853 mov dx,offset dg:XM_PAGE_SEG_PTR ;an000;message
854 call STD_PRINTF ;an000;print it
855 dec cx ;an000;decrease counter
856 add di,04 ;an000;adjust pointer
857; $enddo ;an000;
858 JMP SHORT $$DO91
859$$EN91:
860
861 call XM_UNALL_COUNT ;an000;display page status
862 call XM_HANDLE_COUNT ;an000;display handle status
863
864; $else
865 JMP SHORT $$EN87
866$$IF87:
867 call XM_ERROR ;an000;display the error
868; $endif ;an000;
869$$EN87:
870 ret ;an000;
871
872XM_CURR_STATUS endp ;an000;
873
874;=========================================================================
875; XM_UNALL_COUNT : This routine generates a line of the status report
876; displaying the number of pages allocated out of
877; the total possible
878;
879; Inputs : none
880;
881; Outputs : Current status of allocated pages
882; "%1 of a total %2 EMS pages have been allocated"
883;
884; Date: 8/05/86
885;=========================================================================
886
887XM_UNALL_COUNT proc near ;an000;
888
889 mov ah,EMS_UNALL_PG_CNT ;an000;see how many pages
890 ; remaining
891 int 67h ;an000;
892 or ah,ah ;an000;see if error
893
894; $if z ;an000;no error
895 JNZ $$IF96
896 push bx ;an000;save bx
897 push dx ;an000;save dx
898 call CRLF ;an000;
899 pop dx ;an000;restore dx
900 pop bx ;an000;restore bx
901 mov ax,dx ;an000;total page count
902 sub ax,bx ;an000;get pages allocated
903 mov dg:XM_ALLOC_PG,ax ;an000;save allocated pages
904 mov dg:XM_TOTAL_PG,dx ;an000;save total page count
905 mov dx,offset dg:XM_UNALL_PTR ;an000;"%1 of a total %2 EMS
906 ; pages have been allocated",cr,lf
907 call STD_PRINTF ;an000;print it
908; $endif ;an000;
909$$IF96:
910
911 ret ;an000;
912
913XM_UNALL_COUNT endp ;an000;
914
915
916;=========================================================================
917; XM_HANDLE_COUNT: This routine generates a line of the status report
918; displaying the number of handles allocated out of
919; the total possible.
920;
921; Inputs : none
922;
923; Outputs : Current status of allocated pages
924; "%1 of a total %2 EMS handles have been allocated"
925;
926; Date: 8/05/86
927;=========================================================================
928
929XM_HANDLE_COUNT proc near ;an000;
930
931 mov ah,EMS_HANDLE_CNT ;an000;see how many handles
932 ; possible
933 int 67h ;an000;
934 or ah,ah ;an000;see if error
935
936; $if z ;an000;no error
937 JNZ $$IF98
938 mov ax,EMS_HANDLE_TOTAL ;an000;total possible handles
939 mov dg:XM_HAN_TOTAL,ax ;an000;save total page count
940 mov dg:XM_HAN_ALLOC,bx ;an000;save allocated pages
941 mov dx,offset dg:XM_HAN_ALLOC_PTR
942 ;an000;"%1 of a total %2 EMS
943 ; handles have been allocated",cr,lf
944 call STD_PRINTF ;an000;print it
945; $endif ;an000;
946$$IF98:
947
948 ret ;an000;
949
950XM_HANDLE_COUNT endp ;an000;
951
952
953;=========================================================================
954; XM_FRAME_SEG : This routine accesses the vector created by
955; function 58h, int 67h. It obtains a physical
956; page of EMS and its segment from this vector
957;
958; Inputs : ES:DI - points to frame buffer
959;
960; Outputs : XM_PHY - a physical page in EMS
961; XM_FRAME - segment corresponding to the physical page
962;
963; Date: 8/05/86
964;=========================================================================
965
966
967XM_GET_FRAME_SEG proc near ;an000;find the frame segment
968
969 mov al,byte ptr es:[di+2] ;an000;get physical page
970 mov dg:XM_PHY,al ;an000;place in print var
971 mov ax,word ptr es:[di] ;an000;get frame segment
972 mov dg:XM_FRAME,ax ;an000;place in print var
973
974 ret ;an000;
975
976XM_GET_FRAME_SEG endp ;an000;
977
978;=========================================================================
979; XM_INSTALL_CHECK: This routine performs function 51h, int 67h to
980; determine if EMS is indeed active.
981;
982; Inputs : XM_FRAME_BUFFER - used to receive physical page
983; and segment data for EMS.
984;
985; Outputs : XM_FRAME_BUFFER - buffer holds physical page
986; and segment data for EMS.
987;
988; Date: 8/05/86
989;=========================================================================
990
991XM_INSTALL_CHECK proc near ;an000;see if EMS installed
992
993 MOV AH,EMS_GET_MAN_STAT ;AN000;GET EMS STATUS
994 XOR AL,AL ;an000;clear low byte
995 INT 67h ;an000;
996 OR AH,AH ;an000;check for error
997; $IF Z ;an000;no error
998 JNZ $$IF100
999 MOV AH,EMS_VERSION ;an000;get version number
1000 INT 67h ;an000;
1001 CMP AL,EMS_LIM_40 ;an000;LIM 4.0 ?
1002; $IF AE ;an000;4.0 or greater
1003 JNAE $$IF101
1004 MOV AH,00h ;an000;set up for flag pass
1005 OR AH,AH ;an000;set flag to ZR
1006; $ELSE ;an000;below 4.0
1007 JMP SHORT $$EN101
1008$$IF101:
1009 MOV AH,01h ;an000;set up for flag pass
1010 OR AH,AH ;an000;set flag to NZ
1011; $ENDIF ;an000;
1012$$EN101:
1013; $ENDIF ;an000;
1014$$IF100:
1015
1016 ret ;an000;
1017
1018XM_INSTALL_CHECK endp ;an000;
1019
1020
1021
1022
1023;=========================================================================
1024; XM_EMS_DEALL : This routine deallocates handles from EMS.
1025;
1026; Inputs : DX - Handle supplied by XM_DEALL_PROMPT
1027;
1028; Outputs : Good return - "Handle %1 deallocated"
1029; Bad return - message describing error
1030;
1031; Date: 8/05/86
1032;=========================================================================
1033
1034XM_EMS_DEALL proc near ;an000;deallocate EMS pages
1035
1036 call XM_GET_MAN_STATUS ;an000;see if EMS installed
1037; $if nc ;an000;error?
1038 JC $$IF105
1039 call XM_DEALL_PROMPT ;an000;prompt user for handle
1040 mov ah,EMS_PAGE_DEALL ;an000;function 45h, int 67h
1041 int 67h ;an000;
1042
1043 or ah,ah ;an000;error?
1044; $if nz ;an000;yes
1045 JZ $$IF106
1046 call XM_ERROR ;an000;say why
1047; $else ;an000;
1048 JMP SHORT $$EN106
1049$$IF106:
1050 mov dx,offset dg:XM_DEALL_PTR;an000;"Handle %1 deallocated"
1051 call STD_PRINTF ;an000;print message
1052; $endif ;an000;
1053$$EN106:
1054; $else ;an000;
1055 JMP SHORT $$EN105
1056$$IF105:
1057 call XM_ERROR ;an000;print type of error
1058; $endif ;an000;
1059$$EN105:
1060
1061 ret ;an000;
1062
1063XM_EMS_DEALL endp ;an000;
1064
1065;=========================================================================
1066; XM_DEALL_PROMPT : This routine prompts the user for the handle to be
1067; deallocated. It converts the handle entered to
1068; binary and passes it back to the caller in DX.
1069;
1070; Inputs : none
1071;
1072; Outputs : DX - Handle to be deallocated.
1073;
1074; Date: 8/05/86
1075;=========================================================================
1076
1077XM_DEALL_PROMPT proc near ;an000;prompt user for handle
1078 ; to deallocate
1079 call SCANB ;an000;see if parm entered
1080; $if nz ;an000;parm found
1081 JZ $$IF111
1082 mov cx,04 ;an000;bytes to parse
1083 call GETHX ;an000;get hex value
1084; $if c ;an000;no an error occurred
1085 JNC $$IF112
1086 call PERR ;an000;display ^ error
1087; $else ;an000;
1088 JMP SHORT $$EN112
1089$$IF112:
1090 mov dg:XM_DEALL_HAN,dx ;an000;save handle to deallocate
1091; $endif ;an000;
1092$$EN112:
1093; $else ;an000;
1094 JMP SHORT $$EN111
1095$$IF111:
1096 call PERR ;an000;display ^ error
1097; $endif ;an000;
1098$$EN111:
1099
1100 ret ;an000;return to caller
1101
1102XM_DEALL_PROMPT endp ;an000;
1103
1104
1105;=========================================================================
1106; XM_FRAME_BUFFER : This routine obtains the frame buffer
1107; of EMS pages.
1108;
1109; Inputs : none
1110;
1111; Outputs : ES:DI - Pointer to frame array
1112; CX - Number of elements in array
1113;=========================================================================
1114
1115XM_FRAME_BUFFER proc near ;an000;
1116
1117 mov ax,EMS_PG_FRAME ;an000;get frame buffer
1118 int 67h ;an000;
1119
1120 ret ;an000;
1121
1122XM_FRAME_BUFFER endp ;an000;
1123
1124
1125CODE ENDS
1126 END DEBEMS
1127 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBEQU.ASM b/v4.0/src/CMD/DEBUG/DEBEQU.ASM
new file mode 100644
index 0000000..fab6f28
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBEQU.ASM
@@ -0,0 +1,164 @@
1;======================= START OF SPECIFICATIONS =========================
2;
3; MODULE NAME: DEBEQU.SAL
4;
5; DESCRIPTIVE NAME: EQUATES NEEDED BY DEBUG
6;
7; FUNCTION: PROVIDES EQUATES NEEDED BY DEBUG
8;
9; ENTRY POINT: NA
10;
11; INPUT: NA
12;
13; EXIT NORMAL: NA
14;
15; EXIT ERROR: NA
16;
17; INTERNAL REFERENCES: NA
18;
19; EXTERNAL REFERENCES: NA
20;
21; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
22; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
23; DEBCONST+DEBDATA+DEBMES
24;
25; REVISION HISTORY:
26;
27; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
28;
29; - IMPLEMENT DBCS HANDLING DMS:6/17/87
30; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87
31; - > 32 MB SUPPORT DMS:6/17/87
32;
33; COPYRIGHT: "MS DOS DEBUG UTILITY"
34; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
35; "LICENSED MATERIAL - PROPERTY OF Microsoft "
36;
37;======================= END OF SPECIFICATIONS ===========================
38
39 IF1
40 %OUT Including DEBEQU.ASM...
41 ENDIF
42
43;IBMVER EQU TRUE ; These switches get set in version.inc
44;MSVER EQU FALSE ; NOT HERE !!!
45
46 INCLUDE SYSVER.INC
47
48IBMJAPAN EQU FALSE
49
50SETCNTC EQU TRUE ; If this is FALSE, DEBUG will not set
51 ; the Control C int vector
52
53PROMPT EQU "-"
54FCB EQU 5CH
55EXEFCB EQU FCB
56BUFLEN EQU 80 ; Maximum length of line input buffer
57BPMAX EQU 10 ; Maximum number of breakpoints
58BPLEN EQU 5*BPMAX ; Length of breakpoint table
59REGTABLEN EQU 14 ; Number of registers
60SEGDIF EQU 0
61BUFSIZ EQU 512
62
63BXREG EQU "B"+5800H ; "BX"
64BPREG EQU "B"+5000H ; "BP"
65SIREG EQU "S"+4900H ; "SI"
66DIREG EQU "D"+4900H ; "DI"
67COMMA EQU 2C00H
68OPBUFLEN EQU 35
69
70 IF IBMVER
71MASK_PORT EQU 21H ; 8259 interrupt control register
72INT_MASK EQU 11111111B ; Disable ALL interrupts
73 ENDIF
74
75CR EQU 13 ;CARRIAGE RETURN
76LF EQU 10 ;LINE FEED
77CHAR_TAB EQU 9 ;TAB
78CHAR_BACKSPACE EQU 8 ;BACKSPACE CHARACTER
79CHAR_EOF EQU 1AH ;END OF FILE CHARACTER
80CHAR_RUBOUT EQU 7FH ;RUBOUT CHARACTER
81
82CHAR_EQUAL EQU "=" ;CHARACTER EQUAL
83CHAR_MINUS EQU "-" ;MINUS CHARACTER
84CHAR_BLANK EQU " " ;BLANK CHARACTER
85DOUBLE_QUOTE EQU '"' ;DOUBLE QUOTE CHARACTER
86SINGLE_QUOTE EQU "'" ;SINGLE QUOTE CHARACTER
87CHAR_COMMA EQU "," ;CHARACTER COMMA
88CHAR_PERIOD EQU "." ;CHARACTER PERIOD
89CHAR_COLON EQU ":" ;CHARACTER COLON
90CHAR_SEMICOLON EQU ";" ;CHARACTER SEMICOLON
91CHAR_LEFT_BRACKET EQU "[" ;CHARACTER LEFT BRACKET
92CHAR_AT_SIGN EQU "@" ;CHARACTER "AT" SIGN
93CHAR_ZERO EQU "0" ;CHARACTER ZERO
94
95LOWER_A EQU "a" ;LOWER CASE CHARACTER "a"
96LOWER_Z EQU "z" ;LOWER CASE CHARACTER "z"
97
98UPPER_A EQU "A" ;UPPER CASE CHARACTER "A"
99UPPER_C EQU "C" ;UPPER CASE CHARACTER "C"
100UPPER_E EQU "E" ;UPPER CASE CHARACTER "E"
101UPPER_F EQU "F" ;UPPER CASE CHARACTER "F"
102UPPER_L EQU "L" ;UPPER CASE CHARACTER "L"
103UPPER_M EQU "M" ;UPPER CASE CHARACTER "M"
104UPPER_N EQU "N" ;UPPER CASE CHARACTER "N"
105UPPER_P EQU "P" ;UPPER CASE CHARACTER "P"
106UPPER_S EQU "S" ;UPPER CASE CHARACTER "S"
107UPPER_X EQU "X" ;UPPER CASE CHARACTER "X"
108UPPER_Z EQU "Z" ;UPPER CASE CHARACTER "Z"
109
110VEC_SING_STEP EQU 1 ;ID OF THE SINGLE STEP VECTOR
111VEC_BREAKPOINT EQU 3 ;ID OF THE BREAKPOINT VECTOR
112VEC_TERM_ADDR EQU 22H ;ID OF THE TERMINATE ADDRESS VECTOR
113VEC_CTRL_BREAK EQU 23H ;ID OF THE CTRL BREAK EXIT ADDRESS VECTOR
114VEC_CRIT_ERR EQU 24H ;ID OF THE CRITICAL ERROR HANDLER VECTOR
115VEC_PRIMITIVE_DISK_READ EQU 25H ;ID OF THE PRIMITAVE DISK READ VECTOR
116VEC_PRIMITIVE_DISK_WRITE EQU 26H ;ID OF THE PRIMITAVE DISK WRITE VECTOR
117GENERIC_IOCTL EQU 440DH ;an000;Generic IOCtl function
118READ_WRITE EQU 08H ;an000;read/write relative sectors
119READ_SECTOR EQU 00H ;an000;currently unknown value
120WRITE_SECTOR EQU 00H ;an000;currently unknown value
121
122SET_DRIVEID_OPTION EQU 1 ;AL VALUE FOR "PARSE FILENAME" FUNCTION
123LSEEK_FROM_START EQU 0 ;AL VALUE FOR "LSEEK" FUNCTION
124LSEEK_EOF_OPTION EQU 2 ;AL VALUE FOR "LSEEK" FUNCTION
125
126;======================= EMS Equates Begin ===============================
127
128EMS_GET_MAN_STAT equ 40h ;an000;function 40h, int 67h
129EMS_UNALL_PG_CNT equ 42h ;an000;funciton 42h, int 67h
130EMS_HAN_ALLOC equ 43h ;an000;function 43h, int 67h
131EMS_MAP_MEMORY equ 44h ;an000;function 44h, int 67h
132EMS_PAGE_DEALL equ 45h ;an000;function 45h, int 67h
133EMS_VERSION equ 46h ;an000;function 46h, int 67h
134EMS_SAVE_PAGE_MAP equ 47h ;an000;function 47h, int 67h
135EMS_REST_PAGE_MAP equ 48h ;an000;function 48h, int 67h
136EMS_HANDLE_CNT equ 4bh ;an000;function 4bh, int 67h
137EMS_HANDLE_PAGES equ 4dh ;an000;function 4dh, int 67h
138EMS_GET_SET_PG_MP equ 4eh ;an000;function 4eh, int 67h
139EMS_GET_PAGE_MAP equ 00h ;an000;sub function 00h of
140EMS_PG_FRAME equ 5800h ;an000;function 58h, int 67h
141 ; function 4eh, int 67h
142EMS_SET_PAGE_MAP equ 01h ;an000;sub function 01h of
143 ; function 4eh, int 67h
144EMS_HANDLE_TOTAL equ 0ffh ;an000;total possible handles
145
146EMS_LIM_40 equ 040h ;an000;LIM 4.0 I.D.
147
148XM_ERR80 equ 80h ;an000;error message type
149XM_ERR83 equ 83h ;an000;error message type
150XM_ERR84 equ 84h ;an000;error message type
151XM_ERR85 equ 85h ;an000;error message type
152XM_ERR86 equ 86h ;an000;error message type
153XM_ERR87 equ 87h ;an000;error message type
154XM_ERR88 equ 88h ;an000;error message type
155XM_ERR89 equ 89h ;an000;error message type
156XM_ERR8A equ 8Ah ;an000;error message type
157XM_ERR8B equ 8Bh ;an000;error message type
158XM_ERR8D equ 8Dh ;an000;error message type
159XM_ERR8E equ 8Eh ;an000;error message type
160XM_ERR8F equ 8Fh ;an000;error message type
161XM_NOT_INST equ 0ffh ;an000;EMS not inst
162
163;======================= EMS Equates End =================================
164 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBERR.ASM b/v4.0/src/CMD/DEBUG/DEBERR.ASM
new file mode 100644
index 0000000..3c59cf0
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBERR.ASM
@@ -0,0 +1,183 @@
1 PAGE 80,132 ;
2 TITLE DEBERR.ASM - DEBUGGER DISK ERROR HANDLER
3
4;******************* START OF SPECIFICATIONS *****************************
5;
6; MODULE NAME:DEBERR.SAL
7;
8; DESCRIPTIVE NAME: DISK ERROR HANDLER
9;
10; FUNCTION: THIS ROUTINE IS A CATCHALL ERROR HANDLER. IT PRIMARILY
11; HANDLES DISK ERROR.
12;
13; ENTRY POINT: ANY CALLED ROUTINE
14;
15; INPUT: NA
16;
17; EXIT-NORMAL: NA
18;
19; EXIT-ERROR: NA
20;
21; INTERNAL REFERENCES:
22;
23;
24; EXTERNAL REFERENCES:
25;
26; NOTES: THIS MODULE SHOULD BE PROCESSED WITH THE SALUT PRE-PROCESSOR
27; WITH OPTIONS "PR".
28; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+DEBCONST+
29; DEBDATA+DEBMES
30;
31; REVISION HISTORY:
32;
33; AN000 VERSION DOS 4.0 - MESSAGE RETRIEVER IMPLEMENTED. DMS:6/17/87
34;
35;
36; COPYRIGHT: "MS DOS DEBUG Utility"
37; "Version 4.00 (C) Copyright 1988 Microsoft"
38; "Licensed Material - Property of Microsoft "
39;
40;******************** END OF SPECIFICATIONS ******************************
41
42
43 IF1
44 %OUT COMPONENT=DEBUG, MODULE=DEBERR
45 ENDIF
46.XLIST
47.XCREF
48 INCLUDE DOSSYM.INC
49.CREF
50.LIST
51
52 INCLUDE DEBEQU.ASM
53
54FIRSTDRV EQU "A"
55
56CODE SEGMENT PUBLIC BYTE
57CODE ENDS
58
59CONST SEGMENT PUBLIC BYTE
60 EXTRN RDFLG:BYTE
61 EXTRN DRVLET:BYTE
62 EXTRN dr1_ptr:word,dr2_ptr:word,dr3_ptr:word,dr4_ptr:word ;ac000
63CONST ENDS
64
65CSTACK SEGMENT STACK
66CSTACK ENDS
67
68DATA SEGMENT PUBLIC BYTE
69 EXTRN PARITYFLAG:BYTE
70DATA ENDS
71
72DG GROUP CODE,CONST,CSTACK,DATA
73
74CODE SEGMENT PUBLIC BYTE
75 ASSUME CS:DG,DS:DG,ES:DG,SS:DG
76
77 EXTRN RESTART:NEAR
78 PUBLIC DRVERR, TRAPPARITY, RELEASEPARITY, NMIINT, NMIINTEND
79
80TRAPPARITY:
81 IF IBMJAPAN
82 PUSH BX
83 PUSH ES
84 PUSH DX ; save location of new offset
85 MOV DX,OFFSET DG:NMIINT ; DS:DX has new interrupt vector
86 CALL SWAPINT ; diddle interrupts
87 ASSUME ES:NOTHING
88
89 MOV WORD PTR [NMIPTR],BX ; save old offset
90 MOV WORD PTR [NMIPTR+2],ES ; save old segment
91 POP DX ; get old regs back
92 POP ES ; restore old values
93 ASSUME ES:DG
94
95 POP BX
96 MOV BYTE PTR [PARITYFLAG],0 ; no interrupts detected yet!
97 RET
98
99SWAPINT:
100 PUSH AX
101 MOV AX,(GET_INTERRUPT_VECTOR SHL 8) + 2
102 INT 21H ; Get old NMI Vector
103 MOV AX,(SET_INTERRUPT_VECTOR SHL 8) + 2
104 INT 21h ; let OS set new vector
105 POP AX
106 ENDIF
107 RET
108
109RELEASEPARITY:
110 IF IBMJAPAN
111 PUSH DX
112 PUSH DS
113 PUSH BX
114 PUSH ES
115 LDS DX,DWORD PTR [NMIPtr] ; get old vector
116 CALL SwapInt ; diddle back to original
117 POP ES
118 POP BX
119 POP DS
120 POP DX
121 MOV [PARITYFLAG],0 ; no interrupts possible!
122 ENDIF
123 RET
124
125NMIInt:
126 IF IBMJAPAN
127 PUSH AX ; save AX
128 IN AL,0A0H ; get status register
129 OR AL,1 ; was there parity check?
130 POP AX ; get old AX back
131 JZ NMICHAIN ; no, go chain interrupt
132 OUT 0A2H,AL ; reset NMI detector
133 MOV CS:[PARITYFLAG],1 ; signal detection
134 IRET
135NMICHAIN:
136 JMP DWORD PTR CS:[NMIPTR] ; chain the vectors
137NMIPTR DD ? ; where old NMI gets stashed
138 ENDIF
139NMIINTEND:
140
141DRVERR:
142
143 or al,al ;ac000;see if drive specified
144; $if nz ;an000;drive specified
145 JZ $$IF1
146 add byte ptr drvlet,firstdrv;ac000;determine drive letter
147 cmp byte ptr rdflg,write ;ac000;see if it is read/write
148; $if z ;an000;it is write
149 JNZ $$IF2
150 mov dx,offset dg:dr2_ptr ;an000;message
151; $else ;an000;it is read
152 JMP SHORT $$EN2
153$$IF2:
154 mov dx,offset dg:dr1_ptr ;an000;message
155; $endif ;an000;
156$$EN2:
157; $else ;an000;write protect error
158 JMP SHORT $$EN1
159$$IF1:
160 add byte ptr drvlet,firstdrv;ac000;determine drive letter
161 cmp byte ptr rdflg,write ;ac000;see if it is read/write
162; $if z ;an000;it is write
163 JNZ $$IF6
164 mov dx,offset dg:dr4_ptr ;an000;message
165; $else ;an000;it is read
166 JMP SHORT $$EN6
167$$IF6:
168 mov dx,offset dg:dr3_ptr ;an000;message
169; $endif ;an000;
170$$EN6:
171; $endif ;an000;
172$$EN1:
173
174; CLEAN OUT THE DISK...
175 MOV AH,DISK_RESET
176 INT 21H
177
178 JMP RESTART
179CODEEND:
180
181CODE ENDS
182 END
183 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBMES.ASM b/v4.0/src/CMD/DEBUG/DEBMES.ASM
new file mode 100644
index 0000000..23f0e0d
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBMES.ASM
@@ -0,0 +1,1524 @@
1PAGE 60,132 ;
2 TITLE DEBMES.SAL - DEBUGGER MESSAGES PC DOS
3 IF1
4 %OUT COMPONENT=DEBUG, MODULE=DEBMES
5 ENDIF
6
7;******************* START OF SPECIFICATIONS *****************************
8;
9; MODULE NAME:DEBMES.SAL
10;
11; DESCRIPTIVE NAME: SUPPLIES APPLICABLE MESSAGES TO DEBUG.ASM
12;
13; FUNCTION: THIS ROUTINE PROVIDES A MEANS BY WHICH MESSAGES MAY BE
14; OUTPUT FOR DEBUG. THIS IS HANDLED THROUGH THE MESSAGE
15; RETRIEVER FUNCTION SYSDISPMSG. TO
16; FACILITATE MIGRATION AWAY FROM THE PRINTF UTILITY
17; THE INTERFACE FOR INVOKING MESSAGES HAS REMAINED THE SAME.
18; THIS IS ACCOMPLISHED THROUGH THE USE OF MACROS AND TABLES.
19; EACH MESSAGE HAS A TABLE OF VALUES REQUIRED BY THE MESSAGE
20; RETRIEVER UTILITIES. THE MACROS OPERATE ON THESE TABLES
21; TO SUPPLY SYSDISPMSG WITH THE VALUES NECESSARY
22; TO PRINT A MESSAGE.
23;
24; ENTRY POINT: PRINTF
25;
26; INPUT: PRINTF IS INVOKED AS IT HAS ALWAYS BEEN INVOKED. DX MUST
27; POINT TO THE OFFSET OF A MESSAGE TABLE. THE TABLE POINTED TO
28; BY DX CONTAINS ALL THE NECESSARY INFORMATION FOR THAT MESSAGE
29; TO BE PRINTED.
30;
31; EXIT-NORMAL: NO CARRY
32;
33; EXIT-ERROR: CARRY SET - EITHER MESSAGE NOT FOUND OR UNABLE TO BE DISPLAYED
34;
35; INTERNAL REFERENCES:
36;
37; ROUTINE:DISP_MESSAGE - THIS MACRO IS USED TO DIPLAY A MESSAGE
38; VIA SYSDISPMSG. IT TAKES AS INPUT A POINTER
39; IN DX. THIS POINTER POINTS TO A TABLE OF
40; VALUES FOR THE REQUESTED MESSAGE.
41; DISP_MESSAGE OBTAINS THE VALUES IT NEEDS TO
42; TO INVOKE SYSDISPMSG FROM THIS TABLE.
43;
44; EXTERNAL REFERENCES:
45;
46; ROUTINE: SYSMSG.INC - THIS ROUTINE IS SUPPLIED TO INTERFACE THE
47; MESSAGE RETRIEVER SERVICES.
48;
49; NOTES: THIS MODULE SHOULD BE PROCESSED WITH THE SALUT PRE-PROCESSOR
50; WITH OPTIONS "PR".
51; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+DEBCONST+
52; DEBDATA+DEBMES
53;
54; REVISION HISTORY:
55;
56; AN000 VERSION DOS 4.0 - MESSAGE RETRIEVER IMPLEMENTED. DMS:6/17/87
57;
58;
59; COPYRIGHT: "MS DOS DEBUG Utility"
60; "Version 4.00 (C) Copyright 1988 Microsoft"
61; "Licensed Material - Property of Microsoft "
62;
63;******************** END OF SPECIFICATIONS ******************************
64.xlist
65
66 include sysmsg.inc ;an000;message retriever
67
68.list
69
70msg_utilname <DEBUG> ;an000;DEBUG messages
71
72;=========================================================================
73;revised debmes.asm
74;=========================================================================
75
76fatal_error equ 45 ;fatal message handler error
77unlim_width equ 00h ;unlimited output width
78pad_blank equ 20h ;blank pad
79pre_load equ 00h ;an000;normal pre-load
80pad_zero equ 30h ;an000;zero pad
81
82
83FALSE EQU 0
84TRUE EQU NOT FALSE
85
86;SYSVER EQU FALSE ;if true, i/o direct to bios
87 INCLUDE SYSVER.INC
88
89;=========================================================================
90; macro disp_message: the macro takes the message obtained in get_message
91; and displays it to the applicable screen device.
92;=========================================================================
93
94disp_message macro tbl ;an000;display message macro
95
96 push si ;an000;save affected reg
97 push di ;an000;
98 push ax ;an000;
99 push bx ;an000;
100 push cx ;an000;
101 push dx ;an000;
102
103 push tbl ;an000;exchange tbl with si
104 pop si ;an000;
105
106 mov ax,[si] ;an000;move message number to ax
107 mov bx,[si+3] ;an000;display handle
108 mov cx,[si+7] ;an000;number of subs
109 mov dl,[si+9] ;an000;function type
110 mov di,[si+10] ;an000;input buffer if appl.
111 mov dh,[si+2] ;an000;message type
112 mov si,[si+5] ;an000;sublist
113
114 call sysdispmsg ;an000;display the message
115
116 pop dx ;an000;restore affected reg
117 pop cx ;an000;
118 pop bx ;an000;
119 pop ax ;an000;
120 pop di ;an000;
121 pop si ;an000;
122
123
124endm ;an000;end macro disp_message
125
126;=========================================================================
127; macro disp_message: end macro
128;=========================================================================
129
130
131
132CODE SEGMENT PUBLIC BYTE
133CODE ENDS
134
135CONST SEGMENT PUBLIC BYTE
136CONST ENDS
137
138CSTACK SEGMENT STACK
139CSTACK ENDS
140
141DATA SEGMENT PUBLIC BYTE
142
143DATA ENDS
144
145DG GROUP CODE,CONST,CSTACK,DATA
146
147
148code segment public byte ;an000;code segment
149 assume cs:dg,ds:dg,ss:dg,es:dg ;an000;
150
151 public printf ;an000;share printf
152;; public disp_fatal ;an000;fatal error display
153 public pre_load_message ;an000;message pre load
154
155.xlist
156
157msg_services <MSGDATA>
158
159.list
160
161;=========================================================================
162; include sysmsg.inc - message retriever services
163;options selected:
164; NEARmsg
165; DISPLAYmsg
166; LOADmsg
167; INPUTmsg
168; CHARmsg
169; NUMmsg
170; CLSAmsg
171; CLSBmsg
172; CLSCmsg
173; CLSDmsg
174;=========================================================================
175
176.xlist
177
178msg_services <LOADmsg> ;an000;load the messages
179msg_services <DISPLAYmsg,CHARmsg,NUMmsg>;an000;get and display messages
180msg_services <INPUTmsg> ;an000;input from keyboard
181msg_services <DEBUG.CLA,DEBUG.CLB> ;an000;message types
182msg_services <DEBUG.CLC,DEBUG.CLD> ;an000;
183msg_services <DEBUG.CL1,DEBUG.CL2> ;an000;
184
185.list
186
187;=========================================================================
188; printf: printf is a replacement of the printf procedure used in DOS
189; releases prior 4.00. printf invokes the macros get_message and
190; disp_message to invoke the new message handler. the interface
191; into printf will continue to be a pointer to a message passed
192; in DX. the pointer is pointing to more than a message now. it
193; is pointing to a table for that message containing all relevant
194; information for retieving and printing the message. the macros
195; get_message and disp_message operate on these tables.
196;=========================================================================
197
198printf proc near ;an000;printf procedure
199
200 disp_message dx ;an000;display a message
201;; $if c ;an000;if an error occurred
202;; call disp_fatal ;an000;display the fatal error
203;; $endif ;an000;
204
205 ret ;an000;return to caller
206
207printf endp ;an000;end printf
208
209
210;=========================================================================
211; disp_fatal: this routine displays a fatal error message in the event
212; an error occurred in disp_message.
213;=========================================================================
214
215;;disp_fatal proc near ;an000;fatal error message
216;;
217;; mov ax,fatal_error ;an000;fatal_error number
218;; mov bx,stdout ;an000;print to console
219;; mov cx,0 ;an000;no parameters
220;; mov dl,no_input ;an000;no input will be coming
221;; mov dh,UTILITY_MSG_CLASS ;an000;utility messages
222;; call sysdispmsg ;an000;dispaly fatal error
223;; ret ;an000;return to caller
224;;
225;;disp_fatal endp ;an000;end disp_fatal
226
227
228;=========================================================================
229; PRE_LOAD_MESSAGE : This routine provides access to the messages required
230; by DEBUG. This routine will report if the load was
231; successful. An unsuccessful load will cause DEBUG
232; to terminate with an appropriate error message.
233;
234; Date : 6/15/87
235;=========================================================================
236
237PRE_LOAD_MESSAGE proc near ;an000;pre-load messages
238
239 call SYSLOADMSG ;an000;invoke loader
240
241; $if c ;an000;if an error
242 JNC $$IF1
243 pushf ;an000;save flags
244 call SYSDISPMSG ;an000;let him say why
245 popf ;an000;restore flags
246; $endif ;an000;
247$$IF1:
248
249 ret ;an000;return to caller
250
251PRE_LOAD_MESSAGE endp ;an000;end proc
252
253include msgdcl.inc
254
255code ends ;an000;end code segment
256
257
258CONST SEGMENT PUBLIC BYTE
259
260 PUBLIC ENDMES_PTR,CRLF_PTR,NAMBAD_PTR
261 PUBLIC NOTFND_PTR,NOROOM_PTR,BADVER
262 PUBLIC NOSPACE_PTR,DRVLET
263 PUBLIC ACCMES_PTR,PROMPT_PTR
264 PUBLIC TOOBIG_PTR,SYNERR_PTR,BACMES_PTR
265 PUBLIC HEXERR_PTR,HEXWRT_PTR,WRTMES_PTR,EXEBAD_PTR,EXEWRT_PTR
266 PUBLIC EXECEMES_PTR, PARITYMES_PTR, NONAMESPEC_PTR
267 PUBLIC dr1_ptr,dr2_ptr,dr3_ptr,dr4_ptr ;ac000;new messages
268 PUBLIC CHANGE_FLAG_PTR,DF_ERROR,BF_ERROR,BR_ERROR,BP_ERROR
269 PUBLIC CONSTEND
270
271;======================= TABLE STRUCTURE =================================
272;
273; byte 1 - message number of message to be displayed
274; byte 2 - message type to be used, i.e.;class 1, utility, etc.
275; byte 3 - display handle, i.e.; console, printer, etc.
276; byte 4 - pointer to substitution list, if any.
277; byte 6 - number of replaceable parameters, if any.
278; byte 7 - type of input from keyboard, if any.
279; byte 8 - pointer to buffer for keyboard input, if any.
280;
281;=========================================================================
282
283 IF SYSVER
284
285 PUBLIC BADDEV_PTR,BADLSTMES_PTR
286
287
288baddev_ptr label word ;an000;"Bad device name",0
289 dw 0006 ;an000;message number 6
290 db UTILITY_MSG_CLASS ;an000;utility message
291 dw stdout ;an000;display handle
292 dw 00 ;an000;sublist
293 dw 00 ;an000;no subs
294 db no_input ;an000;no keyboard input
295 dw 00 ;an000;no keyboard buffer
296
297badlstmes_ptr label word ;an000;"Couldn't open list device
298 ; PRN","Enter name of list
299 ; device?"
300 dw 0007 ;an000;message number 7
301 db UTILITY_MSG_CLASS ;an000;utility message
302 dw stdout ;an000;display handle
303 dw 00 ;an000;sublist
304 dw 00 ;an000;no subs
305 db DOS_KEYB_INP ;an000;keyboard input
306 dw 00 ;an000;no keyboard buffer
307
308
309 ENDIF
310
311;================= REPLACEABLE PARAMETER SUBLIST STRUCTURE ===============
312;
313; byte 1 - substitution list size, always 11
314; byte 2 - reserved for use by message handler
315; byte 3 - pointer to parameter to be used as a substitution
316; byte 7 - which parameter is this to replace, %1, %2, etc.
317; byte 8 - determines how the parameter is to be output
318; byte 9 - determines the maximum width of the parameter string
319; byte 10 - determines the minimum width of the parameter string
320; byte 11 - define what is to be used as a pad character
321;
322;=========================================================================
323
324
325;=========================================================================
326; replaceable parameter sublists
327;=========================================================================
328
329db_synerr_sub label dword ;an000;synerr parameters
330 db Sublist_Length ;an000;sublist size
331 db reserved ;an000;reserved
332 dd dg:arg_buf ;an000;point to argument buffer
333 db 01 ;an000;parameter one
334 db left_align+Char_field_ASCIIZ
335 ;an000;left align/ASCIIZ/character
336 db unlim_width ;an000;unlimited width
337 db 00 ;an000;minimum width
338 db pad_blank ;an000;blank pad
339
340db_change_sub label dword ;an000;synerr parameters
341 db Sublist_Length ;an000;sublist size
342 db reserved ;an000;reserved
343 dd dg:arg_buf ;an000;point to argument buffer
344 db 01 ;an000;parameter one
345 db left_align+Char_field_ASCIIZ
346 ;an000;left align/ASCIIZ/character
347 db unlim_width ;an000;unlimited width
348 db 00 ;an000;minimum width
349 db pad_blank ;an000;blank pad
350
351db_drive_error label dword ;an000;drive error parameters
352 db Sublist_Length ;an000;sublist size
353 db reserved ;an000;reserved
354 dd dg:drvlet ;an000;point to drive letter
355 db 01 ;an000;parameter one
356 db left_align+Char_field_ASCIIZ
357 ;an000;left align/ASCIIZ/character
358 db 01 ;an000;1 byte
359 db 01 ;an000;1 byte
360 db pad_blank ;an000;blank pad
361
362
363
364;=========================================================================
365; end replaceable parameter sublists
366;=========================================================================
367
368
369crlf_ptr label word ;an000;13,10,0
370 dw 0008 ;an000;message number
371 db UTILITY_MSG_CLASS ;an000;utility message
372 dw stdout ;an000;display handle
373 dw 00 ;an000;sublist
374 dw 00 ;an000;no subs
375 db no_input ;an000;no keyboard input
376 dw 00 ;an000;no keyboard buffer
377
378
379bacmes_ptr label word ;an000;32,8,0
380 dw 0044 ;an000;message number
381 db UTILITY_MSG_CLASS ;an000;utility message
382 dw stdout ;an000;display handle
383 dw 00 ;an000;sublist
384 dw 00 ;an000;no subs
385 db no_input ;an000;no keyboard input
386 dw 00 ;an000;no keyboard buffer
387
388
389badver label word ;an000;"Incorrect DOS version"
390 dw 0001 ;an000;message number
391 db UTILITY_MSG_CLASS ;an000;utility message
392 dw stdout ;an000;display handle
393 dw 00 ;an000;sublist
394 dw 00 ;an000;no subs
395 db no_input ;an000;no keyboard input
396 dw 00 ;an000;no keyboard buffer
397
398endmes_ptr label word ;an000;13,10,"Program terminated
399 ; normally",0
400 dw 0009 ;an000;message number
401 db UTILITY_MSG_CLASS ;an000;utility message
402 dw stdout ;an000;display handle
403 dw 00 ;an000;sublist
404 dw 00 ;an000;no subs
405 db no_input ;an000;no keyboard input
406 dw 00 ;an000;no keyboard buffer
407
408
409nambad_ptr label word ;an000;"Invalid drive specification",0
410 dw 0010 ;an000;message number
411 db UTILITY_MSG_CLASS ;an000;utility message
412 dw stdout ;an000;display handle
413 dw 00 ;an000;sublist
414 dw 00 ;an000;no subs
415 db no_input ;an000;no keyboard input
416 dw 00 ;an000;no keyboard buffer
417
418
419notfnd_ptr label word ;an000;"File not found",0
420 dw 0002 ;an000;message number
421 db Ext_Err_Class ;an000;extended error
422 dw stderr ;an000;display handle
423 dw 00 ;an000;sublist
424 dw 00 ;an000;no subs
425 db no_input ;an000;no keyboard input
426 dw 00 ;an000;no keyboard buffer
427
428
429noroom_ptr label word ;an000;"File creation error",0
430 dw 0012 ;an000;message number
431 db UTILITY_MSG_CLASS ;an000;utility message
432 dw stdout ;an000;display handle
433 dw 00 ;an000;sublist
434 dw 00 ;an000;no subs
435 db no_input ;an000;no keyboard input
436 dw 00 ;an000;no keyboard buffer
437
438
439nospace_ptr label word ;an000;"Insufficient space on disk",0
440 dw 0013 ;an000;message number
441 db UTILITY_MSG_CLASS ;an000;utility message
442 dw stdout ;an000;display handle
443 dw 00 ;an000;sublist
444 dw 00 ;an000;no subs
445 db no_input ;an000;no keyboard input
446 dw 00 ;an000;no keyboard buffer
447
448
449dr1_ptr label word ;an000;"Disk error reading drive %1"
450 dw 0014 ;an000;message number
451 db UTILITY_MSG_CLASS ;an000;utility message
452 dw stdout ;an000;display handle
453 dw dg:db_drive_error ;an000;sublist
454 dw 01 ;an000;no subs
455 db no_input ;an000;no keyboard input
456 dw 00 ;an000;no keyboard buffer
457
458
459dr2_ptr label word ;an000;"Disk error writing drive %1"
460 dw 0015 ;an000;message number
461 db UTILITY_MSG_CLASS ;an000;utility message
462 dw stdout ;an000;display handle
463 dw dg:db_drive_error ;an000;sublist
464 dw 01 ;an000;no subs
465 db no_input ;an000;no keyboard input
466 dw 00 ;an000;no keyboard buffer
467
468
469dr3_ptr label word ;an000;"Write protect error reading
470 ; drive %1"
471 dw 0016 ;an000;message number
472 db UTILITY_MSG_CLASS ;an000;utility message
473 dw stdout ;an000;display handle
474 dw dg:db_drive_error ;an000;sublist
475 dw 01 ;an000;no subs
476 db no_input ;an000;no keyboard input
477 dw 00 ;an000;no keyboard buffer
478
479
480dr4_ptr label word ;an000;"Write protect error writing
481 ; drive %1"
482 dw 0017 ;an000;message number
483 db UTILITY_MSG_CLASS ;an000;utility message
484 dw stdout ;an000;display handle
485 dw dg:db_drive_error ;an000;sublist
486 dw 01 ;an000;no subs
487 db no_input ;an000;no keyboard input
488 dw 00 ;an000;no keyboard buffer
489
490
491toobig_ptr label word ;an000;"Insufficient memory",0
492 dw 0008 ;an000;message number
493 db Ext_Err_Class ;an000;utility message
494 dw stderr ;an000;display handle
495 dw 00 ;an000;sublist
496 dw 00 ;an000;no subs
497 db no_input ;an000;no keyboard input
498 dw 00 ;an000;no keyboard buffer
499
500synerr_ptr label word ;an000;"%1^Error",0
501 dw 0019 ;an000;message number
502 db UTILITY_MSG_CLASS ;an000;utility message
503 dw stdout ;an000;display handle
504 dw dg:db_synerr_sub ;an000;sublist
505 dw 01 ;an000;1 sub - leading spaces
506 db no_input ;an000;no keyboard input
507 dw 00 ;an000;no keyboard buffer
508
509
510hexerr_ptr label word ;an000;"Error in EXE or HEX file",0
511 dw 0020 ;an000;message number
512 db UTILITY_MSG_CLASS ;an000;utility message
513 dw stdout ;an000;display handle
514 dw 00 ;an000;sublist
515 dw 00 ;an000;no subs
516 db no_input ;an000;no keyboard input
517 dw 00 ;an000;no keyboard buffer
518
519exebad_ptr label word ;an000;"Error in EXE or HEX file",0
520 dw 0020 ;an000;message number
521 db UTILITY_MSG_CLASS ;an000;utility message
522 dw stdout ;an000;display handle
523 dw 00 ;an000;sublist
524 dw 00 ;an000;no subs
525 db no_input ;an000;no keyboard input
526 dw 00 ;an000;no keyboard buffer
527
528
529hexwrt_ptr label word ;an000;"EXE and HEX files cannot be
530 ; written",0
531 dw 0021 ;an000;message number
532 db UTILITY_MSG_CLASS ;an000;utility message
533 dw stdout ;an000;display handle
534 dw 00 ;an000;sublist
535 dw 00 ;an000;no subs
536 db no_input ;an000;no keyboard input
537 dw 00 ;an000;no keyboard buffer
538
539exewrt_ptr label word ;an000;"EXE and HEX files cannot be
540 ; written",0
541 dw 0021 ;an000;message number
542 db UTILITY_MSG_CLASS ;an000;utility message
543 dw stdout ;an000;display handle
544 dw 00 ;an000;sublist
545 dw 00 ;an000;no subs
546 db no_input ;an000;no keyboard input
547 dw 00 ;an000;no keyboard buffer
548
549
550execemes_ptr label word ;an000;"EXEC failure",0
551 dw 0022 ;an000;message number
552 db UTILITY_MSG_CLASS ;an000;utility message
553 dw stdout ;an000;display handle
554 dw 00 ;an000;sublist
555 dw 00 ;an000;no subs
556 db no_input ;an000;no keyboard input
557 dw 00 ;an000;no keyboard buffer
558
559
560nonamespec_ptr label word ;an000;"(W)rite error, no destination
561 ; defined",0
562 dw 0023 ;an000;message number
563 db UTILITY_MSG_CLASS ;an000;utility message
564 dw stdout ;an000;display handle
565 dw 00 ;an000;sublist
566 dw 00 ;an000;no subs
567 db no_input ;an000;no keyboard input
568 dw 00 ;an000;no keyboard buffer
569
570accmes_ptr label word ;an000;Access denied",0
571 dw 0024 ;an000;message number
572 db UTILITY_MSG_CLASS ;an000;utility message
573 dw stdout ;an000;display handle
574 dw 00 ;an000;sublist
575 dw 00 ;an000;no subs
576 db no_input ;an000;no keyboard input
577 dw 00 ;an000;no keyboard buffer
578
579
580paritymes_ptr label word ;an000;"Parity error or nonexistant
581 ; memory error detected",0
582 dw 0025 ;an000;message number
583 db UTILITY_MSG_CLASS ;an000;utility message
584 dw stdout ;an000;display handle
585 dw 00 ;an000;sublist
586 dw 00 ;an000;no subs
587 db no_input ;an000;no keyboard input
588 dw 00 ;an000;no keyboard buffer
589
590
591prompt_ptr label word ;an000;"-",0
592 dw 0026 ;an000;message number
593 db UTILITY_MSG_CLASS ;an000;utility message
594 dw stdout ;an000;display handle
595 dw 00 ;an000;sublist
596 dw 00 ;an000;no subs
597 db no_input ;an000;no keyboard input
598 dw 00 ;an000;no keyboard buffer
599
600
601change_flag_ptr label word ;an000;"%1 -",0
602 dw 0027 ;an000;message number
603 db UTILITY_MSG_CLASS ;an000;utility message
604 dw stdout ;an000;display handle
605 dw dg:db_change_sub ;an000;sublist
606 dw 01 ;an000;no subs
607 db no_input ;an000;no keyboard input
608 dw 00 ;an000;no keyboard buffer
609
610df_error db "df",0
611bf_error db "bf",0
612br_error db "br",0
613bp_error db "bp",0
614drvlet db "A",0
615
616CONSTEND LABEL BYTE
617
618CONST ENDS
619
620DATA SEGMENT PUBLIC BYTE
621
622 PUBLIC HEX_ARG1,HEX_ARG2,HEX_PTR,ARG_BUF
623 PUBLIC ARG_BUF_PTR,ADD_PTR,ERR_TYPE
624 PUBLIC CRLF_PTR,ADD_ARG,SUB_ARG,PROMPT_PTR
625 PUBLIC REGISTER_PTR,REG_NAME,REG_CONTENTS
626 PUBLIC SINGLE_REG_PTR,SINGLE_REG_ARG
627 PUBLIC ERRMES_PTR,LOC_PTR,LOC_ADD
628 PUBLIC LITTLE_PTR,BIG_PTR,LITTLE_CONTENTS
629 PUBLIC BIG_CONTENTS,COMP_PTR,COMP_ARG1,COMP_ARG2
630 PUBLIC COMP_ARG3,COMP_ARG4,COMP_ARG5,COMP_ARG6
631 PUBLIC WRTMES_PTR,WRT_ARG1,WRT_ARG2
632 PUBLIC IOTYP,MESTYP
633 PUBLIC ONE_CHAR_BUF,ONE_CHAR_BUF_PTR
634 PUBLIC OPBUF,UNASSEM_LN_PTR
635
636 PUBLIC xm_han_ret_ptr
637 PUBLIC xm_mapped_ptr
638 PUBLIC xm_err80_ptr
639 PUBLIC xm_err83_ptr
640 PUBLIC xm_err84_ptr
641 PUBLIC xm_err85_ptr
642 PUBLIC xm_err86_ptr
643 PUBLIC xm_err87_ptr
644 PUBLIC xm_err88_ptr
645 PUBLIC xm_err89_ptr
646 PUBLIC xm_err8a_ptr
647 PUBLIC xm_err8b_ptr
648 PUBLIC xm_err8d_ptr
649 PUBLIC xm_err8e_ptr
650 PUBLIC xm_err_gen_ptr
651 PUBLIC xm_parse_err_ptr
652 PUBLIC xm_status_ptr
653 PUBLIC xm_page_seg_ptr
654 PUBLIC xm_deall_ptr
655 PUBLIC xm_errff_ptr
656 PUBLIC xm_unall_ptr
657 PUBLIC xm_han_alloc_ptr
658
659 EXTRN XM_HANDLE_RET:word
660 EXTRN XM_LOG:byte
661 EXTRN XM_PHY:byte
662 EXTRN XM_PAGE_CNT:word
663 EXTRN XM_FRAME:word
664 EXTRN XM_DEALL_HAN:word
665 EXTRN XM_ALLOC_PG:word
666 EXTRN XM_TOTAL_PG:word
667 EXTRN XM_HAN_ALLOC:word
668 EXTRN XM_HAN_TOTAL:word
669
670;=========================================================================
671; begin parameter sublists
672;=========================================================================
673
674;======================= unassemble parameter sublists ===================
675
676db_unassem_sb1 label dword ;an000;unassemble parameter 1
677 db Sublist_Length ;an000;sublist size
678 db reserved ;an000;reserved
679 dd dg:arg_buf ;an000;point to argument buffer
680 db 01 ;an000;parameter one
681 db left_align+Char_field_ASCIIZ
682 ;an000;left align/ASCIIZ/character
683 db unlim_width ;an000;unlimited width
684 db 00 ;an000;minimum width
685 db pad_blank ;an000;blank pad
686
687db_unassem_sb2 label dword ;an000;unassemble parameter 2
688 db Sublist_Length ;an000;sublist size
689 db reserved ;an000;reserved
690 dd dg:opbuf ;an000;point to argument buffer
691 db 02 ;an000;parameter two
692 db left_align+Char_field_ASCIIZ
693 ;an000;left align/ASCIIZ/character
694 db unlim_width ;an000;unlimited width
695 db 00 ;an000;minimum width
696 db pad_blank ;an000;blank pad
697
698
699;================== hex argument parameter sublists ======================
700
701db_hexarg_sb1 label dword ;an000;hex argument parameter 1
702 db Sublist_Length ;an000;sublist size
703 db reserved ;an000;reserved
704 dd dg:hex_arg1 ;an000;point to argument buffer
705 db 01 ;an000;parameter one
706 db right_align+bin_hex_word
707 ;an000;right align/word/hexadecimal
708 db 04 ;an000;maximum of 4 bytes
709 db 04 ;an000;minimum of 4 bytes
710 db pad_zero ;an000;blank pad
711
712db_hexarg_sb2 label dword ;an000;hex argument parameter 2
713 db Sublist_Length ;an000;sublist size
714 db reserved ;an000;reserved
715 dd dg:hex_arg2 ;an000;point to argument buffer
716 db 02 ;an000;parameter two
717 db right_align+bin_hex_word
718 ;an000;left align/word/hexadecimal
719 db 04 ;an000;maximum of 4 bytes
720 db 04 ;an000;minimum of 4 bytes
721 db pad_zero ;an000;blank pad
722
723db_hexarg_sb3 label dword ;an000;hex argument parameter 3
724 db Sublist_Length ;an000;sublist size
725 db reserved ;an000;reserved
726 dd dg:arg_buf ;an000;point to argument buffer
727 db 03 ;an000;parameter one
728 db left_align+Char_field_ASCIIZ
729 ;an000;left align/ASCIIZ/character
730 db unlim_width ;an000;unlimited width
731 db 00 ;an000;minimum width
732 db pad_blank ;an000;blank pad
733
734
735;================== hex add parameter sublists ===========================
736
737db_hexadd_sb1 label dword ;an000;hex add parameter 1
738 db Sublist_Length ;an000;sublist size
739 db reserved ;an000;reserved
740 dd dg:add_arg ;an000;point to add_arg
741 db 01 ;an000;parameter one
742 db right_align+bin_hex_word
743 ;an000;left align/word/hexadecimal
744 db 04 ;an000;maximum of 4 bytes
745 db 04 ;an000;minimum of 4 bytes
746 db pad_zero ;an000;blank pad
747
748db_hexadd_sb2 label dword ;an000;hex argument parameter 1
749 db Sublist_Length ;an000;sublist size
750 db reserved ;an000;reserved
751 dd dg:sub_arg ;an000;point to sub_arg
752 db 02 ;an000;parameter two
753 db right_align+bin_hex_word
754 ;an000;left align/word/hexadecimal
755 db 04 ;an000;maximum of 4 bytes
756 db 04 ;an000;minimum of 4 bytes
757 db pad_zero ;an000;blank pad
758
759;================== end hex add parameter sublists =======================
760
761;================== single register parameter sublists ===================
762;string: "%1 %2",13,10,":",0
763
764db_singrg_sb1 label dword ;an000;single register parameter 1
765 db Sublist_Length ;an000;sublist size
766 db reserved ;an000;reserved
767 dd dg:arg_buf ;an000;point to argument buffer
768 db 01 ;an000;parameter one
769 db left_align+Char_field_ASCIIZ
770 ;an000;left align/ASCIIZ/character
771 db unlim_width ;an000;unlimited width
772 db 00 ;an000;minimum of 0 bytes
773 db pad_blank ;an000;blank pad
774
775db_singrg_sb2 label dword ;an000;single register parameter 2
776 db Sublist_Length ;an000;sublist size
777 db reserved ;an000;reserved
778 dd dg:single_reg_arg ;an000;point single_reg_arg
779 db 02 ;an000;parameter two
780 db right_align+bin_hex_word
781 ;an000;left align/word/hexadecimal
782 db 04 ;an000;maximum of 4 bytes
783 db 04 ;an000;minimum of 4 bytes
784 db pad_zero ;an000;blank pad
785
786;================== register parameter sublists ==========================
787;string: "%1=%2 ",0
788
789db_regist_sb1 label dword ;an000;register parameter 1
790 db Sublist_Length ;an000;sublist size
791 db reserved ;an000;reserved
792 dd dg:reg_name ;an000;point to reg_name
793 db 01 ;an000;parameter one
794 db left_align+Char_field_ASCIIZ
795 ;an000;left align/ASCIIZ/character
796 db 02 ;an000;unlimited width
797 db 02 ;an000;minimum of 0 bytes
798 db pad_blank ;an000;blank pad
799
800db_regist_sb2 label dword ;an000;register parameter 2
801 db Sublist_Length ;an000;sublist size
802 db reserved ;an000;reserved
803 dd dg:reg_contents ;an000;point to reg_contents
804 db 02 ;an000;parameter two
805 db right_align+bin_hex_word
806 ;an000;left align/word/hexadecimal
807 db 04 ;an000;maximum of 4 bytes
808 db 04 ;an000;minimum of 4 bytes
809 db pad_zero ;an000;blank pad
810
811;================== error message parameter sublists =====================
812;string: "%1 Error",0
813
814db_error_sb1 label dword ;an000;error message parameter 1
815 db Sublist_Length ;an000;sublist size
816 db reserved ;an000;reserved
817 dd dg:err_type ;an000;point to argument buffer
818 db 01 ;an000;parameter one
819 db left_align+Char_field_ASCIIZ
820 ;an000;left align/ASCIIZ/character
821 db unlim_width ;an000;unlimited width
822 db 00 ;an000;minimum of 0 bytes
823 db pad_blank ;an000;blank pad
824
825;================== writing message parameter sublists ===================
826;string: "Writing %1%2 bytes",0
827
828db_wrtmes_sb1 label dword ;an000;wrtmes parameter 1
829 db Sublist_Length ;an000;sublist size
830 db reserved ;an000;reserved
831 dd dg:wrt_arg1 ;an000;point to argument buffer
832 db 01 ;an000;parameter one
833 db right_align+bin_hex_word
834 ;an000;right align/word/hexadecimal
835 db 04 ;an000;maximum of 4 bytes
836 db 04 ;an000;minimum of 4 bytes
837 db pad_zero ;an000;blank pad
838
839db_wrtmes_sb2 label dword ;an000;wrtmes parameter 2
840 db Sublist_Length ;an000;sublist size
841 db reserved ;an000;reserved
842 dd dg:wrt_arg2 ;an000;point to argument buffer
843 db 02 ;an000;parameter two
844 db left_align+bin_hex_word
845 ;an000;left align/word/hexadecimal
846 db 04 ;an000;maximum of 4 bytes
847 db 04 ;an000;minimum of 4 bytes
848 db pad_zero ;an000;blank pad
849
850;================== loc address parameter sublists =======================
851;string: "%1:%2=",0
852
853db_locadd_sb1 label dword ;an000;loc address parameter 1
854 db Sublist_Length ;an000;sublist size
855 db reserved ;an000;reserved
856 dd dg:arg_buf ;an000;point to argument buffer
857 db 01 ;an000;parameter one
858 db right_align+Char_field_ASCIIZ
859 ;an000;left align/ASCIZZ/character
860 db unlim_width ;an000;unlimited width
861 db 00 ;an000;minimum of 0 bytes
862 db pad_blank ;an000;blank pad
863
864db_locadd_sb2 label dword ;an000;loc address parameter 2
865 db Sublist_Length ;an000;sublist size
866 db reserved ;an000;reserved
867 dd dg:loc_add ;an000;point to loc_add
868 db 02 ;an000;parameter two
869 db right_align+bin_hex_word
870 ;an000;left align/word/hexadecimal
871 db 04 ;an000;maximum of 4 bytes
872 db 04 ;an000;minimum of 4 bytes
873 db pad_zero ;an000;blank pad
874
875;================== little contents parameter sublists ===================
876;string "%1",0
877
878db_little_sb1 label dword ;an000;one byte output parameter 1
879 db Sublist_Length ;an000;sublist size
880 db reserved ;an000;reserved
881 dd dg:little_contents ;an000;point to little_contents
882 db 01 ;an000;parameter one
883 db right_align+bin_hex_byte
884 ;an000;left align/byte/hexadecimal
885 db 02 ;an000;maximum of 2 bytes
886 db 02 ;an000;minimum of 2 bytes
887 db pad_zero ;an000;blank pad
888
889;================== big argument parameter sublists ======================
890;string: "%1",0
891
892db_big_sb1 label dword ;an000;word argument parameter 1
893 db Sublist_Length ;an000;sublist size
894 db reserved ;an000;reserved
895 dd dg:big_contents ;an000;point to big_contents
896 db 01 ;an000;parameter one
897 db right_align+bin_hex_word
898 ;an000;left align/word/hexadecimal
899 db 04 ;an000;maximum of 4 bytes
900 db 04 ;an000;minimum of 4 bytes
901 db pad_zero ;an000;blank pad
902
903;======================= comp argument parameter sublists ================
904;string "%1:%2 %3 %4 %5:%6",0
905
906db_comp_sb1 label dword ;an000;comp argument parameter 1
907 db Sublist_Length ;an000;sublist size
908 db reserved ;an000;reserved
909 dd dg:comp_arg1 ;an000;point to comp_arg1
910 db 01 ;an000;parameter one
911 db right_align+bin_hex_word
912 ;an000;left align/word/hexadecimal
913 db 04 ;an000;maximum of 4 bytes
914 db 04 ;an000;minimum of 4 bytes
915 db pad_zero ;an000;blank pad
916
917db_comp_sb2 label dword ;an000;comp argument parameter 2
918 db Sublist_Length ;an000;sublist size
919 db reserved ;an000;reserved
920 dd dg:comp_arg2 ;an000;point to comp_arg2
921 db 02 ;an000;parameter two
922 db right_align+bin_hex_word
923 ;an000;left align/word/hexadecimal
924 db 04 ;an000;maximum of 4 bytes
925 db 04 ;an000;minimum of 4 bytes
926 db pad_zero ;an000;blank pad
927
928db_comp_sb3 label dword ;an000;comp argument parameter 3
929 db Sublist_Length ;an000;sublist size
930 db reserved ;an000;reserved
931 dd dg:comp_arg3 ;an000;point to comp_arg3
932 db 03 ;an000;parameter three
933 db right_align+bin_hex_byte
934 ;an000;left align/byte/hexadecimal
935 db 02 ;an000;maximum of 2 bytes
936 db 02 ;an000;minimum of 2 bytes
937 db pad_zero ;an000;blank pad
938
939db_comp_sb4 label dword ;an000;comp argument parameter 4
940 db Sublist_Length ;an000;sublist size
941 db reserved ;an000;reserved
942 dd dg:comp_arg4 ;an000;point to comp_arg4
943 db 04 ;an000;parameter four
944 db right_align+bin_hex_byte
945 ;an000;left align/byte/hexadecimal
946 db 02 ;an000;maximum of 2 bytes
947 db 02 ;an000;minimum of 2 bytes
948 db pad_zero ;an000;blank pad
949
950db_comp_sb5 label dword ;an000;comp argument parameter 5
951 db Sublist_Length ;an000;sublist size
952 db reserved ;an000;reserved
953 dd dg:comp_arg5 ;an000;point to comp_arg5
954 db 05 ;an000;parameter five
955 db right_align+bin_hex_word
956 ;an000;left align/word/hexadecimal
957 db 04 ;an000;maximum of 4 bytes
958 db 04 ;an000;minimum of 4 bytes
959 db pad_zero ;an000;blank pad
960
961db_comp_sb6 label dword ;an000;comp argument parameter 6
962 db Sublist_Length ;an000;sublist size
963 db reserved ;an000;reserved
964 dd dg:comp_arg6 ;an000;
965 db 06 ;an000;parameter 6
966 db right_align+bin_hex_word
967 ;an000;left align/word/hexadecimal
968 db 04 ;an000;maximum of 4 bytes
969 db 04 ;an000;minimum of 4 bytes
970 db pad_zero ;an000;blank pad
971
972;======================= disk error parameter sublists ===================
973;string: "%1 error %2 drive %3",0
974
975db_disk_sb1 label dword ;an000;disk argument parameter 1
976 db Sublist_Length ;an000;sublist size
977 db reserved ;an000;reserved
978 dd dg:mestyp ;an000;point to mestyp
979 db 01 ;an000;parameter one
980 db left_align+Char_field_ASCIIZ
981 ;an000;left align/ASCIIZ/character
982 db unlim_width ;an000;unlimited width
983 db 00 ;an000;minimum of 0 bytes
984 db pad_blank ;an000;blank pad
985
986db_disk_sb2 label dword ;an000;disk argument parameter 2
987 db Sublist_Length ;an000;sublist size
988 db reserved ;an000;reserved
989 dd dg:iotyp ;an000;point to iotyp
990 db 02 ;an000;parameter two
991 db left_align+Char_field_ASCIIZ
992 ;an000;left align/ASCIIZ/character
993 db unlim_width ;an000;unlimited width
994 db 00 ;an000;minimum of 0 bytes
995 db pad_blank ;an000;blank pad
996
997db_disk_sb3 label dword ;an000;disk argument parameter 3
998 db Sublist_Length ;an000;sublist size
999 db reserved ;an000;reserved
1000 dd dg:drive ;an000;point to drive
1001 db 03 ;an000;parameter three
1002 db left_align+char_field_char
1003 ;an000;left align/character/character
1004 db unlim_width ;an000;unlimited width
1005 db 00 ;an000;minimum of 0 bytes
1006 db pad_blank ;an000;blank pad
1007
1008arg_buf_sb1 label dword ;an000;argument sublist
1009 db Sublist_Length ;an000;sublist size
1010 db reserved ;an000;reserved
1011 dd dg:arg_buf ;an000;point to argument buffer
1012 db 01 ;an000;parameter one
1013 db left_align+Char_Field_ASCIIZ
1014 ;an000;left align/ASCIIZ/character
1015 db unlim_width ;an000;unlimited width
1016 db 00 ;an000;minimum of 0 bytes
1017 db pad_blank ;an000;blank pad
1018
1019one_char_sb1 label dword ;an000;character buffer sublist
1020 db Sublist_Length ;an000;sublist size
1021 db reserved ;an000;reserved
1022 dd dg:one_char_buf ;an000;point to argument buffer
1023 db 01 ;an000;parameter one
1024 db left_align+Char_Field_Char
1025 ;an000;left align/character/character
1026 db unlim_width ;an000;unlimited width
1027 db 00 ;an000;minimum of 0 bytes
1028 db pad_blank ;an000;blank pad
1029
1030xm_han_sub label dword ;an000;sublist for handles
1031 db Sublist_Length ;an000;11 bytes
1032 db Reserved ;an000;reserved field
1033 dd dg:XM_HANDLE_RET ;an000;parameter 1
1034 db 01 ;an000;parameter 1
1035 db right_align+Bin_Hex_Word;an000;
1036 db 04 ;an000;maximum width
1037 db 04 ;an000;minimum width
1038 db 30h ;an000;pad with zeros
1039
1040xm_map_sub label dword ;an000;sublist for mappings
1041 db Sublist_Length ;an000;11 bytes
1042 db Reserved ;an000;reserved field
1043 dd dg:XM_LOG ;an000;parameter 1
1044 db 01 ;an000;parameter 1
1045 db right_align+Bin_Hex_Byte;an000;
1046 db 02 ;an000;maximum width
1047 db 02 ;an000;minimum width
1048 db 30h ;an000;pad with zeros
1049
1050 db Sublist_Length ;an000;11 bytes
1051 db Reserved ;an000;reserved field
1052 dd dg:XM_PHY ;an000;parameter 2
1053 db 02 ;an000;parameter 2
1054 db right_align+Bin_Hex_Byte;an000;
1055 db 02 ;an000;maximum width
1056 db 02 ;an000;minimum width
1057 db 30h ;an000;pad with zeros
1058
1059xm_sta_sub label word ;an000;sublist for status
1060 db Sublist_Length ;an000;11 bytes
1061 db Reserved ;an000;reserved field
1062 dd dg:XM_HANDLE_RET ;an000;parameter 1
1063 db 01 ;an000;parameter 1
1064 db right_align+Bin_Hex_Word;an000;
1065 db 04 ;an000;maximum width
1066 db 04 ;an000;minimum width
1067 db 30h ;an000;pad with zeros
1068
1069 db Sublist_Length ;an000;11 bytes
1070 db Reserved ;an000;reserved field
1071 dd dg:XM_PAGE_CNT ;an000;parameter 2
1072 db 02 ;an000;parameter 2
1073 db right_align+Bin_Hex_Word;an000;
1074 db 04 ;an000;maximum width
1075 db 04 ;an000;minimum width
1076 db 30h ;an000;pad with zeros
1077
1078xm_page_seg_sub label word ;an000;sublist for frame seg status
1079 db Sublist_Length ;an000;11 bytes
1080 db Reserved ;an000;reserved field
1081 dd dg:XM_PHY ;an000;parameter 1
1082 db 01 ;an000;parameter 1
1083 db right_align+Bin_Hex_Byte;an000;
1084 db 02 ;an000;maximum width
1085 db 02 ;an000;minimum width
1086 db 30h ;an000;pad with zeros
1087
1088 db Sublist_Length ;an000;11 bytes
1089 db Reserved ;an000;reserved field
1090 dd dg:XM_FRAME ;an000;parameter 2
1091 db 02 ;an000;parameter 2
1092 db right_align+Bin_Hex_Word;an000;
1093 db 04 ;an000;maximum width
1094 db 04 ;an000;minimum width
1095 db 30h ;an000;pad with zeros
1096
1097xm_deall_sub label word ;an000;sublist for handle deallocation
1098 db Sublist_Length ;an000;11 bytes
1099 db Reserved ;an000;reserved field
1100 dd dg:XM_DEALL_HAN ;an000;parameter 1
1101 db 01 ;an000;parameter 1
1102 db right_align+Bin_Hex_Byte;an000;
1103 db 04 ;an000;maximum width
1104 db 04 ;an000;minimum width
1105 db 30h ;an000;pad with zeros
1106
1107xm_unall_sub label word ;an000;sublist unallocated page report
1108 db Sublist_Length ;an000;11 bytes
1109 db Reserved ;an000;reserved field
1110 dd dg:XM_ALLOC_PG ;an000;parameter 1
1111 db 01 ;an000;parameter 1
1112 db right_align+Bin_Hex_Word;an000;
1113 db 04 ;an000;maximum width
1114 db 04 ;an000;minimum width
1115 db 20h ;an000;pad with blanks
1116
1117 db Sublist_Length ;an000;11 bytes
1118 db Reserved ;an000;reserved field
1119 dd dg:XM_TOTAL_PG ;an000;parameter 1
1120 db 02 ;an000;parameter 1
1121 db right_align+Bin_Hex_Word;an000;
1122 db 04 ;an000;maximum width
1123 db 04 ;an000;minimum width
1124 db 20h ;an000;pad with zeros
1125
1126
1127xm_han_alloc_sub label word ;an000;sublist unallocated page report
1128 db Sublist_Length ;an000;11 bytes
1129 db Reserved ;an000;reserved field
1130 dd dg:XM_HAN_ALLOC ;an000;parameter 1
1131 db 01 ;an000;parameter 1
1132 db right_align+Bin_Hex_Word;an000;
1133 db 04 ;an000;maximum width
1134 db 04 ;an000;minimum width
1135 db 20h ;an000;pad with blanks
1136
1137 db Sublist_Length ;an000;11 bytes
1138 db Reserved ;an000;reserved field
1139 dd dg:XM_HAN_TOTAL ;an000;parameter 1
1140 db 02 ;an000;parameter 1
1141 db right_align+Bin_Hex_Word;an000;
1142 db 04 ;an000;maximum width
1143 db 04 ;an000;minimum width
1144 db 20h ;an000;pad with zeros
1145;=========================================================================
1146; end parameter sublists
1147;=========================================================================
1148
1149
1150unassem_ln_ptr label word ;an000;"%1%2",0
1151 dw 0032 ;an000;message number
1152 db UTILITY_MSG_CLASS ;an000;utility message
1153 dw stdout ;an000;display handle
1154 dw dg:db_unassem_sb1 ;an000;sublist
1155 dw 02 ;an000;2 subs
1156 db no_input ;an000;no keyboard input
1157 dw 00 ;an000;no keyboard buffer
1158
1159
1160hex_ptr label word ;an000;"%1:%2 %3",0
1161 dw 0033 ;an000;message number
1162 db UTILITY_MSG_CLASS ;an000;utility message
1163 dw stdout ;an000;display handle
1164 dw dg:db_hexarg_sb1 ;an000;sublist
1165 dw 03 ;an000;3 subs
1166 db no_input ;an000;no keyboard input
1167 dw 00 ;an000;no keyboard buffer
1168
1169
1170add_ptr label word ;an000;"%1 %2",0
1171 dw 0034 ;an000;message number
1172 db UTILITY_MSG_CLASS ;an000;utility message
1173 dw stdout ;an000;display handle
1174 dw dg:db_hexadd_sb1 ;an000;sublist
1175 dw 02 ;an000;2 subs
1176 db no_input ;an000;no keyboard input
1177 dw 00 ;an000;no keyboard buffer
1178
1179
1180
1181single_reg_ptr label word ;an000;"%1 %2",13,10,":",0
1182 dw 0035 ;an000;message number
1183 db UTILITY_MSG_CLASS ;an000;utility message
1184 dw stdout ;an000;display handle
1185 dw dg:db_singrg_sb1 ;an000;sublist
1186 dw 02 ;an000;2 subs
1187 db no_input ;an000;no keyboard input
1188 dw 00 ;an000;no keyboard buffer
1189
1190
1191
1192register_ptr label word ;an000;"%1=%2 ",0 ex: AX=FFFF
1193 dw 0036 ;an000;message number
1194 db UTILITY_MSG_CLASS ;an000;utility message
1195 dw stdout ;an000;display handle
1196 dw dg:db_regist_sb1 ;an000;sublist
1197 dw 02 ;an000;2 subs
1198 db no_input ;an000;no keyboard input
1199 dw 00 ;an000;no keyboard buffer
1200
1201
1202errmes_ptr label word ;an000;"%1 Error",0
1203 dw 0037 ;an000;message number
1204 db UTILITY_MSG_CLASS ;an000;utility message
1205 dw stdout ;an000;display handle
1206 dw dg:db_error_sb1 ;an000;sublist
1207 dw 01 ;an000;1 sub
1208 db no_input ;an000;no keyboard input
1209 dw 00 ;an000;no keyboard buffer
1210
1211
1212wrtmes_ptr label word ;an000;"Writing %1 bytes",0
1213 dw 0038 ;an000;message number
1214 db UTILITY_MSG_CLASS ;an000;utility message
1215 dw stdout ;an000;display handle
1216 dw dg:db_wrtmes_sb1 ;an000;sublist
1217 dw 01 ;an000;1 sub
1218 db no_input ;an000;no keyboard input
1219 dw 00 ;an000;no keyboard buffer
1220
1221
1222loc_ptr label word ;an000:"%1;%2=",0 ex:CX:0000
1223 dw 0039 ;an000;message number
1224 db UTILITY_MSG_CLASS ;an000;utility message
1225 dw stdout ;an000;display handle
1226 dw dg:db_locadd_sb1 ;an000;sublist
1227 dw 02 ;an000;2 subs
1228 db no_input ;an000;no keyboard input
1229 dw 00 ;an000;no keyboard buffer
1230
1231
1232little_ptr label word ;an000;"%1",0 ex:FF
1233 dw 0040 ;an000;message number
1234 db UTILITY_MSG_CLASS ;an000;utility message
1235 dw stdout ;an000;display handle
1236 dw dg:db_little_sb1 ;an000;sublist
1237 dw 01 ;an000;1 sub
1238 db no_input ;an000;no keyboard input
1239 dw 00 ;an000;no keyboard buffer
1240
1241
1242big_ptr label word ;an000;"%1",0
1243 dw 0041 ;an000;message number
1244 db UTILITY_MSG_CLASS ;an000;utility message
1245 dw stdout ;an000;display handle
1246 dw dg:db_big_sb1 ;an000;sublist
1247 dw 01 ;an000;1 sub
1248 db no_input ;an000;no keyboard input
1249 dw 00 ;an000;no keyboard buffer
1250
1251
1252comp_ptr label word ;an000;"%1:%2 %3 %4 %5:%6",0
1253 dw 0042 ;an000;message number
1254 db UTILITY_MSG_CLASS ;an000;utility message
1255 dw stdout ;an000;display handle
1256 dw dg:db_comp_sb1 ;an000;sublist
1257 dw 06 ;an000;6 subs
1258 db no_input ;an000;no keyboard input
1259 dw 00 ;an000;no keyboard buffer
1260
1261
1262arg_buf_ptr label word ;an000;"%1"
1263 dw 0046 ;an000;message number
1264 db UTILITY_MSG_CLASS ;an000;utility messages
1265 dw stdout ;an000;display handle
1266 dw dg:arg_buf_sb1 ;an000;sublist
1267 dw 01 ;an000;1 sub
1268 db no_input ;an000;no keyboard input
1269 dw 00 ;an000;no keyboard buffer
1270
1271
1272one_char_buf_ptr label word ;an000;"%1"
1273 dw 0047 ;an000;message number
1274 db UTILITY_MSG_CLASS ;an000;utility messages
1275 dw stdout ;an000;display handle
1276 dw dg:one_char_sb1 ;an000;sublist
1277 dw 01 ;an000;1 sub
1278 db no_input ;an000;no keyboard input
1279 dw 00 ;an000;no keyboard buffer
1280
1281xm_unall_ptr label word ;an000;unallocated message report
1282 dw 0050 ;an000;"%1 of a total %2 EMS pages
1283 ; have been allocated",cr,lf
1284 db UTILITY_MSG_CLASS ;an000;utility messages
1285 dw stdout ;an000;display handle
1286 dw dg:XM_UNALL_SUB ;an000;sublist
1287 dw 02 ;an000;1 sub
1288 db no_input ;an000;no keyboard input
1289 dw 00 ;an000;no keyboard buffer
1290
1291xm_han_alloc_ptr label word ;an000;unallocated message report
1292 dw 0051 ;an000;"%1 of a total %2 EMS handles
1293 ; have been allocated",cr,lf
1294 db UTILITY_MSG_CLASS ;an000;utility messages
1295 dw stdout ;an000;display handle
1296 dw dg:XM_HAN_ALLOC_SUB ;an000;sublist
1297 dw 02 ;an000;2 subs
1298 db no_input ;an000;no keyboard input
1299 dw 00 ;an000;no keyboard buffer
1300
1301xm_han_ret_ptr label word ;an000;prints handle created
1302 dw 0055 ;an000;message number
1303 db UTILITY_MSG_CLASS ;an000;utility messages
1304 dw stdout ;an000;display handle
1305 dw dg:XM_HAN_SUB ;an000;sublist
1306 dw 01 ;an000;1 sub
1307 db no_input ;an000;no keyboard input
1308 dw 00 ;an000;no keyboard buffer
1309
1310xm_mapped_ptr label word ;an000;prints log/phy pages
1311 dw 0056 ;an000;message number
1312 db UTILITY_MSG_CLASS ;an000;utility messages
1313 dw stdout ;an000;display handle
1314 dw dg:XM_MAP_SUB ;an000;sublist
1315 dw 02 ;an000;2 subs
1316 db no_input ;an000;no keyboard input
1317 dw 00 ;an000;no keyboard buffer
1318
1319xm_err80_ptr label word ;an000;ems error message
1320 dw 0057 ;an000;message number
1321 db UTILITY_MSG_CLASS ;an000;utility messages
1322 dw stdout ;an000;display handle
1323 dw 00 ;an000;sublist
1324 dw 00 ;an000;1 sub
1325 db no_input ;an000;no keyboard input
1326 dw 00 ;an000;no keyboard buffer
1327
1328xm_err83_ptr label word ;an000;ems error message
1329 dw 0058 ;an000;message number
1330 db UTILITY_MSG_CLASS ;an000;utility messages
1331 dw stdout ;an000;display handle
1332 dw 00 ;an000;sublist
1333 dw 00 ;an000;1 sub
1334 db no_input ;an000;no keyboard input
1335 dw 00 ;an000;no keyboard buffer
1336
1337xm_err84_ptr label word ;an000;ems error message
1338 dw 0059 ;an000;message number
1339 db UTILITY_MSG_CLASS ;an000;utility messages
1340 dw stdout ;an000;display handle
1341 dw 00 ;an000;sublist
1342 dw 00 ;an000;1 sub
1343 db no_input ;an000;no keyboard input
1344 dw 00 ;an000;no keyboard buffer
1345
1346xm_err85_ptr label word ;an000;ems error message
1347 dw 0060 ;an000;message number
1348 db UTILITY_MSG_CLASS ;an000;utility messages
1349 dw stdout ;an000;display handle
1350 dw 00 ;an000;sublist
1351 dw 00 ;an000;1 sub
1352 db no_input ;an000;no keyboard input
1353 dw 00 ;an000;no keyboard buffer
1354
1355xm_err86_ptr label word ;an000;ems error message
1356 dw 0061 ;an000;message number
1357 db UTILITY_MSG_CLASS ;an000;utility messages
1358 dw stdout ;an000;display handle
1359 dw 00 ;an000;sublist
1360 dw 00 ;an000;1 sub
1361 db no_input ;an000;no keyboard input
1362 dw 00 ;an000;no keyboard buffer
1363
1364xm_err87_ptr label word ;an000;ems error message
1365 dw 0062 ;an000;message number
1366 db UTILITY_MSG_CLASS ;an000;utility messages
1367 dw stdout ;an000;display handle
1368 dw 00 ;an000;sublist
1369 dw 00 ;an000;1 sub
1370 db no_input ;an000;no keyboard input
1371 dw 00 ;an000;no keyboard buffer
1372
1373xm_err88_ptr label word ;an000;ems error message
1374 dw 0063 ;an000;message number
1375 db UTILITY_MSG_CLASS ;an000;utility messages
1376 dw stdout ;an000;display handle
1377 dw 00 ;an000;sublist
1378 dw 00 ;an000;1 sub
1379 db no_input ;an000;no keyboard input
1380 dw 00 ;an000;no keyboard buffer
1381
1382xm_err89_ptr label word ;an000;ems error message
1383 dw 0064 ;an000;message number
1384 db UTILITY_MSG_CLASS ;an000;utility messages
1385 dw stdout ;an000;display handle
1386 dw 00 ;an000;sublist
1387 dw 00 ;an000;1 sub
1388 db no_input ;an000;no keyboard input
1389 dw 00 ;an000;no keyboard buffer
1390
1391xm_err8a_ptr label word ;an000;ems error message
1392 dw 0065 ;an000;message number
1393 db UTILITY_MSG_CLASS ;an000;utility messages
1394 dw stdout ;an000;display handle
1395 dw 00 ;an000;sublist
1396 dw 00 ;an000;1 sub
1397 db no_input ;an000;no keyboard input
1398 dw 00 ;an000;no keyboard buffer
1399
1400xm_err8b_ptr label word ;an000;ems error message
1401 dw 0066 ;an000;message number
1402 db UTILITY_MSG_CLASS ;an000;utility messages
1403 dw stdout ;an000;display handle
1404 dw 00 ;an000;sublist
1405 dw 00 ;an000;1 sub
1406 db no_input ;an000;no keyboard input
1407 dw 00 ;an000;no keyboard buffer
1408
1409xm_err8d_ptr label word ;an000;ems error message
1410 dw 0067 ;an000;message number
1411 db UTILITY_MSG_CLASS ;an000;utility messages
1412 dw stdout ;an000;display handle
1413 dw 00 ;an000;sublist
1414 dw 00 ;an000;1 sub
1415 db no_input ;an000;no keyboard input
1416 dw 00 ;an000;no keyboard buffer
1417
1418xm_err8e_ptr label word ;an000;ems error message
1419 dw 0068 ;an000;message number
1420 db UTILITY_MSG_CLASS ;an000;utility messages
1421 dw stdout ;an000;display handle
1422 dw 00 ;an000;sublist
1423 dw 00 ;an000;1 sub
1424 db no_input ;an000;no keyboard input
1425 dw 00 ;an000;no keyboard buffer
1426
1427xm_err_gen_ptr label word ;an000;ems error message
1428 dw 0070 ;an000;message number
1429 db UTILITY_MSG_CLASS ;an000;utility messages
1430 dw stdout ;an000;display handle
1431 dw 00 ;an000;sublist
1432 dw 00 ;an000;1 sub
1433 db no_input ;an000;no keyboard input
1434 dw 00 ;an000;no keyboard buffer
1435
1436xm_parse_err_ptr label word ;an000;input error message
1437 dw 0071 ;an000;message number
1438 db UTILITY_MSG_CLASS ;an000;utility messages
1439 dw stdout ;an000;display handle
1440 dw 00 ;an000;sublist
1441 dw 00 ;an000;1 sub
1442 db no_input ;an000;no keyboard input
1443 dw 00 ;an000;no keyboard buffer
1444
1445xm_status_ptr label word ;an000;prints status of EMS
1446 dw 0072 ;an000;message number
1447 db UTILITY_MSG_CLASS ;an000;utility messages
1448 dw stdout ;an000;display handle
1449 dw dg:XM_STA_SUB ;an000;sublist
1450 dw 02 ;an000;2 subs
1451 db no_input ;an000;no keyboard input
1452 dw 00 ;an000;no keyboard buffer
1453
1454xm_page_seg_ptr label word ;an000;"Physical page %1 = Frame
1455 ; segment %2"
1456 dw 0075 ;an000;message number
1457 db UTILITY_MSG_CLASS ;an000;utility messages
1458 dw stdout ;an000;display handle
1459 dw dg:XM_PAGE_SEG_SUB ;an000;sublist
1460 dw 02 ;an000;2 subs
1461 db no_input ;an000;no keyboard input
1462 dw 00 ;an000;no keyboard buffer
1463
1464xm_deall_ptr label word ;an000;"Handle %1 deallocated"
1465
1466 dw 0076 ;an000;message number
1467 db UTILITY_MSG_CLASS ;an000;utility messages
1468 dw stdout ;an000;display handle
1469 dw dg:XM_DEALL_SUB ;an000;sublist
1470 dw 01 ;an000;1 subs
1471 db no_input ;an000;no keyboard input
1472 dw 00 ;an000;no keyboard buffer
1473
1474xm_errff_ptr label word ;an000;"EMS not installed"
1475
1476 dw 0078 ;an000;message number
1477 db UTILITY_MSG_CLASS ;an000;utility messages
1478 dw stdout ;an000;display handle
1479 dw 00 ;an000;sublist
1480 dw 00 ;an000;0 subs
1481 db no_input ;an000;no keyboard input
1482 dw 00 ;an000;no keyboard buffer
1483
1484arg_buf db 80 dup (?) ;an000;argument buffer
1485one_char_buf db ? ;an000;character buffer
1486
1487opbuf db 51h dup (?)
1488
1489hex_arg1 dw ?
1490hex_arg2 dw ?
1491
1492add_arg dw ?
1493sub_arg dw ?
1494
1495single_reg_arg dw ?
1496
1497reg_name dw ?
1498reg_contents dw ?
1499
1500err_type db 3 dup(0) ;ac000;changed to hold bf,bp,etc.
1501
1502wrt_arg1 dw ?
1503wrt_arg2 dw ?
1504
1505loc_add dw ?
1506
1507little_contents dw ?
1508big_contents dw ?
1509
1510comp_arg1 dw ?
1511comp_arg2 dw ?
1512comp_arg3 dw ?
1513comp_arg4 dw ?
1514comp_arg5 dw ?
1515comp_arg6 dw ?
1516
1517mestyp dw ?
1518iotyp dw ?
1519drive db ?
1520
1521
1522DATA ENDS
1523 END
1524 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBUASM.ASM b/v4.0/src/CMD/DEBUG/DEBUASM.ASM
new file mode 100644
index 0000000..6dffb33
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBUASM.ASM
@@ -0,0 +1,954 @@
1 PAGE 80,132 ;
2 TITLE DEBUASM.ASM
3; Code for the UASSEMble command in the debugger
4
5 IF1
6 %OUT COMPONENT=DEBUG, MODULE=DEBUASM
7 ENDIF
8.XLIST
9.XCREF
10 INCLUDE DOSSYM.INC
11 INCLUDE DEBEQU.ASM
12.CREF
13.LIST
14CODE SEGMENT PUBLIC BYTE
15CODE ENDS
16
17CONST SEGMENT PUBLIC BYTE
18 EXTRN SYNERR_PTR:BYTE,UNASSEM_LN_PTR:WORD
19 EXTRN NSEG:WORD,SISAVE:WORD,BPSAVE:WORD,DISAVE:WORD
20 EXTRN BXSAVE:WORD,DSSAVE:WORD,ESSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD
21 EXTRN SSSAVE:WORD,CXSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD
22 EXTRN DISTAB:WORD,SHFTAB:WORD,IMMTAB:WORD,GRP1TAB:WORD,GRP2TAB:WORD
23 EXTRN DBMN:BYTE,ESCMN:BYTE,DISPB:WORD,STACK:BYTE,REG8:BYTE
24 EXTRN REG16:BYTE,SREG:BYTE,SIZ8:BYTE,SEGTAB:WORD,M8087_TAB:BYTE
25 EXTRN FI_TAB:BYTE,SIZE_TAB:BYTE,MD9_TAB:BYTE,MD9_TAB2:BYTE
26 EXTRN MDB_TAB:BYTE,MDB_TAB2:BYTE,MDD_TAB:BYTE,MDD_TAB2:BYTE
27 EXTRN MDF_TAB:BYTE
28CONST ENDS
29
30CSTACK SEGMENT STACK
31CSTACK ENDS
32
33DATA SEGMENT PUBLIC BYTE
34 EXTRN DISADD:BYTE,DISCNT:WORD,BYTCNT:BYTE,TEMP:BYTE,AWORD:BYTE
35 EXTRN MIDFLD:BYTE,MODE:BYTE,REGMEM:BYTE,OPCODE:WORD,OPBUF:BYTE
36 EXTRN INDEX:WORD,ARG_BUF:BYTE,ARG_BUF_PTR:BYTE,ARG_BUF_INDEX:WORD
37 EXTRN OPBUF:BYTE,OPCODE:WORD
38DATA ENDS
39
40DG GROUP CODE,CONST,CSTACK,DATA
41
42CODE SEGMENT PUBLIC BYTE
43 ASSUME CS:DG,DS:DG,ES:DG,SS:DG
44
45 PUBLIC UNASSEM
46 PUBLIC DISASLN,MEMIMM,JMPCALL,SIGNIMM,ALUFROMREG,WORDTOALU
47 PUBLIC GRP2,PREFIX,OUTVARW,GRP1,SSPRE,MOVSEGTO,DSPRE,SHIFT
48 PUBLIC ESPRE,IMMED,CSPRE,OUTVARB,CHK10,ACCIMM,INT3,INVARB
49 PUBLIC MOVSEGFROM,LOADACC,OUTFIXB,XCHGAX,REGIMMW,SHORTJMP
50 PUBLIC SAV8,M8087,M8087_DB,M8087_DF,M8087_D9,M8087_DD
51 PUBLIC SAV16,SAVHEX,INFIXW,REGIMMB,OUTFIXW,SHIFTV,LONGJMP
52 PUBLIC INVARW,STOREACC,INFIXB,NOOPERANDS,ALUTOREG
53 PUBLIC SEGOP,REGOP,GETADDR
54
55 EXTRN CRLF:NEAR,BLANK:NEAR,TAB:NEAR,STD_PRINTF:NEAR
56 EXTRN HEX:NEAR,DEFAULT:NEAR,OUTSI:NEAR,OUTDI:NEAR
57 EXTRN HEX_ADDRESS_ONLY:NEAR
58
59UNASSEM:
60 MOV BP,[CSSAVE] ; Default code segment
61 MOV DI,OFFSET DG:DISADD ; Default address
62 MOV CX,DISPB ; Default length
63 SHR CX,1
64 SHR CX,1
65 CALL DEFAULT
66 MOV WORD PTR [DISADD],DX ; Displacement of disassembly
67 MOV WORD PTR [DISADD+2],AX ; Segment
68 MOV WORD PTR [DISCNT],CX ; No. of bytes (but whole instructions)
69DISLP:
70 CALL DISASLN ; Disassemble one line
71 CALL CRLF
72 TEST [DISCNT],-1 ; See if we've used up the range
73 JNZ DISLP
74 RET
75
76GOTDIS:
77 PUSH DS ; RE-GET LAST BYTE
78 PUSH SI
79 LDS SI,DWORD PTR [DISADD]
80 MOV AL,[SI-1]
81 POP SI
82 POP DS
83 RET
84
85GETDIS:
86 PUSH DS
87 LDS SI,DWORD PTR [DISADD]
88 LODSB ; Get the next byte of code
89 POP DS
90 MOV WORD PTR [DISADD],SI ; Update pointer
91 PUSH AX
92 PUSH DI
93 MOV DI,[ARG_BUF_INDEX]
94 CALL HEX ; Display each code byte
95 MOV [ARG_BUF_INDEX],DI
96 POP DI
97 MOV SI,[DISCNT]
98 OR SI,SI ; Check if range exhausted
99 JZ ENDRNG ; If so, don't wrap around
100 DEC SI ; Count off the bytes
101 MOV [DISCNT],SI
102ENDRNG:
103 INC BYTE PTR[BYTCNT] ; Keep track of no. of bytes per line
104 POP AX
105 RET
106
107DSPRE:
108 INC BYTE PTR [NSEG+1]
109SSPRE:
110 INC BYTE PTR [NSEG+1]
111CSPRE:
112 INC BYTE PTR [NSEG+1]
113ESPRE:
114 INC BYTE PTR [NSEG+1]
115
116PREFIX:
117 POP BX ; Dump off return address
118 CALL FINLN
119 CALL CRLF
120DISASLN:
121 PUSH DS
122 LDS SI,DWORD PTR [DISADD]
123 CALL OUTSI ; Show disassembly address
124 POP DS
125 CALL HEX_ADDRESS_ONLY
126DISASLN1:
127 MOV BYTE PTR [BYTCNT],0 ; Count of code bytes per line
128; Fill overflow area with zeros
129 MOV DI,OFFSET DG:OPBUF
130 MOV CX,50
131 MOV AL,0
132 REP STOSB
133; fill buffer with spaces
134 MOV DI,OFFSET DG:OPBUF
135 MOV CX,OPBUFLEN
136 MOV AL," "
137 REP STOSB
138 MOV DI,OFFSET DG:ARG_BUF
139 MOV [ARG_BUF_INDEX],DI
140 CALL GETDIS ; Get opcode
141 MOV DI,[ARG_BUF_INDEX]
142 MOV AH,0
143 MOV BX,AX
144 AND AL,1 ; Mask to "W" bit
145 MOV [AWORD],AL
146 MOV AL,BL ; Restore opcode
147 SHL BX,1
148 SHL BX,1 ; Multiply opcode by 4
149 ADD BX,OFFSET DG:DISTAB
150 MOV DX,[BX] ; Get pointer to mnemonic from table
151 MOV [OPCODE],DX
152 MOV [ARG_BUF_INDEX],DI
153 MOV DI,OFFSET DG:OPBUF
154 CALL WORD PTR [BX+2]
155FINLN:
156 MOV AH,[BYTCNT] ; See how many bytes in this instruction
157 ADD AH,AH ; Each uses two characters
158 MOV AL,14 ; Amount of space we want to use
159 SUB AL,AH ; See how many fill characters needed
160 CBW
161 XCHG CX,AX ; Parameter for TAB needed in CX
162 MOV DI,[ARG_BUF_INDEX]
163 CALL TAB
164 MOV SI,[OPCODE]
165 OR SI,SI
166 JZ GET_TAB
167GET_OPCODE:
168 LODSB
169 OR AL,AL
170 JZ GET_TAB
171 STOSB
172 JMP GET_OPCODE
173
174GET_TAB:
175 MOV AL,9
176 STOSB
177 MOV BYTE PTR [DI],0 ; nul terminate address buffer
178 MOV DX,OFFSET DG:UNASSEM_LN_PTR
179 CALL STD_PRINTF
180 RET
181
182GETMODE:
183 CALL GETDIS ; Get the address mode byte
184 MOV AH,AL
185 AND AL,7 ; Mask to "r/m" field
186 MOV [REGMEM],AL
187 SHR AH,1
188 SHR AH,1
189 SHR AH,1
190 MOV AL,AH
191 AND AL,7 ; Mask to center 3-bit field
192 MOV [MIDFLD],AL
193 SHR AH,1
194 SHR AH,1
195 SHR AH,1
196 MOV [MODE],AH ; Leaving 2-bit "MOD" field
197 RET
198
199IMMED:
200 MOV BX,OFFSET DG:IMMTAB
201 CALL GETMNE
202FINIMM:
203 CALL TESTREG
204 JMP SHORT IMM
205
206MEMIMM:
207 CALL GETMODE
208 JMP SHORT FINIMM
209
210ACCIMM:
211 XOR AL,AL
212IMM1:
213 CALL SAVREG
214IMM:
215 MOV AL,","
216 STOSB
217 TEST BYTE PTR [AWORD],-1
218 JNZ SAV16
219SAV8:
220 CALL GETDIS
221 JMP SHORT SAVHEX
222
223LONGJMP:
224 PUSH DI
225 MOV DI,OFFSET DG:TEMP
226 CALL SAV16
227 POP DI
228 CALL SAV16
229 MOV AL,":"
230 STOSB
231 MOV SI,OFFSET DG:TEMP
232 MOV CX,4
233MOVDIG:
234 LODSB
235 STOSB
236 LOOP MOVDIG
237 RET
238
239SAV16:
240 CALL GETDIS ; Get low byte
241 MOV DL,AL
242 CALL GETDIS ; Get high byte
243 MOV DH,AL
244 CALL SAVHEX ; Convert and store high byte
245 MOV AL,DL
246SAVHEX:
247 MOV AH,AL
248 SHR AL,1
249 SHR AL,1
250 SHR AL,1
251 SHR AL,1
252 CALL SAVDIG
253 MOV AL,AH
254SAVDIG:
255 AND AL,0FH
256 ADD AL,90H
257 DAA
258 ADC AL,40H
259 DAA
260 STOSB
261 RET
262
263CHK10:
264 CALL GETDIS
265 CMP AL,10
266 JNZ SAVHEX
267 RET
268
269SIGNIMM:
270 MOV BX,OFFSET DG:IMMTAB
271 CALL GETMNE
272 CALL TESTREG
273 MOV AL,","
274 STOSB
275SAVD8:
276 CALL GETDIS ; Get signed 8-bit number
277 CBW
278 MOV DX,AX ; Save true 16-bit value in DX
279 MOV AH,AL
280 MOV AL,"+"
281 OR AH,AH
282; JZ NOSIGN
283 JNS POSITIV ; OK if positive
284 MOV AL,"-"
285 NEG AH ; Get magnitude if negative
286POSITIV:
287 STOSB
288; NOSIGN:
289 MOV AL,AH
290 JMP SHORT SAVHEX
291
292ALUFROMREG:
293 CALL GETADDR
294 MOV AL,","
295 STOSB
296REGFLD:
297 MOV AL,[MIDFLD]
298SAVREG:
299 MOV SI,OFFSET DG:REG8
300 CMP BYTE PTR [AWORD],1
301 JNE FNDREG
302SAVREG16:
303 MOV SI,OFFSET DG:REG16
304FNDREG:
305 CBW
306 ADD SI,AX
307 ADD SI,AX
308 MOVSW
309 RET
310
311SEGOP:
312 SHR AL,1
313 SHR AL,1
314 SHR AL,1
315SAVSEG:
316 AND AL,3
317 MOV SI,OFFSET DG:SREG
318 JMP SHORT FNDREG
319
320REGOP:
321 AND AL,7
322 JMP SHORT SAVREG16
323
324MOVSEGTO:
325 MOV BYTE PTR [AWORD],1
326 CALL GETADDR
327 MOV AL,","
328 STOSB
329 MOV AL,[MIDFLD]
330 JMP SHORT SAVSEG
331
332MOVSEGFROM:
333 CALL GETMODE
334 CALL SAVSEG
335 MOV BYTE PTR [AWORD],1
336 JMP SHORT MEMOP2
337
338GETADDR:
339 CALL GETMODE
340 JMP SHORT ADDRMOD
341
342WORDTOALU:
343 MOV BYTE PTR [AWORD],1
344ALUTOREG:
345 CALL GETMODE
346 CALL REGFLD
347MEMOP2:
348 MOV AL,","
349 STOSB
350ADDRMOD:
351 CMP BYTE PTR [MODE],3
352 MOV AL,[REGMEM]
353 JE SAVREG
354 XOR BX,BX
355 MOV BYTE PTR [NSEG],3
356 MOV BYTE PTR [DI],"["
357 INC DI
358 CMP AL,6
359 JNE NODRCT
360 CMP BYTE PTR [MODE],0
361 JE DIRECT ; Mode=0 and R/M=6 means direct addr.
362NODRCT:
363 MOV DL,AL
364 CMP AL,1
365 JBE USEBX
366 CMP AL,7
367 JE USEBX
368 CMP AL,3
369 JBE USEBP
370 CMP AL,6
371 JNE CHKPLS
372USEBP:
373 MOV BX,[BPSAVE]
374 MOV BYTE PTR [NSEG],2 ; Change default to Stack Segment
375 MOV AX,BPREG
376SAVBASE:
377 STOSW
378CHKPLS:
379 CMP DL,4
380 JAE NOPLUS
381 MOV AL,"+"
382 STOSB
383NOPLUS:
384 CMP DL,6
385 JAE DOMODE ; No index register
386 AND DL,1 ; Even for SI, odd for DI
387 JZ USESI
388 ADD BX,[DISAVE]
389 MOV AX,DIREG
390SAVINDX:
391 STOSW
392DOMODE:
393 MOV AL,[MODE]
394 OR AL,AL
395 JZ CLOSADD ; If no displacement, then done
396 CMP AL,2
397 JZ ADDDIR
398 CALL SAVD8 ; Signed 8-bit displacement
399ADDCLOS:
400 ADD BX,DX
401CLOSADD:
402 MOV AL,"]"
403 STOSB
404 MOV [INDEX],BX
405NOOPERANDS:
406 RET
407
408ADDDIR:
409 MOV AL,"+"
410 STOSB
411DIRECT:
412 CALL SAV16
413 JMP SHORT ADDCLOS
414
415USEBX:
416 MOV BX,[BXSAVE]
417 MOV AX,BXREG
418 JMP SHORT SAVBASE
419
420USESI:
421 ADD BX,[SISAVE]
422 MOV AX,SIREG
423 JMP SHORT SAVINDX
424
425SHORTJMP:
426 CALL GETDIS
427 CBW
428 ADD AX,WORD PTR [DISADD]
429 XCHG DX,AX
430SAVJMP:
431 MOV AL,DH
432 CALL SAVHEX
433 MOV AL,DL
434 JMP SAVHEX
435
436JMPCALL:
437 CALL GETDIS
438 MOV DL,AL
439 CALL GETDIS
440 MOV DH,AL
441 ADD DX,WORD PTR [DISADD]
442 JMP SHORT SAVJMP
443
444XCHGAX:
445 AND AL,7
446 CALL SAVREG16
447 MOV AL,","
448 STOSB
449 XOR AL,AL
450 JMP SAVREG16
451
452LOADACC:
453 XOR AL,AL
454 CALL SAVREG
455 MOV AL,","
456 STOSB
457MEMDIR:
458 MOV AL,"["
459 STOSB
460 XOR BX,BX
461 MOV BYTE PTR [NSEG],3
462 JMP DIRECT
463
464STOREACC:
465 CALL MEMDIR
466 MOV AL,","
467 STOSB
468 XOR AL,AL
469 JMP SAVREG
470
471REGIMMB:
472 MOV BYTE PTR [AWORD],0
473 JMP SHORT REGIMM
474
475REGIMMW:
476 MOV BYTE PTR [AWORD],1
477REGIMM:
478 AND AL,7
479 JMP IMM1
480
481INT3:
482 MOV BYTE PTR [DI],"3"
483 INC DI
484 RET
485
486; 8087 instructions whose first byte is 0dfh
487M8087_DF:
488 CALL GET64F
489 JZ ISDD3
490 MOV SI,OFFSET DG:MDF_TAB
491 JMP NODB3
492
493; 8087 instructions whose first byte is 0ddh
494M8087_DD:
495 CALL GET64F
496 JZ ISDD3
497 MOV SI,OFFSET DG:MDD_TAB
498 JMP NOD93
499
500ISDD3:
501 MOV AL,DL
502 TEST AL,100B
503 JZ ISSTI
504 JMP ESC0
505
506ISSTI:
507 AND AL,11B
508 MOV SI,OFFSET DG:MDD_TAB2
509 MOV CL,AL
510 CALL MOVBYT
511 JMP PUTRST
512
513; 8087 instructions whose first byte is 0dbh
514M8087_DB:
515 CALL GET64F
516 JZ ISDB3
517 MOV SI,OFFSET DG:MDB_TAB
518NODB3:
519 CALL PUTOP
520 CALL PUTSIZE
521 JMP ADDRMOD
522
523ISDB3:
524 MOV AL,DL
525 TEST AL,100B
526 JNZ ISDBIG
527ESC0V:
528 JMP ESC0
529
530ISDBIG:
531 CALL GOTDIS
532 AND AL,11111B
533 CMP AL,4
534 JAE ESC0V
535 MOV SI,OFFSET DG:MDB_TAB2
536 JMP DOBIG
537
538; 8087 instructions whose first byte is 0d9h
539M8087_D9:
540 CALL GET64F
541 JZ ISD93
542
543 MOV SI,OFFSET DG:MD9_TAB
544NOD93:
545 CALL PUTOP
546 AND AL,111B
547 CMP AL,3
548 JA NOSHO
549 MOV AL,DL
550 CALL PUTSIZE
551NOSHO:
552 JMP ADDRMOD
553
554ISD93:
555 MOV AL,DL
556 TEST AL,100B
557 JNZ ISD9BIG
558 AND AL,111B
559 OR AL,AL
560 JNZ NOTFLD
561 MOV AX,"DL"
562 STOSW
563 JMP SHORT PUTRST
564
565NOTFLD:
566 CMP AL,1
567 JNZ NOTFXCH
568 MOV AX,"CX"
569 STOSW
570 MOV AL,"H"
571 JMP SHORT PUTRST1
572
573NOTFXCH:
574 CMP AL,3
575 JNZ NOTFSTP
576 MOV AX,"TS"
577 STOSW
578 MOV AL,"P"
579PUTRST1:
580 STOSB
581PUTRST:
582 MOV AL,9
583 STOSB
584 JMP PUTST0
585
586NOTFSTP:
587 CALL GOTDIS
588 CMP AL,11010000B ; CHECK FOR FNOP
589 JZ GOTFNOP
590 JMP ESC0
591
592GOTFNOP:
593 MOV AX,"ON"
594 STOSW
595 MOV AL,"P"
596 STOSB
597 RET
598
599ISD9BIG:
600 CALL GOTDIS ; GET THE MODE BYTE
601 MOV SI,OFFSET DG:MD9_TAB2
602DOBIG:
603 AND AL,11111B
604 MOV CL,AL
605 JMP MOVBYT
606
607; entry point for the remaining 8087 instructions
608M8087:
609 CALL GET64
610 CALL PUTFI ; PUT FIRST PART OF OPCODE
611 MOV AL,DL
612 CMP BYTE PTR [MODE],11B ; CHECK FOR REGISTER MODE
613 JZ MODEIS3
614 CALL PUTMN ; PUT MIDDLE PART OF OPCODE
615NO3:
616 MOV AL,9 ; OUTPUT A TAB
617 STOSB
618 MOV AL,DL
619 CALL PUTSIZE ; OUTPUT THE OPERAND SIZE
620 JMP ADDRMOD
621
622MODEIS3:
623 TEST AL,100000B ; D BIT SET?
624 JZ MPUT ; NOPE...
625 TEST AL,000100B ; FDIV OR FSUB?
626 JZ MPUT ; NOPE...
627 XOR AL,1 ; REVERSE SENSE OF R
628 MOV DL,AL ; SAVE CHANGE
629MPUT:
630 CALL PUTMN ; PUT MIDDLE PART OF OPCODE
631 MOV AL,DL
632 TEST AL,010000B
633 JZ NOPSH
634 MOV AL,"P"
635 STOSB
636NOPSH:
637 MOV AL,9
638 STOSB
639 MOV AL,DL
640 AND AL,00000111B
641 CMP AL,2 ; FCOM
642 JZ PUTST0
643 CMP AL,3 ; FCOMP
644 JZ PUTST0
645 MOV AL,DL
646 TEST AL,100000B
647 JZ PUTSTST0
648
649; output 8087 registers in the form st(n),st
650PUTST0ST:
651 CALL PUTST0
652 MOV AL,','
653ISCOMP:
654 STOSB
655
656PUTST:
657 MOV AX,"TS"
658 STOSW
659 RET
660
661; output 8087 registers in the form st,st(n)
662PUTSTST0:
663 CALL PUTST
664 MOV AL,','
665 STOSB
666
667PUTST0:
668 CALL PUTST
669 MOV AL,"("
670 STOSB
671 MOV AL,[REGMEM]
672 ADD AL,"0"
673 STOSB
674 MOV AL,")"
675 STOSB
676 RET
677
678; output an 8087 mnemonic
679PUTMN:
680 MOV SI,OFFSET DG:M8087_TAB
681 MOV CL,AL
682 AND CL,00000111B
683 JMP SHORT MOVBYT
684
685; output either 'FI' or 'F' for first byte of opcode
686PUTFI:
687 MOV SI,OFFSET DG:FI_TAB
688 JMP SHORT PUTFI2
689
690; output size (dword, tbyte, etc.)
691PUTSIZE:
692 MOV SI,OFFSET DG:SIZE_TAB
693PUTFI2:
694 CMP BYTE PTR [MODE],11B ; check if 8087 register
695 JNZ PUTFI3
696 AND AL,111000B ; LOOK FOR INVALID FORM OF 0DAH OPERANDS
697 CMP AL,010000B
698 JZ ESC0PJ
699 MOV AL,DL
700 CMP AL,110011B ; FCOMPP
701 JNZ GOFI
702 CMP BYTE PTR [REGMEM],1
703 JZ GOFI
704ESC0PJ:
705 JMP ESC0P
706
707GOFI:
708 XOR CL,CL
709 JMP SHORT MOVBYT
710
711; Look for qword
712PUTFI3:
713 CMP AL,111101B
714 JZ GOTQU
715 CMP AL,111111B
716 JNZ NOTQU
717GOTQU:
718 MOV CL,2
719 JMP SHORT MOVBYT
720
721; look for tbyte
722NOTQU:
723 CMP AL,011101B
724 JZ GOTTB
725 CMP AL,111100B
726 JZ GOTTB
727 CMP AL,111110B
728 JZ GOTTB
729 CMP AL,011111B
730 JNZ NOTTB
731GOTTB:
732 MOV CL,5
733 JMP SHORT MOVBYT
734
735NOTTB:
736 MOV CL,4
737 SHR AL,CL
738 MOV CL,AL
739; SI POINTS TO A TABLE OF TEXT SEPARATED BY "$"
740; CL = WHICH ELEMENT IN THE TABLE YOU WISH TO COPY TO [DI]
741MOVBYT:
742 PUSH AX
743 INC CL
744MOVBYT1:
745 DEC CL
746 JZ MOVBYT3
747MOVBYT2:
748 LODSB
749 CMP AL,"$"
750 JZ MOVBYT1
751 JMP MOVBYT2
752
753MOVBYT3:
754 LODSB
755 CMP AL,'$'
756 JZ MOVBYT5
757 CMP AL,'@' ; THIS MEANS RESVERED OP-CODE
758 JNZ MOVBYT4
759 POP AX
760 JMP SHORT ESC0P ; GO DO AN ESCAPE COMMAND
761
762MOVBYT4:
763 STOSB
764 JMP MOVBYT3
765
766MOVBYT5:
767 POP AX
768 RET
769
770PUTOP:
771 AND AL,111B
772 MOV CL,AL
773 CALL MOVBYT
774 MOV AL,9
775 STOSB
776 MOV AL,DL
777 RET
778
779GET64F:
780 CALL GET64
781 MOV AL,"F"
782 STOSB
783 CMP BYTE PTR [MODE],3
784 MOV AL,DL
785 RET
786
787GET64:
788 AND AL,7
789 MOV DL,AL
790 CALL GETMODE
791 SHL DL,1
792 SHL DL,1
793 SHL DL,1
794 OR AL,DL
795 MOV DL,AL ; SAVE RESULT
796 RET
797
798ESC0P:
799 POP DI ; CLEAN UP STACK
800ESC0:
801 MOV WORD PTR [OPCODE],OFFSET DG:ESCMN
802 MOV AL,DL
803 MOV DI,OFFSET DG:OPBUF
804 JMP SHORT ESC1
805
806ESCP:
807 CALL GET64
808ESC1:
809 CALL SAVHEX
810 CMP BYTE PTR [MODE],3
811 JZ SHRTESC
812 MOV BYTE PTR [AWORD],1
813 JMP MEMOP2
814
815SHRTESC:
816 MOV AL,","
817 STOSB
818 MOV AL,[REGMEM]
819 AND AL,7
820 JMP SAVREG
821
822INVARW:
823 CALL PUTAX
824 JMP SHORT INVAR
825
826INVARB:
827 CALL PUTAL
828INVAR:
829 MOV AL,','
830 STOSB
831 JMP PUTDX
832
833INFIXW:
834 CALL PUTAX
835 JMP SHORT INFIX
836
837INFIXB:
838 CALL PUTAL
839INFIX:
840 MOV AL,','
841 STOSB
842 JMP SAV8
843
844 STOSW ;IS THIS DEAD CODE? EMK
845 RET
846
847OUTVARB:
848 MOV BX,"LA"
849 JMP SHORT OUTVAR
850
851OUTVARW:
852 MOV BX,"XA"
853OUTVAR:
854 CALL PUTDX
855OUTFV:
856 MOV AL,','
857 STOSB
858 MOV AX,BX
859 STOSW
860 RET
861
862OUTFIXB:
863 MOV BX,"LA"
864 JMP SHORT OUTFIX
865
866OUTFIXW:
867 MOV BX,"XA"
868OUTFIX:
869 CALL SAV8
870 JMP OUTFV
871
872PUTAL:
873 MOV AX,"A"+4C00H ; "AL"
874 JMP SHORT PUTX
875
876PUTAX:
877 MOV AX,"A"+5800H ; "AX"
878 JMP SHORT PUTX
879
880PUTDX:
881 MOV AX,"D"+5800H ; "DX"
882PUTX:
883 STOSW
884 RET
885
886SHFT:
887 MOV BX,OFFSET DG:SHFTAB
888 CALL GETMNE
889TESTREG:
890 CMP BYTE PTR [MODE],3
891 JZ NOFLG
892 MOV SI,OFFSET DG:SIZE_TAB
893 MOV CL,3
894 TEST BYTE PTR [AWORD],-1
895 JNZ TEST_1
896 INC CL
897TEST_1:
898 CALL MOVBYT
899NOFLG:
900 JMP ADDRMOD
901
902SHIFTV:
903 CALL SHFT
904 MOV AL,","
905 STOSB
906 MOV WORD PTR [DI],"C"+4C00H ; "CL"
907 ADD DI,2
908 RET
909
910SHIFT:
911 CALL SHFT
912 MOV AX,"1,"
913 STOSW
914 RET
915
916GETMNE:
917 CALL GETMODE
918 MOV DL,AL
919 CBW
920 SHL AX,1
921 ADD BX,AX
922 MOV AX,[BX]
923 MOV [OPCODE],AX
924 MOV AL,DL
925 RET
926
927GRP1:
928 MOV BX,OFFSET DG:GRP1TAB
929 CALL GETMNE
930 OR AL,AL
931 JZ FINIMMJ
932 JMP TESTREG
933FINIMMJ:
934 JMP FINIMM
935
936GRP2:
937 MOV BX,OFFSET DG:GRP2TAB
938 CALL GETMNE
939 CMP AL,2
940 JB TESTREG
941 CMP AL,6
942 JAE INDIRECT
943 TEST AL,1
944 JZ INDIRECT
945 MOV AX,"AF" ; "FAR"
946 STOSW
947 MOV AX," R"
948 STOSW
949INDIRECT:
950 JMP ADDRMOD
951
952CODE ENDS
953 END UNASSEM
954 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBUG.ASM b/v4.0/src/CMD/DEBUG/DEBUG.ASM
new file mode 100644
index 0000000..e986db9
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBUG.ASM
@@ -0,0 +1,1236 @@
1 PAGE 60,132 ;
2 TITLE DEBUG.SAL - DEBUGger for PC DOS
3
4;======================= START OF SPECIFICATIONS =========================
5;
6; MODULE NAME: DEBUG.SAL
7;
8; DESCRIPTIVE NAME: DEBUGGING TOOL
9;
10; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS.
11;
12; ENTRY POINT: START
13;
14; INPUT: DOS COMMAND LINE
15; DEBUG COMMANDS
16;
17; EXIT NORMAL: NA
18;
19; EXIT ERROR: NA
20;
21; INTERNAL REFERENCES:
22;
23; EXTERNAL REFERENCES:
24;
25; ROUTINE: DEBCOM1 - CONTAINS ROUTINES CALLED BY DEBUG
26; DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG
27; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG
28; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG
29; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG
30; DEBMES - CONTAINS MESSAGE RETRIEVER ROUTINES
31;
32; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS.
33; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+
34; DEBCONST+DEBDATA+DEBMES
35;
36; REVISION HISTORY:
37;
38; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING:
39;
40; - IMPLEMENT DBCS HANDLING DMS:6/17/87
41; - IMPLEMENT DBCS HANDLING bgb:5/03/88 ;an001;bgb
42; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87
43; - > 32 MB SUPPORT DMS:6/17/87
44;
45; COPYRIGHT: "MS DOS DEBUG UTILITY"
46; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft"
47; "LICENSED MATERIAL - PROPERTY OF Microsoft "
48;
49; MICROSOFT REVISION HISTORY:
50;
51; Modified 5/4/82 by AaronR to do all I/O direct to devices
52; Runs on MS-DOS 1.28 and above
53;
54; REV 1.20
55; Tab expansion
56; New device interface (1.29 and above)
57; REV 2.0
58; line by line assembler added by C. P.
59; REV 2.1
60; Uses EXEC system call
61; REV 2.2
62; Ztrace mode by zibo.
63; Fix dump display to indent properly
64; Parity nonsense by zibo
65;
66; REV 2.3 NP
67; Use Printf for all standard output.
68; Change to EXE file
69; REV 2.4 ARR
70; Bug fixes. TEST, XCHG instructions reg order reversed.
71; Single step, break point interrupts saved and restored.
72; Access denied given on W to read only file.
73;======================= END OF SPECIFICATIONS ===========================
74
75 IF1
76 %OUT COMPONENT=DEBUG, MODULE=DEBUG
77 ENDIF
78.XLIST
79.XCREF
80 INCLUDE DOSSYM.INC ; ALSO VERSION NUMBER
81.CREF
82.LIST
83 INCLUDE DEBEQU.ASM
84 IF SYSVER
85; Structure for system call 72
86SYSINITVAR STRUC
87DPBHEAD DD ? ; Pointer to head of DPB-FAT list
88SFT_ADDR DD ? ; Pointer to first FCB table
89; The following address points to the CLOCK device
90BCLOCK DD ?
91; The following address is used by DISKSTATCHK it is always
92; points to the console input device header
93BCON DD ? ; Console device entry points
94MAXSEC DW 0 ; Maximum allowed sector size
95BUFFHEAD DD ?
96CDS DD ?
97SFTFCB DD ?
98KEEP DW ?
99NUMIO DB 0 ; Number of disk tables
100NCDS DB ?
101DEVHEAD DD ?
102SYSINITVAR ENDS
103
104 ENDIF
105
106
107;======================= macro equates ===================================
108
109dbcs_delim equ 81h ;an000;delimits dbcs char
110asian_blk equ 40h ;an000;asian blank
111amer_blk equ 20h ;an000;american blank
112quote_char equ 22h ;an000;quote delim "
113
114;======================= end macro equates ===============================
115
116
117;This segment must be the first loaded since we are using it to make
118;a CREATE_PROCESS_DATA_BLOCK system call a la 1.0 and .COM files.
119;For this system call CS must point to the Program Prefix Header, so
120;by setting up a seperate segment just after the header we can issue
121;an INT 21H via a long call. So don't move this guy around!
122
123A_CREATE_BLOCK SEGMENT
124
125 PUBLIC CREATE_CALL
126
127;The other arguements to this system call have been set up
128;by the caller.
129
130CREATE_CALL PROC FAR
131 MOV AH,CREATE_PROCESS_DATA_BLOCK
132 INT 21H
133 RET
134
135CREATE_CALL ENDP
136
137A_CREATE_BLOCK ENDS
138
139
140CODE SEGMENT PUBLIC
141CODE ENDS
142
143CONST SEGMENT PUBLIC
144CONST ENDS
145
146CSTACK SEGMENT STACK
147CSTACK ENDS
148
149DATA SEGMENT PUBLIC
150DATA ENDS
151
152DG GROUP CODE,CONST,CSTACK,DATA
153
154CONST SEGMENT PUBLIC BYTE
155 EXTRN BADVER:BYTE,ENDMES_PTR:BYTE,CRLF_PTR:BYTE
156 IF IBMJAPAN
157 EXTRN PARITYMES_PTR:BYTE
158 ENDIF
159 EXTRN PROMPT_PTR:BYTE,ADD_PTR:BYTE,HEX_PTR:BYTE
160 EXTRN USER_PROC_PDB:WORD,CSSAVE:WORD,DSSAVE:WORD
161 EXTRN SPSAVE:WORD,IPSAVE:WORD,LINEBUF:BYTE,QFLAG:BYTE
162 EXTRN NEWEXEC:BYTE,HEADSAVE:WORD,LBUFSIZ:BYTE,BACMES_PTR:WORD
163
164 IF IBMVER
165 EXTRN DSIZ:BYTE,NOREGL:BYTE,DISPB:WORD
166 ENDIF
167
168 IF SYSVER
169 EXTRN CONFCB:BYTE,POUT:DWORD,COUT:DWORD,CIN:DWORD,IOBUFF:BYTE
170 EXTRN IOADDR:DWORD,IOCALL:BYTE,IOCOM:BYTE,IOSTAT:WORD,IOCNT:WORD
171 EXTRN IOSEG:WORD,COLPOS:BYTE,BADDEV_PTR:BYTE,BADLSTMES_PTR:BYTE
172 EXTRN LBUFFCNT:BYTE,PFLAG:BYTE
173 ENDIF
174
175 EXTRN NAMESPEC:BYTE
176
177CONST ENDS
178
179CSTACK SEGMENT STACK
180 DB (362 - 80H) + 80H DUP(?) ; (362 - 80H) == IBM'S ROM REQUIREMENTS
181 ; (NEW - OLD) == SIZE TO GROW STACK
182CSTACK ENDS
183
184DATA SEGMENT PUBLIC BYTE
185 EXTRN ARG_BUF:BYTE,ADD_ARG:WORD,SUB_ARG:WORD,HEX_ARG1:WORD
186 EXTRN HEX_ARG2:WORD,STACK:BYTE, PREV24:DWORD, FIN24:BYTE
187 EXTRN PARSERR:BYTE,DATAEND:WORD,PARITYFLAG:BYTE,DISADD:BYTE
188 EXTRN ASMADD:BYTE,DEFDUMP:BYTE,BYTEBUF:BYTE,BEGSEG:WORD
189 EXTRN BPINTSAV:DWORD,SSINTSAV:DWORD ;ARR 2.4
190 EXTRN CREATE_LONG:DWORD
191
192 extrn lbtbl:dword ;an000;lead byte table pointer
193
194DATA ENDS
195
196 EXTRN PRINTF:NEAR ;ac000;changed to NEAR call
197
198CODE SEGMENT PUBLIC
199 ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:CSTACK
200
201 PUBLIC RESTART
202 PUBLIC STD_PRINTF,PRINTF_CRLF
203 PUBLIC HEX_ADDRESS_ONLY,HEX_ADDRESS_STR
204 PUBLIC RESTART,SET_TERMINATE_VECTOR,DABORT,TERMINATE,COMMAND
205 PUBLIC FIND_DEBUG,CRLF,BLANK,TAB,INBUF,SCANB,SCANP
206 PUBLIC HEX,OUTSI,OUTDI,DIGIT,BACKUP,RBUFIN
207 public test_lead ;an001;bgb
208 public test1 ;an001;bgb
209
210 IF SYSVER
211; PUBLIC SETUDEV,DEVIOCALL ; kwc 12/10/86
212 PUBLIC SETUDEV ; kwc 12/10/86
213 EXTRN DISPREG:NEAR,INPT:NEAR
214 ENDIF
215
216 EXTRN PERR:NEAR,COMPARE:NEAR,DUMP:NEAR,ENTERDATA:NEAR,FILL:NEAR
217 EXTRN GO:NEAR,INPUT:NEAR,LOAD:NEAR,MOVE:NEAR,NAMED:NEAR
218 EXTRN REG:NEAR,SEARCH:NEAR,DWRITE:NEAR,UNASSEM:NEAR,ASSEM:NEAR
219 EXTRN OUTPUT:NEAR,ZTRACE:NEAR,TRACE:NEAR,GETHEX:NEAR,GETEOL:NEAR
220 EXTRN PREPNAME:NEAR,DEFIO:NEAR,SKIP_FILE:NEAR,DEBUG_FOUND:NEAR
221 EXTRN TRAPPARITY:NEAR,RELEASEPARITY:NEAR
222 extrn pre_load_message:near ;an000;load messages
223 extrn debems:near ;an000;ems support
224
225
226 DB 100H DUP (?)
227
228START:
229 JMP SHORT DSTRT
230
231HEADER DB "Vers 2.40"
232
233DSTRT:
234;=========================================================================
235; invoke PRE_LOAD_MESSAGE here. If the messages were not loaded we will
236; exit with an appropriate error message.
237;
238; Date : 6/14/87
239;=========================================================================
240
241 push ds ;an000;save regs
242 push es ;an000;save resg
243
244 push cs ;an000;transfer cs
245 pop ds ;an000; to ds
246
247 push cs ;an000;transfer cs
248 pop es ;an000; to es
249 assume ds:dg,es:dg ;an000;assume them
250 call PRE_LOAD_MESSAGE ;an000;invoke SYSLOADMSG
251; $if c ;an000;if the load was unsuccessful
252 JNC $$IF1
253 mov ax,(exit shl 8) ;an000;exit EDLIN. PRE_LOAD_MESSAGE
254 ; has already said why
255 int 21h ;an000;exit
256; $endif ;an000;
257$$IF1:
258
259 pop es ;an000;restore regs.
260 pop ds ;an000;
261 assume ds:nothing,es:nothing ;an000;back to original
262
263 MOV AX,(GET_INTERRUPT_VECTOR SHL 8) OR VEC_BREAKPOINT ;get original contents
264 INT 21H ; of the BREAKPOINT vector
265
266 MOV WORD PTR [BPINTSAV],BX ; and save that vector for later
267 MOV WORD PTR [BPINTSAV+WORD],ES ; restoration
268
269 MOV AX,(GET_INTERRUPT_VECTOR SHL 8) OR VEC_SING_STEP ;get original contents
270 INT 21H ; of the SINGLE STEP vector
271
272 MOV WORD PTR [SSINTSAV],BX ; and save that vector for later
273 MOV WORD PTR [SSINTSAV+WORD],ES ; restoration
274
275 MOV BEGSEG,DS ; save beginning DS
276 PUSH CS ; repair damaged ES to be
277 POP ES ; back to just like CS
278 XOR SI,SI ; set source and destination
279 XOR DI,DI ; indices both to zero
280 MOV CX,256 ; set count to size of PSP
281 REP MOVSB ; move to es:[di] from ds:[si]
282 PUSH CS ; set up DS to be just like CS
283 POP DS ; to match .COM rules of addressability
284 ASSUME DS:DG,ES:DG ; like CS, also have DS and DS as bases
285
286 CALL TRAPPARITY ; scarf up those parity guys
287 MOV AH,GET_CURRENT_PDB ;(undocumented function call - 51h)
288 INT 21H
289
290 MOV [USER_PROC_PDB],BX ; Initially set to DEBUG
291
292 IF SYSVER
293 MOV [IOSEG],CS
294 ENDIF
295
296 MOV [PARSERR],AL
297
298
299 IF SYSVER
300 MOV AH,GET_IN_VARS ;(undocumented function call - 52h)
301 INT 21H
302
303 LDS SI,ES:[BX.BCON] ; get system console device
304 ASSUME DS:NOTHING
305
306 MOV WORD PTR CS:[CIN+WORD],DS ;save vector to console input device
307 MOV WORD PTR CS:[CIN],SI
308 MOV WORD PTR CS:[COUT+WORD],DS ;save vector to console output device
309 MOV WORD PTR CS:[COUT],SI
310 PUSH CS ; restore DS to be
311 POP DS ; just like CS, as before
312 ASSUME DS:DG
313
314 MOV DX,OFFSET DG:CONFCB ; get system printer device
315 MOV AH,FCB_OPEN ; open system printer "PRN"
316 INT 21H
317
318 OR AL,AL ; open ok?
319 JZ GOTLIST ; yes, it was there
320
321 MOV DX,OFFSET DG:BADLSTMES_ptr ; no list file found...
322 CALL STD_PRINTF ; tell user
323
324 CALL RBUFIN ; ask for a new one
325
326 CALL CRLF
327
328 MOV CL,[LBUFFCNT]
329 OR CL,CL
330 JZ NOLIST1 ; User didn't specify one
331
332 XOR CH,CH
333 MOV DI,OFFSET DG:(CONFCB + BYTE)
334 MOV SI,OFFSET DG:LINEBUF ; get one from input line
335 REP MOVSB
336 MOV DX,OFFSET DG:CONFCB
337 MOV AH,FCB_OPEN ; try to open it
338 INT 21H
339
340 OR AL,AL
341 JZ GOTLIST ; yep, use it...
342
343 MOV DX,OFFSET DG:BADDEV_Ptr ; complain again
344 CALL STD_PRINTF
345NOLIST1: ; kwc 12/10/86
346 MOV WORD PTR [POUT+WORD],CS ; use null device for printer
347 MOV WORD PTR [POUT],OFFSET DG:LONGRET
348 JMP NOLIST
349
350XXX PROC FAR
351LONGRET:
352 RET
353XXX ENDP
354 ENDIF
355
356GOTLIST:
357;DX = OFFSET OF 'CONFCB', WHICH HAS JUST BEEN OPENED OK
358 IF SYSVER
359 MOV SI,DX
360; LDS SI,DWORD PTR DS:[SI.FCB_FIRCLUS] ; KWC 12/10/86
361 LDS SI,DWORD PTR DS:[SI.FCB_NSLD_DRVPTR] ; KWC 12/10/86
362 ASSUME DS:NOTHING
363
364 MOV WORD PTR CS:[POUT+WORD],DS
365 MOV WORD PTR CS:[POUT],SI
366 ENDIF
367NOLIST:
368 MOV AX,CS ;restore the DS and ES segregs
369 MOV DS,AX ; to become once again just like CS
370 MOV ES,AX
371 ASSUME DS:DG,ES:DG
372
373; Code to print header
374; MOV DX,OFFSET DG:HEADER_PTR
375; CALL STD_PRINTF
376
377 CALL SET_TERMINATE_VECTOR
378
379; Save the current INT 24 vector. We will need this to link to the previous
380; handler for handling of int 24 output.
381 PUSH ES ; save it, about to clobber it...
382 MOV AX,(GET_INTERRUPT_VECTOR SHL 8) + VEC_CRIT_ERR ; get original contents
383 INT 21H ; of the int 24h vector
384
385 MOV WORD PTR PREV24,BX ; remember what int 24h used to
386 MOV WORD PTR PREV24+WORD,ES ; point to
387 POP ES ; restore ES to be like CS and DS
388
389 MOV AX,(SET_INTERRUPT_VECTOR SHL 8) + VEC_CRIT_ERR ; change int 24h to
390 MOV DX,OFFSET DG:MY24 ; point to my own int 24h handler
391 INT 21H
392
393 IF SETCNTC
394 MOV AL,VEC_CTRL_BREAK ; Set vector 23H
395 MOV DX,OFFSET DG:DABORT
396 INT 21H
397 ENDIF
398
399 MOV DX,CS ;get para of where this pgm starts
400 MOV AX,OFFSET DG:DATAEND+15 ;get offset of end of this program
401 MOV CL,4 ; (plus 15 padding for rounding)
402 SHR AX,CL ; adjusted to number of paragraphs
403 ADD DX,AX ;get para of where this pgm ends
404 MOV AX,CS
405 SUB AX,BEGSEG ; add in size of printf
406 ADD DX,AX ; create program segment here
407 CALL [CREATE_LONG] ; and call special routine
408
409 MOV AX,DX
410; Initialize the segments
411 MOV DI,OFFSET DG:DSSAVE
412 CLD
413 STOSW
414 STOSW
415 STOSW
416 STOSW
417 MOV WORD PTR [DISADD+WORD],AX
418 MOV WORD PTR [ASMADD+WORD],AX
419 MOV WORD PTR [DEFDUMP+WORD],AX
420
421 MOV AX,100H
422 MOV WORD PTR[DISADD],AX
423 MOV WORD PTR[ASMADD],AX
424 MOV WORD PTR [DEFDUMP],AX
425
426 MOV DS,DX
427 MOV ES,DX
428 ASSUME DS:NOTHING,ES:NOTHING
429
430 MOV DX,80H
431 MOV AH,SET_DMA
432 INT 21H ; Set default DMA address to 80H
433; Set up initial stack. We already have a 'good' stack set up already. DS:6
434; has the number of bytes remaining in the segment. We should take this
435; value, add 100h and use it as the Stack pointer.
436 MOV AX,WORD PTR DS:[6] ; get bytes remaining
437 MOV BX,AX
438 ADD AX,100h
439
440; MOV BX,AX
441; CMP AX,0FFF0H
442; PUSH CS
443; POP DS
444; JAE SAVSTK
445; MOV AX,WORD PTR DS:[6]
446; PUSH BX
447; MOV BX,OFFSET DG:DATAEND + 15
448; AND BX,0FFF0H ; Size of DEBUG in bytes (rounded up to PARA)
449; SUB AX,BX
450; POP BX
451;SAVSTK:
452 PUSH CS
453 POP DS
454 ASSUME DS:DG
455 PUSH BX ; bx is no. bytes remaining from PSP+6
456 DEC AX ; ax was no. bytes remaining +100h
457 DEC AX ; back up one word from end of new stack
458 MOV BX,AX ; set base to point to last word in new stack
459 MOV WORD PTR ES:[BX],0 ; set final word in new stack to zero
460 POP BX ; back to beginning of new stack area
461 MOV SPSAVE,AX ; remember where new stack is
462 DEC AH
463 MOV ES:WORD PTR [6],AX ; change PSP to show usage of
464 SUB BX,AX ; new stack area
465 MOV CL,4
466 SHR BX,CL
467 ADD ES:WORD PTR [8],BX
468
469 IF IBMVER
470; Get screen size and initialize display related variables
471 MOV AH,15 ;function = "request current video state"
472 INT 10H ;set al=screen mode
473 ; ah=no. char cols on screen
474 ; bh=current active display page
475 CMP AH,40 ;is screen in 40 col mode?
476 JNZ PARSCHK ; no, skip
477 ; yes, 40 col, continue
478 ;next fields defined in 'debconst.asm'
479 MOV BYTE PTR DSIZ,7 ; originally assembled as 0fh
480 MOV BYTE PTR NOREGL,4 ; originally assembled as 8
481 MOV DISPB,64 ; originally assembled as 128
482 ENDIF
483
484PARSCHK:
485
486
487 call DEBUG_LEAD_BYTE ;an000;build the dbcs env. table
488 ; of valid dbcs lead bytes
489
490;=========================================================================
491; prep_command_line requires the use of ds:si. ds is left intact for
492; the call. si is initialized to point to the command line input buffer.
493; ds and si are saved since we stomp all over them in prep_command_line.
494;=========================================================================
495
496 push si ;an000;save si
497
498 mov si,81h ;an000;point to command line
499 call prep_command_line ;an000;invoke command line conversion
500
501 pop si ;an000;restore si
502
503;=========================================================================
504; we have prepped the command line for dbcs. we can now enter the old
505; routines.
506;=========================================================================
507
508; Copy rest of command line to test program's parameter area
509 MOV DI,FCB ;es[di]=to be filled with unopened FCB
510 MOV SI,81H ;ds[si]=command line to parse
511 MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION
512 ;func=29H, option al=1, which
513 ; says, drive id byte in fcb is set
514 ; only if drive specified in command
515 ; line being parsed.
516 INT 21H ;parse filename from command to fcb
517 ; ds:si=points to first char AFTER parsed filename
518 ; es:di=points to first byte of formatted FCB
519
520 CALL SKIP_FILE ; Make sure si points to delimiter
521test1: ;for testing only - u can remove this
522 CALL PREPNAME
523
524 PUSH CS ;restore ES to point to the
525 POP ES ; common group
526FILECHK:
527 MOV DI,80H ;point to byte in PSP defining parm length
528 CMP BYTE PTR ES:[DI],0 ; ANY STUFF FOUND?
529 JZ COMMAND ; no parms, skip
530 ; yes parms, continue
531FILOOP:
532 INC DI ;set index to first/next char in parm text
533 CMP BYTE PTR ES:[DI],CR ; carriage return? (at end of parms)
534 JZ COMMAND ; yes, at end of parms
535 ; no, not at end of parms yet, continue
536 CMP BYTE PTR ES:[DI],CHAR_BLANK ; is this parm text char a blank?
537 JZ FILOOP ; yes, a blank, skip
538 ; no, not a blank, continue
539 CMP BYTE PTR ES:[DI],CHAR_TAB ; is this parm text char a tab?
540 JZ FILOOP ; yes, a tab, skip
541 ; no, not a tab, continue
542 OR [NAMESPEC],1 ; set flag to indicate
543 ; we have a specified file
544 ; (this could be set by "N" command also)
545 CALL DEFIO ; READ in the specified file
546
547 PUSH CS ;restore DS to point to the
548 POP DS ; common group
549
550 ;perform self-relocation on some internal vectors:
551 MOV AX,CSSAVE ; pick up the seg id to go to vectors
552 MOV WORD PTR DISADD+WORD,AX ; shove it into the segid portion
553 MOV WORD PTR ASMADD+WORD,AX ; of these two vectors
554 MOV AX,IPSAVE ; pick up the offset to go to vectors
555 MOV WORD PTR DISADD,AX ; shove it into the offset portion
556 MOV WORD PTR ASMADD,AX ; of these two vectors
557COMMAND:
558 CLD
559 MOV AX,CS
560 MOV DS,AX
561 MOV ES,AX
562 cli ;disable before setting up the stack - EMK
563 MOV SS,AX ;now everything points to the same group
564 ASSUME SS:DG
565
566 MOV SP,OFFSET DG:STACK
567 STI ;re-enable
568 CMP [PARITYFLAG],0 ; did we detect a parity error?
569 JZ GOPROMPT ; no, go prompt
570 ; yes, parity error, continue
571 MOV [PARITYFLAG],0 ; reset flag
572 IF IBMJAPAN
573 MOV DX,OFFSET DG:PARITYMES_PTR
574 CALL STD_PRINTF ;display msg about parity error
575 ENDIF
576GOPROMPT:
577 MOV DX,OFFSET DG:PROMPT_PTR ;display the user prompt request
578 CALL STD_PRINTF
579
580 CALL INBUF ; Get command line
581; From now and throughout command line processing, DI points
582; to next character in command line to be processed.
583 CALL SCANB ; Scan off leading blanks
584
585 JZ COMMAND ; if zero, Null command, go get another
586 ; nonzero, got something in response
587 LODSB ; AL=first non-blank character
588; Prepare command letter for table lookup
589; converts the first non-blank (assumed to be the command letter)
590; to in index in the "comtab" array.
591 SUB AL,UPPER_A ; Low end range check
592 JB ERR1
593
594 CMP AL,UPPER_Z - UPPER_A ; Upper end range check
595 JA ERR1
596
597 SHL AL,1 ; Times two
598 CBW ; Now a 16-bit quantity
599 XCHG BX,AX ; In BX we can address with it
600 CALL CS:[BX+COMTAB] ; Execute command
601
602 JMP SHORT COMMAND ; Get next command
603ERR1:
604 JMP PERR
605
606SET_TERMINATE_VECTOR:
607 PUSH DS
608 PUSH CS
609 POP DS
610 MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_TERM_ADDR ; Set vector 22H
611 MOV DX,OFFSET DG:TERMINATE
612 INT 21H
613
614 POP DS
615 RET
616
617RESTORE_DEB_VECT:
618 PUSH DS
619 PUSH DX
620 PUSH AX
621 LDS DX,CS:[BPINTSAV]
622 MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_BREAKPOINT ;Vector 3
623 INT 21H
624
625 LDS DX,CS:[SSINTSAV]
626 MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_SING_STEP ;Vector 1
627 INT 21H
628
629 POP AX
630 POP DX
631 POP DS
632 RET
633
634; Internal INT 24 handler. We allow our parent's handler to decide what to do
635; and how to prompt. When our parent returns, we note the return in AL. If
636; he said ABORT, we need to see if we are aborting ourselves. If so, we
637; cannot turn it into fail; we may get a cascade of errors due to the original
638; cause. Instead, we do the ol' disk-reset hack to clean up. This involves
639; issuing a disk-reset, ignoring all errors, and then returning to the caller.
640MY24:
641 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
642
643; If we are already inside an INT 24, just ignore this error
644 TEST FIN24,-1
645 JZ DO24
646
647 MOV AL,0 ; signal ignore
648 IRET
649
650; Let the user decide what to do
651DO24:
652 PUSHF
653 CALL PREV24 ; simulate INT 24 to him
654
655 CMP AL,2 ; was it ABORT?
656 JNZ DOIRET ; no, let it happen
657
658 PUSH AX
659 PUSH BX
660 MOV AH,GET_CURRENT_PDB ; find out who's terminating
661 INT 21H
662
663 CMP BX,BEGSEG ; is it us?
664 POP BX
665 POP AX
666 JZ DORESET ; no, let it happen
667
668DOIRET:
669 IRET
670
671; We have been instructed to abort ourselves. Since we can't do this, we will
672; perform a disk reset to flush out all buffers and then ignore the errors we
673; get.
674DORESET:
675 MOV FIN24,-1 ; signal that we ignore errors
676 MOV AH,DISK_RESET
677 INT 21H ; clean out cache
678
679 MOV FIN24,0 ; reset flag
680 JMP COMMAND
681
682TERMINATE:
683 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
684
685 CMP QFLAG,0
686 JNZ QUITING
687
688 MOV AX,BEGSEG
689 MOV USER_PROC_PDB,AX
690 CMP NEWEXEC,0
691 JZ NORMTERM
692
693 MOV AX,CS
694 MOV DS,AX
695 ASSUME DS:DG
696 ;is CLI/STI needed here ? - emk
697 CLI
698 MOV SS,AX
699 ASSUME SS:DG
700
701 MOV SP,OFFSET DG:STACK
702 STI
703 MOV AX,HEADSAVE
704 JMP DEBUG_FOUND
705
706NORMTERM:
707 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
708
709 PUSH CS
710 POP DS
711 ASSUME DS:DG
712
713 MOV DX,OFFSET DG:ENDMES_PTR
714 JMP SHORT RESTART
715
716QUITING:
717 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
718
719 CALL RESTORE_DEB_VECT
720
721 MOV AX,(EXIT SHL 8)
722 INT 21H
723
724RESTART:
725 CALL STD_PRINTF
726DABORT:
727 MOV AX,CS
728 MOV DS,AX
729 ASSUME DS:DG
730
731 ;is CLI\STI needed here? - emk
732 CLI
733 MOV SS,AX
734 ASSUME SS:DG
735
736 MOV SP,OFFSET DG:STACK
737 STI
738;;;;;; CALL CRLF
739
740 JMP COMMAND
741
742 IF SYSVER
743SETUDEV:
744 MOV DI,OFFSET DG:CONFCB
745 MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION
746 INT 21H
747
748 CALL USERDEV
749
750 JMP DISPREG
751
752USERDEV:
753 MOV DX,OFFSET DG:CONFCB
754 MOV AH,FCB_OPEN
755 INT 21H
756
757 OR AL,AL
758 JNZ OPENERR
759
760 MOV SI,DX
761; TEST BYTE PTR [SI.FCB_DEVID],080H ; Device? ; KWC 12/10/86
762; JZ OPENERR ; NO ; KWC 12/10/86
763 MOV AL,BYTE PTR [SI.FCB_NSL_DRIVE] ; KWC 12/10/86
764 AND AL,NOT FCBMASK ; KWC 12/10/86
765 CMP AL,0C0H ; KWC 12/10/86
766 JNE OPENERR ; KWC 12/10/86
767 XOR AL,AL ; KWC 12/10/86
768
769; LDS SI,DWORD PTR [CONFCB.FCB_FIRCLUS] ; KWC 12/10/86
770 LDS SI,DWORD PTR [CONFCB.FCB_NSLD_DRVPTR] ; KWC 12/10/86
771 MOV WORD PTR CS:[CIN],SI
772 MOV WORD PTR CS:[CIN+WORD],DS
773
774 MOV WORD PTR CS:[COUT],SI
775 MOV WORD PTR CS:[COUT+WORD],DS
776 PUSH CS
777 POP DS
778 RET
779
780OPENERR:
781 MOV DX,OFFSET DG:BADDEV_PTR
782 CALL STD_PRINTF
783
784 RET
785 ENDIF
786; Get input line. Convert all characters NOT in quotes to upper case.
787INBUF:
788 CALL RBUFIN
789
790;=========================================================================
791; prep_command_line requires the use of ds:si. ds is left intact for
792; the call. si is initialized to point to the command line input buffer.
793; ds and si are saved since we stomp all over them in prep_command_line.
794;=========================================================================
795
796 push si ;an000;save si
797
798 mov si,offset dg:linebuf ;an000;point to command line
799 call prep_command_line ;an000;invoke command line conversion
800
801 pop si ;an000;restore si
802
803;=========================================================================
804; we have prepped the command line for dbcs. we can now enter the old
805; routines.
806;=========================================================================
807
808 MOV SI,OFFSET DG:LINEBUF
809 MOV DI,OFFSET DG:BYTEBUF
810
811CASECHK:
812
813 LODSB
814
815 call Test_Lead ;DBCS lead byte ;an000; dms;
816; $if c ;yes - ignore 2nd. byte ;an000; dms;
817 JNC $$IF3
818 stosb ;save the byte ;an000; dms;
819 lodsb ;pick up the 2nd. character ;an000; dms;
820 stosb ;save it also ;an000; dms;
821 jmp CaseChk ;read next character ;an000; dms;
822; $endif ; ;an000; dms;
823$$IF3:
824
825 CMP AL,LOWER_A
826 JB NOCONV
827
828 CMP AL,LOWER_Z
829 JA NOCONV
830
831 ADD AL,UPPER_A - LOWER_A ; Convert to upper case
832NOCONV:
833 STOSB
834 CMP AL,CR
835 JZ INDONE
836
837 CMP AL,DOUBLE_QUOTE
838 JZ QUOTSCAN
839
840 CMP AL,SINGLE_QUOTE
841 JNZ CASECHK
842
843QUOTSCAN:
844 MOV AH,AL
845KILLSTR:
846 LODSB
847 STOSB
848 CMP AL,CR ;CARRIAGE RETURN?
849 JZ INDONE
850
851 CMP AL,AH
852 JNZ KILLSTR
853
854 JMP SHORT CASECHK
855
856INDONE:
857 MOV SI,OFFSET DG:BYTEBUF
858 CALL CRLF
859
860 RET
861
862; Physical backspace - blank, backspace, blank
863BACKUP:
864 PUSH DX
865 MOV DX,OFFSET DG:BACMES_PTR
866 CALL STD_PRINTF
867
868 POP DX
869 RET
870
871; Scan for parameters of a command
872SCANP:
873 CALL SCANB ; Get first non-blank
874
875 CMP BYTE PTR [SI],CHAR_COMMA ; One comma between params OK
876 JNE EOLCHK ; If not comma, we found param
877
878 INC SI ; Skip over comma
879; Scan command line for next non-blank character
880SCANB:
881 PUSH AX
882SCANNEXT:
883 LODSB
884 CMP AL,CHAR_BLANK ;is this char a "blank"?
885 JZ SCANNEXT
886
887 CMP AL,CHAR_TAB ;is this char a "tab"?
888 JZ SCANNEXT
889
890 DEC SI ; Back to first non-blank
891 POP AX
892EOLCHK:
893 CMP BYTE PTR [SI],CR ;CARRIAGE RETURN
894 RET
895
896; Hex addition and subtraction
897HEXADD:
898 MOV CX,4
899 CALL GETHEX
900
901 MOV DI,DX
902 MOV CX,4
903 CALL GETHEX
904
905 CALL GETEOL
906
907 PUSH DX
908 ADD DX,DI
909 MOV [ADD_ARG],DX
910 POP DX
911 SUB DI,DX
912 MOV [SUB_ARG],DI
913 MOV DX,OFFSET DG:ADD_PTR
914 CALL PRINTF_CRLF
915
916 RET
917
918; Put the hex address in DS:SI in the argument list for a call to printf
919OUTSI:
920 MOV CS:[HEX_ARG1],DS
921 MOV CS:[HEX_ARG2],SI
922 RET
923
924;Put the hex address in ES:DI in the argument list for a call to printf
925OUTDI:
926 MOV [HEX_ARG1],ES
927 MOV [HEX_ARG2],DI
928 RET
929
930HEX_ADDRESS_ONLY:
931 MOV BYTE PTR [ARG_BUF],0
932HEX_ADDRESS_STR:
933 MOV DX,OFFSET DG:HEX_PTR
934STD_PRINTF:
935 PUSH DX
936 CALL PRINTF
937 POP DX ;ac000;restore dx
938
939 RET
940
941PRINTF_CRLF:
942 PUSH DX
943 CALL PRINTF
944 POP DX ;ac000;restore dx
945CRLF:
946 MOV DX,OFFSET DG:CRLF_PTR
947 PUSH DX
948 CALL PRINTF
949 POP DX ;ac000;restore dx
950
951 RET
952
953HEX:
954 MOV AH,AL ; Save for second digit
955 PUSH CX
956 MOV CL,4
957 SHR AL,CL
958 POP CX
959
960 CALL DIGIT ; First digit
961
962 MOV AL,AH ; Now do digit saved in AH
963DIGIT:
964 AND AL,0FH ; Mask to 4 bits
965 ADD AL,90H
966 DAA
967 ADC AL,40H
968 DAA
969 AND AL,7FH
970 STOSB
971 RET
972
973RBUFIN:
974 PUSH AX
975 PUSH DX
976 MOV AH,STD_CON_STRING_INPUT
977 MOV DX,OFFSET DG:LBUFSIZ
978 INT 21H
979
980 POP DX
981 POP AX
982 RET
983
984; Put one space in the printf output uffer
985BLANK:
986 MOV AL,CHAR_BLANK
987 STOSB
988 RET
989
990; Put CX spaces in the printf output buffer
991TAB:
992 JCXZ TAB_RET
993
994 CALL BLANK
995
996 LOOP TAB
997TAB_RET:
998 RET
999
1000; Command Table. Command letter indexes into table to get
1001; address of command. PERR prints error for no such command.
1002
1003COMTAB DW ASSEM ; A
1004 DW PERR ; B
1005 DW COMPARE ; C
1006 DW DUMP ; D
1007 DW ENTERDATA ; E
1008 DW FILL ; F
1009 DW GO ; G
1010 DW HEXADD ; H
1011 DW INPUT ; I
1012 DW PERR ; J
1013 DW PERR ; K
1014 DW LOAD ; L
1015 DW MOVE ; M
1016 DW NAMED ; N
1017 DW OUTPUT ; O
1018 DW ZTRACE ; P
1019 DW QUIT ; Q (QUIT)
1020 DW REG ; R
1021 DW SEARCH ; S
1022 DW TRACE ; T
1023 DW UNASSEM ; U
1024 DW PERR ; V
1025 DW DWRITE ; W
1026 IF SYSVER
1027 DW SETUDEV ; X
1028 ELSE
1029 DW DEBEMS
1030 ENDIF
1031 DW PERR ; Y
1032 DW PERR ; Z
1033
1034QUIT:
1035 INC BYTE PTR [QFLAG]
1036 MOV BX,[USER_PROC_PDB]
1037FIND_DEBUG:
1038 IF NOT SYSVER
1039 MOV AH,SET_CURRENT_PDB
1040 INT 21H
1041 ENDIF
1042 CALL RELEASEPARITY ; let system do normal parity stuff
1043
1044 CALL RESTORE_DEB_VECT
1045
1046 MOV AX,(EXIT SHL 8)
1047 INT 21H
1048
1049;======================= proc prep_command_line =========================
1050; prep_command_line: This proc converts a Asian DBCS space delimiter (8140h)
1051; into 2 20h values. In this way we can pass command
1052; lines throughout DEBUG without major modification
1053; to the source code. This proc is invoked anywhere
1054; a command line is initially accessed. In the case
1055; of DEBUG it is used in PARSCHK and INBUF.
1056; Any quoted string, a string delimited by ("), will
1057; be ignored.
1058;
1059; input: ds - segment of command line
1060; si - offset of command line
1061;
1062; output: command line with Asian blanks (8140h) converted to
1063; 2020h.
1064;
1065;=========================================================================
1066
1067prep_command_line proc near ;command line conversion
1068 push ax ;save affected regs.
1069 push bx ;
1070 push si ;
1071
1072 mov bl,00h ;initialize flag
1073 ;bl is used to signal
1074 ; a quote delimiter
1075; $DO ;do while not CR
1076$$DO5:
1077 mov al,[si] ;move char from cmd line for compare
1078 cmp al,CR ;is it a CR ?
1079; $LEAVE E ;if CR exit
1080 JE $$EN5
1081
1082 cmp al,quote_char ;is it a quote ?
1083; $IF Z ;if it is a quote
1084 JNZ $$IF7
1085 xor bl,01h ;set or reset the flag
1086; $ENDIF
1087$$IF7:
1088
1089 cmp bl,01h ;is 1st quote set ?
1090; $IF NZ ;if not continue
1091 JZ $$IF9
1092 call TEST_LEAD ;test for dbcs lead byte
1093; $IF C ;we have a lead byte
1094 JNC $$IF10
1095 cmp al,dbcs_delim ;is it a dbcs char? 81h
1096; $IF Z ;if a dbcs char
1097 JNZ $$IF11
1098 mov al,[si+1] ;move next char al
1099 cmp al,asian_blk ;is it an Asian blank? 40h
1100; $IF Z ;if an Asian blank
1101 JNZ $$IF12
1102 mov al,amer_blk ;set up moves
1103 mov [si],al ; to replace
1104 mov [si+1],al ; Asian blank w/20h
1105 inc si ;point to si+1
1106; $ELSE ;if not an asian blank
1107 JMP SHORT $$EN12
1108$$IF12:
1109 inc si ;point to dbcs char
1110; $ENDIF ;
1111$$EN12:
1112; $ENDIF ;
1113$$IF11:
1114; $ENDIF ;end lead byte test
1115$$IF10:
1116; $ENDIF ;
1117$$IF9:
1118 inc si ;point to si+1
1119; $ENDDO ;end do while
1120 JMP SHORT $$DO5
1121$$EN5:
1122 pop si ;restore affected regs.
1123 pop bx ;
1124 pop ax ;
1125 ret ;return to caller
1126prep_command_line endp ;end proc
1127
1128
1129;=========================================================================
1130; DEBUG_LEAD_BYTE - This routine sets the lead-byte-pointers to point
1131; to the dbcs environmental vector table of lead bytes.
1132; This table will be used to determine if we have a
1133; dbcs lead byte.
1134;
1135; Inputs - none
1136;
1137; Outputs- pointer to dbcs environmental vector table of lead bytes
1138; LBTBL DD ?
1139;
1140; Date : 6/16/87
1141;=========================================================================
1142
1143DEBUG_LEAD_BYTE proc near ;an000;get lead byte vector
1144
1145 push ds ;an000;save affected regs
1146 push es ;an000;
1147 push si ;an000;
1148
1149 mov ax,(ECS_call shl 8) or 00h ;an000;get dbcs env. vector
1150 int 21h ;an000;invoke function
1151
1152 assume ds:nothing
1153
1154 mov word ptr cs:lbtbl[0],si ;an000;move offset of table
1155 mov word ptr cs:lbtbl[2],ds ;an000;move segment of table
1156
1157 pop si ;an000;restore affected regs
1158 pop es ;an000;
1159 pop ds ;an000;
1160
1161 ret ;an000;return to caller
1162
1163DEBUG_LEAD_BYTE endp ;an000;end proc
1164
1165;=========================================================================
1166; TEST_LEAD - This routine will determine whether or not we have a valid
1167; lead byte for a DBCS character.
1168;
1169; Inputs : AL - Holds the byte to compare. Passed by POP. ;an001;bgb
1170;
1171; Outputs: Carry set if lead byte
1172; No carry if not lead byte
1173;
1174; Date : 6/16/87
1175;=========================================================================
1176
1177TEST_LEAD proc near ;an000;check for dbcs lead byte
1178
1179 push ds ;an000;save affected regs
1180 push si ;an000;
1181 push ax ;an000;
1182
1183 xchg ah,al ;an000;ah used for compare
1184 mov si,word ptr cs:lbtbl[2] ;an000;get segment of table
1185 mov ds,si ;an000;
1186 mov si,word ptr cs:lbtbl[0] ;an000;get offset of table
1187
1188ck_next:
1189
1190 lodsb ;an000;load al with byte table
1191 or al,al ;an000;end of table?
1192; $IF z ;an000;yes, end of table
1193 JNZ $$IF19
1194 jmp lead_exit ;an000;exit with clear carry
1195; $ELSE ;an000;
1196 JMP SHORT $$EN19
1197$$IF19:
1198 cmp al,ah ;an000;start > character?
1199; $IF a ;an000;it is above
1200 JNA $$IF21
1201 clc ;an000;clear carry flag
1202 jmp lead_exit ;an000;exit with clear carry
1203; $ELSE ;an000;
1204 JMP SHORT $$EN21
1205$$IF21:
1206 lodsb ;an000;load al with byte table
1207 cmp ah,al ;an000;character > end range
1208; $IF a ;an000;not a lead
1209 JNA $$IF23
1210 jmp ck_next ;an000;check next range
1211; $ELSE ;an000;lead byte found
1212 JMP SHORT $$EN23
1213$$IF23:
1214 stc ;an000;set carry flag
1215; $ENDIF ;an000;
1216$$EN23:
1217; $ENDIF ;an000;
1218$$EN21:
1219; $ENDIF ;an000;
1220$$EN19:
1221
1222lead_exit: ;an000;exit from check
1223
1224 pop ax ;an000;
1225 pop si ;an000;restore affected regs.
1226 pop ds ;an000;
1227
1228 ret ;an000;return to caller
1229
1230TEST_LEAD endp ;an000;end proc
1231
1232
1233
1234CODE ENDS
1235 END START
1236 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBUG.LNK b/v4.0/src/CMD/DEBUG/DEBUG.LNK
new file mode 100644
index 0000000..e9163c0
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBUG.LNK
@@ -0,0 +1,13 @@
1DEBUG+
2DEBCOM1+
3DEBCOM2+
4DEBCOM3+
5DEBASM+
6DEBUASM+
7DEBERR+
8DEBCONST+
9DEBMES+
10DEBEMS+
11DEBDATA
12DEBUG.EXE;
13 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/DEBUG.SKL b/v4.0/src/CMD/DEBUG/DEBUG.SKL
new file mode 100644
index 0000000..0720426
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/DEBUG.SKL
@@ -0,0 +1,125 @@
1;======================= START OF SPECIFICATIONS =========================
2;
3; MODULE NAME: DEBMES.FIL
4;
5; DESCRIPTIVE NAME: MESSAGES USED BY DEBUG
6;
7; FUNCTION: PROVIDES FASTBLD.EXE THE MESSAGES THAT ARE TO BE USED BY DEBUG.
8;
9; ENTRY POINT: NA
10;
11; INPUT: NA
12;
13; EXIT NORMAL: NA
14;
15; EXIT ERROR: NA
16;
17; INTERNAL REFERENCES: NA
18;
19; EXTERNAL REFERENCES: NA
20;
21; NOTES: THIS MODULE IS TO BE PREPPED BY FASTBLD.EXE.
22;
23; FASTBLD.EXE CREATES: DEBUG.CLA
24; DEBUG.CLB
25; DEBUG.CLC
26; DEBUG.CLD
27; DEBUG.CL1
28; DEBUG.CL2
29;
30; REVISION HISTORY: NA
31;
32;
33; COPYRIGHT: "THE IBM PERSONAL COMPUTER EDLIN UTILITY"
34; "VERSION 3.40 (C) COPYRIGHT IBM CORP 1987"
35; "LICENSED MATERIAL - PROGRAM PROPERTY OF IBM"
36;
37; PROGRAM AUTHOR: DS
38;
39;======================= END OF SPECIFICATIONS ===========================
40
41;=========================================================================
42;debug utility message file
43;=========================================================================
44
45:util DEBUG ;utility name
46
47:class 1 ;extended errors
48
49:class A ;system messages
50:use 1 COMMON1 ;"Incorrect DOS version"
51:use 2 COMMON2 ;"Insufficient memory"
52:use 3 COMMON3 ;"Error loading messages"
53:def 4 "Allocation failed or specified buffer too small",CR,LF
54 ;:def 5 "Bad or missing Msg info",CR,LF
55
56:class B ;utility messages
57:def 6 "Bad device name" ;baddev_ptr
58:def 7 "Couldn't open list device PRN",CR,LF
59"Enter name of list device? " ;badlstmes_ptr
60:def 8 CR,LF ;crlf_ptr
61:def 9 CR,LF,"Program terminated normally",CR,LF ;endmes_ptr
62:def 10 "Invalid drive specification",CR,LF ;nambad_ptr
63:def 12 "File creation error",CR,LF ;noroom_ptr
64:def 13 "Insufficient space on disk",CR,LF ;nospace_ptr
65:def 14 "Disk error reading drive %1",CR,LF ;dr1_ptr
66:def 15 "Disk error writing drive %1",CR,LF ;dr2_ptr
67:def 16 "Write protect error reading drive %1",CR,LF ;dr3_ptr
68:def 17 "Write protect error writing drive %1",CR,LF ;dr4_ptr
69:def 19 "%1^ Error" ;synerr
70:def 20 "Error in EXE or HEX file",CR,LF ;exebad_ptr/hexerr_ptr
71
72:class C
73:def 21 "EXE and HEX files cannot be written",CR,LF ;exewrt_ptr/hexwrt_ptr
74:def 22 "EXEC failure" ;execemes_ptr
75:def 23 "(W)rite error, no destination defined",CR,LF ;nonamespec_ptr
76:def 24 "Access denied",CR,LF ;accmes_ptr
77:def 25 "Parity error or nonexistant memory error detected" ;paritymes_ptr
78:def 26 "-" ;prompt_ptr
79:def 27 "%1 -" ;change_flag_ptr
80:def 32 "%1%2" ;unassem_ln_ptr
81:def 33 "%1:%2 %3" ;hex_ptr
82:def 34 "%1 %2" ;add_ptr
83:def 35 "%1 %2",CR,LF,":" ;single_reg_ptr
84:def 36 "%1=%2 " ;register_ptr
85:def 37 "%1 Error" ;errmes_ptr
86:def 38 "Writing %1 bytes" ;wrtmes_ptr
87:def 39 "%1:%2=" ;loc_ptr
88:def 40 "%1" ;little_ptr
89
90:class D
91:def 41 "%1" ;big_ptr
92:def 42 "%1:%2 %3 %4 %5:%6" ;comp_ptr
93:def 44 32,8 ;bacmes_ptr
94 ; :def 45 "Unable to allocate message handler",CR,LF
95 ;fatal_error
96:def 46 "%1" ;arg_buf_ptr
97:def 47 "%1" ;one_char_buf_ptr
98
99:def 50 "%1 of a total %2 EMS pages have been allocated",cr,lf
100:def 51 "%1 of a total %2 EMS handles have been allocated",cr,lf
101:def 55 "Handle created = %1 ",cr,lf
102:def 56 "Logical page %1 mapped to physical page %2 ",cr,lf
103:def 57 "EMS hardward/software failure",cr,lf
104:def 58 "Handle not found",cr,lf
105:def 59 "Invalid function code",cr,lf
106:def 60 "No free handles",cr,lf
107:def 61 "Save/Restore error",cr,lf
108:def 62 "Total pages exceeded",cr,lf
109:def 63 "Free pages exceeded",cr,lf
110:def 64 "Parameter error",cr,lf
111:def 65 "Logical Page out of range",cr,lf
112:def 66 "Physical Page out of range",cr,lf
113:def 67 "Save area already in use",cr,lf
114:def 68 "Save area not in use",cr,lf
115:def 70 "General EMS error",cr,lf
116:def 71 "Missing or invalid EMS parameter",cr,lf
117:def 72 "Handle %1 has %2 pages allocated",cr,lf
118:def 75 "Physical page %1 = Frame segment %2",cr,lf
119:def 76 "Handle %1 deallocated",cr,lf
120:def 78 "EMS not installed",cr,lf
121
122:end
123
124;=========================================================================
125;=========================================================================
diff --git a/v4.0/src/CMD/DEBUG/MAKEFILE b/v4.0/src/CMD/DEBUG/MAKEFILE
new file mode 100644
index 0000000..d0fa39a
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/MAKEFILE
@@ -0,0 +1,107 @@
1#************************** makefile for cmd\append ***************************
2
3msg =..\..\messages
4dos =..\..\dos
5inc =..\..\inc
6hinc =..\..\h
7
8#
9####################### dependencies begin here. #########################
10#
11
12all: debug.com
13
14debug.ctl: debug.skl \
15 $(msg)\$(COUNTRY).msg \
16 makefile
17
18debug.obj: debug.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
19 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
20 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
21 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
22 $(inc)\pdb.inc $(inc)\sf.inc \
23 $(inc)\arena.inc $(inc)\intnat.inc \
24 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
25
26debcom1.obj: debcom1.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
27 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
28 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
29 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
30 $(inc)\pdb.inc $(inc)\sf.inc \
31 $(inc)\arena.inc $(inc)\intnat.inc \
32 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
33
34debcom2.obj: debcom2.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
35 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
36 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
37 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
38 $(inc)\pdb.inc $(inc)\sf.inc \
39 $(inc)\arena.inc $(inc)\intnat.inc \
40 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
41
42debcom3.obj: debcom3.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
43 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
44 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
45 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
46 $(inc)\pdb.inc $(inc)\sf.inc \
47 $(inc)\arena.inc $(inc)\intnat.inc \
48 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
49
50debasm.obj: debasm.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
51 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
52 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
53 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
54 $(inc)\pdb.inc $(inc)\sf.inc \
55 $(inc)\arena.inc $(inc)\intnat.inc \
56 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
57
58debuasm.obj: debuasm.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
59 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
60 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
61 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
62 $(inc)\pdb.inc $(inc)\sf.inc \
63 $(inc)\arena.inc $(inc)\intnat.inc \
64 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
65
66deberr.obj: deberr.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
67 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
68 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
69 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
70 $(inc)\pdb.inc $(inc)\sf.inc \
71 $(inc)\arena.inc $(inc)\intnat.inc \
72 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
73
74debconst.obj: debconst.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
75 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
76 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
77 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
78 $(inc)\pdb.inc $(inc)\sf.inc \
79 $(inc)\arena.inc $(inc)\intnat.inc \
80 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
81
82debdata.obj: debdata.asm $(inc)\dossym.inc $(inc)\dosmac.inc \
83 $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \
84 $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \
85 $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \
86 $(inc)\pdb.inc $(inc)\sf.inc \
87 $(inc)\arena.inc $(inc)\intnat.inc \
88 $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile
89
90debems.obj: debems.asm debequ.asm makefile
91
92debmes.obj: debmes.asm $(inc)\msgserv.asm $(inc)\sysmsg.inc \
93 debug.ctl \
94 debug.cla \
95 debug.clb \
96 debug.clc \
97 debug.cld \
98 debug.cl1 \
99 debug.cl2 \
100 makefile
101
102debug.com: debug.obj debcom1.obj debcom2.obj debcom3.obj debems.obj \
103 debasm.obj debuasm.obj deberr.obj debconst.obj debdata.obj \
104 debmes.obj debug.lnk makefile
105 link @debug.lnk
106 convert debug.exe
107 del debug.exe
diff --git a/v4.0/src/CMD/DEBUG/SYSVER.FAL b/v4.0/src/CMD/DEBUG/SYSVER.FAL
new file mode 100644
index 0000000..a600c51
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/SYSVER.FAL
@@ -0,0 +1,10 @@
1
2
3 IF1
4 %OUT Including ..SYSVER.FAL..
5 ENDIF
6
7SYSVER EQU FALSE ; if true, i/o direct to bios
8 ; so DOS can be debugged
9
10 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/SYSVER.INC b/v4.0/src/CMD/DEBUG/SYSVER.INC
new file mode 100644
index 0000000..a600c51
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/SYSVER.INC
@@ -0,0 +1,10 @@
1
2
3 IF1
4 %OUT Including ..SYSVER.FAL..
5 ENDIF
6
7SYSVER EQU FALSE ; if true, i/o direct to bios
8 ; so DOS can be debugged
9
10 \ No newline at end of file
diff --git a/v4.0/src/CMD/DEBUG/SYSVER.TRU b/v4.0/src/CMD/DEBUG/SYSVER.TRU
new file mode 100644
index 0000000..6714b89
--- /dev/null
+++ b/v4.0/src/CMD/DEBUG/SYSVER.TRU
@@ -0,0 +1,10 @@
1
2
3 IF1
4 %OUT Including ..SYSVER.TRU..
5 ENDIF
6
7SYSVER EQU TRUE ; if true, i/o direct to bios
8 ; so DOS can be debugged
9
10 \ No newline at end of file