From 2d04cacc5322951f187bb17e017c12920ac8ebe2 Mon Sep 17 00:00:00 2001 From: Mark Zbikowski Date: Thu, 25 Apr 2024 21:24:10 +0100 Subject: MZ is back! --- v4.0/src/CMD/DEBUG/DEBASM.ASM | 1441 ++++++++++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBCOM1.ASM | 969 +++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBCOM2.ASM | 1308 +++++++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBCOM3.ASM | 678 +++++++++++++++++ v4.0/src/CMD/DEBUG/DEBCONST.ASM | 1128 +++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBDATA.ASM | 227 ++++++ v4.0/src/CMD/DEBUG/DEBEMS.ASM | 1127 +++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBEQU.ASM | 164 +++++ v4.0/src/CMD/DEBUG/DEBERR.ASM | 183 +++++ v4.0/src/CMD/DEBUG/DEBMES.ASM | 1524 +++++++++++++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBUASM.ASM | 954 ++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBUG.ASM | 1236 +++++++++++++++++++++++++++++++ v4.0/src/CMD/DEBUG/DEBUG.LNK | 13 + v4.0/src/CMD/DEBUG/DEBUG.SKL | 125 ++++ v4.0/src/CMD/DEBUG/MAKEFILE | 107 +++ v4.0/src/CMD/DEBUG/SYSVER.FAL | 10 + v4.0/src/CMD/DEBUG/SYSVER.INC | 10 + v4.0/src/CMD/DEBUG/SYSVER.TRU | 10 + 18 files changed, 11214 insertions(+) create mode 100644 v4.0/src/CMD/DEBUG/DEBASM.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBCOM1.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBCOM2.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBCOM3.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBCONST.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBDATA.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBEMS.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBEQU.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBERR.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBMES.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBUASM.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBUG.ASM create mode 100644 v4.0/src/CMD/DEBUG/DEBUG.LNK create mode 100644 v4.0/src/CMD/DEBUG/DEBUG.SKL create mode 100644 v4.0/src/CMD/DEBUG/MAKEFILE create mode 100644 v4.0/src/CMD/DEBUG/SYSVER.FAL create mode 100644 v4.0/src/CMD/DEBUG/SYSVER.INC create mode 100644 v4.0/src/CMD/DEBUG/SYSVER.TRU (limited to 'v4.0/src/CMD/DEBUG') 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 @@ + PAGE 80,132 ; + TITLE DEBASM.ASM +; CODE FOR THE ASSEMBLE COMMAND IN THE DEBUGGER + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBASM + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM +.CREF +.LIST + + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + + EXTRN DBMN:BYTE,CSSAVE:WORD,REG8:BYTE,REG16:BYTE,SIZ8:BYTE + EXTRN SYNERR_PTR:BYTE,OPTAB:BYTE,MAXOP:ABS + +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + + EXTRN HINUM:WORD,LOWNUM:WORD,ASSEM_CNT:BYTE + EXTRN ASSEM1:BYTE,ASSEM2:BYTE,ASSEM3:BYTE,ASSEM4:BYTE,ASSEM5:BYTE + EXTRN ASSEM6:BYTE,OPBUF:BYTE,OPCODE:WORD,REGMEM:BYTE,INDEX:WORD + EXTRN ASMADD:BYTE,ASMSP:WORD,MOVFLG:BYTE,SEGFLG:BYTE,TSTFLG:BYTE + EXTRN NUMFLG:BYTE,DIRFLG:BYTE,BYTEBUF:BYTE,F8087:BYTE,DIFLG:BYTE + EXTRN SIFLG:BYTE,BXFLG:BYTE,BPFLG:BYTE,NEGFLG:BYTE,MEMFLG:BYTE + EXTRN REGFLG:BYTE,AWORD:BYTE,MIDFLD:BYTE,MODE:BYTE + EXTRN ARG_BUF:BYTE,HEX_PTR:BYTE + +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE +ASSUME CS:DG,DS:DG,ES:DG,SS:DG + + PUBLIC ASSEM + PUBLIC DB_OPER,DW_OPER,ASSEMLOOP,GROUP2,AA_OPER,DCINC_OPER + PUBLIC GROUP1,ESC_OPER,FGROUPP,FGROUPX,FDE_OPER,FGROUPZ + PUBLIC FD9_OPER,FGROUP,FDB_OPER,FGROUPB,FGROUP3,FGROUP3W + PUBLIC FGROUPDS,INT_OPER,IN_OPER,DISP8_OPER,JMP_OPER,NO_OPER + PUBLIC OUT_OPER,L_OPER,MOV_OPER,POP_OPER,PUSH_OPER,ROTOP + PUBLIC TST_OPER,EX_OPER,GET_DATA16,CALL_OPER, DOORG + + EXTRN INBUF:NEAR,SCANB:NEAR,SCANP:NEAR,GETHX:NEAR,GET_ADDRESS:NEAR + EXTRN DEFAULT:NEAR,OUTDI:NEAR,BLANK:NEAR,TAB:NEAR + EXTRN STD_PRINTF:NEAR,PRINTF_CRLF:NEAR + +; Line by line assembler + +MASKMOD EQU 11000000B +SHMOD EQU 6 +MASKREG EQU 00111000B +SHREG EQU 3 +MASKRM EQU 00000111B +SHRM EQU 0 + +ASSEM: + MOV BP,[CSSAVE] ; Default code segment + MOV DI,OFFSET DG:ASMADD ; Default address + CALL DEFAULT + MOV WORD PTR [ASMADD],DX ; Displacement of disassembly + MOV WORD PTR [ASMADD+2],AX ; Segment + MOV [ASMSP],SP ; Save sp in case of error + +ASSEMLOOP: + MOV SP,[ASMSP] ; Restore sp in case of error + LES DI,DWORD PTR ASMADD ; GET PC + CALL OUTDI ; OUTPUT ADDRESS + PUSH CS + POP ES + PUSH DI + MOV DI,OFFSET DG:ARG_BUF +; No spacing is needed. The format string already has one. +; CALL BLANK ; SKIP A SPACE + XOR AL,AL + STOSB + MOV DX,OFFSET DG:HEX_PTR + CALL STD_PRINTF + POP DI + CALL INBUF ; GET A BUFFER + CALL SCANB + JNZ OPLOOK + RET ; if empty just return + +; At this point ds:si points to the opcode mnemonic... +OPLOOK: + XOR CX,CX ; OP-CODE COUNT = 0 + MOV DI,OFFSET DG:DBMN +OPSCAN: + XOR BX,BX +OPLOOP: + MOV AL,[DI+BX] + CMP AL,[SI+BX] + JZ OPMATCH + INC CX ; INCREMENT OP-CODE COUNT + CMP CX,MAXOP ; CHECK FOR END OF LIST + JB OP1 + JMP ASMERR +OP1: + INC DI ; SCAN FOR NEXT OP-CODE... + CMP BYTE PTR [DI-1],0 + JNZ OP1 + JMP OPSCAN + +OPMATCH: + INC BX ; COMPARE NEXT CHAR + CMP BYTE PTR [DI+BX],0 ; ARE WE DONE? + JNZ OPLOOP ; ..IF NOT KEEP COMPARING + XCHG BX,CX + MOV AX,BX + SHL AX,1 + ADD AX,BX + ADD AX,OFFSET DG:OPTAB + MOV BX,AX + +; CX = COUNT OF CHARS IN OPCODE +; BX = POINTER INTO OPCODE TABLE + + XOR AX,AX + MOV BYTE PTR [AWORD],AL + MOV WORD PTR [MOVFLG],AX ; MOVFLG + TSTFLG + MOV BYTE PTR [SEGFLG],AL ; ZERO SEGMENT REGISTER FLAG + MOV AH,00001010B ; SET UP FOR AA_OPER + MOV AL,BYTE PTR [BX] + MOV WORD PTR [ASSEM1],AX + MOV BYTE PTR [ASSEM_CNT],1 + + ADD SI,CX ; SI POINTS TO OPERAND + JMP WORD PTR [BX+1] + +; 8087 INSTRUCTIONS WITH NO OPERANDS + +FDE_OPER: + MOV AH,0DEH + JMP SHORT FDX_OPER +FDB_OPER: + MOV AH,0DBH + JMP SHORT FDX_OPER +FD9_OPER: + MOV AH,0D9H +FDX_OPER: + XCHG AL,AH + MOV WORD PTR [ASSEM1],AX + +; AAD AND AAM INSTRUCIONS + +AA_OPER: + INC BYTE PTR [ASSEM_CNT] + +; INSTRUCTIONS WITH NO OPERANDS + +NO_OPER: + CALL STUFF_BYTES + CALL SCANP + PUSH CS + POP ES + JNZ OPLOOK + JMP ASSEMLOOP + +; PUSH INSTRUCTION + +PUSH_OPER: + MOV AH,11111111B + JMP SHORT POP1 + +; POP INSTRUCTION + +POP_OPER: + MOV AH,10001111B +POP1: + MOV [ASSEM1],AH + MOV [MIDFLD],AL + INC BYTE PTR [MOVFLG] ; ALLOW SEGMENT REGISTERS + MOV BYTE PTR [AWORD],2 ; MUST BE 16 BITS + CALL GETREGMEM + CALL BUILDIT + MOV AL,[DI+2] + CMP AL,11000000B + JB DATRET + MOV BYTE PTR [DI],1 + CMP BYTE PTR [MOVFLG],2 + JNZ POP2 + AND AL,00011000B + OR AL,00000110B + CMP BYTE PTR [MIDFLD],0 + JNZ POP3 + OR AL,00000001B + JMP SHORT POP3 + +POP2: + AND AL,MASKRM + OR AL,01010000B + CMP BYTE PTR [MIDFLD],0 + JNZ POP3 + OR AL,01011000B +POP3: + MOV BYTE PTR [DI+1],AL + JMP ASSEM_EXIT + +; RET AND RETF INSTRUCTIONS + +GET_DATA16: + CALL SCANB + MOV CX,4 + CALL GETHX + JC DATRET + DEC BYTE PTR [ASSEM1] ; CHANGE OP-CODE + ADD BYTE PTR [ASSEM_CNT],2 ; UPDATE LENGTH + MOV WORD PTR [ASSEM2],DX ; SAVE OFFSET +DATRET: + JMP ASSEM_EXIT + + +; INT INSTRUCTION + +INT_OPER: + CALL SCANB + MOV CX,2 + CALL GETHX + JC ERRV1 + MOV AL,DL + CMP AL,3 + JZ DATRET + INC BYTE PTR [ASSEM1] + JMP DISPX + +; IN INSTRUCTION + +IN_OPER: + CALL SCANB + LODSW + CMP AX,'A'+4C00H ; "AL" + JZ IN_1 + CMP AX,'A'+5800H ; "AX" + JZ IN_0 +ERRV1: + JMP ASMERR +IN_0: + INC BYTE PTR [ASSEM1] +IN_1: + CALL SCANP + CMP WORD PTR [SI],'D'+5800H ; "DX" + JZ DATRET + MOV CX,2 + CALL GETHX + JC ERRV1 + AND BYTE PTR [ASSEM1],11110111B + MOV AL,DL + JMP DISPX + +; OUT INSTRUCTION + +OUT_OPER: + CALL SCANB + CMP WORD PTR [SI],'D'+5800H ; "DX" + JNZ OUT_0 + INC SI + INC SI + JMP SHORT OUT_1 +OUT_0: + AND BYTE PTR [ASSEM1],11110111B + MOV CX,2 + CALL GETHX + JC ERRV1 + INC BYTE PTR [ASSEM_CNT] + MOV BYTE PTR [ASSEM2],DL +OUT_1: + CALL SCANP + LODSW + CMP AX,'A'+4C00H ; "AL" + JZ DATRET + CMP AX,'A'+5800H ; "AX" + JNZ ERRV1 + INC BYTE PTR [ASSEM1] + JMP DATRET + + +; JUMP INSTRUCTION + +JMP_OPER: + INC BYTE PTR [TSTFLG] + +; CALL INSTRUCTION + +CALL_OPER: + MOV BYTE PTR [ASSEM1],11111111B + MOV BYTE PTR [MIDFLD],AL + CALL GETREGMEM + CALL BUILD3 + CMP BYTE PTR [MEMFLG],0 + JNZ CALLJ1 + CMP BYTE PTR [REGMEM],-1 + JZ CALLJ2 + +; INDIRECT JUMPS OR CALLS + +CALLJ1: + CMP BYTE PTR [AWORD],1 +ERRZ4: + JZ ERRV1 + CMP BYTE PTR [AWORD],4 + JNZ ASMEX4 + OR BYTE PTR [DI+2],1000B + JMP SHORT ASMEX4 + +; DIRECT JUMPS OR CALLS + +CALLJ2: + MOV AX,[LOWNUM] + MOV DX,[HINUM] + MOV BL,[AWORD] + CMP BYTE PTR [NUMFLG],0 + JZ ERRZ4 + +; BL = NUMBER OF BYTES IN JUMP +; DX = OFFSET +; AX = SEGMENT + +CALLJ3: + MOV BYTE PTR [DI],5 + MOV [DI+2],AX + MOV [DI+4],DX + + MOV AL,10011010B ; SET UP INTER SEGMENT CALL + CMP BYTE PTR [TSTFLG],0 + JZ CALLJ5 + MOV AL,11101010B ; FIX UP FOR JUMP +CALLJ5: + MOV BYTE PTR [DI+1],AL + CMP BL,4 ; FAR SPECIFIED? + JZ ASMEX4 + OR BL,BL + JNZ CALLJ6 + CMP DX,WORD PTR [ASMADD+2] ; DIFFERENT SEGMENT? + JNZ ASMEX4 + +CALLJ6: + MOV BYTE PTR [DI],3 + MOV AL,11101000B ; SET UP FOR INTRASEGMENT + OR AL,[TSTFLG] + MOV BYTE PTR [DI+1],AL + + MOV AX,[LOWNUM] + SUB AX,WORD PTR [ASMADD] + SUB AX,3 + MOV [DI+2],AX + CMP BYTE PTR [TSTFLG],0 + JZ ASMEX4 + CMP BL,2 + JZ ASMEX4 + + INC AX + MOV CX,AX + CBW + CMP AX,CX + JNZ ASMEX3 + MOV BYTE PTR [DI+1],11101011B + MOV [DI+2],AX + DEC BYTE PTR [DI] +ASMEX4: + JMP ASSEM_EXIT + +; CONDITIONAL JUMPS AND LOOP INSTRUCTIONS + +DISP8_OPER: + MOV BP,WORD PTR [ASMADD+2] ; GET DEFAULT DISPLACEMENT + CALL GET_ADDRESS + SUB DX,WORD PTR [ASMADD] + DEC DX + DEC DX + CALL CHKSIZ + CMP CL,1 + JNZ ERRV2 +DISPX: + INC [ASSEM_CNT] + MOV BYTE PTR [ASSEM2],AL +ASMEX3: + JMP ASSEM_EXIT + +; LDS, LES, AND LEA INSTRUCTIONS + +L_OPER: + CALL SCANB + LODSW + MOV CX,8 + MOV DI,OFFSET DG:REG16 + CALL CHKREG + JZ ERRV2 ; CX = 0 MEANS NO REGISTER + SHL AL,1 + SHL AL,1 + SHL AL,1 + MOV BYTE PTR [MIDFLD],AL + CALL SCANP + CALL GETREGMEM + CMP BYTE PTR [AWORD],0 + JNZ ERRV2 + CALL BUILD2 + JMP SHORT ASEXV + +; DEC AND INC INSTRUCTIONS + +DCINC_OPER: + MOV BYTE PTR [ASSEM1],11111110B + MOV BYTE PTR [MIDFLD],AL + CALL GETREGMEM + CALL BUILDIT + TEST BYTE PTR [DI+1],1 + JZ ASEXV + MOV AL,[DI+2] + CMP AL,MASKMOD + JB ASEXV + AND AL,1111B + OR AL,01000000B + MOV [DI+1],AL + DEC BYTE PTR [DI] +ASEXV: + JMP ASSEM_EXIT + +ERRV2: + JMP ASMERR + +; ESC INSTRUCTION + +ESC_OPER: + INC BYTE PTR [AWORD] + CALL SCANB + MOV CX,2 + CALL GETHX + CMP DX,64 + JAE ERRV2 + CALL SCANP + MOV AX,DX + MOV CL,3 + SHR DX,CL + OR [ASSEM1],DL + AND AL,111B + SHL AL,CL + JMP GROUPE + +; 8087 ARITHMETIC INSTUCTIONS + +; OPERANDS THAT ALLOW THE REVERSE BIT + +FGROUPDS: + CALL SETMID + CALL GETREGMEM2 + CALL BUILD3 + CMP BYTE PTR [MODE],11000000B + JNZ FGROUP1 + MOV AL,[DIRFLG] + OR AL,AL + JZ FEXIT + OR [DI+1],AL ; IF D=1... + XOR BYTE PTR [DI+2],00001000B ; ...REVERSE THE SENSE OF R + JMP SHORT FEXIT + +; HERE WHEN INSTRUCTION COULD HAVE MEMORY OR REGISTER OPERAND + +FGROUPX: + CALL SETMID ; THIS ENTRY POINT FOR 1 MEM OPER + MOV BYTE PTR [DIRFLG],0 + JMP SHORT FGRP2 +FGROUP: + CALL SETMID +FGRP2: + CALL GETREGMEM2 + CALL BUILD3 + CMP BYTE PTR [MODE],11000000B + JNZ FGROUP1 + MOV AL,[DIRFLG] + OR [DI+1],AL + JMP SHORT FEXIT +FGROUP1: + CALL SETMF +FEXIT: + JMP ASSEM_EXIT + +; THESE 8087 INSTRUCTIONS REQUIRE A MEMORY OPERAND +FGROUPB: + MOV AH,5 ; MUST BE TBYTE + JMP SHORT FGROUP3E +FGROUP3W: + MOV AH,2 ; MUST BE WORD + JMP SHORT FGROUP3E +FGROUP3: + MOV AH,-1 ; SIZE CANNOT BE SPECIFIED +FGROUP3E: + MOV [AWORD],AH + CALL SETMID + CALL GETREGMEM + CMP BYTE PTR [MODE],11000000B + JZ FGRPERR +FGRP: + CALL BUILD3 + JMP FEXIT + +; THESE 8087 INSTRUCTIONS REQUIRE A REGISTER OPERAND +FGROUPP: ; 8087 POP OPERANDS + MOV BYTE PTR [AWORD],-1 + CALL SETMID + CALL GETREGMEM2 + CMP BYTE PTR [DIRFLG],0 + JNZ FGRP +FGRPERR: + JMP ASMERR + +FGROUPZ: ; ENTRY POINT WHERE ARG MUST BE MEM + CALL SETMID + MOV BYTE PTR [DIRFLG],0 + CALL GETREGMEM + CMP BYTE PTR [MODE],11000000B + JZ FGRPERR + CALL BUILD3 + CALL SETMF + JMP FEXIT + +; NOT, NEG, MUL, IMUL, DIV, AND IDIV INSTRUCTIONS + +GROUP1: + MOV [ASSEM1],11110110B +GROUPE: + MOV BYTE PTR [MIDFLD],AL + CALL GETREGMEM + CALL BUILDIT + JMP FEXIT + +; SHIFT AND ROTATE INSTRUCTIONS + +ROTOP: + MOV [ASSEM1],11010000B + MOV BYTE PTR [MIDFLD],AL + CALL GETREGMEM + CALL BUILDIT + CALL SCANP + CMP BYTE PTR [SI],'1' + JZ ASMEXV1 + CMP WORD PTR [SI],"LC" ; CL + JZ ROTOP1 +ROTERR: + JMP ASMERR +ROTOP1: + OR BYTE PTR [ASSEM1],10B +ASMEXV1: + JMP ASSEM_EXIT + +; XCHG INSTRUCTION + +EX_OPER: + INC BYTE PTR [TSTFLG] + +; TEST INSTRUCTION + +TST_OPER: + INC BYTE PTR [TSTFLG] + JMP SHORT MOVOP + +; MOV INSTRUCTION + +MOV_OPER: + INC BYTE PTR [MOVFLG] +MOVOP: + XOR AX,AX + JMP SHORT GROUPM + +; ADD, ADC, SUB, SBB, CMP, AND, OR, XOR instructions + +GROUP2: + MOV BYTE PTR [ASSEM1],10000000B +GROUPM: + MOV BYTE PTR [MIDFLD],AL + + PUSH AX + CALL GETREGMEM + CALL BUILD2 + CALL SCANP ; POINT TO NEXT OPERAND + MOV AL,BYTE PTR [ASSEM_CNT] + PUSH AX + CALL GETREGMEM + POP AX + MOV BYTE PTR [DI],AL + POP AX + MOV BL,BYTE PTR [AWORD] + OR BL,BL + JZ ERRV5 + DEC BL + AND BL,1 + OR BYTE PTR [DI+1],BL + + CMP BYTE PTR [MEMFLG],0 + JNZ G21V + CMP BYTE PTR [NUMFLG],0 ; TEST FOR IMMEDIATE DATA + JZ G21V + CMP BYTE PTR [SEGFLG],0 + JNZ ERRV5 + CMP BYTE PTR [TSTFLG],2 ; XCHG? + JNZ IMMED1 +ERRV5: + JMP ASMERR +G21V: + JMP GRP21 + +; SECOND OPERAND WAS IMMEDIATE + +IMMED1: + MOV AL,BYTE PTR [DI+2] + CMP BYTE PTR [MOVFLG],0 + JZ NOTMOV1 + AND AL,11000000B + CMP AL,11000000B + JNZ GRP23 ; not to a register + ; MOVE IMMEDIATE TO REGISTER + MOV AL,BYTE PTR [DI+1] + AND AL,1 ; SET SIZE + PUSHF + SHL AL,1 + SHL AL,1 + SHL AL,1 + OR AL,BYTE PTR [DI+2] ; SET REGISTER + AND AL,00001111B + OR AL,10110000B + MOV BYTE PTR [DI+1],AL + MOV AX,WORD PTR [LOWNUM] + MOV WORD PTR [DI+2],AX + POPF + JZ EXVEC + INC BYTE PTR [DI] +EXVEC: + JMP GRPEX + +NOTMOV1: + AND AL,11000111B + CMP AL,11000000B + JZ IMMACC ; IMMEDIATE TO ACC + + CMP BYTE PTR [TSTFLG],0 + JNZ GRP23 + CMP BYTE PTR [MIDFLD],1*8 ; OR? + JZ GRP23 + CMP BYTE PTR [MIDFLD],4*8 ; AND? + JZ GRP23 + CMP BYTE PTR [MIDFLD],6*8 ; XOR? + JZ GRP23 + TEST BYTE PTR [DI+1],1 ; TEST IF BYTE OPCODE + JZ GRP23 + + MOV AX,[LOWNUM] + MOV BX,AX + CBW + CMP AX,BX + JNZ GRP23 ; SMALL ENOUGH? + + MOV BL,[DI] + DEC BYTE PTR [DI] + OR BYTE PTR [DI+1],10B + JMP SHORT GRP23X + +IMMACC: + MOV AL,BYTE PTR [DI+1] + AND AL,1 + CMP BYTE PTR [TSTFLG],0 + JZ NOTTST + OR AL,10101000B + JMP SHORT TEST1 +NOTTST: + OR AL,BYTE PTR [MIDFLD] + OR AL,100B +TEST1: + MOV BYTE PTR [DI+1],AL + DEC BYTE PTR [DI] + +GRP23: + MOV BL,BYTE PTR [DI] +GRP23X: + XOR BH,BH + ADD BX,DI + INC BX + MOV AX,WORD PTR [LOWNUM] + MOV WORD PTR [BX],AX + INC BYTE PTR [DI] + TEST BYTE PTR [DI+1],1 + JZ GRPEX1 + INC BYTE PTR [DI] +GRPEX1: + JMP GRPEX + +; SECOND OPERAND WAS MEMORY OR REGISTER + +GRP21: + CMP BYTE PTR [SEGFLG],0 + JZ GRP28 ; FIRST OPERAND WAS A SEGMENT REG + MOV AL,BYTE PTR [REGMEM] + TEST AL,10000B + JZ NOTSEG1 +ERRV3: + JMP ASMERR +NOTSEG1: + AND AL,111B + OR BYTE PTR [DI+2],AL + AND BYTE PTR [DI+1],11111110B + CMP BYTE PTR [MEMFLG],0 + JNZ G22V + JMP GRPEX + +GRP28: + AND BYTE PTR [DI+2],11000111B + MOV AL,BYTE PTR [DI+1] ; GET FIRST OPCODE + AND AL,1B + CMP BYTE PTR [MOVFLG],0 + JZ NOTMOV2 + OR AL,10001000B + JMP SHORT MOV1 +NOTMOV2: + CMP BYTE PTR [TSTFLG],0 + JZ NOTTST2 + OR AL,10000100B + CMP BYTE PTR [TSTFLG],2 + JNZ NOTTST2 + OR AL,10B +NOTTST2: + OR AL,BYTE PTR [MIDFLD] ; MIDFLD IS ZERO FOR TST +MOV1: + MOV BYTE PTR [DI+1],AL + CMP BYTE PTR [MEMFLG],0 +G22V: + JZ NotGRP22 + JMP GRP22 +NotGRP22: + +; SECOND OPERAND WAS A REGISTER + + MOV AL,BYTE PTR [REGMEM] + TEST AL,10000B ; SEGMENT REGISTER? + JZ NOTSEG + CMP BYTE PTR [MOVFLG],0 + JZ ERRV3 + MOV BYTE PTR [DI+1],10001100B + +NOTSEG: + AND AL,111B + SHL AL,1 + SHL AL,1 + SHL AL,1 + OR BYTE PTR [DI+2],AL +; ARR 2.4 +; In the case of the XCHG reg,reg and TEST reg,reg we have just built the +; instruction backwards. This is because these two instructions do not have +; the D bit. We need to switch R/S and REG +; +; Good comment Aaron, except that we do NOT switch if a memory operand was +; present for precisely the reason that the D bit is not present +; + CMP BYTE PTR [TSTFLG],0 + JZ NOSWITCH ; Not XCHG or TEST +; +; See if there is a memory operand specified. If the MOD field is 11, then +; we do perform the exchange. +; + MOV AH,[DI+2] + AND AH,MASKMOD + CMP AH,MASKMOD + JNZ NOSWITCH + MOV AH,BYTE PTR [DI+2] + AND AH,MASKRM + SHL AH,1 ; Low three bits to middle three + SHL AH,1 + SHL AH,1 + MOV AL,BYTE PTR [DI+2] + AND AL,MASKREG + SHR AL,1 ; Middle three to low three + SHR AL,1 + SHR AL,1 + OR AL,AH ; Re combine + AND BYTE PTR [DI+2],MASKMOD ; Zap original + OR BYTE PTR [DI+2],AL ; New low 6 bits +NOSWITCH: + + +; SPECIAL FORM OF THE EXCHANGE COMMAND + + CMP BYTE PTR [TSTFLG],2 + JNZ GRPEX + TEST BYTE PTR [DI+1],1 + JZ GRPEX + PUSH AX + MOV AL,BYTE PTR [DI+2] + AND AL,MASKMOD + CMP AL,MASKMOD ; MUST BE REGISTER TO REGISTER + POP AX + JB GRPEX + OR AL,AL + JZ SPECX + MOV AL,[DI+2] + AND AL,MASKRM + JNZ GRPEX + MOV CL,3 + SHR BYTE PTR [DI+2],CL +SPECX: + MOV AL,[DI+2] + AND AL,MASKRM + OR AL,10010000B + MOV BYTE PTR [DI+1],AL + DEC BYTE PTR [DI] + JMP SHORT GRPEX + +; SECOND OPERAND WAS A MEMORY REFERENCE + +GRP22: + CMP BYTE PTR [TSTFLG],0 + JNZ TST2 + OR BYTE PTR [DI+1],10B +TST2: + MOV AL,BYTE PTR [DI+2] + CMP AL,MASKMOD ; MUST BE A REGISTER + JB ASMERR + CMP BYTE PTR [SEGFLG],0 + JZ GRP223 + AND AL,00011000B + JMP SHORT GRP222 +GRP223: + AND AL,MASKRM + SHL AL,1 + SHL AL,1 + SHL AL,1 +GRP222: + OR AL,BYTE PTR [MODE] + OR AL,BYTE PTR [REGMEM] + MOV BYTE PTR [DI+2],AL + MOV AX,WORD PTR [LOWNUM] + MOV WORD PTR [DI+3],AX +GRPSIZ: + MOV BYTE PTR [DI],2 + MOV AL,BYTE PTR [DI+2] + AND AL,11000111B + CMP AL,00000110B + JZ GRP24 + AND AL,MASKMOD + CMP AL,01000000B + JZ GRP25 + CMP AL,10000000B + JNZ GRPEX +GRP24: + INC BYTE PTR [DI] +GRP25: + INC BYTE PTR [DI] + +GRPEX: + CMP BYTE PTR [MOVFLG],0 + JZ ASSEM_EXIT + +; TEST FOR SPECIAL FORM OF MOV AX,[MEM] OR MOV [MEM],AX + + MOV AL,[DI+1] ; GET OP-CODE + AND AL,11111100B + CMP AL,10001000B + JNZ ASSEM_EXIT + CMP BYTE PTR [DI+2],00000110B ; MEM TO AX OR AX TO MEM + JNZ ASSEM_EXIT + MOV AL,BYTE PTR [DI+1] + AND AL,11B + XOR AL,10B + OR AL,10100000B + MOV BYTE PTR [DI+1],AL + DEC BYTE PTR [DI] + MOV AX,[DI+3] + MOV WORD PTR [DI+2],AX + +ASSEM_EXIT: + CALL STUFF_BYTES + JMP ASSEMLOOP + +; Assem error. SI points to character in the input buffer +; which caused error. By subtracting from start of buffer, +; we will know how far to tab over to appear directly below +; it on the terminal. Then print "^ Error". + +ASMERR: + SUB SI,OFFSET DG:(BYTEBUF-10) ; How many char processed so far? + MOV CX,SI ; Parameter for TAB in CX + MOV DI,OFFSET DG:ARG_BUF + CALL TAB ; Directly below bad char + MOV BYTE PTR [DI],0 + MOV DX,OFFSET DG:SYNERR_PTR ; Error message + CALL PRINTF_CRLF + JMP ASSEMLOOP +; +; assemble the different parts into an instruction +; +BUILDIT: + MOV AL,BYTE PTR [AWORD] + OR AL,AL + JNZ BUILD1 +BLDERR: + JMP ASMERR + +BUILD1: + DEC AL + OR BYTE PTR [DI+1],AL ; SET THE SIZE + +BUILD2: + CMP BYTE PTR [NUMFLG],0 ; TEST FOR IMMEDIATE DATA + JZ BUILD3 + CMP BYTE PTR [MEMFLG],0 + JZ BLDERR + +BUILD3: + MOV AL,BYTE PTR [REGMEM] + CMP AL,-1 + JZ BLD1 + TEST AL,10000B ; TEST IF SEGMENT REGISTER + JZ BLD1 + CMP BYTE PTR [MOVFLG],0 + JZ BLDERR + MOV WORD PTR [DI+1],10001110B + INC BYTE PTR [MOVFLG] + INC BYTE PTR [SEGFLG] + AND AL,00000011B + SHL AL,1 + SHL AL,1 + SHL AL,1 + OR AL,MASKMOD + MOV BYTE PTR [DI+2],AL + RET + +BLD1: + AND AL,00000111B +BLD4: + OR AL,BYTE PTR [MODE] + OR AL,BYTE PTR [MIDFLD] + MOV BYTE PTR [DI+2],AL + MOV AX,WORD PTR [LOWNUM] + MOV WORD PTR [DI+3],AX + RET + +GETREGMEM: + MOV BYTE PTR [F8087],0 +GETREGMEM2: + CALL SCANP + XOR AX,AX + MOV WORD PTR [LOWNUM],AX ; OFFSET + MOV WORD PTR [DIFLG],AX ; DIFLG+SIFLG + MOV WORD PTR [BXFLG],AX ; BXFLG+BPFLG + MOV WORD PTR [NEGFLG],AX ; NEGFLG+NUMFLG + MOV WORD PTR [MEMFLG],AX ; MEMFLG+REGFLG + DEC AL + CMP BYTE PTR [F8087],0 + JZ PUTREG + MOV AL,1 ; DEFAULT 8087 REG IS 1 +PUTREG: + MOV BYTE PTR [REGMEM],AL + +GETLOOP: + MOV BYTE PTR [NEGFLG],0 +GETLOOP1: + MOV AX,WORD PTR [SI] + CMP AL,',' + JZ GOMODE + CMP AL,13 + JZ GOMODE + CMP AL,';' + JZ GOMODE + CMP AL,9 + JZ GETTB + CMP AL,' ' + JNZ GOGET +GETTB: + INC SI + JMP GETLOOP1 +GOGET: + JMP GETINFO + +; DETERMINE THE MODE BITS + +GOMODE: + MOV DI,OFFSET DG:ASSEM_CNT + MOV BYTE PTR [MODE],11000000B + MOV BYTE PTR [ASSEM_CNT],2 + CMP BYTE PTR [MEMFLG],0 + JNZ GOMODE1 + MOV AL,[NUMFLG] + OR AL,[REGFLG] + JNZ MORET + OR AL,[F8087] + JZ ERRET + MOV AL,[DI+1] + OR AL,[DIRFLG] + CMP AL,0DCH ; ARITHMETIC? + JNZ MORET + MOV BYTE PTR [DI+1],0DEH ; ADD POP TO NULL ARG 8087 +MORET: + RET +ERRET: + JMP ASMERR + +GOMODE1: + MOV BYTE PTR [MODE],0 + CMP BYTE PTR [NUMFLG],0 + JZ GOREGMEM + + MOV BYTE PTR [DI],4 + MOV AX,WORD PTR [DIFLG] + OR AX,WORD PTR [BXFLG] + JNZ GOMODE2 + MOV BYTE PTR [REGMEM],00000110B + RET + +GOMODE2: + MOV BYTE PTR [MODE],10000000B + CALL CHKSIZ1 + CMP CL,2 + JZ GOREGMEM + DEC BYTE PTR [DI] + MOV BYTE PTR [MODE],01000000B + +; DETERMINE THE REG-MEM BITS + +GOREGMEM: + MOV BX,WORD PTR [BXFLG] + MOV CX,WORD PTR [DIFLG] + XOR DX,DX +GOREG0: + MOV AL,BL ; BX + ADD AL,CH ; SI + CMP AL,2 + JZ GOGO + INC DL + MOV AL,BL + ADD AL,CL + CMP AL,2 + JZ GOGO + INC DL + MOV AL,BH + ADD AL,CH + CMP AL,2 + JZ GOGO + INC DL + MOV AL,BH + ADD AL,CL + CMP AL,2 + JZ GOGO + INC DL + OR CH,CH + JNZ GOGO + INC DL + OR CL,CL + JNZ GOGO + INC DL ; BP+DISP + OR BH,BH + JZ GOREG1 + CMP BYTE PTR [MODE],0 + JNZ GOGO + MOV BYTE PTR [MODE],01000000B + INC BYTE PTR [DI] + DEC DL +GOREG1: + INC DL ; BX+DISP +GOGO: + MOV BYTE PTR [REGMEM],DL + RET + +GETINFO: + CMP AX,'EN' ; NEAR + JNZ GETREG3 +GETREG0: + MOV DL,2 +GETRG01: + CALL SETSIZ1 +GETREG1: + CALL SCANS + MOV AX,WORD PTR [SI] + CMP AX,"TP" ; PTR + JZ GETREG1 + JMP GETLOOP + +GETREG3: + MOV CX,5 + MOV DI,OFFSET DG:SIZ8 + CALL CHKREG ; LOOK FOR BYTE, WORD, DWORD, ETC. + JZ GETREG41 + INC AL + MOV DL,AL + JMP GETRG01 + +GETREG41: + MOV AX,[SI] + CMP BYTE PTR [F8087],0 + JZ GETREG5 + CMP AX,"TS" ; 8087 STACK OPERAND + JNZ GETREG5 + CMP BYTE PTR [SI+2],',' + JNZ GETREG5 + MOV BYTE PTR [DIRFLG],0 + ADD SI,3 + JMP GETLOOP + +GETREG5: + CMP AX,"HS" ; SHORT + JZ GETREG1 + + CMP AX,"AF" ; FAR + JNZ GETRG51 + CMP BYTE PTR [SI+2],'R' + JNZ GETRG51 + ADD SI,3 + MOV DL,4 + JMP GETRG01 + +GETRG51: + CMP AL,'[' + JNZ GETREG7 +GETREG6: + INC BYTE PTR [MEMFLG] +GETREGADD: + INC SI + JMP GETLOOP + +GETREG7: + CMP AL,']' + JZ GETREG6 + CMP AL,'.' + JZ GETREG6 + CMP AL,'+' + JZ GETREGAdd + CMP AL,'-' + JNZ GETREG8 + INC BYTE PTR [NEGFLG] + INC SI + JMP GETLOOP1 + +GETREG8: ; LOOK FOR A REGISTER + CMP BYTE PTR [F8087],0 + JZ GETREGREG + CMP AX,"TS" + JNZ GETREGREG + CMP BYTE PTR [SI+2],'(' + JNZ GETREGREG + CMP BYTE PTR [SI+4],')' + JNZ ASMPOP + MOV AL,[SI+3] + SUB AL,'0' + JB ASMPOP + CMP AL,7 + JA ASMPOP + MOV [REGMEM],AL + INC BYTE PTR [REGFLG] + ADD SI,5 + CMP WORD PTR [SI],"S," + JNZ ZLOOP + CMP BYTE PTR [SI+2],'T' + JNZ ZLOOP + ADD SI,3 +ZLOOP: + JMP GETLOOP + +GETREGREG: + MOV CX,20 + MOV DI,OFFSET DG:REG8 + CALL CHKREG + JZ GETREG12 ; CX = 0 MEANS NO REGISTER + MOV BYTE PTR [REGMEM],AL + INC BYTE PTR [REGFLG] ; TELL EVERYONE WE FOUND A REG + CMP BYTE PTR [MEMFLG],0 + JNZ NOSIZE + CALL SETSIZ +INCSI2: + ADD SI,2 + JMP GETLOOP + +NOSIZE: + CMP AL,11 ; BX REGISTER? + JNZ GETREG9 + CMP WORD PTR [BXFLG],0 + JZ GETOK +ASMPOP: + JMP ASMERR + +GETOK: + INC BYTE PTR [BXFLG] + JMP INCSI2 +GETREG9: + CMP AL,13 ; BP REGISTER? + JNZ GETREG10 + CMP WORD PTR [BXFLG],0 + JNZ ASMPOP + INC BYTE PTR [BPFLG] + JMP INCSI2 +GETREG10: + CMP AL,14 ; SI REGISTER? + JNZ GETREG11 + CMP WORD PTR [DIFLG],0 + JNZ ASMPOP + INC BYTE PTR [SIFLG] + JMP INCSI2 +GETREG11: + CMP AL,15 ; DI REGISTER? + JNZ ASMPOP ; *** error + CMP WORD PTR [DIFLG],0 + JNZ ASMPOP + INC BYTE PTR [DIFLG] + JMP INCSI2 + +GETREG12: ; BETTER BE A NUMBER! + MOV BP,WORD PTR [ASMADD+2] + CMP BYTE PTR [MEMFLG],0 + JZ GTRG121 +GTRG119: + MOV CX,4 +GTRG120: + CALL GETHX + JMP SHORT GTRG122 +GTRG121: + MOV CX,2 + CMP BYTE PTR [AWORD],1 + JZ GTRG120 + CMP BYTE PTR [AWORD],CL + JZ GTRG119 + CALL GET_ADDRESS +GTRG122: + JC ASMPOP + MOV [HINUM],AX + CMP BYTE PTR [NEGFLG],0 + JZ GETREG13 + NEG DX +GETREG13: + ADD WORD PTR [LOWNUM],DX + INC BYTE PTR [NUMFLG] +GETLOOPV: + JMP GETLOOP + +CHKREG: + PUSH CX + INC CX + REPNZ SCASW + POP AX + SUB AX,CX + OR CX,CX + RET + +STUFF_BYTES: + PUSH SI + LES DI,DWORD PTR ASMADD + MOV SI,OFFSET DG:ASSEM_CNT + XOR AX,AX + LODSB + MOV CX,AX + JCXZ STUFFRET + REP MOVSB + MOV WORD PTR [ASMADD],DI +STUFFRET: + POP SI + RET + +SETSIZ: + MOV DL,1 + TEST AL,11000B ; 16 BIT OR SEGMENT REGISTER? + JZ SETSIZ1 + INC DL +SETSIZ1: + CMP BYTE PTR [AWORD],0 + JZ SETSIZ2 + CMP BYTE PTR [AWORD],DL + JZ SETSIZ2 +SETERR: + POP DX + JMP ASMPOP +SETSIZ2: + MOV BYTE PTR [AWORD],DL + RET + +; DETERMINE IF NUMBER IN AX:DX IS 8 BITS, 16 BITS, OR 32 BITS + +CHKSIZ: + MOV CL,4 + CMP AX,BP + JNZ RETCHK +CHKSIZ1: + MOV CL,2 + MOV AX,DX + CBW + CMP AX,DX + JNZ RETCHK + DEC CL +RETCHK: + RET + +; get first character after first space + +SCANS: + CMP BYTE PTR [SI],13 + JZ RETCHK + CMP BYTE PTR [SI],'[' + JZ RETCHK + LODSB + CMP AL,' ' + JZ SCANBV + CMP AL,9 + JNZ SCANS +SCANBV: + JMP SCANB + +; Set up for 8087 op-codes + +SETMID: + MOV BYTE PTR [ASSEM1],0D8H + MOV AH,AL + AND AL,111B ; SET MIDDLE BITS OF SECOND BYTE + SHL AL,1 + SHL AL,1 + SHL AL,1 + MOV [MIDFLD],AL + MOV AL,AH ; SET LOWER BITS OF FIRST BYTE + SHR AL,1 + SHR AL,1 + SHR AL,1 + OR [ASSEM1],AL + MOV BYTE PTR [F8087],1 ; INDICATE 8087 OPERAND + MOV BYTE PTR [DIRFLG],100B + RET + +; Set MF bits for 8087 op-codes + +SETMF: + MOV AL,[AWORD] + TEST BYTE PTR [DI+1],10B + JNZ SETMFI + AND BYTE PTR [DI+1],11111001B ; CLEAR MF BITS + CMP AL,3 ; DWORD? + JZ SETMFRET + CMP AL,4 ; QWORD? + JZ SETMFRET2 + TEST BYTE PTR [DI+1],1 + JZ SETMFERR + CMP AL,5 ; TBYTE? + JZ SETMFRET3 + JMP SHORT SETMFERR + +SETMFI: + CMP AL,3 ; DWORD? + JZ SETMFRET + CMP AL,2 ; WORD? + JZ SETMFRET2 + TEST BYTE PTR [DI+1],1 + JZ SETMFERR + CMP AL,4 ; QWORD? + JNZ SETMFERR + OR BYTE PTR [DI+1],111B +SETMFRET3: + OR BYTE PTR [DI+1],011B + OR BYTE PTR [DI+2],101000B + JMP SHORT SETMFRET +SETMFRET2: + OR BYTE PTR [DI+1],100B +SETMFRET: + RET + +SETMFERR: + JMP ASMPOP + + +DW_OPER: + MOV BP,1 + JMP SHORT DBEN + +DB_OPER: + XOR BP,BP +DBEN: + MOV DI,OFFSET DG:ASSEM_CNT + DEC BYTE PTR [DI] + INC DI +DB0: + XOR BL,BL + CALL SCANP + JNZ DB1 +DBEX: + JMP ASSEM_EXIT +DB1: + OR BL,BL + JNZ DB3 + MOV BH,BYTE PTR [SI] + CMP BH,"'" + JZ DB2 + CMP BH,'"' + JNZ DB4 +DB2: + INC SI + INC BL +DB3: + LODSB + CMP AL,13 + JZ DBEX + CMP AL,BH + JZ DB0 + STOSB + INC BYTE PTR [ASSEM_CNT] + JMP DB3 +DB4: + MOV CX,2 + CMP BP,0 + JZ DB41 + MOV CL,4 +DB41: + PUSH BX + CALL GETHX + POP BX + JNC DB5 + JMP ASMERR +DB5: + MOV AX,DX + CMP BP,0 + JZ DB6 + STOSW + INC BYTE PTR [ASSEM_CNT] + JMP SHORT DB7 +DB6: + STOSB +DB7: + INC BYTE PTR [ASSEM_CNT] + JMP DB0 + +; ORG pseudo op + +DOORG: + MOV BP,WORD PTR ASMADD+2 + CALL GET_ADDRESS + MOV WORD PTR ASMADD,DX + MOV WORD PTR ASMADD+2,AX + JMP ASSEMLOOP + +CODE ENDS + END ASSEM + \ 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 @@ + PAGE 60,132 ; + TITLE DEBCOM1.ASM - PART1 DEBUGGER COMMANDS PC DOS +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DECOM1.SAL +; +; DESCRIPTIVE NAME: DEBUGGING TOOL +; +; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT DBCS HANDLING DMS:6/17/87 +; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87 +; - IMPLEMENT > 32MB SUPPORT DMS:6/17/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +;======================= END OF SPECIFICATIONS =========================== + +; Routines to perform debugger commands except ASSEMble and UASSEMble + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBCOM1 + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM +.CREF +.LIST + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + EXTRN SYNERR_PTR:BYTE + EXTRN DISPB:WORD,DSIZ:BYTE,DSSAVE:WORD + IF SYSVER + EXTRN CIN:DWORD,PFLAG:BYTE + ENDIF +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN DEFLEN:WORD,BYTEBUF:BYTE,DEFDUMP:BYTE + EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE + EXTRN ONE_CHAR_BUF:BYTE,ONE_CHAR_BUF_PTR:WORD +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE +ASSUME CS:DG,DS:DG,ES:DG,SS:DG + PUBLIC HEXCHK,GETHEX1,PRINT,DSRANGE,ADDRESS,HEXIN,PERROR + PUBLIC GETHEX,GET_ADDRESS,GETEOL,GETHX,PERR + PUBLIC PERR,MOVE,DUMP,ENTERDATA,FILL,SEARCH,DEFAULT + IF SYSVER + PUBLIC IN + EXTRN DISPREG:NEAR,DEVIOCALL:NEAR + ENDIF + EXTRN CRLF:NEAR,OUTDI:NEAR,OUTSI:NEAR,SCANP:NEAR + EXTRN SCANB:NEAR,BLANK:NEAR,TAB:NEAR,COMMAND:NEAR + EXTRN HEX:NEAR,BACKUP:NEAR + EXTRN PRINTF_CRLF:NEAR,HEX_ADDRESS_ONLY:NEAR,HEX_ADDRESS_STR:NEAR + EXTRN STD_PRINTF:NEAR +DEBCOM1: +; RANGE - Looks for parameters defining an address range. +; The first parameter is the starting address. The second parameter +; may specify the ending address, or it may be preceded by +; "L" and specify a length (4 digits max), or it may be +; omitted and a length of 128 bytes is assumed. Returns with +; segment in AX, displacement in DX, and length in CX. +DSRANGE: + MOV BP,[DSSAVE] ; Set default segment to DS + MOV [DEFLEN],128 ; And default length to 128 bytes +RANGE: + CALL ADDRESS + + PUSH AX ; Save segment + PUSH DX ; Save offset + CALL SCANP ; Get to next parameter + + MOV AL,[SI] + CMP AL,UPPER_L ; Length indicator? + JE GETLEN + + MOV DX,[DEFLEN] ; Default length + CALL HEXIN ; Second parameter present? + + JC GETDEF ; If not, use default + + MOV CX,4 + CALL GETHEX ; Get ending address (same segment) + + MOV CX,DX ; Low 16 bits of ending addr. + POP DX ; Low 16 bits of starting addr. + SUB CX,DX ; Compute range + JAE DSRNG2 + +DSRNG1: + JMP PERROR ; Negative range +DSRNG2: + INC CX ; Include last location +; JCXZ DSRNG1 ; Wrap around error +; Removing this instruction allows 0 FFFF to valid range + POP AX ; Restore segment + RET +GETDEF: + POP CX ; get original offset + PUSH CX ; save it + NEG CX ; rest of segment + JZ RNGRET ; use default + + CMP CX,DX ; more room in segment? + JAE RNGRET ; yes, use default + + JMP RNGRET1 ; no, length is in CX + +GETLEN: + INC SI ; Skip over "L" to length + MOV CX,4 ; Length may have 4 digits + CALL GETHEX ; Get the range + +RNGRET: + MOV CX,DX ; Length +RNGRET1: + POP DX ; Offset + MOV AX,CX + ADD AX,DX + JNC OKRET + + CMP AX,1 + JAE DSRNG1 ; Look for wrap error + +OKRET: + POP AX ; Segment + RET +DEFAULT: +; DI points to default address and CX has default length + CALL SCANP + + JZ USEDEF ; Use default if no parameters + + MOV [DEFLEN],CX + CALL RANGE + + JMP GETEOL + +USEDEF: + MOV SI,DI + LODSW ; Get default displacement + MOV DX,AX + LODSW ; Get default segment + RET + +; Dump an area of memory in both hex and ASCII +DUMP: + MOV BP,[DSSAVE] + MOV CX,DISPB + MOV DI,OFFSET DG:DEFDUMP + CALL DEFAULT ; Get range if specified + + MOV DS,AX ; Set segment + ASSUME DS:NOTHING + + MOV SI,DX ; SI has displacement in segment + PUSH SI ; save SI away + MOV AL,DSIZ + XOR AH,AH + XOR AX,-1 + AND SI,AX ; convert to para number + MOV DI,OFFSET DG:ARG_BUF ; Build the output str in arg_buf + CALL OUTSI ; display location + + POP SI ; get SI back +; Determine where the registers display should begin. + MOV AX,SI ; move offset + MOV AH,3 ; spaces per byte + AND AL,DSIZ ; convert to real offset + MUL AH ; 3 char positions per byte of output + OR AL,AL ; at beginning? + JZ INROW ; if so, then no movement. + + PUSH CX + MOV CX,AX + CALL TAB + + POP CX +INROW: + PUSH SI ; Save address for ASCII dump +BYTE0: + CALL BLANK ; Space between bytes +BYTE1: + LODSB ; Get byte to dump + CALL HEX ; and display it + + POP DX ; DX has start addr. for ASCII dump + DEC CX ; Drop loop count + JZ ASCII ; If through do ASCII dump + + MOV AX,SI + TEST AL,DSIZ ; On row boundary? + JZ ENDROW + + PUSH DX ; Didn't need ASCII addr. yet + TEST AL,7 ; On 8-byte boundary? + JNZ BYTE0 + + MOV AL,CHAR_MINUS ; Mark every 8 bytes with "-" + STOSB + JMP SHORT BYTE1 + +ENDROW: + CALL ASCII ; Show it in ASCII + + MOV DI,OFFSET DG:ARG_BUF ; Build the output str in arg_buf + CALL OUTSI ; Get the address at start of line + + JMP INROW ; Loop until count is zero + +; Produce a dump of the ascii text characters. We take the current SI which +; contains the byte after the last one dumped. From this we determine how +; many spaces we need to output to get to the ascii column. Then we look at +; the beginning address of the dump to tsee how many spaces we need to indent. +ASCII: + PUSH CX ; Save count of remaining bytes +; Determine how many spaces to go until the ASCII column. + MOV AX,SI ; get offset of next byte + DEC AL + AND AL,DSIZ + INC AL +; AX now has the number of bytes that we have displayed: 1 to Dsiz+1. +; Compute characters remaining to be displayed. We *always* put the ASCII +; dump in column 51 (or whereever) + SUB AL,10H ; get negative of number + DEC AL ; + NEG AL ; convert to positive + CBW ; convert to word +; 3 character positions for each byte displayed. + MOV CX,AX + SHL AX,1 + ADD CX,AX +; Compute indent for ascii dump + MOV AX,DX + AND AL,DSIZ + XOR AH,AH + ADD CX,AX +; Tab over + CALL TAB + +; Set up for true dump + MOV CX,SI + MOV SI,DX + SUB CX,SI +ASCDMP: + LODSB ; Get ASCII byte to dump + CMP AL,CHAR_RUBOUT + JAE NOPRT ; Don't print RUBOUT or above + + CMP AL,CHAR_BLANK + JAE PRIN ; print space through RUBOUT-1 + +NOPRT: + MOV AL,CHAR_PERIOD ; If unprintable character +PRIN: + STOSB + LOOP ASCDMP ; CX times + MOV AL,0 + STOSB + PUSH DS + PUSH CS + POP DS + ASSUME DS:DG + + CALL HEX_ADDRESS_STR + + CALL CRLF + + POP DS + ASSUME DS:NOTHING + + POP CX ; Restore overall dump len + MOV WORD PTR [DEFDUMP],SI + MOV WORD PTR [DEFDUMP+WORD],DS ; Save last address as def + RET + + ASSUME DS:DG +; Block move one area of memory to another Overlapping moves are performed +; correctly, i.e., so that a source byte is not overwritten until after it has +; been moved. +MOVE: + CALL DSRANGE ; Get range of source area + + PUSH CX ; Save length + PUSH AX ; Save segment + PUSH DX ; Save source displacement + CALL ADDRESS ; Get destination address (sam + + CALL GETEOL ; Check for errors + + POP SI + MOV DI,DX ; Set dest. displacement + POP BX ; Source segment + MOV DS,BX + MOV ES,AX ; Destination segment + POP CX ; Length + CMP DI,SI ; Check direction of move + SBB AX,BX ; Extend the CMP to 32 bits + JB COPYLIST ; Move forward into lower mem. + +; Otherwise, move backward. Figure end of source and destination +; areas and flip direction flag. + DEC CX + ADD SI,CX ; End of source area + ADD DI,CX ; End of destination area + STD ; Reverse direction + INC CX +COPYLIST: + MOVSB ; Do at least 1 - Range is 1-1 + DEC CX + REP MOVSB ; Block move +RET1: + RET + +; Fill an area of memory with a list values. If the list +; is bigger than the area, don't use the whole list. If the +; list is smaller, repeat it as many times as necessary. +FILL: + CALL DSRANGE ; Get range to fill + + PUSH CX ; Save length + PUSH AX ; Save segment number + PUSH DX ; Save displacement + CALL LIST ; Get list of values to fill w + + POP DI ; Displacement in segment + POP ES ; Segment + POP CX ; Length + CMP BX,CX ; BX is length of fill list + MOV SI,OFFSET DG:BYTEBUF ; List is in byte buffer + JCXZ BIGRNG + + JAE COPYLIST ; If list is big, copy part of + +BIGRNG: + SUB CX,BX ; How much bigger is area than + XCHG CX,BX ; CX=length of list + PUSH DI ; Save starting addr. of area + REP MOVSB ; Move list into area + POP SI +; The list has been copied into the beginning of the +; specified area of memory. SI is the first address +; of that area, DI is the end of the copy of the list +; plus one, which is where the list will begin to repeat. +; All we need to do now is copy [SI] to [DI] until the +; end of the memory area is reached. This will cause the +; list to repeat as many times as necessary. + MOV CX,BX ; Length of area minus list + PUSH ES ; Different index register + POP DS ; requires different segment r + JMP SHORT COPYLIST ; Do the block move + +; Search a specified area of memory for given list of bytes. +; Print address of first byte of each match. +SEARCH: + CALL DSRANGE ; Get area to be searched + + PUSH CX ; Save count + PUSH AX ; Save segment number + PUSH DX ; Save displacement + CALL LIST ; Get search list + + DEC BX ; No. of bytes in list-1 + POP DI ; Displacement within segment + POP ES ; Segment + POP CX ; Length to be searched + SUB CX,BX ; minus length of list +SCAN: + MOV SI,OFFSET DG:BYTEBUF ; List kept in byte buffer + LODSB ; Bring first byte into AL +DOSCAN: + SCASB ; Search for first byte + LOOPNE DOSCAN ; Do at least once by using LO + + JNZ RET1 ; Exit if not found + + PUSH BX ; Length of list minus 1 + XCHG BX,CX + PUSH DI ; Will resume search here + REPE CMPSB ; Compare rest of string + MOV CX,BX ; Area length back in CX + POP DI ; Next search location + POP BX ; Restore list length + JNZ TTEST ; Continue search if no match + + DEC DI ; Match address + CALL OUTDI ; Print it + + INC DI ; Restore search address + CALL HEX_ADDRESS_ONLY ; Print the addresss + + CALL CRLF + +TTEST: + JCXZ RET1 + + JMP SHORT SCAN ; Look for next occurrence + +; Get the next parameter, which must be a hex number. +; CX is maximum number of digits the number may have. + +;========================================================================= +; GETHX: This routine calculates the binary representation of an address +; entered in ASCII by a user. GETHX has been modified to provide +; support for sector addresses > 32mb. To do this the bx register +; has been added to provide a 32 bit address. BX is the high word +; and DX is the low word. For routines that rely on DX for a 16 +; bit address, the use of BX will have no effect. +; +; Date : 6/16/87 +;========================================================================= + +GETHX: + CALL SCANP +GETHX1: + XOR DX,DX ; Initialize the number + xor bx,bx ;an000;initialize high word for + ; sector address + CALL HEXIN ; Get a hex digit + + JC HXERR ; Must be one valid digit + + MOV DL,AL ; First 4 bits in position +GETLP: + INC SI ; Next char in buffer + DEC CX ; Digit count + CALL HEXIN ; Get another hex digit? + + JC RETHX ; All done if no more digits + + STC + JCXZ HXERR ; Too many digits? + + + call ADDRESS_32_BIT ;an000;multiply by 32 + JMP SHORT GETLP ; Get more digits + +GETHEX: + CALL GETHX ; Scan to next parameter + + JMP SHORT GETHX2 + +GETHEX1: + CALL GETHX1 +GETHX2: + JC PERROR +RETHX: + CLC +HXERR: + RET + +; Check if next character in the input buffer is a hex digit +; and convert it to binary if it is. Carry set if not. +HEXIN: + MOV AL,[SI] +; Check if AL is a hex digit and convert it to binary if it +; is. Carry set if not. +HEXCHK: + SUB AL,CHAR_ZERO ; Kill ASCII numeric bias + JC RET2 + + CMP AL,10 + CMC + JNC RET2 ; OK if 0-9 + + AND AL,5FH + SUB AL,7 ; Kill A-F bias + CMP AL,10 + JC RET2 + + CMP AL,16 + CMC +RET2: + RET + +; Process one parameter when a list of bytes is +; required. Carry set if parameter bad. Called by LIST. +LISTITEM: + CALL SCANP ; Scan to parameter + + CALL HEXIN ; Is it in hex? + + JC STRINGCHK ; If not, could be a string + + MOV CX,2 ; Only 2 hex digits for bytes + push bx ;an000;save it - we stomp it + CALL GETHEX ; Get the byte value + pop bx ;an000;restore it + + MOV [BX],DL ; Add to list + INC BX +GRET: + CLC ; Parameter was OK + RET + +STRINGCHK: + MOV AL,[SI] ; Get first character of param + CMP AL,SINGLE_QUOTE ; String? + JZ STRING + + CMP AL,DOUBLE_QUOTE ; Either quote is all right + JZ STRING + + STC ; Not string, not hex - bad + RET +STRING: + MOV AH,AL ; Save for closing quote + INC SI +STRNGLP: + LODSB ; Next char of string + CMP AL,CR ; Check for end of line + JZ PERR ; Must find a close quote + + CMP AL,AH ; Check for close quote + JNZ STOSTRG ; Add new character to list + + CMP AH,[SI] ; Two quotes in a row? + JNZ GRET ; If not, we're done + + INC SI ; Yes - skip second one +STOSTRG: + MOV [BX],AL ; Put new char in list + INC BX + JMP SHORT STRNGLP ; Get more characters + +; Get a byte list for ENTER, FILL or SEARCH. Accepts any number +; of 2-digit hex values or character strings in either single +; (') or double (") quotes. +LIST: + MOV BX,OFFSET DG:BYTEBUF ; Put byte list in the byte buffer +LISTLP: + CALL LISTITEM ; Process a parameter + + JNC LISTLP ; If OK, try for more + + SUB BX,OFFSET DG:BYTEBUF ; BX now has no. of bytes in list + JZ PERROR ; List must not be empty + +; Make sure there is nothing more on the line except for +; blanks and carriage return. If there is, it is an +; unrecognized parameter and an error. +GETEOL: + CALL SCANB ; Skip blanks + + JNZ PERROR ; Better be a RETURN +RET3: + RET + +; Command error. SI has been incremented beyond the command letter so it must +; decremented for the error pointer to work. +PERR: + DEC SI +; Syntax error. SI points to character in the input buffer which caused +; error. By subtracting from start of buffer, we will know how far to tab +; over to appear directly below it on the terminal. Then print "^ Error". +PERROR: + SUB SI,OFFSET DG:(BYTEBUF-1) ; How many char processed so far? + MOV CX,SI ; Parameter for TAB in CX + MOV DI,OFFSET DG:ARG_BUF ; + CALL TAB ; Directly below bad char + + MOV BYTE PTR [DI],0 ; nul terminate the tab + MOV DX,OFFSET DG:SYNERR_PTR ; Error message +; Print error message and abort to command level +PRINT: + CALL PRINTF_CRLF + + JMP COMMAND + +; Gets an address in Segment:Displacement format. Segment may be omitted +; and a default (kept in BP) will be used, or it may be a segment +; register (DS, ES, SS, CS). Returns with segment in AX, OFFSET in DX. +ADDRESS: + CALL GET_ADDRESS + + JC PERROR + +ADRERR: + STC + RET + +GET_ADDRESS: + CALL SCANP + + MOV AL,[SI+1] + CMP AL,UPPER_S + JZ SEGREG + + MOV CX,4 + CALL GETHX + + JC ADRERR + + MOV AX,BP ; Get default segment + CMP BYTE PTR [SI],CHAR_COLON + JNZ GETRET + + PUSH DX +GETDISP: + INC SI ; Skip over ":" + MOV CX,4 + CALL GETHX + + POP AX + JC ADRERR + +GETRET: + CLC + RET + +SEGREG: + MOV AL,[SI] + MOV DI,OFFSET DG:SEGLET ; SEGLET DB "CSED" + MOV CX,4 + REPNE SCASB + JNZ ADRERR + + INC SI + INC SI + SHL CX,1 + MOV BX,CX + CMP BYTE PTR [SI],CHAR_COLON + JNZ ADRERR + + PUSH [BX+DSSAVE] + JMP SHORT GETDISP + +SEGLET DB "CSED" ; First letter of each of the segregs: CS,SS,ES,DS + +; Short form of ENTER command. A list of values from the +; command line are put into memory without using normal +; ENTER mode. +GETLIST: + CALL LIST ; Get the bytes to enter + + POP DI ; Displacement within segment + POP ES ; Segment to enter into + MOV SI,OFFSET DG:BYTEBUF ; List of bytes is in byte buffer + MOV CX,BX ; Count of bytes + REP MOVSB ; Enter that byte list + RET + +; Enter values into memory at a specified address. If the line contains +; nothing but the address we go into "enter mode", where the address and its +; current value are printed and the user may change it if desired. To change, +; type in new value in hex. Backspace works to correct errors. If an illegal +; hex digit or too many digits are typed, the bell is sounded but it is +; otherwise ignored. To go to the next byte (with or without change), hit +; space bar. To back CLDto a previous address, type "-". On every 8-byte +; boundary a new line is started and the address is printed. To terminate +; command, type carriage return. +; Alternatively, the list of bytes to be entered may be included on the +; original command line immediately following the address. This is in regular +; LIST format so any number of hex values or strings in quotes may be entered. +ENTERDATA: + MOV BP,[DSSAVE] ; Set default segment to DS + CALL ADDRESS + + PUSH AX ; Save for later + PUSH DX + CALL SCANB ; Any more parameters? + + JNZ GETLIST ; If not end-of-line get list + + POP DI ; Displacement of ENTER + POP ES ; Segment +GETROW: + CALL OUTDI ; Print address of entry + + PUSH DI + PUSH ES + PUSH DS + POP ES + MOV DI,OFFSET DG:ARG_BUF + CALL BLANK + + XOR AL,AL + STOSB + CALL HEX_ADDRESS_STR + + POP ES + POP DI +GETBYTE: + MOV AL,ES:[DI] ; Get current value + PUSH DI + PUSH ES + PUSH DS + POP ES + MOV DI,OFFSET DG:ARG_BUF + CALL HEX ; And display it + + MOV AL,CHAR_PERIOD + STOSB + XOR AL,AL + STOSB + MOV DX,OFFSET DG:ARG_BUF_PTR + CALL STD_PRINTF + + POP ES + POP DI +LOOK_AGAIN: + MOV CX,2 ; Max of 2 digits in new value + MOV DX,0 ; Intial new value +GETDIG: + CALL INPT ; Get digit from user + + MOV AH,AL ; Save + CALL HEXCHK ; Hex digit? + + XCHG AH,AL ; Need original for echo + JC NOHEX ; If not, try special command + + MOV DH,DL ; Rotate new value + MOV DL,AH ; And include new digit + LOOP GETDIG ; At most 2 digits + +; We have two digits, so all we will accept now is a command. +DWAIT: + CALL INPT ; Get command character +NOHEX: + CMP AL,CHAR_BACKSPACE ; Backspace + JZ BS + + CMP AL,CHAR_RUBOUT ; RUBOUT + JZ RUB + + CMP AL,CHAR_MINUS ; Back up to previous address + JZ PREV + + CMP AL,CR ; All done with command? + JZ EOL + + CMP AL,CHAR_BLANK ; Go to next address + JZ NEXT + + MOV AL,CHAR_BACKSPACE + CALL OUT_CHAR ; Back up over illegal character + + CALL BACKUP + + JCXZ DWAIT + + JMP SHORT GETDIG + +RUB: + MOV AL,CHAR_BACKSPACE + CALL OUT_char +BS: + CMP CL,2 ; CX=2 means nothing typed yet + JZ PUTDOT ; Put back the dot we backed up over + + INC CL ; Accept one more character + MOV DL,DH ; Rotate out last digit + MOV DH,CH ; Zero this digit + CALL BACKUP ; Physical backspace + + JMP SHORT GETDIG ; Get more digits + +PUTDOT: + MOV AL,CHAR_PERIOD + CALL OUT_CHAR + + JMP LOOK_AGAIN + +; If new value has been entered, convert it to binary and +; put into memory. Always bump pointer to next location +STORE: + CMP CL,2 ; CX=2 means nothing typed yet + JZ NOSTO ; So no new value to store + +; Rotate DH left 4 bits to combine with DL and make a byte value + PUSH CX + MOV CL,4 + SHL DH,CL + POP CX + OR DL,DH ; Hex is now converted to binary + MOV ES:[DI],DL ; Store new value +NOSTO: + INC DI ; Prepare for next location + RET + +NEXT: + CALL STORE ; Enter new value + + INC CX ; Leave a space plus two for + INC CX ; each digit not entered + PUSH DI + MOV DI,OFFSET DG:ARG_BUF + PUSH ES + PUSH DS + POP ES + CALL TAB + + XOR AL,AL + STOSB + MOV DX,OFFSET DG:ARG_BUF_PTR + CALL STD_PRINTF + + POP ES + POP DI + MOV AX,DI ; Next memory address + AND AL,7 ; Check for 8-byte boundary + JZ NEWROW ; Take 8 per line + + JMP GETBYTE + +NEWROW: + CALL CRLF ; Terminate line + + JMP GETROW ; Print address on new line + +PREV: + CALL STORE ; Enter the new value + +; DI has been bumped to next byte. Drop it 2 to go to previous addr + DEC DI + DEC DI + JMP SHORT NEWROW ; Terminate line after backing CLD + +EOL: + CALL STORE ; Enter the new value + + JMP CRLF ; CR/LF and terminate + +; Console input of single character + IF SYSVER +INPT: ;*** change for build - label to inpt + PUSH DS + PUSH SI + LDS SI,CS:[CIN] + MOV AH,4 + CALL DEVIOCALL + + POP SI + POP DS + CMP AL,3 + JNZ NOTCNTC + + INT VEC_CTRL_BREAK ;23H + +NOTCNTC: + CMP AL,UPPER_P - CHAR_AT_SIGN + JZ PRINTON + + CMP AL,UPPER_N - CHAR_AT_SIGN + JZ PRINTOFF + + CALL OUT_CHAR + + RET + +PRINTOFF: +PRINTON: + NOT [PFLAG] + JMP SHORT IN + + ELSE +INPT: ; Change label for build + MOV AH,Std_Con_Input ;OPTION=1, STANDARD CONSOLE INPUT + INT 21H + + RET + + ENDIF +OUT_CHAR: + PUSH DI + PUSH DX + PUSH ES + PUSH DS + POP ES + MOV DI,OFFSET DG:ONE_CHAR_BUF + STOSB + MOV AL,0 + STOSB + MOV DX,OFFSET DG:ONE_CHAR_BUF_PTR + CALL STD_PRINTF + + POP ES + POP DX + POP DI + RET + +;========================================================================= +; ADDRESS_32_BIT: This routine will build an address for 32bit sector +; addressibility. BX will be the high word, with DX being +; the low word. +; +; Inputs : DX/BX - registers to contain 32bit sector address +; DX & BX are both initialized to 0 on first call to routine. +; +; Outputs: DX/BX - registers to contain 32bit sector address +; +; Date : 6/16/87 +;========================================================================= + +ADDRESS_32_BIT proc near ;an000;perform 32 bit address + ; creation + push cx ;an000;save affected regs. + mov cx,04h ;an000;initialize to + ; nibble shift +; $do ;an000;while cx not= 0 +$$DO1: + cmp cx,00h ;an000;are we done? +; $leave e ;an000;yes, quit loop + JE $$EN1 + shl bx,1 ;an000;shift bx 1 bit + shl dx,1 ;an000;shift dx 1 bit +; $if c ;an000;did low word carry + JNC $$IF3 + or bx,01h ;an000;set bit 0 of high word +; $endif ;an000; +$$IF3: + dec cx ;an000;decrease counter +; $enddo ;an000;end while loop + JMP SHORT $$DO1 +$$EN1: + or dl, al ;an000;overlay low word + ; bits 0-3 with next + ; portion of the address + pop cx ;an000;restore affected regs. + + ret ;an000;return to caller + +ADDRESS_32_BIT endp ;an000;end proc + + + +CODE ENDS + END DEBCOM1 + \ 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 @@ + PAGE 60,132 ; + TITLE DEBCOM2.ASM - PART2 DEBUGGER COMMANDS PC DOS +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DECOM2.SAL +; +; DESCRIPTIVE NAME: DEBUGGING TOOL +; +; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: DEBCOM1 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; AC000 VERSION 4.00 - +; +; - IMPLEMENT DBCS HANDLING DMS:6/17/87 +; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87 +; - IMPLEMENT > 32MB SUPPORT DMS:6/17/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +;======================= END OF SPECIFICATIONS =========================== + +; Routines to perform debugger commands except ASSEMble and UASSEMble + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBCOM2 + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM +.CREF +.LIST +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + EXTRN NOTFND_PTR:BYTE,NOROOM_PTR:BYTE,DRVLET:BYTE,ERRMES_PTR:BYTE + EXTRN NAMBAD_PTR:BYTE,NOSPACE_PTR:BYTE,TOOBIG_PTR:BYTE + EXTRN HEXERR_PTR:BYTE,HEXWRT_PTR:BYTE,ACCMES_PTR:BYTE + EXTRN EXEBAD_PTR:BYTE,EXEWRT_PTR:BYTE + EXTRN EXECEMES_PTR:BYTE,NONAMESPEC_PTR:BYTE + + EXTRN FLAGTAB:WORD,EXEC_BLOCK:BYTE,COM_LINE:DWORD,COM_FCB1:DWORD + EXTRN COM_FCB2:DWORD,COM_SSSP:DWORD,COM_CSIP:DWORD,RETSAVE:WORD + EXTRN NEWEXEC:BYTE,HEADSAVE:WORD + EXTRN REGTAB:BYTE,TOTREG:BYTE,NOREGL:BYTE + EXTRN USER_PROC_PDB:WORD,STACK:BYTE,RSTACK:WORD,AXSAVE:WORD + EXTRN BXSAVE:WORD,DSSAVE:WORD,ESSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD + EXTRN SSSAVE:WORD,CXSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD + EXTRN SREG:BYTE,SEGTAB:WORD,REGDIF:ABS,RDFLG:BYTE + EXTRN REGTABEND:WORD + EXTRN NAMESPEC:BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN DEFDUMP:BYTE,TRANSADD:DWORD,INDEX:WORD,BUFFER:BYTE + EXTRN ASMADD:BYTE,DISADD:BYTE,NSEG:WORD + EXTRN SWITCHAR:BYTE,XNXCMD:BYTE,XNXOPT:BYTE + EXTRN AWORD:BYTE,EXTPTR:WORD,HANDLE:WORD,PARSERR:BYTE + EXTRN REG_NAME:WORD,REG_CONTENTS:WORD,REGISTER_PTR:BYTE + EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE,LOC_ADD:WORD,LOC_PTR:BYTE + EXTRN BIG_CONTENTS:WORD,BIG_PTR:BYTE,LITTLE_CONTENTS:WORD,LITTLE_PTR:BYTE + EXTRN SINGLE_REG_ARG:WORD,CHANGE_FLAG_PTR:BYTE,DF_ERROR:BYTE + EXTRN BR_ERROR:BYTE,BF_ERROR:BYTE,SINGLE_REG_PTR:WORD + EXTRN WRT_ARG1:WORD,WRT_ARG2:WORD,WRTMES_PTR:BYTE,BEGSEG:WORD + EXTRN FILESTRT:WORD,FILEEND:WORD + EXTRN ERR_TYPE:BYTE ;ac000;converted to buffer + + extrn rel_read_write_tab:dword ;an000;primitive I/O + extrn rel_rw_add:dword ;an000;transfer address + extrn rel_low_sec:word ;an000;low sector word + extrn rel_high_sec:word ;an000;high sector word + extrn rel_sec_num:word ;an000;# of sectors + +fnd_dbcs db 0 +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE +ASSUME CS:DG,DS:DG,ES:DG,SS:DG + PUBLIC DEFIO,PREPNAME,DEBUG_FOUND + PUBLIC REG,LOAD + PUBLIC NAMED,DWRITE + PUBLIC DISPREG,ERR,DELIM1,DELIM2,delim0 + public getchrup,open1,open2,open3,open4,oc_file,opnret ;an001;bgb + public delete_a_file, parse_a_file, exec_a_file, open_a_file, create_a_file ;an001;bgb + public gcur,ifhex ;an001;bgb + public comtail ;an001;bgb + extrn test_lead:near ;an001;bgb + EXTRN OUTSI:NEAR,OUTDI:NEAR,INBUF:NEAR,SCANB:NEAR,SCANP:NEAR + EXTRN COMMAND:NEAR,DISASLN:NEAR,SET_TERMINATE_VECTOR:NEAR + EXTRN RESTART:NEAR,TERMINATE:NEAR,DRVERR:NEAR + EXTRN GETHEX:NEAR,GETEOL:NEAR,SKIP_FILE:NEAR + EXTRN HEXCHK:NEAR,GETHEX1:NEAR,PRINT:NEAR + EXTRN CRLF:NEAR,BLANK:NEAR + EXTRN HEX:NEAR,DIGIT:NEAR + EXTRN FIND_DEBUG:NEAR + EXTRN ADDRESS:NEAR,PERROR:NEAR + EXTRN STD_PRINTF:NEAR,PRINTF_CRLF:NEAR +DEBCOM2: +DISPLAY_LINE: + mov ax,word ptr [si] ;an000;move reg name to ax + MOV [REG_NAME],ax ;ac000;save it in reg_name + ADD SI,3 + MOV AX,[BX] + ADD BX,2 + MOV [REG_CONTENTS],AX + MOV DX,OFFSET DG:REGISTER_PTR + CALL STD_PRINTF + + LOOP DISPLAY_LINE + + RETURN + +DISPLAY_FLAGS: + MOV DI,OFFSET DG:ARG_BUF + MOV AL,CHAR_BLANK + STOSB +DISPLAY_FLAGS_2: + MOV SI,OFFSET DG:FLAGTAB + MOV CX,16 + MOV DX,[FLSAVE] +DFLAGS: + LODS CS:WORD PTR [SI] + SHL DX,1 + JC FLAGSET + + MOV AX,CS:[SI+30] +FLAGSET: + OR AX,AX + JZ NEXT_FLAG + + STOSW + MOV AL,CHAR_BLANK + STOSB +NEXT_FLAG: + LOOP DFLAGS + XOR AL,AL + STOSB + RETURN + +DISPREG: + MOV SI,OFFSET DG:REGTAB + MOV DI,OFFSET DG:ARG_BUF + MOV BX,OFFSET DG:AXSAVE + MOV BYTE PTR TOTREG,CR + MOV CH,0 + MOV CL,NOREGL +SET_DISPLAY: +REPEAT_DISPLAY: + SUB TOTREG,CL + CALL DISPLAY_LINE + + CALL CRLF + + XOR CH,CH + MOV CL,NOREGL + CMP CL,TOTREG + JB REPEAT_DISPLAY + + MOV CL,TOTREG + CALL DISPLAY_LINE + + CALL DISPLAY_FLAGS + + MOV DX,OFFSET DG:ARG_BUF_PTR + CALL PRINTF_CRLF + + MOV AX,[IPSAVE] + MOV WORD PTR [DISADD],AX + PUSH AX + MOV AX,[CSSAVE] + MOV WORD PTR [DISADD+WORD],AX + PUSH AX + MOV [NSEG],-1 + CALL DISASLN + + POP WORD PTR DISADD+WORD + POP WORD PTR DISADD + MOV AX,[NSEG] + CMP AL,-1 + JNZ ASSEM_LIN_CONT + + JMP CRLF + +ASSEM_LIN_CONT: + CMP AH,-1 + JZ NOOVER + + XCHG AL,AH +NOOVER: + CBW + MOV BX,AX + SHL BX,1 + MOV AX,WORD PTR [BX+SREG] + MOV DI,OFFSET DG:ARG_BUF + STOSB + XCHG AL,AH + STOSB + XOR AL,AL + STOSB + MOV DX,[INDEX] + MOV LOC_ADD,DX + MOV DX,OFFSET DG:LOC_PTR + CALL STD_PRINTF + + MOV BX,[BX+SEGTAB] + PUSH DS + MOV DS,[BX] + MOV BX,CS:[INDEX] + MOV BX,[BX] + POP DS + MOV BIG_CONTENTS,BX + MOV DX,OFFSET DG:BIG_PTR + TEST BYTE PTR [AWORD],-1 + JNZ SHOW_CHARS + + XOR BH,BH + MOV LITTLE_CONTENTS,BX + MOV DX,OFFSET DG:LITTLE_PTR +SHOW_CHARS: + CALL PRINTF_CRLF + + RETURN + +DISPREGJ: + JMP DISPREG + +; Perform register dump if no parameters or set register if a +; register designation is a parameter. +REG: + CALL SCANP + + JZ DISPREGJ + + MOV DL,[SI] + INC SI + MOV DH,[SI] + CMP DH,CR + JZ FLAG + + INC SI + CALL GETEOL + + CMP DH,CHAR_BLANK + JZ FLAG + + MOV DI,OFFSET DG:REGTAB + XCHG AX,DX + PUSH CS + POP ES + XOR CX,CX +CHECK_NEXT_REG: + CMP AX,WORD PTR[ DI] + JZ REG_FOUND + + ADD DI,3 + INC CX + CMP DI,OFFSET DG:REGTABEND + JB CHECK_NEXT_REG + + JMP BADREG + +REG_FOUND: + CMP DI,OFFSET DG:REGTABEND + JNZ NOTPC + + DEC DI + DEC DI + DEC DI + MOV AX,CS:[DI-WORD] +NOTPC: + PUSH DI + MOV DI,OFFSET DG:ARG_BUF + STOSB + XCHG AL,AH + STOSB + XOR AL,AL + STOSB + POP DI + PUSH DS + POP ES + LEA BX,[DI+REGDIF] + SUB BX,CX + MOV DX,[BX] + MOV SINGLE_REG_ARG,DX + MOV DX,OFFSET DG:SINGLE_REG_PTR + CALL STD_PRINTF + + CALL INBUF + + CALL SCANB + + RETZ + + push bx ;an000;save bx - we stomp it + MOV CX,4 + CALL GETHEX1 + pop bx ;an000;restore it + + CALL GETEOL + + MOV [BX],DX + RETURN +BADREG: + MOV DX,OFFSET DG:BR_ERROR ; BR ERROR + JMP ERR + +FLAG: + CMP DL,UPPER_F + JNZ BADREG + + MOV DI,OFFSET DG:ARG_BUF + CALL DISPLAY_FLAGS_2 + + MOV DX,OFFSET DG:CHANGE_FLAG_PTR + CALL STD_PRINTF + + CALL INBUF + + CALL SCANB + + XOR BX,BX + MOV DX,[FLSAVE] +GETFLG: + LODSW + CMP AL,CR + JZ SAVCHG + + CMP AH,CR + JZ FLGERR + + MOV DI,OFFSET DG:FLAGTAB + MOV CX,32 + PUSH CS + POP ES + REPNE SCASW + JNZ FLGERR + + MOV CH,CL + AND CL,0FH + MOV AX,1 + ROL AX,CL + TEST AX,BX + JNZ REPFLG + + OR BX,AX + OR DX,AX + TEST CH,16 + JNZ NEXFLG + + XOR DX,AX +NEXFLG: + CALL SCANP + + JMP SHORT GETFLG + +REPFLG: + MOV DX,OFFSET DG:DF_ERROR ; DF ERROR +FERR: + CALL SAVCHG +ERR: + push si ;an000;save affected registers + push di ;an000; + push cx ;an000; + mov cx,03h ;an000;move only three bytes + mov di,offset dg:err_type ;an000;point to buffer + mov si,dx ;an000;dx holds the string + rep movsb ;an000;fill up the buffer + pop cx ;an000;restore registers + pop di ;an000; + pop si ;an000; + MOV DX,OFFSET DG:ERRMES_PTR + JMP PRINT + +SAVCHG: + MOV [FLSAVE],DX + RETURN + +FLGERR: + MOV DX,OFFSET DG:BF_ERROR ; BF ERROR + JMP SHORT FERR + +PREPNAME: + MOV ES,DSSAVE + PUSH SI + MOV DI,81H +COMTAIL: + LODSB + STOSB + CMP AL,CR + JNZ COMTAIL + + SUB DI,82H + XCHG AX,DI + MOV ES:(BYTE PTR [80H]),AL + POP SI + MOV DI,FCB ;05cH + MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION ;AL=01H + INT 21H + + MOV BYTE PTR [AXSAVE],AL ; Indicate analysis of first parm + CALL SKIP_FILE + + MOV DI,6CH + MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION ;AL=01H + INT 21H + + MOV BYTE PTR [AXSAVE+1],AL ; Indicate analysis of second parm + RETURN + +; OPENS A XENIX PATHNAME SPECIFIED IN THE UNFORMATTED PARAMETERS +; VARIABLE [XNXCMD] SPECIFIES WHICH COMMAND TO OPEN IT WITH + +; VARIABLE [HANDLE] CONTAINS THE HANDLE +; VARIABLE [EXTPTR] POINTS TO THE FILES EXTENSION +DELETE_A_FILE: + MOV BYTE PTR [XNXCMD],UNLINK + JMP SHORT OC_FILE + +PARSE_A_FILE: + MOV BYTE PTR [XNXCMD],0 + JMP SHORT OC_FILE + +EXEC_A_FILE: + MOV BYTE PTR CS:[XNXCMD],EXEC + MOV BYTE PTR CS:[XNXOPT],1 + JMP SHORT OC_FILE + +OPEN_A_FILE: + MOV BYTE PTR [XNXCMD],OPEN + MOV BYTE PTR [XNXOPT],2 ; Try read write + CALL OC_FILE + + RETNC + MOV BYTE PTR [XNXCMD],OPEN + MOV BYTE PTR [XNXOPT],0 ; Try read only + JMP SHORT OC_FILE + +CREATE_A_FILE: + MOV BYTE PTR [XNXCMD],CREAT +OC_FILE: + PUSH DS + PUSH ES + PUSH AX + PUSH BX + PUSH CX + PUSH DX + PUSH SI + XOR AX,AX + MOV CS:[EXTPTR],AX ; INITIALIZE POINTER TO EXTENSIONS + MOV AH,CHAR_OPER + INT 21H + + MOV CS:[SWITCHAR],DL ; GET THE CURRENT SWITCH CHARACTER + MOV SI,81H + +open1: CALL GETCHRUP ;convert 1 byte to uppercase + CALL DELIM2 ; END OF LINE? + JZ OPEN4 + + CALL DELIM1 ; SKIP LEADING DELIMITERS + JZ OPEN1 + + MOV DX,SI ; SAVE POINTER TO BEGINNING + cmp fnd_dbcs,1 +; $if z + JNZ $$IF1 + dec dx ;dec it twice if dbcs +; $endif +$$IF1: + DEC DX +open2: CMP AL,CHAR_PERIOD ; LAST CHAR A "."? + JNZ OPEN3 + + MOV CS:[EXTPTR],SI ; SAVE POINTER TO THE EXTENSION +OPEN3: + CALL GETCHRUP + + CALL DELIM1 ; LOOK FOR END OF PATHNAME + + JZ OPEN4 + + CALL DELIM2 + + JNZ OPEN2 + +OPEN4: DEC SI ; POINT BACK TO LAST CHAR + PUSH [SI] ; SAVE TERMINATION CHAR + MOV BYTE PTR [SI],0 ; NULL TERMINATE THE STRING + MOV AL,CS:[XNXOPT] + MOV AH,CS:[XNXCMD] ; OPEN OR CREATE FILE + OR AH,AH + JZ OPNRET + + MOV CS:[FILESTRT],DX ; Set values for later call on this file + MOV CS:[FILEEND],SI + PUSH CS + POP ES ; Set ES seg for EXEC_BLOCK + MOV BX,OFFSET DG:EXEC_BLOCK + XOR CX,CX + INT 21H + + MOV CS:[HANDLE],AX ; SAVE ERROR CODE OR HANDLE +OPNRET: + POP [SI] + POP SI + POP DX + POP CX + POP BX + POP AX ; blow away error code... + POP ES + POP DS + RETURN + +GETCHRUP: ;an001;bgb + lodsb ;get the character from [si] ;an001;bgb + call test_lead ;is it a dbcs lead byte? ;an001;bgb +; $IF C ;yes ;an001;bgb + JNC $$IF3 + inc si ;bump ptr to past 2nd dbcs byte ;an001;bgb + mov fnd_dbcs,1 ;found a dbcs char + jmp gcur ;dont capitalize it ;an001;bgb +; $ENDIF ;an001;bgb +$$IF3: + ; ;an001;bgb + mov fnd_dbcs,0 ;did not find a dbcs char + cmp al,lower_a ;is it >= "a" ? ;an001;bgb + jb gcur ;no - exit ;an001;bgb + ;an001;bgb + cmp al,lower_z ;is it =< "z" ? ;an001;bgb + ja gcur ;no - exit ;an001;bgb + ;an001;bgb +;if we get here, the char is lowercase, so change it ;an001;bgb + sub al,32 ;convert to uppercase ;an001;bgb + mov [si-1],al ;move it back (si points 1 past) ;an001;bgb +gcur: return ;an001;bgb + +DELIM0: + CMP AL,CHAR_LEFT_BRACKET + RETZ +DELIM1: + CMP AL,CHAR_BLANK ; SKIP THESE GUYS + RETZ + + CMP AL,CHAR_SEMICOLON + RETZ + + CMP AL,CHAR_EQUAL + RETZ + + CMP AL,CHAR_TAB + RETZ + + CMP AL,CHAR_COMMA + RETURN + +DELIM2: + CMP AL,CS:[SWITCHAR] ; STOP ON THESE GUYS + RETZ + + CMP AL,CR + RETURN + +NAMED: + OR [NAMESPEC],1 ; Flag a name command executed + CALL PREPNAME + + MOV AL,BYTE PTR AXSAVE + MOV PARSERR,AL + PUSH ES + POP DS + PUSH CS + POP ES + MOV SI,FCB ; DS:SI points to user FCB + MOV DI,SI ; ES:DI points to DEBUG FCB + MOV CX,82 + REP MOVSW + RETURN + +BADNAM: + MOV DX,OFFSET DG:NAMBAD_PTR + JMP RESTART + +IFHEX: + CMP BYTE PTR [PARSERR],-1 ; Invalid drive specification? + JZ BADNAM + + CALL PARSE_A_FILE + + MOV BX,[EXTPTR] + CMP WORD PTR DS:[BX],"EH" ; "HE" + RETNZ + + CMP BYTE PTR DS:[BX+WORD],UPPER_X + RETURN + +IFEXE: + PUSH BX + MOV BX,[EXTPTR] + CMP WORD PTR DS:[BX],"XE" ; "EX" + JNZ RETIF + + CMP BYTE PTR DS:[BX+WORD],UPPER_E +RETIF: + POP BX + RETURN + +LOAD: + MOV BYTE PTR [RDFLG],READ + JMP SHORT DSKIO + +DWRITE: + MOV BYTE PTR [RDFLG],WRITE +DSKIO: + MOV BP,[CSSAVE] + CALL SCANB + + JNZ PRIMIO + + JMP DEFIO + +PRIMIO: + CALL ADDRESS + + CALL SCANB + + JNZ PRMIO + + JMP FILEIO + +;========================================================================= +; PRMIO: This routine builds the necessary table for the new +; generic IOCtl primitive read/write logical sector function. +; +; Inputs : Binary addresses and values converted by GETHEX +; +; Outputs: REL_READ_WRITE_TAB - Table needed by IOCtl function to +; perform 32 bit sector addressing. +; +; Date : 6/17/87 +;========================================================================= + +PRMIO: + mov word ptr dg:[rel_rw_add],dx ;ac000;save transfer address + ; in table + mov word ptr dg:[rel_rw_add+2],ax ;ac000;save segment of transfer + ; address + MOV CX,2 + CALL GETHEX ; Drive number must be 2 digits or less + + PUSH DX ;save drive number + MOV CX,8 ;ac000;allow 32 bit addressibilty + CALL GETHEX ; Logical record number + mov word ptr dg:[rel_low_sec],dx ;ac000;save low word of logical + ; sector address + mov word ptr dg:[rel_high_sec],bx ;ac000;save high word of + ; logical sector address + + MOV CX,3 + CALL GETHEX ; Number of records + mov word ptr dg:[rel_sec_num],dx ;ac000;save number of sectors + ; to read/write + + CALL GETEOL + + POP BX ;ac000;drive number + CBW ; Turn off verify after write + MOV BYTE PTR DRVLET,bl ;ac000;save drive in case of error + PUSH BX + MOV DL,bL ;ac000;move drive to dl +; Clean off the buffer cache for physical I/O + push ds + MOV AH,DISK_RESET + INT 21H + + INC DL + MOV AH,GET_DPB + INT 21H + pop ds + + or al,al ;ac000;see if an error occurred + pop ax ;ac000;restore drive + + JNZ DRVERRJ + + CMP CS:BYTE PTR [RDFLG],WRITE +; $if z ;an000;we will write to sector(s) + JNZ $$IF5 + call ABSWRT ;an000;logical sector write +; $else ;an000; + JMP SHORT $$EN5 +$$IF5: + call ABSREAD ;an000;we will read sector(s) +; $endif ;an000; +$$EN5: + + +ENDABS: + JNC RET0 + +DRVERRJ: + JMP DRVERR + +RET0: +; Clean cache again... + MOV AH,DISK_RESET + INT 21H + + RETURN + + +;called from debug.sal +DEFIO: + MOV AX,[CSSAVE] ; Default segment + MOV DX,100H ; Default file I/O offset + CALL IFHEX + JNZ EXECHK + XOR DX,DX ; If HEX file, default OFFSET is zero +HEX2BINJ: + JMP HEX2BIN + +FILEIO: +; AX and DX have segment and offset of transfer, respectively + CALL IFHEX + JZ HEX2BINJ + +EXECHK: + CALL IFEXE + JNZ BINFIL + CMP BYTE PTR [RDFLG],READ + JZ EXELJ + MOV DX,OFFSET DG:EXEWRT_PTR + JMP RESTART ; Can't write .EXE files + +BINFIL: + CMP BYTE PTR [RDFLG],WRITE + JZ BINLOAD + CMP WORD PTR DS:[BX],4F00H + UPPER_C ;"CO" + JNZ BINLOAD + CMP BYTE PTR DS:[BX+WORD],UPPER_M + JNZ BINLOAD + +EXELJ: + DEC SI + CMP DX,100H + JNZ PRER + + CMP AX,[CSSAVE] + JZ OAF + +PRER: + JMP PERROR + +OAF: + CALL OPEN_A_FILE + + JNC GDOPEN + + MOV AX,ERROR_FILE_NOT_FOUND + JMP EXECERR + +GDOPEN: + XOR DX,DX + XOR CX,CX + MOV BX,[HANDLE] + MOV AL,2 + MOV AH,LSEEK + INT 21H + + CALL IFEXE ; SUBTRACT 512 BYTES FOR EXE + + JNZ BIN2 ; FILE LENGTH BECAUSE OF + + SUB AX,512 ; THE HEADER +BIN2: + MOV [BXSAVE],DX ; SET UP FILE SIZE IN DX:AX + MOV [CXSAVE],AX + MOV AH,CLOSE + INT 21H + + JMP EXELOAD + +NO_MEM_ERR: + MOV DX,OFFSET DG:TOOBIG_PTR + CALL PRINTF_CRLF + + JMP COMMAND + +WRTFILEJ: + JMP WRTFILE +NOFILEJ: + JMP NOFILE + +BINLOAD: + PUSH AX + PUSH DX + CMP BYTE PTR [RDFLG],WRITE + JZ WRTFILEJ + + CALL OPEN_A_FILE + + JC NOFILEJ + + MOV BX,[HANDLE] + MOV AX,(LSEEK SHL 8) OR LSEEK_EOF_OPTION + XOR DX,DX ;CX:DX=DISTANCE (OFFSET) TO MOVE IN BYTES + MOV CX,DX + INT 21H ; GET SIZE OF FILE + + MOV SI,DX + MOV DI,AX ; SIZE TO SI:DI + MOV AX,(LSEEK SHL 8) OR LSEEK_FROM_START + XOR DX,DX + MOV CX,DX + INT 21H ; RESET POINTER BACK TO BEGINNING + + POP AX + POP BX + PUSH BX + PUSH AX ; TRANS ADDR TO BX:AX + ADD AX,15 + RCR AX,1 + MOV CL,3 + MOV CL,4 + SHR AX,CL + ADD BX,AX ; Start of transfer rounded up to seg + MOV DX,SI + MOV AX,DI ; DX:AX is size + cmp dx,10h + jnc no_mem_err + MOV CX,16 + DIV CX + OR DX,DX + JZ NOREM + + INC AX +NOREM: ; AX is number of paras in transfer + ADD AX,BX ; AX is first seg that need not exist + jc no_mem_err + CMP AX,CS:[PDB_BLOCK_LEN] + JA NO_MEM_ERR + + MOV CXSAVE,DI + MOV BXSAVE,SI + POP DX + POP AX +; AX:DX is disk transfer address (segment:offset) +; SI:DI is length (32-bit number) +RDWR: +RDWRLOOP: + MOV BX,DX ; Make a copy of the offset + AND DX,000FH ; Establish the offset in 0H-FH range + MOV CL,4 + SHR BX,CL ; Shift offset and + ADD AX,BX ; Add to segment register to get new Seg:offset + PUSH AX + PUSH DX ; Save AX,DX register pair + MOV WORD PTR [TRANSADD],DX + MOV WORD PTR [TRANSADD+WORD],AX + MOV CX,0FFF0H ; Keep request in segment + OR SI,SI ; Need > 64K? + JNZ BIGRDWR + + MOV CX,DI ; Limit to amount requested +BIGRDWR: + PUSH DS + PUSH BX + MOV BX,[HANDLE] + MOV AH,[RDFLG] + LDS DX,[TRANSADD] + INT 21H ; Perform read or write + + POP BX + POP DS + JC BADWR + + CMP BYTE PTR [RDFLG],WRITE + JNZ GOODR + + CMP CX,AX + JZ GOODR + +BADWR: + MOV CX,AX + STC + POP DX ; READ OR WRITE BOMBED OUT + POP AX + RETURN + +GOODR: + MOV CX,AX + SUB DI,CX ; Request minus amount transferred + SBB SI,0 ; Ripple carry + OR CX,CX ; End-of-file? + POP DX ; Restore DMA address + POP AX + JZ DOCLOSE + + ADD DX,CX ; Bump DMA address by transfer length + MOV BX,SI + OR BX,DI ; Finished with request + JNZ RDWRLOOP + +DOCLOSE: + SAVEREG + MOV BX,HANDLE + MOV AH,CLOSE + INT 21H + + RESTOREREG + RETURN + +NOFILE: + MOV DX,OFFSET DG:NOTFND_PTR + JMP RESTART + +NO_NAME_GIVEN: + MOV DX,OFFSET DG:NONAMESPEC_PTR +RESTARTJMP: + JMP RESTART + +WRTFILE: + CMP [NAMESPEC],0 + JZ NO_NAME_GIVEN ; Hey User, you forgot to specify a name + + CALL CREATE_A_FILE ; Create file we want to write to + + JC CHECKREADONLY ; ARR 2.4 + + MOV SI,BXSAVE ; Get high order number of bytes to transfer + CMP SI,000FH + JLE WRTSIZE ; Is bx less than or equal to FH + + XOR SI,SI ; Ignore BX if greater than FH - set to zero +WRTSIZE: + MOV WRT_ARG2,SI + MOV DI,CXSAVE + MOV WRT_ARG1,DI + MOV DX,OFFSET DG:WRTMES_PTR + CALL PRINTF_CRLF + + POP DX + POP AX + CALL RDWR + + JNC CLSFLE + + CALL CLSFLE + + CALL DELETE_A_FILE + + MOV DX,OFFSET DG:NOSPACE_PTR + JMP RESTARTJMP + + CALL CLSFLE ;is this dead code? - edk + + JMP COMMAND + +CHECKREADONLY: ; ARR 2.4 + MOV DX,[FILESTRT] + MOV SI,[FILEEND] + PUSH [SI] + MOV BYTE PTR [SI],0 + MOV AX,CHMOD SHL 8 ;AL=0,REQUEST FILE'S CURRENT + ; ATTRIBUTE BE RETURNED IN CX + INT 21H + + POP [SI] + MOV DX,OFFSET DG:NOROOM_PTR ; Creation error - report error + JC RESTARTJMP + + TEST CX,ATTR_READ_ONLY+ATTR_HIDDEN+ATTR_SYSTEM + JZ RESTARTJMP + + MOV DX,OFFSET DG:ACCMES_PTR ; Write on read only file + JMP RESTARTJMP + +CLSFLE: + MOV AH,CLOSE + MOV BX,[HANDLE] + INT 21H + + RETURN + +EXELOAD: + POP [RETSAVE] ; Suck up return addr + INC BYTE PTR [NEWEXEC] + MOV BX,[USER_PROC_PDB] + MOV AX,BEGSEG + MOV DS,AX + ASSUME DS:NOTHING + + CMP AX,BX + JZ DEBUG_CURRENT + + JMP FIND_DEBUG + +DEBUG_CURRENT: + MOV AX,CS:[DSSAVE] +DEBUG_FOUND: + MOV CS:BYTE PTR [NEWEXEC],0 + MOV CS:[HEADSAVE],AX + PUSH CS:[RETSAVE] ; Get the return address back + PUSH AX + MOV BX,CS + SUB AX,BX + PUSH ES + MOV ES,CS:BEGSEG + ASSUME ES:NOTHING + + MOV BX,AX ; size of debug in para. + ADD BX,10H + MOV AX,CS ; and the size of printf in para. + SUB AX,CS:BEGSEG + ADD BX,AX + MOV AH,SETBLOCK + INT 21H + + POP ES + POP AX + MOV CS:WORD PTR [COM_LINE+WORD],AX + MOV CS:WORD PTR [COM_FCB1+WORD],AX + MOV CS:WORD PTR [COM_FCB2+WORD],AX + PUSH DS + PUSH CS + POP DS + CALL EXEC_A_FILE + + POP DS + MOV AX,CS:[HANDLE] + JC EXECERR + + CALL SET_TERMINATE_VECTOR ; Reset int 22 + + MOV AH,GET_CURRENT_PDB + INT 21H + + MOV CS:[USER_PROC_PDB],BX + MOV CS:[DSSAVE],BX + MOV CS:[ESSAVE],BX + MOV ES,BX + MOV WORD PTR ES:[PDB_EXIT],OFFSET DG:TERMINATE + MOV WORD PTR ES:[PDB_EXIT+WORD],CS + LES DI,CS:[COM_CSIP] + MOV CS:[CSSAVE],ES + MOV CS:[IPSAVE],DI + MOV CS:WORD PTR [DISADD+WORD],ES + MOV CS:WORD PTR [DISADD],DI + MOV CS:WORD PTR [ASMADD+WORD],ES + MOV CS:WORD PTR [ASMADD],DI + MOV CS:WORD PTR [DEFDUMP+WORD],ES + MOV CS:WORD PTR [DEFDUMP],DI + MOV BX,DS + MOV AH,SET_CURRENT_PDB + INT 21H + + LES DI,CS:[COM_SSSP] + MOV AX,ES:[DI] + INC DI + INC DI + MOV CS:[AXSAVE],AX + MOV CS:[SSSAVE],ES + MOV CS:[SPSAVE],DI + RETURN + +EXECERR: + PUSH CS + POP DS + MOV DX,OFFSET DG:NOTFND_PTR + CMP AX,ERROR_FILE_NOT_FOUND + JZ GOTEXECEMES + + MOV DX,OFFSET DG:ACCMES_PTR + CMP AX,ERROR_ACCESS_DENIED + JZ GOTEXECEMES + + MOV DX,OFFSET DG:TOOBIG_PTR + CMP AX,ERROR_NOT_ENOUGH_MEMORY + JZ GOTEXECEMES + + MOV DX,OFFSET DG:EXEBAD_PTR + CMP AX,ERROR_BAD_FORMAT + JZ GOTEXECEMES + + MOV DX,OFFSET DG:EXECEMES_PTR +GOTEXECEMES: + CALL PRINTF_CRLF + + JMP COMMAND + +HEX2BIN: + MOV [INDEX],DX + MOV DX,OFFSET DG:HEXWRT_PTR + CMP BYTE PTR [RDFLG],WRITE + JNZ RDHEX + + JMP RESTARTJ2 + +RDHEX: + MOV ES,AX + CALL OPEN_A_FILE + + MOV DX,OFFSET DG:NOTFND_PTR + JNC HEXFND + + JMP RESTART + +HEXFND: + XOR BP,BP + MOV SI,OFFSET DG:(BUFFER+BUFSIZ) ; Flag input buffer as empty +READHEX: + CALL GETCH + + CMP AL,CHAR_COLON ; Search for : to start line + JNZ READHEX + + CALL GETBYT ; Get byte count + + MOV CL,AL + MOV CH,0 + JCXZ HEXDONE + + CALL GETBYT ; Get high byte of load address + + MOV BH,AL + CALL GETBYT ; Get low byte of load address + + MOV BL,AL + ADD BX,[INDEX] ; Add in offset + MOV DI,BX + CALL GETBYT ; Throw away type byte + +READLN: + CALL GETBYT ; Get data byte + + STOSB + CMP DI,BP ; Check if this is the largest address so far + JBE HAVBIG + + MOV BP,DI ; Save new largest +HAVBIG: + LOOP READLN + + JMP SHORT READHEX + +GETCH: + CMP SI,OFFSET DG:(BUFFER+BUFSIZ) + JNZ NOREAD + + MOV DX,OFFSET DG:BUFFER + MOV SI,DX + MOV AH,READ + PUSH BX + PUSH CX + MOV CX,BUFSIZ + MOV BX,cs:[HANDLE] + INT 21H + + POP CX + POP BX + OR AX,AX + JZ HEXDONE + +NOREAD: + LODSB + CMP AL,CHAR_EOF + JZ HEXDONE + + OR AL,AL + RETNZ + +HEXDONE: + MOV [CXSAVE],BP + MOV BXSAVE,0 + RETURN + +HEXDIG: + CALL GETCH + + CALL HEXCHK + + RETNC + + MOV DX,OFFSET DG:HEXERR_PTR +RESTARTJ2: + JMP RESTART + +GETBYT: + CALL HEXDIG + + MOV BL,AL + CALL HEXDIG + + SHL BL,1 + SHL BL,1 + SHL BL,1 + SHL BL,1 + OR AL,BL + RETURN + +;========================================================================= +; ABSREAD: This routine performs a primitive logical sector read of +; the specified drive. This routine replaces the old +; INT 25h function which only allowed 16 bit addressibility. +; The new generic IOCtl logical sector read will permit +; 32 bit addressibility on a disk device. +; +; Inputs : REL_READ_WRITE_TAB - Table provides dword sector +; addressibility. +; +; Outputs: Data located at specified transfer address. +; +; Error : Carry is set on error. +; +; Date : 6/17/87 +;========================================================================= + +ABSREAD proc near ;an000;read logical sector(s) + + push ds ;an000;save affected regs + push cx ;an000;save affected regs + push bx ;an000; + + mov cx,-1 ;an000;extended format + mov bx,offset dg:rel_read_write_tab ;an000;point to read/write table + int 25h ;an000;invoke relative sector read + pop bx ;an000;discard stack word + + pop bx ;an000;restore regs + pop cx ;an000; + pop ds ;an000; + + ret ;an000;return to caller + +ABSREAD endp ;an000;end proc + + +;========================================================================= +; ABSWRT: This routine performs a primitive logical sector write of +; the specified drive. This routine replaces the old +; INT 26h function which only allowed 16 bit addressibility. +; The new generic IOCtl logical sector write will permit +; 32 bit addressibility on a disk device. +; +; Inputs : REL_READ_WRITE_TAB - Table provides dword sector +; addressibility. +; +; Outputs: Data moved from transfer address to applicable sector(s). +; +; Error : Carry is set on error. +; +; Date : 6/17/87 +;========================================================================= + +ABSWRT proc near ;an000;write logical sector(s) + + push ds ;an000;save affected regs + push cx ;an000; + push bx ;an000; + + mov cx,-1 ;an000;extended format + mov bx,offset dg:rel_read_write_tab ;an000;point to read/write table + int 26h ;an000;invoke relative sector write + pop bx ;an000;discard stack word + + pop bx ;an000;restore regs + pop cx ;an000; + pop ds ;an000; + + ret ;an000;return to caller + +ABSWRT endp ;an000;end proc + + +CODE ENDS + END DEBCOM2 + \ 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 @@ + PAGE 80,132 ; + TITLE DEBCOM3.ASM - PART3 DEBUGGER COMMANDS +; ROUTINES TO PERFORM DEBUGGER COMMANDS + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBCOM3 + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM + INCLUDE DPL.ASM +.CREF +.LIST +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + EXTRN USER_PROC_PDB:WORD,RSTACK:WORD,STACK:BYTE + EXTRN DSSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD,axSAVE:WORD,dxSAVE:WORD + EXTRN SSSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD + EXTRN NEXTCS:WORD,NEXTIP:WORD, RSETFLAG:BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN BRKCNT:WORD,TCOUNT:WORD,SWITCHAR:BYTE,BPTAB:BYTE + EXTRN BP_ERROR:BYTE,COMP_ARG1:WORD,COMP_ARG2:WORD,COMP_ARG3:WORD + EXTRN COMP_ARG4:WORD,COMP_ARG5:WORD,COMP_ARG6:WORD,COMP_PTR:BYTE + EXTRN ARG_BUF:BYTE,ARG_BUF_PTR:BYTE + EXTRN FZTRACE:BYTE, SYNERR_PTR:BYTE + EXTRN BEGSEG:WORD + IF IBMVER + EXTRN OLD_MASK:BYTE + ENDIF + EXTRN SAVESTATE:BYTE +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE +ASSUME CS:DG,DS:DG,ES:DG,SS:DG + PUBLIC COMPARE,INPUT,OUTPUT,GO + PUBLIC TRACE,ZTRACE,SKIP_FILE + EXTRN GETHEX:NEAR,GETEOL:NEAR,CRLF:NEAR,ERR:NEAR, PERR:NEAR + EXTRN HEX:NEAR,DIGIT:NEAR,SCANP:NEAR,DISPREG:NEAR + EXTRN COMMAND:NEAR,DABORT:NEAR,DELIM1:NEAR,DELIM2:NEAR + EXTRN NMIINT:NEAR,NMIINTEND:NEAR,PRINTF_CRLF:NEAR + EXTRN ADDRESS:NEAR,HEXIN:NEAR,DSRANGE:NEAR +; just like trace except skips OVER next INT or CALL. +DEBCOM3: +ZTRACE: + MOV FZTRACE,-1 + CALL SETADD + CALL SCANP + CALL HEXIN + MOV DX,1 + JC ZSTOCNT + MOV CX,4 + CALL GETHEX + CALL CHECKNONE +ZSTOCNT: + MOV [TCOUNT],DX + CALL GETEOL + MOV DX,NEXTCS + MOV CSSAVE,DX + MOV DX,NEXTIP + MOV IPSAVE,DX +ZSTEP: + MOV ES,[CSSAVE] ; point to instruction to execute + MOV DI,[IPSAVE] ; include offset in segment + XOR DX,DX ; where to place breakpoint +get_opcode: + MOV AL,ES:[DI] ; get the opcode + cmp al,0f0h ; lock + je is_override + cmp al,26h ; es: + je is_override + cmp al,2eh ; cs: + je is_override + cmp al,36h ; ss: + je is_override + cmp al,3eh ; ds: + jne not_override +Is_override: +; inc dx ; this seemed to put us in an endless + inc di ; loop, try this. + jmp get_opcode +Not_override: + CMP AL,11101000B ; direct intra call + JZ ZTRACE3 ; yes, 3 bytes + CMP AL,10011010B ; direct inter call + JZ ZTRACE5 ; yes, 5 bytes + CMP AL,11111111B ; indirect? + JZ ZTRACEMODRM ; yes, go figure length + CMP AL,11001100B ; short interrupt? + JZ ZTRACE1 ; yes, 1 byte + CMP AL,11001101B ; long interrupt? + JZ ZTRACE2 ; yes, 2 bytes + CMP AL,11100010B ; loop + JZ ZTRACE2 ; 2 byter + CMP AL,11100001B ; loopz/loope + JZ ZTRACE2 ; 2 byter + CMP AL,11100000B ; loopnz/loopne + JZ ZTRACE2 ; 2 byter + AND AL,11111110B ; check for rep + CMP AL,11110010B ; perhaps? + JZ FOO1 + JMP STEP ; can't do anything special, step +FOO1: + MOV AL,ES:[DI+1] ; next instruction + AND AL,11111110B ; ignore w bit + CMP AL,10100100B ; MOVS + JZ ZTRACE2 ; two byte + CMP AL,10100110B ; CMPS + JZ ZTRACE2 ; two byte + CMP AL,10101110B ; SCAS + JZ ZTRACE2 ; two byte + CMP AL,10101100B ; LODS + JZ ZTRACE2 ; two byte + CMP AL,10101010B ; STOS + JZ ZTRACE2 ; two byte + JMP STEP ; bogus, do single step + +ZTRACEMODRM: + MOV AL,ES:[DI+1] ; get next byte + AND AL,11111000B ; get mod and type + CMP AL,01010000B ; indirect intra 8 bit offset? + JZ ZTRACE3 ; yes, three byte whammy + CMP AL,01011000B ; indirect inter 8 bit offset + JZ ZTRACE3 ; yes, three byte guy + CMP AL,10010000B ; indirect intra 16 bit offset? + JZ ZTRACE4 ; four byte offset + CMP AL,10011000B ; indirect inter 16 bit offset? + JZ ZTRACE4 ; four bytes + CMP AL,11010000B ; indirect through reg? + JZ ZTRACE2 ; two byte instruction + JMP STEP ; can't figger out what this is! +ZTRACE5: + INC DX +ZTRACE4: + INC DX +ZTRACE3: + INC DX +ZTRACE2: + INC DX +ZTRACE1: + INC DX + ADD DI,DX ; offset to breakpoint instruction + MOV WORD PTR [BPTAB],DI ; save offset + MOV WORD PTR [BPTAB+2],ES ; save segment + MOV AL,ES:[DI] ; get next opcode byte + MOV BYTE PTR [BPTAB+4],AL ; save it + MOV BYTE PTR ES:[DI],0CCH ; break point it + MOV [BRKCNT],1 ; only this breakpoint + JMP DEXIT ; start the operation! + +; Trace 1 instruction or the number of instruction specified +; by the parameter using 8086 trace mode. Registers are all +; set according to values in save area +TRACE: + MOV FZTRACE,0 + CALL SETADD + CALL SCANP + CALL HEXIN + MOV DX,1 + JC STOCNT + MOV CX,4 + CALL GETHEX + CALL CHECKNONE +STOCNT: + MOV [TCOUNT],DX + CALL GETEOL + MOV DX,NEXTCS + MOV CSSAVE,DX + MOV DX,NEXTIP + MOV IPSAVE,DX +STEP: + MOV [BRKCNT],0 +; The 286 has a problem with trace mode and software interrupt instructions; +; it treats them as atomic operations. We simulate the operation in software. + MOV ES,[CSSAVE] ; Get next instruction pointer + MOV DI,[IPSAVE] + MOV AL,ES:[DI] ; get next opcode + cmp al,0e4h ; check for 'IN' opcode + jne not_inal_op + cmp es:byte ptr[di+1],21h + jne not_mask_op + add [ipsave],2 + JMP SETalmask + +not_inal_op: + cmp al,0ech ; in al,DX ? + jne not_mask_op + cmp dxsave,21h + jne not_mask_op + add [ipsave],1 +SETalmask: + mov ax,[axsave] + in al,21h + mov [axsave],ax + JMP SETENVIRON + +not_mask_op: + CMP AL,0CDH ; trace over an interrupt? + JZ DOINT ; no, check for other special cases + CMP AL,0CEH ; how about int overflow + JNZ CHECKCC + TEST FLSAVE,F_OVERFLOW ; see it overflow is present + JZ CHECKOP + MOV BX,4 ; INTO = INT 4 + DEC IPSAVE ; INTO is a singel byte + JMP SHORT DOVAL +CHECKCC: + CMP AL,0CCH + JNZ CHECKOP + MOV BX,3 ; INT 3 = CC + DEC IPSAVE + JMP SHORT DOVAL +DOINT: +; We have a software interrupt. Get destination vector + MOV BL,BYTE PTR ES:[DI+1] ; get vector number + XOR BH,BH ; clear out upper +DOVAL: + SHL BX,1 ; word index + SHL BX,1 ; dword index + XOR DI,DI ; interrupt table + MOV ES,DI + MOV AX,ES:[BX] ; point to vector + MOV BX,ES:[BX+2] ; point to vector +; AX:BX is the vector. Swap it with currect CS:IP + XCHG AX,IPSAVE ; new CS:IP + XCHG BX,CSSAVE +; AX:BX is old CS:IP. We 'PUSH' flags, oldCS and oldIP, reset flags (ifl) and +; set CS:IP to point to interrupt instruction. + MOV ES,SSSAVE ; point to user stack + MOV DI,SPSAVE +; Take old flags and PUSH the flags. + MOV CX,FLSAVE ; get flags + SUB DI,2 ; PUSHF + MOV ES:[DI],CX ; rest of push +; Push the old CS + SUB DI,2 ; PUSH CS + MOV ES:[DI],BX ; rest of push +; Push the old IP + SUB DI,2 ; PUSH IP + ADD AX,2 ; increment IP + MOV ES:[DI],AX ; rest of push +; Update stack + MOV SPSAVE,DI ; store +; Take flags and turn interrupts off and trace mode off + AND CX,NOT F_INTERRUPT ; CLI + AND CX,NOT F_TRACE ; no trace + MOV FLSAVE,CX ; rest of CLI +; Set up correct process and go to normal reentry code. + IF NOT SYSVER + MOV BX,[USER_PROC_PDB] + MOV AH,SET_CURRENT_PDB + INT 21H + ENDIF + JMP SETENVIRON +; We need to special case the following instructions that may push a TRACE bit +; on the stack: PUSHF (9C) + +; Save the opcode in A Special place +CHECKOP: + MOV RSETFLAG,AL ; no bits to turn off +SETTRACE: + OR FLSAVE,F_TRACE ; Turn on trace bit + IF IBMVER + CLI + IN AL,MASK_PORT ; Get current mask + JMP SHORT FOO +FOO: + MOV [OLD_MASK],AL ; Save it + MOV AL,INT_MASK ; New mask + OUT MASK_PORT,AL ; Set it + STI + ENDIF +DEXIT: + IF NOT SYSVER + MOV BX,[USER_PROC_PDB] + MOV AH,SET_CURRENT_PDB + INT 21H + ENDIF +; Unfortunately, any system call we issue will muck with the current extended +; errors. Here we must restore the extended error state so that if the user +; program gets it, we do not interfere. + MOV AX,(SERVERCALL SHL 8) + 10 + MOV DX,OFFSET DG:SAVESTATE + INT 21H + PUSH DS + XOR AX,AX + MOV DS,AX + MOV WORD PTR DS:[12],OFFSET DG:BREAKFIX ; Set vector 3--breakpoint instruction + MOV WORD PTR DS:[14],CS + MOV WORD PTR DS:[4],OFFSET DG:REENTER ; Set vector 1--Single step + MOV WORD PTR DS:[6],CS + CLI + IF SETCNTC + MOV WORD PTR DS:[8CH],OFFSET DG:CONTC ; Set vector 23H (CTRL-C) + MOV WORD PTR DS:[8EH],CS + ENDIF + POP DS + MOV SP,OFFSET DG:STACK + POP AX + POP BX + POP CX + POP DX + POP BP + POP BP + POP SI + POP DI + POP ES + POP ES + POP SS + MOV SP,[SPSAVE] + PUSH [FLSAVE] + PUSH [CSSAVE] + PUSH [IPSAVE] + MOV DS,[DSSAVE] + IRET +STEP1: + CALL CRLF + CALL DISPREG + TEST FZTRACE,-1 + JNZ STEPZ + JMP STEP +STEPZ: JMP ZSTEP + +; Re-entry point from CTRL-C. Top of stack has address in 86-DOS for +; continuing, so we must pop that off. +CONTC: + ADD SP,6 + JMP SHORT REENTERREAL + +; Re-entry point from breakpoint. Need to decrement instruction +; pointer so it points to location where breakpoint actually +; occured. +BREAKFIX: + PUSH BP + MOV BP,SP + DEC WORD PTR [BP].OLDIP + POP BP + JMP REENTERREAL + +; Re-entry point from trace mode or interrupt during execution. All registers +; are saved so they can be displayed or modified. +INTERRUPT_FRAME STRUC +OLDBP DW ? +OLDIP DW ? +OLDCS DW ? +OLDF DW ? +OLDERIP DW ? +OLDERCS DW ? +OLDERF DW ? +INTERRUPT_FRAME ENDS + +ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:NOTHING +; ReEnter is the main entry point for breakpoint interrupts and for trace mode +; interrupts. We treat both of these cases identically: save state, display +; registers and go for another command. If we get NMI's, we skip them or if +; it turns out that we are debugging ourselves, we skip them. + +; Due to bogosities in the 808x chip, Consider tracing over an interrupt and +; then setting a breakpoint to where the interrupt returns. You get the INT 3 +; and then trace mode gets invoked! This is why we ignore interrupts within +; ourselves. +REENTER: + PUSH BP + MOV BP,SP ; get a frame to address from + PUSH AX +; MOV AX,CS +; CMP AX,[BP].OLDCS ; Did we interrupt ourselves? +; JNZ GOREENTER ; no, go reenter + IF IBMJAPAN + MOV AX,[BP].OLDIP + CMP AX,OFFSET DG:NMIINT ; interrupt below NMI interrupt? + JB GOREENTER ; yes, go reenter + CMP [BP].OLDIP,OFFSET DG:NMIINTEND + JAE GOREENTER ; interrupt above NMI interrupt? + POP AX ; restore state + POP BP + SUB SP,6 ; switch TRACE and NMI stack frames + PUSH BP + MOV BP,SP ; set up frame + PUSH AX ; get temp variable + MOV AX,[BP].OLDERIP ; get NMI Vector + MOV [BP].OLDIP,AX ; stuff in new NMI vector + MOV AX,[BP].OLDERCS ; get NMI Vector + MOV [BP].OLDCS,AX ; stuff in new NMI vector + MOV AX,[BP].OLDERF ; get NMI Vector + AND AH,0FEH ; turn off Trace if present + MOV [BP].OLDF,AX ; stuff in new NMI vector + MOV [BP].OLDERF,AX + MOV [BP].OLDERIP,OFFSET DG:REENTER ; offset of routine + MOV [BP].OLDERCS,CS ; and CS + POP AX + POP BP + IRET ; go try again + ENDIF +GOREENTER: + IF IBMVER + MOV AL,CS:[OLD_MASK] ; Recover Old mask + OUT MASK_PORT,AL ; Restore it + ENDIF + MOV AL,CS:[RSETFLAG] +; Determine, based on the previous instruction, what we are supposed to do +; to flags on the users stack. + CMP AL,09CH ; PUSHF + JNZ NOFIX +; OlderIP = flags. Turn off trace bit + AND [BP].OLDERIP,NOT F_TRACE +NOFIX: + POP AX + POP BP +REENTERREAL: + MOV CS:[SPSAVE+SEGDIF],SP + MOV CS:[SSSAVE+SEGDIF],SS + MOV CS:[FLSAVE],CS + MOV SS,CS:[FLSAVE] + MOV SP,OFFSET DG:RSTACK + ASSUME SS:DG + + PUSH ES + PUSH DS + PUSH DI + PUSH SI + PUSH BP + DEC SP + DEC SP + PUSH DX + PUSH CX + PUSH BX + PUSH AX + PUSH SS + POP DS + ASSUME DS:DG + + MOV SS,[SSSAVE] + MOV SP,[SPSAVE] + ASSUME SS:NOTHING + + POP [IPSAVE] + POP [CSSAVE] + POP AX + AND AX,NOT F_TRACE ; TURN OFf trace mode bit + MOV [FLSAVE],AX + MOV [SPSAVE],SP +SETENVIRON: + PUSH DS + POP ES + ASSUME ES:DG + + PUSH DS + POP SS + ASSUME SS:DG + + MOV SP,OFFSET DG:STACK + PUSH DS + XOR AX,AX + MOV DS,AX + ASSUME DS:NOTHING + + IF SETCNTC + MOV WORD PTR DS:[8CH],OFFSET DG:DABORT ; Set Ctrl-C vector + MOV WORD PTR DS:[8EH],CS + ENDIF + POP DS + ASSUME DS:DG + + STI + CLD +; Since we are about to issue system calls, let's grab the current user's +; extended error info. + MOV AH,GETEXTENDEDERROR + INT 21H + ASSUME DS:NOTHING,ES:NOTHING + + MOV SAVESTATE.DPL_AX,AX + MOV SAVESTATE.DPL_BX,BX + MOV SAVESTATE.DPL_CX,CX + MOV SAVESTATE.DPL_DX,DX + MOV SAVESTATE.DPL_SI,SI + MOV SAVESTATE.DPL_DI,DI + MOV SAVESTATE.DPL_DS,DS + MOV SAVESTATE.DPL_ES,ES + MOV AX,CS + MOV DS,AX + MOV ES,AX + ASSUME DS:DG,ES:DG + + IF NOT SYSVER + MOV AH,GET_CURRENT_PDB + INT 21H + MOV [USER_PROC_PDB],BX + MOV BX,BEGSEG + MOV AH,SET_CURRENT_PDB + INT 21H + ENDIF + MOV SI,OFFSET DG:BPTAB + MOV CX,[BRKCNT] + JCXZ SHOREG + PUSH ES +CLEARBP: + LES DI,DWORD PTR [SI] + ADD SI,4 + MOVSB + LOOP CLEARBP + POP ES +SHOREG: + DEC [TCOUNT] + JZ CHECKDISP + JMP STEP1 +CHECKDISP: + CALL CRLF + CALL DISPREG + JMP COMMAND + +; Input from the specified port and display result +INPUT: + MOV CX,4 ; Port may have 4 digits + CALL GETHEX ; Get port number in DX + CALL GETEOL + + IN AL,DX ; Variable port input + + PUSH CS + POP ES + MOV DI,OFFSET DG:ARG_BUF + CALL HEX ; And display + + XOR AL,AL + STOSB + MOV DX,OFFSET DG:ARG_BUF_PTR + JMP PRINTF_CRLF + +; Output a value to specified port. +OUTPUT: + MOV CX,4 ; Port may have 4 digits + CALL GETHEX ; Get port number + PUSH DX ; Save while we get data + MOV CX,2 ; Byte output only + CALL GETHEX ; Get data to output + CALL GETEOL + XCHG AX,DX ; Output data in AL + POP DX ; Port in DX + + OUT DX,AL ; Variable port output + + RETURN + +SETADD: + MOV DX,CSSAVE ; set up start addresses + MOV NEXTCS,DX + MOV DX,IPSAVE + MOV NEXTIP,DX + MOV BP,[CSSAVE] + CALL SCANP + CMP BYTE PTR [SI],"=" + RETNZ + INC SI + CALL ADDRESS + MOV NEXTCS,AX + MOV NEXTIP,DX + RETURN + +; Jump to program, setting up registers according to the +; save area. up to 10 breakpoint addresses may be specified. +GO: + MOV RSETFLAG,0 + CALL SETADD + XOR BX,BX + MOV DI,OFFSET DG:BPTAB +GO1: + CALL SCANP + JZ DEXEC + MOV BP,[CSSAVE] + PUSH DI + PUSH BX ;AN000; DMS;SAVE BX - ADDRESS KILLS IT + CALL ADDRESS + POP BX ;AN000; DMS;RESTORE BX + POP DI + MOV [DI],DX ; Save offset + MOV [DI+2],AX ; Save segment + ADD DI,5 ; Leave a little room + INC BX + CMP BX,1+BPMAX + JNZ GO1 + MOV DX,OFFSET DG:BP_ERROR ; BP ERROR + JMP ERR +DEXEC: + MOV [BRKCNT],BX + MOV CX,BX + JCXZ NOBP + MOV DI,OFFSET DG:BPTAB + PUSH DS +SETBP: + LDS SI,ES:DWORD PTR [DI] + ADD DI,4 + MOVSB + MOV BYTE PTR [SI-1],0CCH + LOOP SETBP + POP DS +NOBP: + MOV DX,NEXTCS + MOV CSSAVE,DX + MOV DX,NEXTIP + MOV IPSAVE,DX + MOV [TCOUNT],1 + JMP DEXIT + +SKIP_FILE: + MOV AH,CHAR_OPER + INT 21H + MOV CS:[SWITCHAR],DL ; GET THE CURRENT SWITCH CHARACTER +FIND_DELIM: + LODSB + CALL DELIM1 + JZ GOTDELIM + CALL DELIM2 + JNZ FIND_DELIM +GOTDELIM: + DEC SI + RETURN + +COMPARE: + CALL DSRANGE + PUSH CX + PUSH AX + PUSH DX + CALL ADDRESS ; Same segment + CALL GETEOL + POP SI + MOV DI,DX + MOV ES,AX + POP DS + POP CX ; Length + DEC CX + CALL COMP ; Do one less than total + INC CX ; CX=1 (do last one) +COMP: + REPE CMPSB + RETZ +; Compare error. Print address, value; value, address. + DEC SI + MOV CS:COMP_ARG1,DS + MOV CS:COMP_ARG2,SI + XOR AH,AH + LODSB + MOV CS:COMP_ARG3,AX + DEC DI + MOV AL,ES:[DI] + MOV CS:COMP_ARG4,AX + MOV CS:COMP_ARG5,ES + MOV CS:COMP_ARG6,DI + INC DI + PUSH DS + PUSH CS + POP DS + MOV DX,OFFSET DG:COMP_PTR + CALL PRINTF_CRLF + POP DS + XOR AL,AL + JMP SHORT COMP + + PROCEDURE CHECKNONE,NEAR + OR DX,DX + RETNZ + MOV DX,OFFSET DG:SYNERR_PTR ; ERROR MESSAGE + JMP PERR + ENDPROC CHECKNONE + +CODE ENDS + END DEBCOM3 + \ 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 @@ + PAGE 80,132 ; + TITLE DEBCONST.ASM + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBCONST + ENDIF +.XLIST +.XCREF +INCLUDE DOSSYM.INC +INCLUDE DEBEQU.ASM +.LIST +.CREF + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE + + EXTRN ALUFROMREG:NEAR, ALUTOREG:NEAR, ACCIMM:NEAR, SEGOP:NEAR + EXTRN ESPRE:NEAR, SSPRE:NEAR, CSPRE:NEAR, DSPRE:NEAR + EXTRN REGOP:NEAR, NOOPERANDS:NEAR, SAVHEX:NEAR, SHORTJMP:NEAR + EXTRN MOVSEGTO:NEAR, WORDTOALU:NEAR, MOVSEGFROM:NEAR + EXTRN GETADDR:NEAR, XCHGAX:NEAR, LONGJMP:NEAR, LOADACC:NEAR + EXTRN STOREACC:NEAR, REGIMMB:NEAR, SAV16:NEAR, MEMIMM:NEAR + EXTRN INT3:NEAR, SAV8:NEAR, CHK10:NEAR, M8087:NEAR + EXTRN M8087_D9:NEAR, M8087_DB:NEAR, M8087_DD:NEAR + EXTRN M8087_DF:NEAR, INFIXB:NEAR, INFIXW:NEAR, OUTFIXB:NEAR + EXTRN OUTFIXW:NEAR, JMPCALL:NEAR, INVARB:NEAR, INVARW:NEAR + EXTRN OUTVARB:NEAR, OUTVARW:NEAR, PREFIX:NEAR, IMMED:NEAR + EXTRN SIGNIMM:NEAR, SHIFT:NEAR, SHIFTV:NEAR, GRP1:NEAR + EXTRN GRP2:NEAR, REGIMMW:NEAR, DOORG:NEAR + + + EXTRN DB_OPER:NEAR, DW_OPER:NEAR, ASSEMLOOP:NEAR, GROUP2:NEAR + EXTRN NO_OPER:NEAR, GROUP1:NEAR, FGROUPP:NEAR, FGROUPX:NEAR + EXTRN FGROUPZ:NEAR, FD9_OPER:NEAR, FGROUPB:NEAR, FGROUP:NEAR + EXTRN FGROUPDS:NEAR, DCINC_OPER:NEAR, INT_OPER:NEAR + EXTRN IN_OPER:NEAR, DISP8_OPER:NEAR, JMP_OPER:NEAR, L_OPER:NEAR + EXTRN MOV_OPER:NEAR, OUT_OPER:NEAR, PUSH_OPER:NEAR + EXTRN GET_DATA16:NEAR, FGROUP3:NEAR, FGROUP3W:NEAR + EXTRN FDE_OPER:NEAR, ESC_OPER:NEAR, AA_OPER:NEAR + EXTRN CALL_OPER:NEAR, FDB_OPER:NEAR, POP_OPER:NEAR, ROTOP:NEAR + EXTRN TST_OPER:NEAR, EX_OPER:NEAR + +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + + PUBLIC REG8, REG16, SREG, SIZ8, DISTAB, DBMN, ADDMN, ADCMN, SUBMN + PUBLIC SBBMN, XORMN, ORMN, ANDMN, AAAMN, AADMN, AASMN, CALLMN, CBWMN + PUBLIC UPMN, DIMN, CMCMN, CMPMN, CWDMN, DAAMN, DASMN, DECMN, DIVMN + PUBLIC ESCMN, HLTMN, IDIVMN, IMULMN, INCMN, INTOMN, INTMN, INMN + PUBLIC IRETMN, JAMN, JCXZMN, JNCMN, JBEMN, JZMN, JGEMN, JGMN, JLEMN + PUBLIC JLMN, JMPMN, JNZMN, JPEMN, JNZMN, JPEMN, JPOMN, JNSMN, JNOMN + PUBLIC JOMN, JSMN, LAHFMN, LDSMN, LEAMN, LESMN, LOCKMN, LODBMN + PUBLIC LODWMN, LOOPNZMN, LOOPZMN, LOOPMN, MOVBMN, MOVWMN, MOVMN + PUBLIC MULMN, NEGMN, NOPMN, NOTMN, OUTMN, POPFMN, POPMN, PUSHFMN + PUBLIC PUSHMN, RCLMN, RCRMN, REPZMN, REPNZMN, RETFMN, RETMN, ROLMN + PUBLIC RORMN, SAHFMN, SARMN, SCABMN, SCAWMN, SHLMN, SHRMN, STCMN + PUBLIC DOWNMN, EIMN, STOBMN, STOWMN, TESTMN, WAITMN, XCHGMN, XLATMN + PUBLIC ESSEGMN, CSSEGMN, SSSEGMN, DSSEGMN, BADMN + + PUBLIC M8087_TAB, FI_TAB, SIZE_TAB, MD9_TAB, MD9_TAB2, MDB_TAB + PUBLIC MDB_TAB2, MDD_TAB, MDD_TAB2, MDF_TAB, OPTAB, MAXOP, SHFTAB + PUBLIC IMMTAB, GRP1TAB, GRP2TAB, SEGTAB, REGTAB, REGTABEND, FLAGTAB + PUBLIC STACK + + PUBLIC AXSAVE, BXSAVE, CXSAVE, DXSAVE, BPSAVE, SPSAVE, SISAVE + PUBLIC DISAVE, DSSAVE, ESSAVE, SSSAVE, CSSAVE, IPSAVE, FLSAVE, RSTACK + PUBLIC REGDIF, RDFLG, TOTREG, DSIZ, NOREGL, DISPB, LBUFSIZ, LBUFFCNT + PUBLIC LINEBUF, PFLAG, COLPOS, RSETFLAG + + IF SYSVER + PUBLIC CONFCB, POUT, COUT, CIN, IOBUFF, IOADDR, IOCALL, IOCOM + PUBLIC IOSTAT, IOCHRET, IOSEG, IOCNT + ENDIF + + PUBLIC QFLAG, NEWEXEC, RETSAVE, USER_PROC_PDB, HEADSAVE, EXEC_BLOCK + PUBLIC COM_LINE, COM_FCB1, COM_FCB2, COM_SSSP, COM_CSIP, NEXTCS + PUBLIC NEXTIP, NAMESPEC + +REG8 DB "ALCLDLBLAHCHDHBH" +REG16 DB "AXCXDXBXSPBPSIDI" +SREG DB "ESCSSSDS",0,0 +SIZ8 DB "BYWODWQWTB",0,0 +; 0 +DISTAB DW OFFSET DG:ADDMN,ALUFROMREG + DW OFFSET DG:ADDMN,ALUFROMREG + DW OFFSET DG:ADDMN,ALUTOREG + DW OFFSET DG:ADDMN,ALUTOREG + DW OFFSET DG:ADDMN,ACCIMM + DW OFFSET DG:ADDMN,ACCIMM + DW OFFSET DG:PUSHMN,SEGOP + DW OFFSET DG:POPMN,SEGOP + DW OFFSET DG:ORMN,ALUFROMREG + DW OFFSET DG:ORMN,ALUFROMREG + DW OFFSET DG:ORMN,ALUTOREG + DW OFFSET DG:ORMN,ALUTOREG + DW OFFSET DG:ORMN,ACCIMM + DW OFFSET DG:ORMN,ACCIMM + DW OFFSET DG:PUSHMN,SEGOP + DW OFFSET DG:POPMN,SEGOP +; 10H + DW OFFSET DG:ADCMN,ALUFROMREG + DW OFFSET DG:ADCMN,ALUFROMREG + DW OFFSET DG:ADCMN,ALUTOREG + DW OFFSET DG:ADCMN,ALUTOREG + DW OFFSET DG:ADCMN,ACCIMM + DW OFFSET DG:ADCMN,ACCIMM + DW OFFSET DG:PUSHMN,SEGOP + DW OFFSET DG:POPMN,SEGOP + DW OFFSET DG:SBBMN,ALUFROMREG + DW OFFSET DG:SBBMN,ALUFROMREG + DW OFFSET DG:SBBMN,ALUTOREG + DW OFFSET DG:SBBMN,ALUTOREG + DW OFFSET DG:SBBMN,ACCIMM + DW OFFSET DG:SBBMN,ACCIMM + DW OFFSET DG:PUSHMN,SEGOP + DW OFFSET DG:POPMN,SEGOP +; 20H + DW OFFSET DG:ANDMN,ALUFROMREG + DW OFFSET DG:ANDMN,ALUFROMREG + DW OFFSET DG:ANDMN,ALUTOREG + DW OFFSET DG:ANDMN,ALUTOREG + DW OFFSET DG:ANDMN,ACCIMM + DW OFFSET DG:ANDMN,ACCIMM + DW OFFSET DG:ESSEGMN,ESPRE + DW OFFSET DG:DAAMN,NOOPERANDS + DW OFFSET DG:SUBMN,ALUFROMREG + DW OFFSET DG:SUBMN,ALUFROMREG + DW OFFSET DG:SUBMN,ALUTOREG + DW OFFSET DG:SUBMN,ALUTOREG + DW OFFSET DG:SUBMN,ACCIMM + DW OFFSET DG:SUBMN,ACCIMM + DW OFFSET DG:CSSEGMN,CSPRE + DW OFFSET DG:DASMN,NOOPERANDS +; 30H + DW OFFSET DG:XORMN,ALUFROMREG + DW OFFSET DG:XORMN,ALUFROMREG + DW OFFSET DG:XORMN,ALUTOREG + DW OFFSET DG:XORMN,ALUTOREG + DW OFFSET DG:XORMN,ACCIMM + DW OFFSET DG:XORMN,ACCIMM + DW OFFSET DG:SSSEGMN,SSPRE + DW OFFSET DG:AAAMN,NOOPERANDS + DW OFFSET DG:CMPMN,ALUFROMREG + DW OFFSET DG:CMPMN,ALUFROMREG + DW OFFSET DG:CMPMN,ALUTOREG + DW OFFSET DG:CMPMN,ALUTOREG + DW OFFSET DG:CMPMN,ACCIMM + DW OFFSET DG:CMPMN,ACCIMM + DW OFFSET DG:DSSEGMN,DSPRE + DW OFFSET DG:AASMN,NOOPERANDS +; 40H + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:INCMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP + DW OFFSET DG:DECMN,REGOP +; 50H + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:PUSHMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP + DW OFFSET DG:POPMN,REGOP +; 60H + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX +; 70H + DW OFFSET DG:JOMN,SHORTJMP + DW OFFSET DG:JNOMN,SHORTJMP + DW OFFSET DG:JCMN,SHORTJMP + DW OFFSET DG:JNCMN,SHORTJMP + DW OFFSET DG:JZMN,SHORTJMP + DW OFFSET DG:JNZMN,SHORTJMP + DW OFFSET DG:JBEMN,SHORTJMP + DW OFFSET DG:JAMN,SHORTJMP + DW OFFSET DG:JSMN,SHORTJMP + DW OFFSET DG:JNSMN,SHORTJMP + DW OFFSET DG:JPEMN,SHORTJMP + DW OFFSET DG:JPOMN,SHORTJMP + DW OFFSET DG:JLMN,SHORTJMP + DW OFFSET DG:JGEMN,SHORTJMP + DW OFFSET DG:JLEMN,SHORTJMP + DW OFFSET DG:JGMN,SHORTJMP +; 80H + DW 0,IMMED + DW 0,IMMED + DW 0,IMMED + DW 0,SIGNIMM + DW OFFSET DG:TESTMN,ALUTOREG ;ARR 2.4 + DW OFFSET DG:TESTMN,ALUTOREG ;ARR 2.4 + DW OFFSET DG:XCHGMN,ALUTOREG ;ARR 2.4 + DW OFFSET DG:XCHGMN,ALUTOREG ;ARR 2.4 + DW OFFSET DG:MOVMN,ALUFROMREG + DW OFFSET DG:MOVMN,ALUFROMREG + DW OFFSET DG:MOVMN,ALUTOREG + DW OFFSET DG:MOVMN,ALUTOREG + DW OFFSET DG:MOVMN,MOVSEGTO + DW OFFSET DG:LEAMN,WORDTOALU + DW OFFSET DG:MOVMN,MOVSEGFROM + DW OFFSET DG:POPMN,GETADDR +; 90H + DW OFFSET DG:NOPMN,NOOPERANDS + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:XCHGMN,XCHGAX + DW OFFSET DG:CBWMN,NOOPERANDS + DW OFFSET DG:CWDMN,NOOPERANDS + DW OFFSET DG:CALLMN,LONGJMP + DW OFFSET DG:WAITMN,NOOPERANDS + DW OFFSET DG:PUSHFMN,NOOPERANDS + DW OFFSET DG:POPFMN,NOOPERANDS + DW OFFSET DG:SAHFMN,NOOPERANDS + DW OFFSET DG:LAHFMN,NOOPERANDS +; A0H + DW OFFSET DG:MOVMN,LOADACC + DW OFFSET DG:MOVMN,LOADACC + DW OFFSET DG:MOVMN,STOREACC + DW OFFSET DG:MOVMN,STOREACC + DW OFFSET DG:MOVBMN,NOOPERANDS + DW OFFSET DG:MOVWMN,NOOPERANDS + DW OFFSET DG:CMPBMN,NOOPERANDS + DW OFFSET DG:CMPWMN,NOOPERANDS + DW OFFSET DG:TESTMN,ACCIMM + DW OFFSET DG:TESTMN,ACCIMM + DW OFFSET DG:STOBMN,NOOPERANDS + DW OFFSET DG:STOWMN,NOOPERANDS + DW OFFSET DG:LODBMN,NOOPERANDS + DW OFFSET DG:LODWMN,NOOPERANDS + DW OFFSET DG:SCABMN,NOOPERANDS + DW OFFSET DG:SCAWMN,NOOPERANDS +; B0H + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMB + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW + DW OFFSET DG:MOVMN,REGIMMW +; C0H + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:RETMN,SAV16 + DW OFFSET DG:RETMN,NOOPERANDS + DW OFFSET DG:LESMN,WORDTOALU + DW OFFSET DG:LDSMN,WORDTOALU + DW OFFSET DG:MOVMN,MEMIMM + DW OFFSET DG:MOVMN,MEMIMM + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:RETFMN,SAV16 + DW OFFSET DG:RETFMN,NOOPERANDS + DW OFFSET DG:INTMN,INT3 + DW OFFSET DG:INTMN,SAV8 + DW OFFSET DG:INTOMN,NOOPERANDS + DW OFFSET DG:IRETMN,NOOPERANDS +; D0H + DW 0,SHIFT + DW 0,SHIFT + DW 0,SHIFTV + DW 0,SHIFTV + DW OFFSET DG:AAMMN,CHK10 + DW OFFSET DG:AADMN,CHK10 + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:XLATMN,NOOPERANDS + DW 0,M8087 ; d8 + DW 0,M8087_D9 ; d9 + DW 0,M8087 ; da + DW 0,M8087_DB ; db + DW 0,M8087 ; dc + DW 0,M8087_DD ; dd + DW 0,M8087 ; de + DW 0,M8087_DF ; df +; E0H + DW OFFSET DG:LOOPNZMN,SHORTJMP + DW OFFSET DG:LOOPZMN,SHORTJMP + DW OFFSET DG:LOOPMN,SHORTJMP + DW OFFSET DG:JCXZMN,SHORTJMP + DW OFFSET DG:INMN,INFIXB + DW OFFSET DG:INMN,INFIXW + DW OFFSET DG:OUTMN,OUTFIXB + DW OFFSET DG:OUTMN,OUTFIXW + DW OFFSET DG:CALLMN,JMPCALL + DW OFFSET DG:JMPMN,JMPCALL + DW OFFSET DG:JMPMN,LONGJMP + DW OFFSET DG:JMPMN,SHORTJMP + DW OFFSET DG:INMN,INVARB + DW OFFSET DG:INMN,INVARW + DW OFFSET DG:OUTMN,OUTVARB + DW OFFSET DG:OUTMN,OUTVARW +; F0H + DW OFFSET DG:LOCKMN,PREFIX + DW OFFSET DG:DBMN,SAVHEX + DW OFFSET DG:REPNZMN,PREFIX + DW OFFSET DG:REPZMN,PREFIX + DW OFFSET DG:HLTMN,NOOPERANDS + DW OFFSET DG:CMCMN,NOOPERANDS + DW 0,GRP1 + DW 0,GRP1 + DW OFFSET DG:CLCMN,NOOPERANDS + DW OFFSET DG:STCMN,NOOPERANDS + DW OFFSET DG:DIMN,NOOPERANDS + DW OFFSET DG:EIMN,NOOPERANDS + DW OFFSET DG:UPMN,NOOPERANDS + DW OFFSET DG:DOWNMN,NOOPERANDS + DW 0,GRP2 + DW 0,GRP2 + +DBMN DB "DB",0 + DB "DW",0 + DB ";",0 +ORGMN DB "ORG",0 +ADDMN DB "ADD",0 +ADCMN DB "ADC",0 +SUBMN DB "SUB",0 +SBBMN DB "SBB",0 +XORMN DB "XOR",0 +ORMN DB "OR",0 +ANDMN DB "AND",0 +AAAMN DB "AAA",0 +AADMN DB "AAD",0 +AAMMN DB "AAM",0 +AASMN DB "AAS",0 +CALLMN DB "CALL",0 +CBWMN DB "CBW",0 +CLCMN DB "CLC",0 +UPMN DB "CLD",0 ; CLD,0 +DIMN DB "CLI",0 +CMCMN DB "CMC",0 +CMPBMN DB "CMPSB",0 ; CMPSB +CMPWMN DB "CMPSW",0 ; CMPSW,0 +CMPMN DB "CMP",0 +CWDMN DB "CWD",0 +DAAMN DB "DAA",0 +DASMN DB "DAS",0 +DECMN DB "DEC",0 +DIVMN DB "DIV",0 +ESCMN DB "ESC",0 + DB "FXCH",0 + DB "FFREE",0 + DB "FCOMPP",0 + DB "FCOMP",0 + DB "FCOM",0 + DB "FICOMP",0 + DB "FICOM",0 + DB "FNOP",0 + DB "FCHS",0 + DB "FABS",0 + DB "FTST",0 + DB "FXAM",0 + DB "FLDL2T",0 + DB "FLDL2E",0 + DB "FLDLG2",0 + DB "FLDLN2",0 + DB "FLDPI",0 + DB "FLD1",0 + DB "FLDZ",0 + DB "F2XM1",0 + DB "FYL2XP1",0 + DB "FYL2X",0 + DB "FPTAN",0 + DB "FPATAN",0 + DB "FXTRACT",0 + DB "FDECSTP",0 + DB "FINCSTP",0 + DB "FPREM",0 + DB "FSQRT",0 + DB "FRNDINT",0 + DB "FSCALE",0 + DB "FINIT",0 + DB "FDISI",0 + DB "FENI",0 + DB "FCLEX",0 + DB "FBLD",0 + DB "FBSTP",0 + DB "FLDCW",0 + DB "FSTCW",0 + DB "FSTSW",0 + DB "FSTENV",0 + DB "FLDENV",0 + DB "FSAVE",0 + DB "FRSTOR",0 + DB "FADDP",0 + DB "FADD",0 + DB "FIADD",0 + DB "FSUBRP",0 + DB "FSUBR",0 + DB "FSUBP",0 + DB "FSUB",0 + DB "FISUBR",0 + DB "FISUB",0 + DB "FMULP",0 + DB "FMUL",0 + DB "FIMUL",0 + DB "FDIVRP",0 + DB "FDIVR",0 + DB "FDIVP",0 + DB "FDIV",0 + DB "FIDIVR",0 + DB "FIDIV",0 + DB "FWAIT",0 + DB "FILD",0 + DB "FLD",0 + DB "FSTP",0 + DB "FST",0 + DB "FISTP",0 + DB "FIST",0 +HLTMN DB "HLT",0 +IDIVMN DB "IDIV",0 +IMULMN DB "IMUL",0 +INCMN DB "INC",0 +INTOMN DB "INTO",0 +INTMN DB "INT",0 +INMN DB "IN",0 ; IN +IRETMN DB "IRET",0 + DB "JNBE",0 + DB "JAE",0 +JAMN DB "JA",0 +JCXZMN DB "JCXZ",0 +JNCMN DB "JNB",0 +JBEMN DB "JBE",0 +JCMN DB "JB",0 + DB "JNC",0 + DB "JC",0 + DB "JNAE",0 + DB "JNA",0 +JZMN DB "JZ",0 + DB "JE",0 +JGEMN DB "JGE",0 +JGMN DB "JG",0 + DB "JNLE",0 + DB "JNL",0 +JLEMN DB "JLE",0 +JLMN DB "JL",0 + DB "JNGE",0 + DB "JNG",0 +JMPMN DB "JMP",0 +JNZMN DB "JNZ",0 + DB "JNE",0 +JPEMN DB "JPE",0 +JPOMN DB "JPO",0 + DB "JNP",0 +JNSMN DB "JNS",0 +JNOMN DB "JNO",0 +JOMN DB "JO",0 +JSMN DB "JS",0 + DB "JP",0 +LAHFMN DB "LAHF",0 +LDSMN DB "LDS",0 +LEAMN DB "LEA",0 +LESMN DB "LES",0 +LOCKMN DB "LOCK",0 +LODBMN DB "LODSB",0 ; LODSB +LODWMN DB "LODSW",0 ; LODSW,0 +LOOPNZMN DB "LOOPNZ",0 +LOOPZMN DB "LOOPZ",0 + DB "LOOPNE",0 + DB "LOOPE",0 +LOOPMN DB "LOOP",0 +MOVBMN DB "MOVSB",0 ; MOVSB +MOVWMN DB "MOVSW",0 ; MOVSW,0 +MOVMN DB "MOV",0 +MULMN DB "MUL",0 +NEGMN DB "NEG",0 +NOPMN DB "NOP",0 +NOTMN DB "NOT",0 +OUTMN DB "OUT",0 ; OUT +POPFMN DB "POPF",0 +POPMN DB "POP",0 +PUSHFMN DB "PUSHF",0 +PUSHMN DB "PUSH",0 +RCLMN DB "RCL",0 +RCRMN DB "RCR",0 +REPZMN DB "REPZ",0 +REPNZMN DB "REPNZ",0 + DB "REPE",0 + DB "REPNE",0 + DB "REP",0 +RETFMN DB "RETF",0 +RETMN DB "RET",0 +ROLMN DB "ROL",0 +RORMN DB "ROR",0 +SAHFMN DB "SAHF",0 +SARMN DB "SAR",0 +SCABMN DB "SCASB",0 ; SCASB +SCAWMN DB "SCASW",0 ; SCASW,0 +SHLMN DB "SHL",0 +SHRMN DB "SHR",0 +STCMN DB "STC",0 +DOWNMN DB "STD",0 ; STD +EIMN DB "STI",0 ; STI +STOBMN DB "STOSB",0 ; STOSB +STOWMN DB "STOSW",0 ; STOSW,0 +TESTMN DB "TEST",0 +WAITMN DB "WAIT",0 +XCHGMN DB "XCHG",0 +XLATMN DB "XLAT",0 +ESSEGMN DB "ES:",0 +CSSEGMN DB "CS:",0 +SSSEGMN DB "SS:",0 +DSSEGMN DB "DS:",0 +BADMN DB "???",0 + +M8087_TAB DB "ADD$MUL$COM$COMP$SUB$SUBR$DIV$DIVR$" +FI_TAB DB "F$FI$F$FI$" +SIZE_TAB DB "DWORD PTR $DWORD PTR $QWORD PTR $WORD PTR $" + DB "BYTE PTR $TBYTE PTR $" + +MD9_TAB DB "LD$@$ST$STP$LDENV$LDCW$STENV$STCW$" +MD9_TAB2 DB "CHS$ABS$@$@$TST$XAM$@$@$LD1$LDL2T$LDL2E$" + DB "LDPI$LDLG2$LDLN2$LDZ$@$2XM1$YL2X$PTAN$PATAN$XTRACT$" + DB "@$DECSTP$INCSTP$PREM$YL2XP1$SQRT$@$RNDINT$SCALE$@$@$" + +MDB_TAB DB "ILD$@$IST$ISTP$@$LD$@$STP$" +MDB_TAB2 DB "ENI$DISI$CLEX$INIT$" + +MDD_TAB DB "LD$@$ST$STP$RSTOR$@$SAVE$STSW$" +MDD_TAB2 DB "FREE$XCH$ST$STP$" + +MDF_TAB DB "ILD$@$IST$ISTP$BLD$ILD$BSTP$ISTP$" + + +OPTAB DB 11111111B ; DB + DW DB_OPER + DB 11111111B ; DW + DW DW_OPER + DB 11111111B ; COMMENT + DW ASSEMLOOP + DB 11111111B ; ORG + DW DOORG + DB 0 * 8 ; ADD + DW GROUP2 + DB 2 * 8 ; ADC + DW GROUP2 + DB 5 * 8 ; SUB + DW GROUP2 + DB 3 * 8 ; SBB + DW GROUP2 + DB 6 * 8 ; XOR + DW GROUP2 + DB 1 * 8 ; OR + DW GROUP2 + DB 4 * 8 ; AND + DW GROUP2 + DB 00110111B ; AAA + DW NO_OPER + DB 11010101B ; AAD + DW AA_OPER + DB 11010100B ; AAM + DW AA_OPER + DB 00111111B ; AAS + DW NO_OPER + DB 2 * 8 ; CALL + DW CALL_OPER + DB 10011000B ; CBW + DW NO_OPER + DB 11111000B ; CLC + DW NO_OPER + DB 11111100B ; CLD + DW NO_OPER + DB 11111010B ; DIM + DW NO_OPER + DB 11110101B ; CMC + DW NO_OPER + DB 10100110B ; CMPB + DW NO_OPER + DB 10100111B ; CMPW + DW NO_OPER + DB 7 * 8 ; CMP + DW GROUP2 + DB 10011001B ; CWD + DW NO_OPER + DB 00100111B ; DAA + DW NO_OPER + DB 00101111B ; DAS + DW NO_OPER + DB 1 * 8 ; DEC + DW DCINC_OPER + DB 6 * 8 ; DIV + DW GROUP1 + DB 11011000B ; ESC + DW ESC_OPER + DB 00001001B ; FXCH + DW FGROUPP + DB 00101000B ; FFREE + DW FGROUPP + DB 11011001B ; FCOMPP + DW FDE_OPER + DB 00000011B ; FCOMP + DW FGROUPX ; Exception to normal P instructions + DB 00000010B ; FCOM + DW FGROUPX + DB 00010011B ; FICOMP + DW FGROUPZ + DB 00010010B ; FICOM + DW FGROUPZ + DB 11010000B ; FNOP + DW FD9_OPER + DB 11100000B ; FCHS + DW FD9_OPER + DB 11100001B ; FABS + DW FD9_OPER + DB 11100100B ; FTST + DW FD9_OPER + DB 11100101B ; FXAM + DW FD9_OPER + DB 11101001B ; FLDL2T + DW FD9_OPER + DB 11101010B ; FLDL2E + DW FD9_OPER + DB 11101100B ; FLDLG2 + DW FD9_OPER + DB 11101101B ; FLDLN2 + DW FD9_OPER + DB 11101011B ; FLDPI + DW FD9_OPER + DB 11101000B ; FLD1 + DW FD9_OPER + DB 11101110B ; FLDZ + DW FD9_OPER + DB 11110000B ; F2XM1 + DW FD9_OPER + DB 11111001B ; FYL2XP1 + DW FD9_OPER + DB 11110001B ; FYL2X + DW FD9_OPER + DB 11110010B ; FPTAN + DW FD9_OPER + DB 11110011B ; FPATAN + DW FD9_OPER + DB 11110100B ; FXTRACT + DW FD9_OPER + DB 11110110B ; FDECSTP + DW FD9_OPER + DB 11110111B ; FINCSTP + DW FD9_OPER + DB 11111000B ; FPREM + DW FD9_OPER + DB 11111010B ; FSQRT + DW FD9_OPER + DB 11111100B ; FRNDINT + DW FD9_OPER + DB 11111101B ; FSCALE + DW FD9_OPER + DB 11100011B ; FINIT + DW FDB_OPER + DB 11100001B ; FDISI + DW FDB_OPER + DB 11100000B ; FENI + DW FDB_OPER + DB 11100010B ; FCLEX + DW FDB_OPER + DB 00111100B ; FBLD + DW FGROUPB + DB 00111110B ; FBSTP + DW FGROUPB + DB 00001101B ; FLDCW + DW FGROUP3W + DB 00001111B ; FSTCW + DW FGROUP3W + DB 00101111B ; FSTSW + DW FGROUP3W + DB 00001110B ; FSTENV + DW FGROUP3 + DB 00001100B ; FLDENV + DW FGROUP3 + DB 00101110B ; FSAVE + DW FGROUP3 + DB 00101100B ; FRSTOR + DW FGROUP3 + DB 00110000B ; FADDP + DW FGROUPP + DB 00000000B ; FADD + DW FGROUP + DB 00010000B ; FIADD + DW FGROUPZ + DB 00110100B ; FSUBRP + DW FGROUPP + DB 00000101B ; FSUBR + DW FGROUPDS + DB 00110101B ; FSUBP + DW FGROUPP + DB 00000100B ; FSUB + DW FGROUPDS + DB 00010101B ; FISUBR + DW FGROUPZ + DB 00010100B ; FISUB + DW FGROUPZ + DB 00110001B ; FMULP + DW FGROUPP + DB 00000001B ; FMUL + DW FGROUP + DB 00010001B ; FIMUL + DW FGROUPZ + DB 00110110B ; FDIVRP + DW FGROUPP + DB 00000111B ; FDIVR + DW FGROUPDS + DB 00110111B ; FDIVP + DW FGROUPP + DB 00000110B ; FDIV + DW FGROUPDS + DB 00010111B ; FIDIVR + DW FGROUPZ + DB 00010110B ; FIDIV + DW FGROUPZ + DB 10011011B ; FWAIT + DW NO_OPER + DB 00011000B ; FILD + DW FGROUPZ + DB 00001000B ; FLD + DW FGROUPX + DB 00001011B ; FSTP + DW FGROUP ;an000; dms; + DB 00101010B ; FST + DW FGROUPX + DB 00011011B ; FISTP + DW FGROUPZ + DB 00011010B ; FIST + DW FGROUPZ + DB 11110100B ; HLT + DW NO_OPER + DB 7 * 8 ; IDIV + DW GROUP1 + DB 5 * 8 ; IMUL + DW GROUP1 + DB 0 * 8 ; INC + DW DCINC_OPER + DB 11001110B ; INTO + DW NO_OPER + DB 11001100B ; INTM + DW INT_OPER + DB 11101100B ; IN + DW IN_OPER + DB 11001111B ; IRET + DW NO_OPER + DB 01110111B ; JNBE + DW DISP8_OPER + DB 01110011B ; JAE + DW DISP8_OPER + DB 01110111B ; JA + DW DISP8_OPER + DB 11100011B ; JCXZ + DW DISP8_OPER + DB 01110011B ; JNB + DW DISP8_OPER + DB 01110110B ; JBE + DW DISP8_OPER + DB 01110010B ; JB + DW DISP8_OPER + DB 01110011B ; JNC + DW DISP8_OPER + DB 01110010B ; JC + DW DISP8_OPER + DB 01110010B ; JNAE + DW DISP8_OPER + DB 01110110B ; JNA + DW DISP8_OPER + DB 01110100B ; JZ + DW DISP8_OPER + DB 01110100B ; JE + DW DISP8_OPER + DB 01111101B ; JGE + DW DISP8_OPER + DB 01111111B ; JG + DW DISP8_OPER + DB 01111111B ; JNLE + DW DISP8_OPER + DB 01111101B ; JNL + DW DISP8_OPER + DB 01111110B ; JLE + DW DISP8_OPER + DB 01111100B ; JL + DW DISP8_OPER + DB 01111100B ; JNGE + DW DISP8_OPER + DB 01111110B ; JNG + DW DISP8_OPER + DB 4 * 8 ; JMP + DW JMP_OPER + DB 01110101B ; JNZ + DW DISP8_OPER + DB 01110101B ; JNE + DW DISP8_OPER + DB 01111010B ; JPE + DW DISP8_OPER + DB 01111011B ; JPO + DW DISP8_OPER + DB 01111011B ; JNP + DW DISP8_OPER + DB 01111001B ; JNS + DW DISP8_OPER + DB 01110001B ; JNO + DW DISP8_OPER + DB 01110000B ; JO + DW DISP8_OPER + DB 01111000B ; JS + DW DISP8_OPER + DB 01111010B ; JP + DW DISP8_OPER + DB 10011111B ; LAHF + DW NO_OPER + DB 11000101B ; LDS + DW L_OPER + DB 10001101B ; LEA + DW L_OPER + DB 11000100B ; LES + DW L_OPER + DB 11110000B ; LOCK + DW NO_OPER + DB 10101100B ; LODB + DW NO_OPER + DB 10101101B ; LODW + DW NO_OPER + DB 11100000B ; LOOPNZ + DW DISP8_OPER + DB 11100001B ; LOOPZ + DW DISP8_OPER + DB 11100000B ; LOOPNE + DW DISP8_OPER + DB 11100001B ; LOOPE + DW DISP8_OPER + DB 11100010B ; LOOP + DW DISP8_OPER + DB 10100100B ; MOVB + DW NO_OPER + DB 10100101B ; MOVW + DW NO_OPER + DB 11000110B ; MOV + DW MOV_OPER + DB 4 * 8 ; MUL + DW GROUP1 + DB 3 * 8 ; NEG + DW GROUP1 + DB 10010000B ; NOP + DW NO_OPER + DB 2 * 8 ; NOT + DW GROUP1 + DB 11101110B ; OUT + DW OUT_OPER + DB 10011101B ; POPF + DW NO_OPER + DB 0 * 8 ; POP + DW POP_OPER + DB 10011100B ; PUSHF + DW NO_OPER + DB 6 * 8 ; PUSH + DW PUSH_OPER + DB 2 * 8 ; RCL + DW ROTOP + DB 3 * 8 ; RCR + DW ROTOP + DB 11110011B ; REPZ + DW NO_OPER + DB 11110010B ; REPNZ + DW NO_OPER + DB 11110011B ; REPE + DW NO_OPER + DB 11110010B ; REPNE + DW NO_OPER + DB 11110011B ; REP + DW NO_OPER + DB 11001011B ; RETF + DW GET_DATA16 + DB 11000011B ; RET + DW GET_DATA16 + DB 0 * 8 ; ROL + DW ROTOP + DB 1 * 8 ; ROR + DW ROTOP + DB 10011110B ; SAHF + DW NO_OPER + DB 7 * 8 ; SAR + DW ROTOP + DB 10101110B ; SCAB + DW NO_OPER + DB 10101111B ; SCAW + DW NO_OPER + DB 4 * 8 ; SHL + DW ROTOP + DB 5 * 8 ; SHR + DW ROTOP + DB 11111001B ; STC + DW NO_OPER + DB 11111101B ; STD + DW NO_OPER + DB 11111011B ; EI + DW NO_OPER + DB 10101010B ; STOB + DW NO_OPER + DB 10101011B ; STOW + DW NO_OPER + DB 11110110B ; TEST + DW TST_OPER + DB 10011011B ; WAIT + DW NO_OPER + DB 10000110B ; XCHG + DW EX_OPER + DB 11010111B ; XLAT + DW NO_OPER + DB 00100110B ; ESSEG + DW NO_OPER + DB 00101110B ; CSSEG + DW NO_OPER + DB 00110110B ; SSSEG + DW NO_OPER + DB 00111110B ; DSSEG + DW NO_OPER + +ZZOPCODE LABEL BYTE +MAXOP = (ZZOPCODE-OPTAB)/3 + +SHFTAB DW OFFSET DG:ROLMN,OFFSET DG:RORMN,OFFSET DG:RCLMN + DW OFFSET DG:RCRMN,OFFSET DG:SHLMN,OFFSET DG:SHRMN + DW OFFSET DG:BADMN,OFFSET DG:SARMN + +IMMTAB DW OFFSET DG:ADDMN,OFFSET DG:ORMN,OFFSET DG:ADCMN + DW OFFSET DG:SBBMN,OFFSET DG:ANDMN,OFFSET DG:SUBMN + DW OFFSET DG:XORMN,OFFSET DG:CMPMN + +GRP1TAB DW OFFSET DG:TESTMN,OFFSET DG:BADMN,OFFSET DG:NOTMN + DW OFFSET DG:NEGMN,OFFSET DG:MULMN,OFFSET DG:IMULMN + DW OFFSET DG:DIVMN,OFFSET DG:IDIVMN + +GRP2TAB DW OFFSET DG:INCMN,OFFSET DG:DECMN,OFFSET DG:CALLMN + DW OFFSET DG:CALLMN,OFFSET DG:JMPMN,OFFSET DG:JMPMN + DW OFFSET DG:PUSHMN,OFFSET DG:BADMN + +SEGTAB DW OFFSET DG:ESSAVE,OFFSET DG:CSSAVE,OFFSET DG:SSSAVE + DW OFFSET DG:DSSAVE + +REGTAB DB "AX",0,"BX",0,"CX",0,"DX",0,"SP",0,"BP",0 + DB "SI",0,"DI",0,"DS",0,"ES",0,"SS",0,"CS",0,"IP",0,"PC",0 +REGTABEND LABEL WORD + +; Flags are ordered to correspond with the bits of the flag +; register, most significant bit first, zero if bit is not +; a flag. First 16 entries are for bit set, second 16 for +; bit reset. + +FLAGTAB DW 0 + DW 0 + DW 0 + DW 0 + DB "OV" + DB "DN" + DB "EI" ; "STI" + DW 0 + DB "NG" + DB "ZR" + DW 0 + DB "AC" + DW 0 + DB "PE" + DW 0 + DB "CY" + DW 0 + DW 0 + DW 0 + DW 0 + DB "NV" + DB "UP" ; "CLD" + DB "DI" + DW 0 + DB "PL" + DB "NZ" + DW 0 + DB "NA" + DW 0 + DB "PO" + DW 0 + DB "NC" + + DW 80H DUP(?) +STACK LABEL BYTE + + +; Register save area + +AXSAVE DW 0 +BXSAVE DW 0 +CXSAVE DW 0 +DXSAVE DW 0 +SPSAVE DW 5AH +BPSAVE DW 0 +SISAVE DW 0 +DISAVE DW 0 +DSSAVE DW 0 +ESSAVE DW 0 +RSTACK LABEL WORD ; Stack set here so registers can be saved by pushing +SSSAVE DW 0 +CSSAVE DW 0 +IPSAVE DW 100H +FLSAVE DW 0F202H + +RSETFLAG DB 0 + +REGDIF EQU AXSAVE-REGTAB + +; This value is initially 0, it is set to non-zero if a file is specified +; either at debug invokation, or via the (N)ame command. It is used to +; control the printing of the NONAMESPEC message for the (W)rite command. +NAMESPEC DB 0 + +; RAM area. + +RDFLG DB READ +TOTREG DB 13 +DSIZ DB 0FH ;changed to 7 if screen 40 col mode +NOREGL DB 8 ;changed to 4 if screen 40 col mode +DISPB DW 128 ;changed to 64 if screen 40 col mode + +LBUFSIZ DB BUFLEN +LBUFFCNT DB 0 +LINEBUF DB 0DH + DB BUFLEN DUP (?) +PFLAG DB 0 +COLPOS DB 0 + + IF SYSVER +CONFCB DB 0 + DB "PRN " + DB 25 DUP(0) + +POUT DD ? +COUT DD ? +CIN DD ? +IOBUFF DB 3 DUP (?) +IOADDR DD ? + +IOCALL DB 22 + DB 0 +IOCOM DB 0 +IOSTAT DW 0 + DB 8 DUP (0) +IOCHRET DB 0 + DW OFFSET DG:IOBUFF +IOSEG DW ? +IOCNT DW 1 + DW 0 + ENDIF + +QFLAG DB 0 +NEWEXEC DB 0 +RETSAVE DW ? + +USER_PROC_PDB DW ? +NextCS DW ? +NextIP DW ? + +HEADSAVE DW ? + +EXEC_BLOCK LABEL BYTE + DW 0 +COM_LINE LABEL DWORD + DW 80H + DW ? +COM_FCB1 LABEL DWORD + DW FCB + DW ? +COM_FCB2 LABEL DWORD + DW FCB + 10H + DW ? +COM_SSSP DD ? +COM_CSIP DD ? + +CONST ENDS + 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 @@ + PAGE 60,132 ; + TITLE DEBDATA.SAL - PC DOS +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DEBDATA.SAL +; +; DESCRIPTIVE NAME: DATA SEGMENT VALUE DEFINITION +; +; FUNCTION: PROVIDES ALL DATA SEGMENT DEFINITIONS. +; +; ENTRY POINT: NA +; +; INPUT: ANY VALUE IN DATA SEGMENT +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: NA +; +; EXTERNAL REFERENCES: NA +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT DBCS HANDLING DMS:6/17/87 +; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87 +; - > 32 MB SUPPORT DMS:6/17/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +;======================= END OF SPECIFICATIONS =========================== + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBDATA + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM + INCLUDE DPL.ASM +.LIST +.CREF +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +DATA SEGMENT PUBLIC BYTE +DATA ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +DATA SEGMENT PUBLIC BYTE + PUBLIC PARITYFLAG,XNXOPT,XNXCMD,SWITCHAR,EXTPTR,HANDLE,TRANSADD + PUBLIC PARSERR,ASMADD,DISADD,DISCNT,ASMSP,INDEX,DEFDUMP,DEFLEN + PUBLIC REGSAVE,SEGSAVE,OFFSAVE,TEMP,BUFFER,BYTCNT,OPCODE,AWORD + PUBLIC REGMEM,MIDFLD,MODE,NSEG,BRKCNT,TCOUNT,ASSEM_CNT + PUBLIC ASSEM1,ASSEM2,ASSEM3,ASSEM4,ASSEM5,ASSEM6,BYTEBUF,BPTAB + PUBLIC DIFLG,SIFLG,BXFLG,BPFLG,NEGFLG,NUMFLG,MEMFLG,REGFLG + PUBLIC MOVFLG,TSTFLG,SEGFLG,LOWNUM,HINUM,F8087,DIRFLG,DATAEND + PUBLIC BEGSEG,CREATE_LONG,ARG_BUF_INDEX + PUBLIC FILEEND,FILESTRT,SSINTSAV,BPINTSAV + PUBLIC FZTRACE, PREV24, FIN24 + + public rel_read_write_tab ;an000;relative read/write + ; table + public rel_low_sec ;an000;sector add. low word + public rel_high_sec ;an000;sector add. high word + public rel_sec_num ;an000;# of sectors to access + public rel_rw_add ;an000;transfer address + + public lbtbl ;an000;lead byte table pointer + + public xm_page ;an000; + public xm_log ;an000; + public xm_phy ;an000; + public xm_handle ;an000; + public xm_handle_ret ;an000; + public xm_page_cnt ;an000; + public xm_handle_pages_buf ;an000; + public xm_frame ;an000; + public xm_deall_han ;an000; + public xm_alloc_pg ;an000; + public xm_total_pg ;an000; + public xm_han_total ;an000; + public xm_han_alloc ;an000; + +;========================================================================= +; REL_READ_WRITE_TAB : This table provides the new generic IOCTL primitive +; read/write with its values. +; +; Date : 6/17/87 +;========================================================================= + +REL_READ_WRITE_TAB label dword ;an000;relative read/write + ; table + rel_low_sec dw ? ;an000;sector add. low word + rel_high_sec dw ? ;an000;sector add. high word + rel_sec_num dw ? ;an000;# of sectors to write + rel_rw_add dd ? ;an000;holds the segment + ; & offset of the + ; transfer address + +;========================================================================= + +lbtbl dd ? ;an000;lead byte table pointer + + xm_page db ? ;an000;page count to allocate + xm_log db ? ;an000;log. page to map + xm_phy db ? ;an000;phy. page to map + xm_deall_han dw ? ;an000;handle to deallocate + xm_handle dw ? ;an000;handle to map + xm_handle_ret dw ? ;an000;handle created + + + xm_page_cnt dw ? ;an000;current page count + + xm_handle_pages_buf db 1024 dup(0) ;an000;hold handle pages + + xm_frame dw ? ;an000;holds frame segment + + xm_alloc_pg dw ? ;an000;active page count + + xm_total_pg dw ? ;an000;total possible page cnt. + + xm_han_total dw ? ;an000;total possible handles + + xm_han_alloc dw ? ;an000;handles allocated + + IF IBMVER + PUBLIC OLD_MASK +OLD_MASK DB ? + ENDIF +PREV24 DD ? ; prevvious INT 24 handler +FIN24 DB 0 ; TRUE => in the process of cleaning up +FZTRACE DB 0 ; TRUE => in a Ztrace +FILEEND DW ? ; ARR 2.4 +FILESTRT DW ? ; ARR 2.4 +SSINTSAV DD ? ; ARR 2.4 +BPINTSAV DD ? ; ARR 2.4 + +PARITYFLAG DB 0 + +PUBLIC SAVESTATE +SAVESTATE DPL <> ; storage for extended error info + +XNXOPT DB ? ; AL OPTION FOR DOS COMMAND +XNXCMD DB ? ; DOS COMMAND FOR OPEN_A_FILE TO PERFORM +SWITCHAR DB ? ; CURRENT SWITCH CHARACTER +EXTPTR DW ? ; POINTER TO FILE EXTENSION +HANDLE DW ? ; CURRENT HANDLE +TRANSADD DD ? ; TRANSFER ADDRESS + +PARSERR DB ? +ASMADD DB 4 DUP (?) +DISADD DB 4 DUP (?) +DISCNT DW ? +ASMSP DW ? ; SP AT ENTRY TO ASM +INDEX DW ? +DEFDUMP DB 4 DUP (?) +DEFLEN DW ? +REGSAVE DW ? +SEGSAVE DW ? +OFFSAVE DW ? + +;Do NOT move this dword variable - it sets up a long call for +;a Create_process_data_block call issued in DEBUG +CREATE_LONG LABEL DWORD + DW 100H +BEGSEG DW ? + +; The following data areas are destroyed during hex file read +TEMP DB 4 DUP(?) +BUFFER LABEL BYTE +BYTCNT DB ? +ARG_BUF_INDEX DW ? +OPCODE DW ? +AWORD DB ? +REGMEM DB ? +MIDFLD DB ? +MODE DB ? +NSEG DW ? +BRKCNT DW ? ; Number of breakpoints +TCOUNT DW ? ; Number of steps to trace +ASSEM_CNT DB ? ; preserve order of assem_cnt and assem1 +ASSEM1 DB ? +ASSEM2 DB ? +ASSEM3 DB ? +ASSEM4 DB ? +ASSEM5 DB ? +ASSEM6 DB ? ; preserve order of assemx and bytebuf +BYTEBUF DB BUFLEN DUP (?) ; Table used by LIST +BPTAB DB BPLEN DUP (?) ; Breakpoint table +DIFLG DB ? +SIFLG DB ? +BXFLG DB ? +BPFLG DB ? +NEGFLG DB ? +NUMFLG DB ? ; ZERO MEANS NO NUMBER SEEN +MEMFLG DB ? +REGFLG DB ? +MOVFLG DB ? +TSTFLG DB ? +SEGFLG DB ? +LOWNUM DW ? +HINUM DW ? +F8087 DB ? +DIRFLG DB ? + DB BUFFER+BUFSIZ-$ DUP (?) + +DATAEND LABEL WORD + +DATA ENDS + END + \ 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 @@ + PAGE 60,132 ; + TITLE DEBEMS.SAL - EMS DEBUGGER COMMANDS PC DOS +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DEBEMS.SAL +; +; DESCRIPTIVE NAME: DEBUGGING TOOL +; +; FUNCTION: PROVIDES USERS WITH ACCESS TO RUDIMENTARY EMS FACILITIES. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBMES - CONTAINS ROUTINES CALLED BY DEBUG +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT EMS FUNCTIONS DSM:6/24/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +;======================= END OF SPECIFICATIONS =========================== + +INCLUDE DOSSYM.INC +include debequ.asm + + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + + extrn xm_page:byte ;an000;page count to allocate + extrn xm_log:byte ;an000;log. page to map + extrn xm_phy:byte ;an000;phy. page to map + extrn xm_handle:word ;an000;handle to map + extrn xm_handle_ret:word ;an000;handle created + + extrn xm_page_cnt:word ;an000;page count + extrn xm_handle_pages_buf:byte ;an000;holds handles and pages + extrn xm_frame:word ;an000;EMS frame value + extrn xm_deall_han:word ;an000;handle to deallocate + extrn xm_alloc_pg:word ;an000;pages allocated + extrn xm_total_pg:word ;an000;total pages possible + extrn xm_han_alloc:word ;an000;handles allocated + extrn xm_han_total:word ;an000;total handles possible + + extrn xm_han_ret_ptr:word ;an000;prints handle created + extrn xm_mapped_ptr:word ;an000;prints log/phy pages + extrn xm_page_seg_ptr:word ;an000;Frame seg status + extrn xm_deall_ptr:word ;an000;Handle deallocation + extrn xm_unall_ptr:word ;an000;prints page status + extrn xm_han_alloc_ptr:word ;an000;print handle status + + extrn xm_err80_ptr:word ;an000;ems error message + extrn xm_err83_ptr:word ;an000;ems error message + extrn xm_err84_ptr:word ;an000;ems error message + extrn xm_err85_ptr:word ;an000;ems error message + extrn xm_err86_ptr:word ;an000;ems error message + extrn xm_err87_ptr:word ;an000;ems error message + extrn xm_err88_ptr:word ;an000;ems error message + extrn xm_err89_ptr:word ;an000;ems error message + extrn xm_err8a_ptr:word ;an000;ems error message + extrn xm_err8b_ptr:word ;an000;ems error message + extrn xm_err8d_ptr:word ;an000;ems error message + extrn xm_err8e_ptr:word ;an000;ems error message + extrn xm_errff_ptr:word ;an000;ems error message + extrn xm_err_gen_ptr:word ;an000;ems error message + extrn xm_parse_err_ptr:word ;an000;input error message + extrn xm_status_ptr:word ;an000;prints status of EMS + +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE +ASSUME CS:DG,DS:DG,ES:DG,SS:DG + + public debems ;an000;entry point + extrn std_printf:near ;an000;message retriever + extrn gethx:near ;an000;ASCII to bin conversion + extrn inbuf:near ;an000;input command line + extrn scanb:near ;an000;scan off blanks + extrn scanp:near ;an000;scan for parm + extrn perr:near ;an000;print ^ error + extrn geteol:near + extrn crlf:near ;an000;prints a cr,lf + + IF SYSVER + ENDIF + +DEBEMS: ;an000;entry to module + + call SCANP ;an000;scan for M or S parm +; $if z ;an000;no parms found + JNZ $$IF1 + call XM_PARSE_ERROR ;an000;tell user of error +; $else ;an000; + JMP SHORT $$EN1 +$$IF1: + mov al,[si] ;an000;grab parm + cmp al,"M" ;an000;is it MAP? +; $if e ;an000;yes + JNE $$IF3 + inc si ;an000;point to next byte + call XM_EMS_MAP ;an000; +; $else ;an000; + JMP SHORT $$EN3 +$$IF3: + cmp al,"S" ;an000;is it a status check? +; $if e ;an000;yes + JNE $$IF5 + inc si ;an000;point to next byte + call XM_EMS_STATUS ;an000; +; $else ;an000; + JMP SHORT $$EN5 +$$IF5: + cmp al,"D" ;an000;Deallocate pages? +; $if e ;an000;yes + JNE $$IF7 + inc si ;an000;point to next byte + call XM_EMS_DEALL ;an000; +; $else ;an000; + JMP SHORT $$EN7 +$$IF7: + cmp al,"A" ;an000;Allocate pages? +; $if e ;an000;yes + JNE $$IF9 + inc si ;an000;point to next byte + call XM_EMS_ALLOC ;an000; +; $else ;an000; + JMP SHORT $$EN9 +$$IF9: + call GETEOL ;an000;check out parm +; $endif ;an000; +$$EN9: +; $endif ;an000; +$$EN7: +; $endif ;an000; +$$EN5: +; $endif ;an000; +$$EN3: +; $endif ;an000; +$$EN1: + + ret ;an000;return to caller + + + +;========================================================================= +; XM_EMS_ALLOC : This function will provide the user the +; capability to set and change EMS logical and +; physical pages within page frame 0. +; +; Inputs: none +; +; Outputs: EMS page frames set or altered +; +; Date: 6/24/87 +;========================================================================= + +XM_EMS_ALLOC proc near ;an000;XM functions + + call XM_GET_MAN_STATUS ;an000;see if EMS active +; $if nc ;an000;EMS active + JC $$IF16 + call XM_PAGE_PROMPT ;an000;get pages to allocate + call XM_GET_HAN_ALLOC ;an000;allocate pages + mov dg:XM_HANDLE_RET,dx ;an000;save handle returned +; $if z ;an000;good return + JNZ $$IF17 + pushf ;an000;save our flags + call XM_DISP1 ;an000;tell user results + popf ;an000;restore our flags +; $else ;an000; + JMP SHORT $$EN17 +$$IF17: + call XM_ERROR ;an000;print error message +; $endif ;an000; +$$EN17: +; $else ;an000;EMS not active + JMP SHORT $$EN16 +$$IF16: + call XM_ERROR ;an000;say why not active +; $endif ;an000; +$$EN16: + + ret ;an000;return to caller + +XM_EMS_ALLOC endp ;an000; + + +;========================================================================= +; XM_EMS_MAP : This function will provide the user the +; capability to set and change EMS logical and +; physical pages within page frame 0. +; +; Inputs: none +; +; Outputs: EMS page frames set or altered +; +; Date: 6/24/87 +;========================================================================= + +XM_EMS_MAP proc near ;an000;XM functions + + call XM_GET_MAN_STATUS ;an000;see if EMS active +; $if nc ;an000;EMS active + JC $$IF22 + call XM_LOG_PROMPT ;an000;get logical page + call XM_PHY_PROMPT ;an000;get physical page + call XM_HAN_PROMPT ;an000;get handle + call XM_MAP_MEMORY ;an000;map the page +; $if z ;an000;good return + JNZ $$IF23 + pushf ;an000;save our flags + call XM_DISP2 ;an000;tell user results + popf ;an000;restore our flags +; $else ;an000; + JMP SHORT $$EN23 +$$IF23: + call XM_ERROR ;an000;tell error +; $endif ;an000; +$$EN23: +; $else ;an000;EMS not active + JMP SHORT $$EN22 +$$IF22: + call XM_ERROR ;an000;say why not active +; $endif ;an000; +$$EN22: + + ret ;an000;return to caller + +XM_EMS_MAP endp ;an000; + +;========================================================================= +; XM_GET_MAN_STATUS : This routine will determine if EMS is active for +; this session. +; +; Called Procs: none +; +; Inputs: none +; +; Outputs: Z - no error +; NZ - error +; AH - error message number +; +; Date: 6/24/87 +;========================================================================= + +XM_GET_MAN_STATUS proc near ;an000;see if EMS active + + push ds ;an000;save ds - we stomp it + mov ax,00h ;an000;set ax to 0 + mov ds,ax ;an000;set ds to 0 + cmp ds:word ptr[067h*4+0],0 ;an000;see if int 67h is there + pop ds ;an000;restore ds +; $if e ;an000;EMS not installed + JNE $$IF28 + stc ;an000;flag no ems + mov ah,XM_NOT_INST ;an000;signal EMS not installed +; $else ;an000; + JMP SHORT $$EN28 +$$IF28: + call XM_INSTALL_CHECK ;an000;see if EMS installed +; $if z ;AN000;IS EMS INSTALLED + JNZ $$IF30 + clc ;AN000;EMS INSTALLED - FLAG IT +; $else ;an000; + JMP SHORT $$EN30 +$$IF30: + stc ;AN000;FLAG EMS NOT INSTALLED + mov ah,XM_NOT_INST ;an000;signal EMS not installed +; $endif ;an000; +$$EN30: +; $endif ;an000; +$$EN28: + + RET ;AN000;RETURN TO CALLER + + +XM_GET_MAN_STATUS endp ;an000; + + + +;========================================================================= +; XM_PAGE_PROMPT : This routine prompts the user for the number of +; pages to be allocated, if he desires a new handle. +; This routine will determine whether or not the other +; prompt messages will be displayed. +; +; Called Procs: STD_PRINTF +; XM_PARSE +; +; Inputs: none +; +; Outputs: XM_PAGE_FLAG +; XM_PAGE_BUF +; XM_PAGE +; +; Date: 6/24/87 +;========================================================================= + +XM_PAGE_PROMPT proc near ;an000;prompt user for number + ; of pages to allocate + call SCANB ;an000;see if parm entered +; $if nz ;an000;if parm found + JZ $$IF34 + mov cx,02 ;an000;bytes to parse + call GETHX ;an000;get hex value +; $if c ;an000;no an error occurred + JNC $$IF35 + call PERR ;an000;display ^ error +; $else ;an000; + JMP SHORT $$EN35 +$$IF35: + mov dg:XM_PAGE,dl ;an000;save page count +; $endif ;an000; +$$EN35: +; $else ;an000; + JMP SHORT $$EN34 +$$IF34: + call PERR ;an000;display ^ error +; $endif ;an000; +$$EN34: + + ret ;an000;return to caller + +XM_PAGE_PROMPT endp ;an000; + + +;========================================================================= +; XM_LOG_PROMPT : This routine prompts the user for the number of the +; logical page that is to be mapped in EMS. This +; routine will not be performed if a page count +; was specified. +; +; Called Procs: STD_PRINTF +; XM_PARSE +; +; Inputs: none +; +; Outputs: XM_LOG_BUF +; XM_LOG +; +; Date: 6/24/87 +;========================================================================= + + +XM_LOG_PROMPT proc near ;an000;prompt user for the + ; logical page to be + ; mapped + call SCANB ;an000;see if parm entered +; $if nz ;an000;parm entered + JZ $$IF40 + mov cx,02 ;an000;bytes to parse + call GETHX ;an000;get hex value +; $if c ;an000;no an error occurred + JNC $$IF41 + call PERR ;an000;display ^ error +; $else ;an000; + JMP SHORT $$EN41 +$$IF41: + mov dg:XM_LOG,dl ;an000;save logical page +; $endif ;an000; +$$EN41: +; $else ;an000; + JMP SHORT $$EN40 +$$IF40: + call PERR ;an000;display ^ error +; $endif ;an000; +$$EN40: + + ret ;an000;return to caller + +XM_LOG_PROMPT endp ;an000; + + +;========================================================================= +; XM_PHY_PROMPT : This routine prompts the user for the number of the +; physical page that is to be mapped in EMS. This +; routine will not be performed if a page count +; was specified. +; +; Called Procs: STD_PRINTF +; XM_PARSE +; +; Inputs: none +; +; Outputs: XM_PHY_BUF +; XM_PHY +; +; Date: 6/24/87 +;========================================================================= + + +XM_PHY_PROMPT proc near ;an000;prompt user for the + ; physical page to be + ; mapped + call SCANB ;an000;see if parm entered +; $if nz ;an000;parm found + JZ $$IF46 + mov cx,02 ;an000;bytes to parse + call GETHX ;an000;get hex value +; $if c ;an000;no an error occurred + JNC $$IF47 + call PERR ;an000;display ^ error +; $else ;an000; + JMP SHORT $$EN47 +$$IF47: + mov dg:XM_PHY,dl ;an000;save logical page +; $endif ;an000; +$$EN47: +; $else ;an000; + JMP SHORT $$EN46 +$$IF46: + call PERR ;an000; +; $endif ;an000; +$$EN46: + + ret ;an000;return to caller + +XM_PHY_PROMPT endp ;an000; + + +;========================================================================= +; XM_HAN_PROMPT : This routine prompts the user for the number of the +; handle that the mapping is to occur on. This +; routine will not be performed if a page count +; was specified. +; +; Called Procs: STD_PRINTF +; XM_PARSE +; +; Inputs: none +; +; Outputs: XM_HAN_BUF +; XM_HAN +; +; Date: 6/24/87 +;========================================================================= + + +XM_HAN_PROMPT proc near ;an000;prompt user for the + ; handle to be mapped + call SCANB ;an000;see if parm entered +; $if nz ;an000;prompt found + JZ $$IF52 + mov cx,04 ;an000;bytes to parse + call GETHX ;an000;get hex value +; $if c ;an000;no an error occurred + JNC $$IF53 + call PERR ;an000;display ^ error +; $else ;an000; + JMP SHORT $$EN53 +$$IF53: + mov dg:XM_HANDLE,dx ;an000;save logical page +; $endif ;an000; +$$EN53: +; $else ;an000; + JMP SHORT $$EN52 +$$IF52: + call PERR ;an000;display ^ error +; $endif ;an000; +$$EN52: + + ret ;an000;return to caller + +XM_HAN_PROMPT endp ;an000; + + + +;========================================================================= +; XM_GET_HAN_ALLOC : This routine will get a handle and allocate the +; requested number of pages to that handle. +; +; Called Procs: none +; +; Inputs: XM_PAGE - number of pages to allocate to handle +; +; Outputs: Z - no error +; NZ - error +; DX - handle allocated +; +; Date: 6/24/87 +;========================================================================= + +XM_GET_HAN_ALLOC proc near ;an000;create handle and alloc. + ; requested pages. + push bx ;an000;save regs. + mov ah,EMS_HAN_ALLOC ;an000;function 43h + xor bh,bh ;an000;clear byte + mov bl,dg:XM_PAGE ;an000;number of pages to + ; allocate + int 67h ;an000;call EMS + or ah,ah ;an000;was there an error + pop bx ;an000;restore regs. + + ret ;an000;return to caller + +XM_GET_HAN_ALLOC endp ;an000; + +;========================================================================= +; XM_MAP_MEMORY : This routine will map the requested logical page +; to the requested physical page in EMS. +; +; Called Procs: none +; +; Inputs: XM_PHY - physical page to map to +; XM_HAN - logical page to map +; +; Outputs: Z - no error +; NZ - error +; page mapped +; +; Date: 6/24/87 +;========================================================================= + +XM_MAP_MEMORY proc near ;an000;map a logical page to + ; a physical page in + ; EMS + push bx ;an000;save regs. + push dx ;an000; + mov ah,EMS_MAP_MEMORY ;an000;function 44h + mov al,dg:XM_PHY ;an000;physical page to map + xor bh,bh ;an000;zero byte + mov bl,dg:XM_LOG ;an000;logical page to map + mov dx,dg:XM_HANDLE ;an000;handle to map page to + int 67h ;an000;call EMS + or ah,ah ;an000;was there an error + pop dx ;an000;restore regs. + pop bx ;an000; + + ret ;an000;return to caller + +XM_MAP_MEMORY endp ;an000; + + +;========================================================================= +; XM_DISP1 : This routine displays the current page frame and +; the handle created as a result of the allocate pages. +; +; Called Procs: STD_PRINTF +; +; Inputs: XM_FRAME_SEG - page frame segment +; XM_HANDLE_RET - created handle +; XM_PG_FRAME_PTR - pointer to message +; XM_HAN_RET_PTR - pointer to message +; +; Outputs: "Page Frame Segment : %1",0d,0a +; "Handle Created : %1",0d,0a +; +; Date: 6/24/87 +;========================================================================= + +XM_DISP1 proc near ;an000;display messages + + mov dx,offset dg:XM_HAN_RET_PTR ;an000;"Handle Created : " + call STD_PRINTF ;an000;call message ret. + + ret ;an000;return to caller + +XM_DISP1 endp ;an000; + + +;========================================================================= +; XM_DISP2 : This routine displays the logical page mapped and +; the physical page it was mapped to. +; +; Called Procs: STD_PRINTF +; +; Inputs: XM_MAPPED_PTR - pointer to message +; XM_LOG - logical page mapped +; XM_PHY - physical page mapped +; +; Outputs: "Logical page %1 mapped to physical page %2",0d0a +; +; Date: 6/24/87 +;========================================================================= + +XM_DISP2 proc near ;an000;display messages + + mov dx,offset dg:XM_MAPPED_PTR ;an000;"Logical page %1 mapped + ; to physical page %2" + call STD_PRINTF ;an000;call message ret. + + ret ;an000;return to caller + +XM_DISP2 endp ;an000; + +;========================================================================= +; XM_ERROR: This routine will determine what error we have by +; querying the result in the AH register. It will then +; report the error to the user through STD_PRINTF +; +; Called Procs: STD_PRINTF +; +; Inputs: AH - error code +; +; Outputs: error message +; +; Date: 6/24/87 +;========================================================================= + +XM_ERROR proc near ;an000;error message printer + + cmp ah,XM_ERR80 ;an000;error message +; $if e ;an000;found message + JNE $$IF58 + mov dx,offset dg:XM_ERR80_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF58: + + cmp ah,XM_ERR83 ;an000;error message +; $if e ;an000;found message + JNE $$IF60 + mov dx,offset dg:XM_ERR83_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF60: + + cmp ah,XM_ERR84 ;an000;error message +; $if e ;an000;found message + JNE $$IF62 + mov dx,offset dg:XM_ERR84_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF62: + + cmp ah,XM_ERR85 ;an000;error message +; $if e ;an000;found message + JNE $$IF64 + mov dx,offset dg:XM_ERR85_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF64: + + + cmp ah,XM_ERR86 ;an000;error message +; $if e ;an000;found message + JNE $$IF66 + mov dx,offset dg:XM_ERR86_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF66: + + cmp ah,XM_ERR87 ;an000;error message +; $if e ;an000;found message + JNE $$IF68 + mov dx,offset dg:XM_ERR87_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF68: + + cmp ah,XM_ERR88 ;an000;error message +; $if e ;an000;found message + JNE $$IF70 + mov dx,offset dg:XM_ERR88_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF70: + + cmp ah,XM_ERR89 ;an000;error message +; $if e ;an000;found message + JNE $$IF72 + mov dx,offset dg:XM_ERR89_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF72: + + cmp ah,XM_ERR8A ;an000;error message +; $if e ;an000;found message + JNE $$IF74 + mov dx,offset dg:XM_ERR8A_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF74: + + cmp ah,XM_ERR8B ;an000;error message +; $if e ;an000;found message + JNE $$IF76 + mov dx,offset dg:XM_ERR8B_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF76: + + cmp ah,XM_ERR8D ;an000;error message +; $if e ;an000;found message + JNE $$IF78 + mov dx,offset dg:XM_ERR8D_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF78: + + cmp ah,XM_ERR8E ;an000;error message +; $if e ;an000;found message + JNE $$IF80 + mov dx,offset dg:XM_ERR8E_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif +$$IF80: + + cmp ah,XM_NOT_INST ;an000;EMS not installed +; $if e ;an000;found message + JNE $$IF82 + mov dx,offset dg:XM_ERRFF_PTR ;an000;point to message + jmp XM_ERROR_CONT ;an000;print error +; $endif ;an000; +$$IF82: + + mov dx,offset dg:XM_ERR_GEN_PTR ;an000;general error message + +XM_ERROR_CONT: + + call STD_PRINTF ;an000;call message ret. + + ret ;an000;return to caller + +XM_ERROR endp ;an000; + +;========================================================================= +; XM_PARSE_ERROR : This routine will display that an error has occurred +; on the input of the requested data. +; +; Called Procs: STD_PRINTF +; +; Inputs: XM_PARSE_ERR_PTR - error message +; +; Outputs: "Invalid value for parameter",0d,0a +; +; Date: 6/24/87 +;========================================================================= + +XM_PARSE_ERROR proc near ;an000;input error message + + mov dx,offset dg:XM_PARSE_ERR_PTR ;an000;error message + call STD_PRINTF ;an000;call message ret. + ret ;an000;return to caller + +XM_PARSE_ERROR endp ;an000; + + + +;========================================================================= +; XM_EMS_STATUS : This function will provide the user with +; a report the the current status of EMS. +; +; Inputs: none +; +; Outputs: EMS page frames set or altered +; +; Date: 6/24/87 +;========================================================================= + +XM_EMS_STATUS proc near ;an000;XM functions + + call XM_GET_MAN_STATUS ;an000;see if EMS active +; $if nc ;an000;EMS active + JC $$IF84 + call XM_CURR_STATUS ;an000;current status of EMS +; $else ;an000;EMS not active + JMP SHORT $$EN84 +$$IF84: + call XM_ERROR ;an000;say why not active +; $endif ;an000; +$$EN84: + + ret ;an000;return to caller + +XM_EMS_STATUS endp ;an000; + + +;========================================================================= +; XM_CURR_STATUS : This routine will display the current status of +; all active EMS handles. +; +; Inputs : none +; +; Outputs : Current status of all active EMS handles +; "Handle %1 has %2 pages allocated" +; +; Physical page with it associated frame segment +; "Physical page %1 = Frame segment %2" +; +; Date: 8/05/86 +;========================================================================= + +XM_CURR_STATUS proc near ;an000;current EMS status + + mov ah,EMS_HANDLE_PAGES ;an000;get handle pages + mov di,offset dg:XM_HANDLE_PAGES_BUF ;an000;point to the buffer + int 67h ;an000; + + or ah,ah ;an000;see if an error occurred +; $if z ;an000;no error + JNZ $$IF87 +; $do ;an000;do while data in buffer +$$DO88: + cmp bx,0 ;an000;end of buffer? +; $leave e ;an000;yes + JE $$EN88 + mov ax,word ptr es:[di] ;an000;page handle + mov dg:XM_HANDLE_RET,ax ;an000;save in var + mov ax,word ptr es:[di+02];an000;page count + mov dg:XM_PAGE_CNT,ax ;an000;save in var + mov dx,offset dg:XM_STATUS_PTR ;an000;point to message + call STD_PRINTF ;an000;print it + add di,04h ;an000;next record + dec bx ;an000;decrement counter +; $enddo ;an000; + JMP SHORT $$DO88 +$$EN88: + + call CRLF ;an000;place a blank line + ; between reports + + call XM_FRAME_BUFFER ;an000;get frame buffer + ;ES:DI points to frame buffer +; $do ;an000;while cx not = 0 +$$DO91: + cmp cx,00 ;an000;at end? +; $leave e ;an000;yes + JE $$EN91 + call XM_GET_FRAME_SEG ;an000;obtain page and seg + mov dx,offset dg:XM_PAGE_SEG_PTR ;an000;message + call STD_PRINTF ;an000;print it + dec cx ;an000;decrease counter + add di,04 ;an000;adjust pointer +; $enddo ;an000; + JMP SHORT $$DO91 +$$EN91: + + call XM_UNALL_COUNT ;an000;display page status + call XM_HANDLE_COUNT ;an000;display handle status + +; $else + JMP SHORT $$EN87 +$$IF87: + call XM_ERROR ;an000;display the error +; $endif ;an000; +$$EN87: + ret ;an000; + +XM_CURR_STATUS endp ;an000; + +;========================================================================= +; XM_UNALL_COUNT : This routine generates a line of the status report +; displaying the number of pages allocated out of +; the total possible +; +; Inputs : none +; +; Outputs : Current status of allocated pages +; "%1 of a total %2 EMS pages have been allocated" +; +; Date: 8/05/86 +;========================================================================= + +XM_UNALL_COUNT proc near ;an000; + + mov ah,EMS_UNALL_PG_CNT ;an000;see how many pages + ; remaining + int 67h ;an000; + or ah,ah ;an000;see if error + +; $if z ;an000;no error + JNZ $$IF96 + push bx ;an000;save bx + push dx ;an000;save dx + call CRLF ;an000; + pop dx ;an000;restore dx + pop bx ;an000;restore bx + mov ax,dx ;an000;total page count + sub ax,bx ;an000;get pages allocated + mov dg:XM_ALLOC_PG,ax ;an000;save allocated pages + mov dg:XM_TOTAL_PG,dx ;an000;save total page count + mov dx,offset dg:XM_UNALL_PTR ;an000;"%1 of a total %2 EMS + ; pages have been allocated",cr,lf + call STD_PRINTF ;an000;print it +; $endif ;an000; +$$IF96: + + ret ;an000; + +XM_UNALL_COUNT endp ;an000; + + +;========================================================================= +; XM_HANDLE_COUNT: This routine generates a line of the status report +; displaying the number of handles allocated out of +; the total possible. +; +; Inputs : none +; +; Outputs : Current status of allocated pages +; "%1 of a total %2 EMS handles have been allocated" +; +; Date: 8/05/86 +;========================================================================= + +XM_HANDLE_COUNT proc near ;an000; + + mov ah,EMS_HANDLE_CNT ;an000;see how many handles + ; possible + int 67h ;an000; + or ah,ah ;an000;see if error + +; $if z ;an000;no error + JNZ $$IF98 + mov ax,EMS_HANDLE_TOTAL ;an000;total possible handles + mov dg:XM_HAN_TOTAL,ax ;an000;save total page count + mov dg:XM_HAN_ALLOC,bx ;an000;save allocated pages + mov dx,offset dg:XM_HAN_ALLOC_PTR + ;an000;"%1 of a total %2 EMS + ; handles have been allocated",cr,lf + call STD_PRINTF ;an000;print it +; $endif ;an000; +$$IF98: + + ret ;an000; + +XM_HANDLE_COUNT endp ;an000; + + +;========================================================================= +; XM_FRAME_SEG : This routine accesses the vector created by +; function 58h, int 67h. It obtains a physical +; page of EMS and its segment from this vector +; +; Inputs : ES:DI - points to frame buffer +; +; Outputs : XM_PHY - a physical page in EMS +; XM_FRAME - segment corresponding to the physical page +; +; Date: 8/05/86 +;========================================================================= + + +XM_GET_FRAME_SEG proc near ;an000;find the frame segment + + mov al,byte ptr es:[di+2] ;an000;get physical page + mov dg:XM_PHY,al ;an000;place in print var + mov ax,word ptr es:[di] ;an000;get frame segment + mov dg:XM_FRAME,ax ;an000;place in print var + + ret ;an000; + +XM_GET_FRAME_SEG endp ;an000; + +;========================================================================= +; XM_INSTALL_CHECK: This routine performs function 51h, int 67h to +; determine if EMS is indeed active. +; +; Inputs : XM_FRAME_BUFFER - used to receive physical page +; and segment data for EMS. +; +; Outputs : XM_FRAME_BUFFER - buffer holds physical page +; and segment data for EMS. +; +; Date: 8/05/86 +;========================================================================= + +XM_INSTALL_CHECK proc near ;an000;see if EMS installed + + MOV AH,EMS_GET_MAN_STAT ;AN000;GET EMS STATUS + XOR AL,AL ;an000;clear low byte + INT 67h ;an000; + OR AH,AH ;an000;check for error +; $IF Z ;an000;no error + JNZ $$IF100 + MOV AH,EMS_VERSION ;an000;get version number + INT 67h ;an000; + CMP AL,EMS_LIM_40 ;an000;LIM 4.0 ? +; $IF AE ;an000;4.0 or greater + JNAE $$IF101 + MOV AH,00h ;an000;set up for flag pass + OR AH,AH ;an000;set flag to ZR +; $ELSE ;an000;below 4.0 + JMP SHORT $$EN101 +$$IF101: + MOV AH,01h ;an000;set up for flag pass + OR AH,AH ;an000;set flag to NZ +; $ENDIF ;an000; +$$EN101: +; $ENDIF ;an000; +$$IF100: + + ret ;an000; + +XM_INSTALL_CHECK endp ;an000; + + + + +;========================================================================= +; XM_EMS_DEALL : This routine deallocates handles from EMS. +; +; Inputs : DX - Handle supplied by XM_DEALL_PROMPT +; +; Outputs : Good return - "Handle %1 deallocated" +; Bad return - message describing error +; +; Date: 8/05/86 +;========================================================================= + +XM_EMS_DEALL proc near ;an000;deallocate EMS pages + + call XM_GET_MAN_STATUS ;an000;see if EMS installed +; $if nc ;an000;error? + JC $$IF105 + call XM_DEALL_PROMPT ;an000;prompt user for handle + mov ah,EMS_PAGE_DEALL ;an000;function 45h, int 67h + int 67h ;an000; + + or ah,ah ;an000;error? +; $if nz ;an000;yes + JZ $$IF106 + call XM_ERROR ;an000;say why +; $else ;an000; + JMP SHORT $$EN106 +$$IF106: + mov dx,offset dg:XM_DEALL_PTR;an000;"Handle %1 deallocated" + call STD_PRINTF ;an000;print message +; $endif ;an000; +$$EN106: +; $else ;an000; + JMP SHORT $$EN105 +$$IF105: + call XM_ERROR ;an000;print type of error +; $endif ;an000; +$$EN105: + + ret ;an000; + +XM_EMS_DEALL endp ;an000; + +;========================================================================= +; XM_DEALL_PROMPT : This routine prompts the user for the handle to be +; deallocated. It converts the handle entered to +; binary and passes it back to the caller in DX. +; +; Inputs : none +; +; Outputs : DX - Handle to be deallocated. +; +; Date: 8/05/86 +;========================================================================= + +XM_DEALL_PROMPT proc near ;an000;prompt user for handle + ; to deallocate + call SCANB ;an000;see if parm entered +; $if nz ;an000;parm found + JZ $$IF111 + mov cx,04 ;an000;bytes to parse + call GETHX ;an000;get hex value +; $if c ;an000;no an error occurred + JNC $$IF112 + call PERR ;an000;display ^ error +; $else ;an000; + JMP SHORT $$EN112 +$$IF112: + mov dg:XM_DEALL_HAN,dx ;an000;save handle to deallocate +; $endif ;an000; +$$EN112: +; $else ;an000; + JMP SHORT $$EN111 +$$IF111: + call PERR ;an000;display ^ error +; $endif ;an000; +$$EN111: + + ret ;an000;return to caller + +XM_DEALL_PROMPT endp ;an000; + + +;========================================================================= +; XM_FRAME_BUFFER : This routine obtains the frame buffer +; of EMS pages. +; +; Inputs : none +; +; Outputs : ES:DI - Pointer to frame array +; CX - Number of elements in array +;========================================================================= + +XM_FRAME_BUFFER proc near ;an000; + + mov ax,EMS_PG_FRAME ;an000;get frame buffer + int 67h ;an000; + + ret ;an000; + +XM_FRAME_BUFFER endp ;an000; + + +CODE ENDS + END DEBEMS + \ 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 @@ +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DEBEQU.SAL +; +; DESCRIPTIVE NAME: EQUATES NEEDED BY DEBUG +; +; FUNCTION: PROVIDES EQUATES NEEDED BY DEBUG +; +; ENTRY POINT: NA +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: NA +; +; EXTERNAL REFERENCES: NA +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT DBCS HANDLING DMS:6/17/87 +; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87 +; - > 32 MB SUPPORT DMS:6/17/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +;======================= END OF SPECIFICATIONS =========================== + + IF1 + %OUT Including DEBEQU.ASM... + ENDIF + +;IBMVER EQU TRUE ; These switches get set in version.inc +;MSVER EQU FALSE ; NOT HERE !!! + + INCLUDE SYSVER.INC + +IBMJAPAN EQU FALSE + +SETCNTC EQU TRUE ; If this is FALSE, DEBUG will not set + ; the Control C int vector + +PROMPT EQU "-" +FCB EQU 5CH +EXEFCB EQU FCB +BUFLEN EQU 80 ; Maximum length of line input buffer +BPMAX EQU 10 ; Maximum number of breakpoints +BPLEN EQU 5*BPMAX ; Length of breakpoint table +REGTABLEN EQU 14 ; Number of registers +SEGDIF EQU 0 +BUFSIZ EQU 512 + +BXREG EQU "B"+5800H ; "BX" +BPREG EQU "B"+5000H ; "BP" +SIREG EQU "S"+4900H ; "SI" +DIREG EQU "D"+4900H ; "DI" +COMMA EQU 2C00H +OPBUFLEN EQU 35 + + IF IBMVER +MASK_PORT EQU 21H ; 8259 interrupt control register +INT_MASK EQU 11111111B ; Disable ALL interrupts + ENDIF + +CR EQU 13 ;CARRIAGE RETURN +LF EQU 10 ;LINE FEED +CHAR_TAB EQU 9 ;TAB +CHAR_BACKSPACE EQU 8 ;BACKSPACE CHARACTER +CHAR_EOF EQU 1AH ;END OF FILE CHARACTER +CHAR_RUBOUT EQU 7FH ;RUBOUT CHARACTER + +CHAR_EQUAL EQU "=" ;CHARACTER EQUAL +CHAR_MINUS EQU "-" ;MINUS CHARACTER +CHAR_BLANK EQU " " ;BLANK CHARACTER +DOUBLE_QUOTE EQU '"' ;DOUBLE QUOTE CHARACTER +SINGLE_QUOTE EQU "'" ;SINGLE QUOTE CHARACTER +CHAR_COMMA EQU "," ;CHARACTER COMMA +CHAR_PERIOD EQU "." ;CHARACTER PERIOD +CHAR_COLON EQU ":" ;CHARACTER COLON +CHAR_SEMICOLON EQU ";" ;CHARACTER SEMICOLON +CHAR_LEFT_BRACKET EQU "[" ;CHARACTER LEFT BRACKET +CHAR_AT_SIGN EQU "@" ;CHARACTER "AT" SIGN +CHAR_ZERO EQU "0" ;CHARACTER ZERO + +LOWER_A EQU "a" ;LOWER CASE CHARACTER "a" +LOWER_Z EQU "z" ;LOWER CASE CHARACTER "z" + +UPPER_A EQU "A" ;UPPER CASE CHARACTER "A" +UPPER_C EQU "C" ;UPPER CASE CHARACTER "C" +UPPER_E EQU "E" ;UPPER CASE CHARACTER "E" +UPPER_F EQU "F" ;UPPER CASE CHARACTER "F" +UPPER_L EQU "L" ;UPPER CASE CHARACTER "L" +UPPER_M EQU "M" ;UPPER CASE CHARACTER "M" +UPPER_N EQU "N" ;UPPER CASE CHARACTER "N" +UPPER_P EQU "P" ;UPPER CASE CHARACTER "P" +UPPER_S EQU "S" ;UPPER CASE CHARACTER "S" +UPPER_X EQU "X" ;UPPER CASE CHARACTER "X" +UPPER_Z EQU "Z" ;UPPER CASE CHARACTER "Z" + +VEC_SING_STEP EQU 1 ;ID OF THE SINGLE STEP VECTOR +VEC_BREAKPOINT EQU 3 ;ID OF THE BREAKPOINT VECTOR +VEC_TERM_ADDR EQU 22H ;ID OF THE TERMINATE ADDRESS VECTOR +VEC_CTRL_BREAK EQU 23H ;ID OF THE CTRL BREAK EXIT ADDRESS VECTOR +VEC_CRIT_ERR EQU 24H ;ID OF THE CRITICAL ERROR HANDLER VECTOR +VEC_PRIMITIVE_DISK_READ EQU 25H ;ID OF THE PRIMITAVE DISK READ VECTOR +VEC_PRIMITIVE_DISK_WRITE EQU 26H ;ID OF THE PRIMITAVE DISK WRITE VECTOR +GENERIC_IOCTL EQU 440DH ;an000;Generic IOCtl function +READ_WRITE EQU 08H ;an000;read/write relative sectors +READ_SECTOR EQU 00H ;an000;currently unknown value +WRITE_SECTOR EQU 00H ;an000;currently unknown value + +SET_DRIVEID_OPTION EQU 1 ;AL VALUE FOR "PARSE FILENAME" FUNCTION +LSEEK_FROM_START EQU 0 ;AL VALUE FOR "LSEEK" FUNCTION +LSEEK_EOF_OPTION EQU 2 ;AL VALUE FOR "LSEEK" FUNCTION + +;======================= EMS Equates Begin =============================== + +EMS_GET_MAN_STAT equ 40h ;an000;function 40h, int 67h +EMS_UNALL_PG_CNT equ 42h ;an000;funciton 42h, int 67h +EMS_HAN_ALLOC equ 43h ;an000;function 43h, int 67h +EMS_MAP_MEMORY equ 44h ;an000;function 44h, int 67h +EMS_PAGE_DEALL equ 45h ;an000;function 45h, int 67h +EMS_VERSION equ 46h ;an000;function 46h, int 67h +EMS_SAVE_PAGE_MAP equ 47h ;an000;function 47h, int 67h +EMS_REST_PAGE_MAP equ 48h ;an000;function 48h, int 67h +EMS_HANDLE_CNT equ 4bh ;an000;function 4bh, int 67h +EMS_HANDLE_PAGES equ 4dh ;an000;function 4dh, int 67h +EMS_GET_SET_PG_MP equ 4eh ;an000;function 4eh, int 67h +EMS_GET_PAGE_MAP equ 00h ;an000;sub function 00h of +EMS_PG_FRAME equ 5800h ;an000;function 58h, int 67h + ; function 4eh, int 67h +EMS_SET_PAGE_MAP equ 01h ;an000;sub function 01h of + ; function 4eh, int 67h +EMS_HANDLE_TOTAL equ 0ffh ;an000;total possible handles + +EMS_LIM_40 equ 040h ;an000;LIM 4.0 I.D. + +XM_ERR80 equ 80h ;an000;error message type +XM_ERR83 equ 83h ;an000;error message type +XM_ERR84 equ 84h ;an000;error message type +XM_ERR85 equ 85h ;an000;error message type +XM_ERR86 equ 86h ;an000;error message type +XM_ERR87 equ 87h ;an000;error message type +XM_ERR88 equ 88h ;an000;error message type +XM_ERR89 equ 89h ;an000;error message type +XM_ERR8A equ 8Ah ;an000;error message type +XM_ERR8B equ 8Bh ;an000;error message type +XM_ERR8D equ 8Dh ;an000;error message type +XM_ERR8E equ 8Eh ;an000;error message type +XM_ERR8F equ 8Fh ;an000;error message type +XM_NOT_INST equ 0ffh ;an000;EMS not inst + +;======================= EMS Equates End ================================= + \ 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 @@ + PAGE 80,132 ; + TITLE DEBERR.ASM - DEBUGGER DISK ERROR HANDLER + +;******************* START OF SPECIFICATIONS ***************************** +; +; MODULE NAME:DEBERR.SAL +; +; DESCRIPTIVE NAME: DISK ERROR HANDLER +; +; FUNCTION: THIS ROUTINE IS A CATCHALL ERROR HANDLER. IT PRIMARILY +; HANDLES DISK ERROR. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; INPUT: NA +; +; EXIT-NORMAL: NA +; +; EXIT-ERROR: NA +; +; INTERNAL REFERENCES: +; +; +; EXTERNAL REFERENCES: +; +; NOTES: THIS MODULE SHOULD BE PROCESSED WITH THE SALUT PRE-PROCESSOR +; WITH OPTIONS "PR". +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+DEBCONST+ +; DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION DOS 4.0 - MESSAGE RETRIEVER IMPLEMENTED. DMS:6/17/87 +; +; +; COPYRIGHT: "MS DOS DEBUG Utility" +; "Version 4.00 (C) Copyright 1988 Microsoft" +; "Licensed Material - Property of Microsoft " +; +;******************** END OF SPECIFICATIONS ****************************** + + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBERR + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC +.CREF +.LIST + + INCLUDE DEBEQU.ASM + +FIRSTDRV EQU "A" + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + EXTRN RDFLG:BYTE + EXTRN DRVLET:BYTE + EXTRN dr1_ptr:word,dr2_ptr:word,dr3_ptr:word,dr4_ptr:word ;ac000 +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN PARITYFLAG:BYTE +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE + ASSUME CS:DG,DS:DG,ES:DG,SS:DG + + EXTRN RESTART:NEAR + PUBLIC DRVERR, TRAPPARITY, RELEASEPARITY, NMIINT, NMIINTEND + +TRAPPARITY: + IF IBMJAPAN + PUSH BX + PUSH ES + PUSH DX ; save location of new offset + MOV DX,OFFSET DG:NMIINT ; DS:DX has new interrupt vector + CALL SWAPINT ; diddle interrupts + ASSUME ES:NOTHING + + MOV WORD PTR [NMIPTR],BX ; save old offset + MOV WORD PTR [NMIPTR+2],ES ; save old segment + POP DX ; get old regs back + POP ES ; restore old values + ASSUME ES:DG + + POP BX + MOV BYTE PTR [PARITYFLAG],0 ; no interrupts detected yet! + RET + +SWAPINT: + PUSH AX + MOV AX,(GET_INTERRUPT_VECTOR SHL 8) + 2 + INT 21H ; Get old NMI Vector + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) + 2 + INT 21h ; let OS set new vector + POP AX + ENDIF + RET + +RELEASEPARITY: + IF IBMJAPAN + PUSH DX + PUSH DS + PUSH BX + PUSH ES + LDS DX,DWORD PTR [NMIPtr] ; get old vector + CALL SwapInt ; diddle back to original + POP ES + POP BX + POP DS + POP DX + MOV [PARITYFLAG],0 ; no interrupts possible! + ENDIF + RET + +NMIInt: + IF IBMJAPAN + PUSH AX ; save AX + IN AL,0A0H ; get status register + OR AL,1 ; was there parity check? + POP AX ; get old AX back + JZ NMICHAIN ; no, go chain interrupt + OUT 0A2H,AL ; reset NMI detector + MOV CS:[PARITYFLAG],1 ; signal detection + IRET +NMICHAIN: + JMP DWORD PTR CS:[NMIPTR] ; chain the vectors +NMIPTR DD ? ; where old NMI gets stashed + ENDIF +NMIINTEND: + +DRVERR: + + or al,al ;ac000;see if drive specified +; $if nz ;an000;drive specified + JZ $$IF1 + add byte ptr drvlet,firstdrv;ac000;determine drive letter + cmp byte ptr rdflg,write ;ac000;see if it is read/write +; $if z ;an000;it is write + JNZ $$IF2 + mov dx,offset dg:dr2_ptr ;an000;message +; $else ;an000;it is read + JMP SHORT $$EN2 +$$IF2: + mov dx,offset dg:dr1_ptr ;an000;message +; $endif ;an000; +$$EN2: +; $else ;an000;write protect error + JMP SHORT $$EN1 +$$IF1: + add byte ptr drvlet,firstdrv;ac000;determine drive letter + cmp byte ptr rdflg,write ;ac000;see if it is read/write +; $if z ;an000;it is write + JNZ $$IF6 + mov dx,offset dg:dr4_ptr ;an000;message +; $else ;an000;it is read + JMP SHORT $$EN6 +$$IF6: + mov dx,offset dg:dr3_ptr ;an000;message +; $endif ;an000; +$$EN6: +; $endif ;an000; +$$EN1: + +; CLEAN OUT THE DISK... + MOV AH,DISK_RESET + INT 21H + + JMP RESTART +CODEEND: + +CODE ENDS + END + \ 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 @@ +PAGE 60,132 ; + TITLE DEBMES.SAL - DEBUGGER MESSAGES PC DOS + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBMES + ENDIF + +;******************* START OF SPECIFICATIONS ***************************** +; +; MODULE NAME:DEBMES.SAL +; +; DESCRIPTIVE NAME: SUPPLIES APPLICABLE MESSAGES TO DEBUG.ASM +; +; FUNCTION: THIS ROUTINE PROVIDES A MEANS BY WHICH MESSAGES MAY BE +; OUTPUT FOR DEBUG. THIS IS HANDLED THROUGH THE MESSAGE +; RETRIEVER FUNCTION SYSDISPMSG. TO +; FACILITATE MIGRATION AWAY FROM THE PRINTF UTILITY +; THE INTERFACE FOR INVOKING MESSAGES HAS REMAINED THE SAME. +; THIS IS ACCOMPLISHED THROUGH THE USE OF MACROS AND TABLES. +; EACH MESSAGE HAS A TABLE OF VALUES REQUIRED BY THE MESSAGE +; RETRIEVER UTILITIES. THE MACROS OPERATE ON THESE TABLES +; TO SUPPLY SYSDISPMSG WITH THE VALUES NECESSARY +; TO PRINT A MESSAGE. +; +; ENTRY POINT: PRINTF +; +; INPUT: PRINTF IS INVOKED AS IT HAS ALWAYS BEEN INVOKED. DX MUST +; POINT TO THE OFFSET OF A MESSAGE TABLE. THE TABLE POINTED TO +; BY DX CONTAINS ALL THE NECESSARY INFORMATION FOR THAT MESSAGE +; TO BE PRINTED. +; +; EXIT-NORMAL: NO CARRY +; +; EXIT-ERROR: CARRY SET - EITHER MESSAGE NOT FOUND OR UNABLE TO BE DISPLAYED +; +; INTERNAL REFERENCES: +; +; ROUTINE:DISP_MESSAGE - THIS MACRO IS USED TO DIPLAY A MESSAGE +; VIA SYSDISPMSG. IT TAKES AS INPUT A POINTER +; IN DX. THIS POINTER POINTS TO A TABLE OF +; VALUES FOR THE REQUESTED MESSAGE. +; DISP_MESSAGE OBTAINS THE VALUES IT NEEDS TO +; TO INVOKE SYSDISPMSG FROM THIS TABLE. +; +; EXTERNAL REFERENCES: +; +; ROUTINE: SYSMSG.INC - THIS ROUTINE IS SUPPLIED TO INTERFACE THE +; MESSAGE RETRIEVER SERVICES. +; +; NOTES: THIS MODULE SHOULD BE PROCESSED WITH THE SALUT PRE-PROCESSOR +; WITH OPTIONS "PR". +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+DEBCONST+ +; DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION DOS 4.0 - MESSAGE RETRIEVER IMPLEMENTED. DMS:6/17/87 +; +; +; COPYRIGHT: "MS DOS DEBUG Utility" +; "Version 4.00 (C) Copyright 1988 Microsoft" +; "Licensed Material - Property of Microsoft " +; +;******************** END OF SPECIFICATIONS ****************************** +.xlist + + include sysmsg.inc ;an000;message retriever + +.list + +msg_utilname ;an000;DEBUG messages + +;========================================================================= +;revised debmes.asm +;========================================================================= + +fatal_error equ 45 ;fatal message handler error +unlim_width equ 00h ;unlimited output width +pad_blank equ 20h ;blank pad +pre_load equ 00h ;an000;normal pre-load +pad_zero equ 30h ;an000;zero pad + + +FALSE EQU 0 +TRUE EQU NOT FALSE + +;SYSVER EQU FALSE ;if true, i/o direct to bios + INCLUDE SYSVER.INC + +;========================================================================= +; macro disp_message: the macro takes the message obtained in get_message +; and displays it to the applicable screen device. +;========================================================================= + +disp_message macro tbl ;an000;display message macro + + push si ;an000;save affected reg + push di ;an000; + push ax ;an000; + push bx ;an000; + push cx ;an000; + push dx ;an000; + + push tbl ;an000;exchange tbl with si + pop si ;an000; + + mov ax,[si] ;an000;move message number to ax + mov bx,[si+3] ;an000;display handle + mov cx,[si+7] ;an000;number of subs + mov dl,[si+9] ;an000;function type + mov di,[si+10] ;an000;input buffer if appl. + mov dh,[si+2] ;an000;message type + mov si,[si+5] ;an000;sublist + + call sysdispmsg ;an000;display the message + + pop dx ;an000;restore affected reg + pop cx ;an000; + pop bx ;an000; + pop ax ;an000; + pop di ;an000; + pop si ;an000; + + +endm ;an000;end macro disp_message + +;========================================================================= +; macro disp_message: end macro +;========================================================================= + + + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + + +code segment public byte ;an000;code segment + assume cs:dg,ds:dg,ss:dg,es:dg ;an000; + + public printf ;an000;share printf +;; public disp_fatal ;an000;fatal error display + public pre_load_message ;an000;message pre load + +.xlist + +msg_services + +.list + +;========================================================================= +; include sysmsg.inc - message retriever services +;options selected: +; NEARmsg +; DISPLAYmsg +; LOADmsg +; INPUTmsg +; CHARmsg +; NUMmsg +; CLSAmsg +; CLSBmsg +; CLSCmsg +; CLSDmsg +;========================================================================= + +.xlist + +msg_services ;an000;load the messages +msg_services ;an000;get and display messages +msg_services ;an000;input from keyboard +msg_services ;an000;message types +msg_services ;an000; +msg_services ;an000; + +.list + +;========================================================================= +; printf: printf is a replacement of the printf procedure used in DOS +; releases prior 4.00. printf invokes the macros get_message and +; disp_message to invoke the new message handler. the interface +; into printf will continue to be a pointer to a message passed +; in DX. the pointer is pointing to more than a message now. it +; is pointing to a table for that message containing all relevant +; information for retieving and printing the message. the macros +; get_message and disp_message operate on these tables. +;========================================================================= + +printf proc near ;an000;printf procedure + + disp_message dx ;an000;display a message +;; $if c ;an000;if an error occurred +;; call disp_fatal ;an000;display the fatal error +;; $endif ;an000; + + ret ;an000;return to caller + +printf endp ;an000;end printf + + +;========================================================================= +; disp_fatal: this routine displays a fatal error message in the event +; an error occurred in disp_message. +;========================================================================= + +;;disp_fatal proc near ;an000;fatal error message +;; +;; mov ax,fatal_error ;an000;fatal_error number +;; mov bx,stdout ;an000;print to console +;; mov cx,0 ;an000;no parameters +;; mov dl,no_input ;an000;no input will be coming +;; mov dh,UTILITY_MSG_CLASS ;an000;utility messages +;; call sysdispmsg ;an000;dispaly fatal error +;; ret ;an000;return to caller +;; +;;disp_fatal endp ;an000;end disp_fatal + + +;========================================================================= +; PRE_LOAD_MESSAGE : This routine provides access to the messages required +; by DEBUG. This routine will report if the load was +; successful. An unsuccessful load will cause DEBUG +; to terminate with an appropriate error message. +; +; Date : 6/15/87 +;========================================================================= + +PRE_LOAD_MESSAGE proc near ;an000;pre-load messages + + call SYSLOADMSG ;an000;invoke loader + +; $if c ;an000;if an error + JNC $$IF1 + pushf ;an000;save flags + call SYSDISPMSG ;an000;let him say why + popf ;an000;restore flags +; $endif ;an000; +$$IF1: + + ret ;an000;return to caller + +PRE_LOAD_MESSAGE endp ;an000;end proc + +include msgdcl.inc + +code ends ;an000;end code segment + + +CONST SEGMENT PUBLIC BYTE + + PUBLIC ENDMES_PTR,CRLF_PTR,NAMBAD_PTR + PUBLIC NOTFND_PTR,NOROOM_PTR,BADVER + PUBLIC NOSPACE_PTR,DRVLET + PUBLIC ACCMES_PTR,PROMPT_PTR + PUBLIC TOOBIG_PTR,SYNERR_PTR,BACMES_PTR + PUBLIC HEXERR_PTR,HEXWRT_PTR,WRTMES_PTR,EXEBAD_PTR,EXEWRT_PTR + PUBLIC EXECEMES_PTR, PARITYMES_PTR, NONAMESPEC_PTR + PUBLIC dr1_ptr,dr2_ptr,dr3_ptr,dr4_ptr ;ac000;new messages + PUBLIC CHANGE_FLAG_PTR,DF_ERROR,BF_ERROR,BR_ERROR,BP_ERROR + PUBLIC CONSTEND + +;======================= TABLE STRUCTURE ================================= +; +; byte 1 - message number of message to be displayed +; byte 2 - message type to be used, i.e.;class 1, utility, etc. +; byte 3 - display handle, i.e.; console, printer, etc. +; byte 4 - pointer to substitution list, if any. +; byte 6 - number of replaceable parameters, if any. +; byte 7 - type of input from keyboard, if any. +; byte 8 - pointer to buffer for keyboard input, if any. +; +;========================================================================= + + IF SYSVER + + PUBLIC BADDEV_PTR,BADLSTMES_PTR + + +baddev_ptr label word ;an000;"Bad device name",0 + dw 0006 ;an000;message number 6 + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +badlstmes_ptr label word ;an000;"Couldn't open list device + ; PRN","Enter name of list + ; device?" + dw 0007 ;an000;message number 7 + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db DOS_KEYB_INP ;an000;keyboard input + dw 00 ;an000;no keyboard buffer + + + ENDIF + +;================= REPLACEABLE PARAMETER SUBLIST STRUCTURE =============== +; +; byte 1 - substitution list size, always 11 +; byte 2 - reserved for use by message handler +; byte 3 - pointer to parameter to be used as a substitution +; byte 7 - which parameter is this to replace, %1, %2, etc. +; byte 8 - determines how the parameter is to be output +; byte 9 - determines the maximum width of the parameter string +; byte 10 - determines the minimum width of the parameter string +; byte 11 - define what is to be used as a pad character +; +;========================================================================= + + +;========================================================================= +; replaceable parameter sublists +;========================================================================= + +db_synerr_sub label dword ;an000;synerr parameters + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width + db pad_blank ;an000;blank pad + +db_change_sub label dword ;an000;synerr parameters + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width + db pad_blank ;an000;blank pad + +db_drive_error label dword ;an000;drive error parameters + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:drvlet ;an000;point to drive letter + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db 01 ;an000;1 byte + db 01 ;an000;1 byte + db pad_blank ;an000;blank pad + + + +;========================================================================= +; end replaceable parameter sublists +;========================================================================= + + +crlf_ptr label word ;an000;13,10,0 + dw 0008 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +bacmes_ptr label word ;an000;32,8,0 + dw 0044 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +badver label word ;an000;"Incorrect DOS version" + dw 0001 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +endmes_ptr label word ;an000;13,10,"Program terminated + ; normally",0 + dw 0009 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +nambad_ptr label word ;an000;"Invalid drive specification",0 + dw 0010 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +notfnd_ptr label word ;an000;"File not found",0 + dw 0002 ;an000;message number + db Ext_Err_Class ;an000;extended error + dw stderr ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +noroom_ptr label word ;an000;"File creation error",0 + dw 0012 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +nospace_ptr label word ;an000;"Insufficient space on disk",0 + dw 0013 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +dr1_ptr label word ;an000;"Disk error reading drive %1" + dw 0014 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_drive_error ;an000;sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +dr2_ptr label word ;an000;"Disk error writing drive %1" + dw 0015 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_drive_error ;an000;sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +dr3_ptr label word ;an000;"Write protect error reading + ; drive %1" + dw 0016 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_drive_error ;an000;sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +dr4_ptr label word ;an000;"Write protect error writing + ; drive %1" + dw 0017 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_drive_error ;an000;sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +toobig_ptr label word ;an000;"Insufficient memory",0 + dw 0008 ;an000;message number + db Ext_Err_Class ;an000;utility message + dw stderr ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +synerr_ptr label word ;an000;"%1^Error",0 + dw 0019 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_synerr_sub ;an000;sublist + dw 01 ;an000;1 sub - leading spaces + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +hexerr_ptr label word ;an000;"Error in EXE or HEX file",0 + dw 0020 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +exebad_ptr label word ;an000;"Error in EXE or HEX file",0 + dw 0020 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +hexwrt_ptr label word ;an000;"EXE and HEX files cannot be + ; written",0 + dw 0021 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +exewrt_ptr label word ;an000;"EXE and HEX files cannot be + ; written",0 + dw 0021 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +execemes_ptr label word ;an000;"EXEC failure",0 + dw 0022 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +nonamespec_ptr label word ;an000;"(W)rite error, no destination + ; defined",0 + dw 0023 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +accmes_ptr label word ;an000;Access denied",0 + dw 0024 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +paritymes_ptr label word ;an000;"Parity error or nonexistant + ; memory error detected",0 + dw 0025 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +prompt_ptr label word ;an000;"-",0 + dw 0026 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +change_flag_ptr label word ;an000;"%1 -",0 + dw 0027 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_change_sub ;an000;sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +df_error db "df",0 +bf_error db "bf",0 +br_error db "br",0 +bp_error db "bp",0 +drvlet db "A",0 + +CONSTEND LABEL BYTE + +CONST ENDS + +DATA SEGMENT PUBLIC BYTE + + PUBLIC HEX_ARG1,HEX_ARG2,HEX_PTR,ARG_BUF + PUBLIC ARG_BUF_PTR,ADD_PTR,ERR_TYPE + PUBLIC CRLF_PTR,ADD_ARG,SUB_ARG,PROMPT_PTR + PUBLIC REGISTER_PTR,REG_NAME,REG_CONTENTS + PUBLIC SINGLE_REG_PTR,SINGLE_REG_ARG + PUBLIC ERRMES_PTR,LOC_PTR,LOC_ADD + PUBLIC LITTLE_PTR,BIG_PTR,LITTLE_CONTENTS + PUBLIC BIG_CONTENTS,COMP_PTR,COMP_ARG1,COMP_ARG2 + PUBLIC COMP_ARG3,COMP_ARG4,COMP_ARG5,COMP_ARG6 + PUBLIC WRTMES_PTR,WRT_ARG1,WRT_ARG2 + PUBLIC IOTYP,MESTYP + PUBLIC ONE_CHAR_BUF,ONE_CHAR_BUF_PTR + PUBLIC OPBUF,UNASSEM_LN_PTR + + PUBLIC xm_han_ret_ptr + PUBLIC xm_mapped_ptr + PUBLIC xm_err80_ptr + PUBLIC xm_err83_ptr + PUBLIC xm_err84_ptr + PUBLIC xm_err85_ptr + PUBLIC xm_err86_ptr + PUBLIC xm_err87_ptr + PUBLIC xm_err88_ptr + PUBLIC xm_err89_ptr + PUBLIC xm_err8a_ptr + PUBLIC xm_err8b_ptr + PUBLIC xm_err8d_ptr + PUBLIC xm_err8e_ptr + PUBLIC xm_err_gen_ptr + PUBLIC xm_parse_err_ptr + PUBLIC xm_status_ptr + PUBLIC xm_page_seg_ptr + PUBLIC xm_deall_ptr + PUBLIC xm_errff_ptr + PUBLIC xm_unall_ptr + PUBLIC xm_han_alloc_ptr + + EXTRN XM_HANDLE_RET:word + EXTRN XM_LOG:byte + EXTRN XM_PHY:byte + EXTRN XM_PAGE_CNT:word + EXTRN XM_FRAME:word + EXTRN XM_DEALL_HAN:word + EXTRN XM_ALLOC_PG:word + EXTRN XM_TOTAL_PG:word + EXTRN XM_HAN_ALLOC:word + EXTRN XM_HAN_TOTAL:word + +;========================================================================= +; begin parameter sublists +;========================================================================= + +;======================= unassemble parameter sublists =================== + +db_unassem_sb1 label dword ;an000;unassemble parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width + db pad_blank ;an000;blank pad + +db_unassem_sb2 label dword ;an000;unassemble parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:opbuf ;an000;point to argument buffer + db 02 ;an000;parameter two + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width + db pad_blank ;an000;blank pad + + +;================== hex argument parameter sublists ====================== + +db_hexarg_sb1 label dword ;an000;hex argument parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:hex_arg1 ;an000;point to argument buffer + db 01 ;an000;parameter one + db right_align+bin_hex_word + ;an000;right align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_hexarg_sb2 label dword ;an000;hex argument parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:hex_arg2 ;an000;point to argument buffer + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_hexarg_sb3 label dword ;an000;hex argument parameter 3 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 03 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width + db pad_blank ;an000;blank pad + + +;================== hex add parameter sublists =========================== + +db_hexadd_sb1 label dword ;an000;hex add parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:add_arg ;an000;point to add_arg + db 01 ;an000;parameter one + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_hexadd_sb2 label dword ;an000;hex argument parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:sub_arg ;an000;point to sub_arg + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;================== end hex add parameter sublists ======================= + +;================== single register parameter sublists =================== +;string: "%1 %2",13,10,":",0 + +db_singrg_sb1 label dword ;an000;single register parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +db_singrg_sb2 label dword ;an000;single register parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:single_reg_arg ;an000;point single_reg_arg + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;================== register parameter sublists ========================== +;string: "%1=%2 ",0 + +db_regist_sb1 label dword ;an000;register parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:reg_name ;an000;point to reg_name + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db 02 ;an000;unlimited width + db 02 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +db_regist_sb2 label dword ;an000;register parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:reg_contents ;an000;point to reg_contents + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;================== error message parameter sublists ===================== +;string: "%1 Error",0 + +db_error_sb1 label dword ;an000;error message parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:err_type ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +;================== writing message parameter sublists =================== +;string: "Writing %1%2 bytes",0 + +db_wrtmes_sb1 label dword ;an000;wrtmes parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:wrt_arg1 ;an000;point to argument buffer + db 01 ;an000;parameter one + db right_align+bin_hex_word + ;an000;right align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_wrtmes_sb2 label dword ;an000;wrtmes parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:wrt_arg2 ;an000;point to argument buffer + db 02 ;an000;parameter two + db left_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;================== loc address parameter sublists ======================= +;string: "%1:%2=",0 + +db_locadd_sb1 label dword ;an000;loc address parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db right_align+Char_field_ASCIIZ + ;an000;left align/ASCIZZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +db_locadd_sb2 label dword ;an000;loc address parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:loc_add ;an000;point to loc_add + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;================== little contents parameter sublists =================== +;string "%1",0 + +db_little_sb1 label dword ;an000;one byte output parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:little_contents ;an000;point to little_contents + db 01 ;an000;parameter one + db right_align+bin_hex_byte + ;an000;left align/byte/hexadecimal + db 02 ;an000;maximum of 2 bytes + db 02 ;an000;minimum of 2 bytes + db pad_zero ;an000;blank pad + +;================== big argument parameter sublists ====================== +;string: "%1",0 + +db_big_sb1 label dword ;an000;word argument parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:big_contents ;an000;point to big_contents + db 01 ;an000;parameter one + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;======================= comp argument parameter sublists ================ +;string "%1:%2 %3 %4 %5:%6",0 + +db_comp_sb1 label dword ;an000;comp argument parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg1 ;an000;point to comp_arg1 + db 01 ;an000;parameter one + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_comp_sb2 label dword ;an000;comp argument parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg2 ;an000;point to comp_arg2 + db 02 ;an000;parameter two + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_comp_sb3 label dword ;an000;comp argument parameter 3 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg3 ;an000;point to comp_arg3 + db 03 ;an000;parameter three + db right_align+bin_hex_byte + ;an000;left align/byte/hexadecimal + db 02 ;an000;maximum of 2 bytes + db 02 ;an000;minimum of 2 bytes + db pad_zero ;an000;blank pad + +db_comp_sb4 label dword ;an000;comp argument parameter 4 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg4 ;an000;point to comp_arg4 + db 04 ;an000;parameter four + db right_align+bin_hex_byte + ;an000;left align/byte/hexadecimal + db 02 ;an000;maximum of 2 bytes + db 02 ;an000;minimum of 2 bytes + db pad_zero ;an000;blank pad + +db_comp_sb5 label dword ;an000;comp argument parameter 5 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg5 ;an000;point to comp_arg5 + db 05 ;an000;parameter five + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +db_comp_sb6 label dword ;an000;comp argument parameter 6 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:comp_arg6 ;an000; + db 06 ;an000;parameter 6 + db right_align+bin_hex_word + ;an000;left align/word/hexadecimal + db 04 ;an000;maximum of 4 bytes + db 04 ;an000;minimum of 4 bytes + db pad_zero ;an000;blank pad + +;======================= disk error parameter sublists =================== +;string: "%1 error %2 drive %3",0 + +db_disk_sb1 label dword ;an000;disk argument parameter 1 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:mestyp ;an000;point to mestyp + db 01 ;an000;parameter one + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +db_disk_sb2 label dword ;an000;disk argument parameter 2 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:iotyp ;an000;point to iotyp + db 02 ;an000;parameter two + db left_align+Char_field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +db_disk_sb3 label dword ;an000;disk argument parameter 3 + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:drive ;an000;point to drive + db 03 ;an000;parameter three + db left_align+char_field_char + ;an000;left align/character/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +arg_buf_sb1 label dword ;an000;argument sublist + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:arg_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_Field_ASCIIZ + ;an000;left align/ASCIIZ/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +one_char_sb1 label dword ;an000;character buffer sublist + db Sublist_Length ;an000;sublist size + db reserved ;an000;reserved + dd dg:one_char_buf ;an000;point to argument buffer + db 01 ;an000;parameter one + db left_align+Char_Field_Char + ;an000;left align/character/character + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum of 0 bytes + db pad_blank ;an000;blank pad + +xm_han_sub label dword ;an000;sublist for handles + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_HANDLE_RET ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 30h ;an000;pad with zeros + +xm_map_sub label dword ;an000;sublist for mappings + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_LOG ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Byte;an000; + db 02 ;an000;maximum width + db 02 ;an000;minimum width + db 30h ;an000;pad with zeros + + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_PHY ;an000;parameter 2 + db 02 ;an000;parameter 2 + db right_align+Bin_Hex_Byte;an000; + db 02 ;an000;maximum width + db 02 ;an000;minimum width + db 30h ;an000;pad with zeros + +xm_sta_sub label word ;an000;sublist for status + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_HANDLE_RET ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 30h ;an000;pad with zeros + + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_PAGE_CNT ;an000;parameter 2 + db 02 ;an000;parameter 2 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 30h ;an000;pad with zeros + +xm_page_seg_sub label word ;an000;sublist for frame seg status + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_PHY ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Byte;an000; + db 02 ;an000;maximum width + db 02 ;an000;minimum width + db 30h ;an000;pad with zeros + + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_FRAME ;an000;parameter 2 + db 02 ;an000;parameter 2 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 30h ;an000;pad with zeros + +xm_deall_sub label word ;an000;sublist for handle deallocation + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_DEALL_HAN ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Byte;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 30h ;an000;pad with zeros + +xm_unall_sub label word ;an000;sublist unallocated page report + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_ALLOC_PG ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 20h ;an000;pad with blanks + + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_TOTAL_PG ;an000;parameter 1 + db 02 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 20h ;an000;pad with zeros + + +xm_han_alloc_sub label word ;an000;sublist unallocated page report + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_HAN_ALLOC ;an000;parameter 1 + db 01 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 20h ;an000;pad with blanks + + db Sublist_Length ;an000;11 bytes + db Reserved ;an000;reserved field + dd dg:XM_HAN_TOTAL ;an000;parameter 1 + db 02 ;an000;parameter 1 + db right_align+Bin_Hex_Word;an000; + db 04 ;an000;maximum width + db 04 ;an000;minimum width + db 20h ;an000;pad with zeros +;========================================================================= +; end parameter sublists +;========================================================================= + + +unassem_ln_ptr label word ;an000;"%1%2",0 + dw 0032 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_unassem_sb1 ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +hex_ptr label word ;an000;"%1:%2 %3",0 + dw 0033 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_hexarg_sb1 ;an000;sublist + dw 03 ;an000;3 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +add_ptr label word ;an000;"%1 %2",0 + dw 0034 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_hexadd_sb1 ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + + +single_reg_ptr label word ;an000;"%1 %2",13,10,":",0 + dw 0035 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_singrg_sb1 ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + + +register_ptr label word ;an000;"%1=%2 ",0 ex: AX=FFFF + dw 0036 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_regist_sb1 ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +errmes_ptr label word ;an000;"%1 Error",0 + dw 0037 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_error_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +wrtmes_ptr label word ;an000;"Writing %1 bytes",0 + dw 0038 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_wrtmes_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +loc_ptr label word ;an000:"%1;%2=",0 ex:CX:0000 + dw 0039 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_locadd_sb1 ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +little_ptr label word ;an000;"%1",0 ex:FF + dw 0040 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_little_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +big_ptr label word ;an000;"%1",0 + dw 0041 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_big_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +comp_ptr label word ;an000;"%1:%2 %3 %4 %5:%6",0 + dw 0042 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:db_comp_sb1 ;an000;sublist + dw 06 ;an000;6 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +arg_buf_ptr label word ;an000;"%1" + dw 0046 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:arg_buf_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +one_char_buf_ptr label word ;an000;"%1" + dw 0047 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:one_char_sb1 ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_unall_ptr label word ;an000;unallocated message report + dw 0050 ;an000;"%1 of a total %2 EMS pages + ; have been allocated",cr,lf + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_UNALL_SUB ;an000;sublist + dw 02 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_han_alloc_ptr label word ;an000;unallocated message report + dw 0051 ;an000;"%1 of a total %2 EMS handles + ; have been allocated",cr,lf + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_HAN_ALLOC_SUB ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_han_ret_ptr label word ;an000;prints handle created + dw 0055 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_HAN_SUB ;an000;sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_mapped_ptr label word ;an000;prints log/phy pages + dw 0056 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_MAP_SUB ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err80_ptr label word ;an000;ems error message + dw 0057 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err83_ptr label word ;an000;ems error message + dw 0058 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err84_ptr label word ;an000;ems error message + dw 0059 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err85_ptr label word ;an000;ems error message + dw 0060 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err86_ptr label word ;an000;ems error message + dw 0061 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err87_ptr label word ;an000;ems error message + dw 0062 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err88_ptr label word ;an000;ems error message + dw 0063 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err89_ptr label word ;an000;ems error message + dw 0064 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err8a_ptr label word ;an000;ems error message + dw 0065 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err8b_ptr label word ;an000;ems error message + dw 0066 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err8d_ptr label word ;an000;ems error message + dw 0067 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err8e_ptr label word ;an000;ems error message + dw 0068 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_err_gen_ptr label word ;an000;ems error message + dw 0070 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_parse_err_ptr label word ;an000;input error message + dw 0071 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_status_ptr label word ;an000;prints status of EMS + dw 0072 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_STA_SUB ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_page_seg_ptr label word ;an000;"Physical page %1 = Frame + ; segment %2" + dw 0075 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_PAGE_SEG_SUB ;an000;sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_deall_ptr label word ;an000;"Handle %1 deallocated" + + dw 0076 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw dg:XM_DEALL_SUB ;an000;sublist + dw 01 ;an000;1 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +xm_errff_ptr label word ;an000;"EMS not installed" + + dw 0078 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility messages + dw stdout ;an000;display handle + dw 00 ;an000;sublist + dw 00 ;an000;0 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +arg_buf db 80 dup (?) ;an000;argument buffer +one_char_buf db ? ;an000;character buffer + +opbuf db 51h dup (?) + +hex_arg1 dw ? +hex_arg2 dw ? + +add_arg dw ? +sub_arg dw ? + +single_reg_arg dw ? + +reg_name dw ? +reg_contents dw ? + +err_type db 3 dup(0) ;ac000;changed to hold bf,bp,etc. + +wrt_arg1 dw ? +wrt_arg2 dw ? + +loc_add dw ? + +little_contents dw ? +big_contents dw ? + +comp_arg1 dw ? +comp_arg2 dw ? +comp_arg3 dw ? +comp_arg4 dw ? +comp_arg5 dw ? +comp_arg6 dw ? + +mestyp dw ? +iotyp dw ? +drive db ? + + +DATA ENDS + END + \ 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 @@ + PAGE 80,132 ; + TITLE DEBUASM.ASM +; Code for the UASSEMble command in the debugger + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBUASM + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC + INCLUDE DEBEQU.ASM +.CREF +.LIST +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE + EXTRN SYNERR_PTR:BYTE,UNASSEM_LN_PTR:WORD + EXTRN NSEG:WORD,SISAVE:WORD,BPSAVE:WORD,DISAVE:WORD + EXTRN BXSAVE:WORD,DSSAVE:WORD,ESSAVE:WORD,CSSAVE:WORD,IPSAVE:WORD + EXTRN SSSAVE:WORD,CXSAVE:WORD,SPSAVE:WORD,FLSAVE:WORD + EXTRN DISTAB:WORD,SHFTAB:WORD,IMMTAB:WORD,GRP1TAB:WORD,GRP2TAB:WORD + EXTRN DBMN:BYTE,ESCMN:BYTE,DISPB:WORD,STACK:BYTE,REG8:BYTE + EXTRN REG16:BYTE,SREG:BYTE,SIZ8:BYTE,SEGTAB:WORD,M8087_TAB:BYTE + EXTRN FI_TAB:BYTE,SIZE_TAB:BYTE,MD9_TAB:BYTE,MD9_TAB2:BYTE + EXTRN MDB_TAB:BYTE,MDB_TAB2:BYTE,MDD_TAB:BYTE,MDD_TAB2:BYTE + EXTRN MDF_TAB:BYTE +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN DISADD:BYTE,DISCNT:WORD,BYTCNT:BYTE,TEMP:BYTE,AWORD:BYTE + EXTRN MIDFLD:BYTE,MODE:BYTE,REGMEM:BYTE,OPCODE:WORD,OPBUF:BYTE + EXTRN INDEX:WORD,ARG_BUF:BYTE,ARG_BUF_PTR:BYTE,ARG_BUF_INDEX:WORD + EXTRN OPBUF:BYTE,OPCODE:WORD +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CODE SEGMENT PUBLIC BYTE + ASSUME CS:DG,DS:DG,ES:DG,SS:DG + + PUBLIC UNASSEM + PUBLIC DISASLN,MEMIMM,JMPCALL,SIGNIMM,ALUFROMREG,WORDTOALU + PUBLIC GRP2,PREFIX,OUTVARW,GRP1,SSPRE,MOVSEGTO,DSPRE,SHIFT + PUBLIC ESPRE,IMMED,CSPRE,OUTVARB,CHK10,ACCIMM,INT3,INVARB + PUBLIC MOVSEGFROM,LOADACC,OUTFIXB,XCHGAX,REGIMMW,SHORTJMP + PUBLIC SAV8,M8087,M8087_DB,M8087_DF,M8087_D9,M8087_DD + PUBLIC SAV16,SAVHEX,INFIXW,REGIMMB,OUTFIXW,SHIFTV,LONGJMP + PUBLIC INVARW,STOREACC,INFIXB,NOOPERANDS,ALUTOREG + PUBLIC SEGOP,REGOP,GETADDR + + EXTRN CRLF:NEAR,BLANK:NEAR,TAB:NEAR,STD_PRINTF:NEAR + EXTRN HEX:NEAR,DEFAULT:NEAR,OUTSI:NEAR,OUTDI:NEAR + EXTRN HEX_ADDRESS_ONLY:NEAR + +UNASSEM: + MOV BP,[CSSAVE] ; Default code segment + MOV DI,OFFSET DG:DISADD ; Default address + MOV CX,DISPB ; Default length + SHR CX,1 + SHR CX,1 + CALL DEFAULT + MOV WORD PTR [DISADD],DX ; Displacement of disassembly + MOV WORD PTR [DISADD+2],AX ; Segment + MOV WORD PTR [DISCNT],CX ; No. of bytes (but whole instructions) +DISLP: + CALL DISASLN ; Disassemble one line + CALL CRLF + TEST [DISCNT],-1 ; See if we've used up the range + JNZ DISLP + RET + +GOTDIS: + PUSH DS ; RE-GET LAST BYTE + PUSH SI + LDS SI,DWORD PTR [DISADD] + MOV AL,[SI-1] + POP SI + POP DS + RET + +GETDIS: + PUSH DS + LDS SI,DWORD PTR [DISADD] + LODSB ; Get the next byte of code + POP DS + MOV WORD PTR [DISADD],SI ; Update pointer + PUSH AX + PUSH DI + MOV DI,[ARG_BUF_INDEX] + CALL HEX ; Display each code byte + MOV [ARG_BUF_INDEX],DI + POP DI + MOV SI,[DISCNT] + OR SI,SI ; Check if range exhausted + JZ ENDRNG ; If so, don't wrap around + DEC SI ; Count off the bytes + MOV [DISCNT],SI +ENDRNG: + INC BYTE PTR[BYTCNT] ; Keep track of no. of bytes per line + POP AX + RET + +DSPRE: + INC BYTE PTR [NSEG+1] +SSPRE: + INC BYTE PTR [NSEG+1] +CSPRE: + INC BYTE PTR [NSEG+1] +ESPRE: + INC BYTE PTR [NSEG+1] + +PREFIX: + POP BX ; Dump off return address + CALL FINLN + CALL CRLF +DISASLN: + PUSH DS + LDS SI,DWORD PTR [DISADD] + CALL OUTSI ; Show disassembly address + POP DS + CALL HEX_ADDRESS_ONLY +DISASLN1: + MOV BYTE PTR [BYTCNT],0 ; Count of code bytes per line +; Fill overflow area with zeros + MOV DI,OFFSET DG:OPBUF + MOV CX,50 + MOV AL,0 + REP STOSB +; fill buffer with spaces + MOV DI,OFFSET DG:OPBUF + MOV CX,OPBUFLEN + MOV AL," " + REP STOSB + MOV DI,OFFSET DG:ARG_BUF + MOV [ARG_BUF_INDEX],DI + CALL GETDIS ; Get opcode + MOV DI,[ARG_BUF_INDEX] + MOV AH,0 + MOV BX,AX + AND AL,1 ; Mask to "W" bit + MOV [AWORD],AL + MOV AL,BL ; Restore opcode + SHL BX,1 + SHL BX,1 ; Multiply opcode by 4 + ADD BX,OFFSET DG:DISTAB + MOV DX,[BX] ; Get pointer to mnemonic from table + MOV [OPCODE],DX + MOV [ARG_BUF_INDEX],DI + MOV DI,OFFSET DG:OPBUF + CALL WORD PTR [BX+2] +FINLN: + MOV AH,[BYTCNT] ; See how many bytes in this instruction + ADD AH,AH ; Each uses two characters + MOV AL,14 ; Amount of space we want to use + SUB AL,AH ; See how many fill characters needed + CBW + XCHG CX,AX ; Parameter for TAB needed in CX + MOV DI,[ARG_BUF_INDEX] + CALL TAB + MOV SI,[OPCODE] + OR SI,SI + JZ GET_TAB +GET_OPCODE: + LODSB + OR AL,AL + JZ GET_TAB + STOSB + JMP GET_OPCODE + +GET_TAB: + MOV AL,9 + STOSB + MOV BYTE PTR [DI],0 ; nul terminate address buffer + MOV DX,OFFSET DG:UNASSEM_LN_PTR + CALL STD_PRINTF + RET + +GETMODE: + CALL GETDIS ; Get the address mode byte + MOV AH,AL + AND AL,7 ; Mask to "r/m" field + MOV [REGMEM],AL + SHR AH,1 + SHR AH,1 + SHR AH,1 + MOV AL,AH + AND AL,7 ; Mask to center 3-bit field + MOV [MIDFLD],AL + SHR AH,1 + SHR AH,1 + SHR AH,1 + MOV [MODE],AH ; Leaving 2-bit "MOD" field + RET + +IMMED: + MOV BX,OFFSET DG:IMMTAB + CALL GETMNE +FINIMM: + CALL TESTREG + JMP SHORT IMM + +MEMIMM: + CALL GETMODE + JMP SHORT FINIMM + +ACCIMM: + XOR AL,AL +IMM1: + CALL SAVREG +IMM: + MOV AL,"," + STOSB + TEST BYTE PTR [AWORD],-1 + JNZ SAV16 +SAV8: + CALL GETDIS + JMP SHORT SAVHEX + +LONGJMP: + PUSH DI + MOV DI,OFFSET DG:TEMP + CALL SAV16 + POP DI + CALL SAV16 + MOV AL,":" + STOSB + MOV SI,OFFSET DG:TEMP + MOV CX,4 +MOVDIG: + LODSB + STOSB + LOOP MOVDIG + RET + +SAV16: + CALL GETDIS ; Get low byte + MOV DL,AL + CALL GETDIS ; Get high byte + MOV DH,AL + CALL SAVHEX ; Convert and store high byte + MOV AL,DL +SAVHEX: + MOV AH,AL + SHR AL,1 + SHR AL,1 + SHR AL,1 + SHR AL,1 + CALL SAVDIG + MOV AL,AH +SAVDIG: + AND AL,0FH + ADD AL,90H + DAA + ADC AL,40H + DAA + STOSB + RET + +CHK10: + CALL GETDIS + CMP AL,10 + JNZ SAVHEX + RET + +SIGNIMM: + MOV BX,OFFSET DG:IMMTAB + CALL GETMNE + CALL TESTREG + MOV AL,"," + STOSB +SAVD8: + CALL GETDIS ; Get signed 8-bit number + CBW + MOV DX,AX ; Save true 16-bit value in DX + MOV AH,AL + MOV AL,"+" + OR AH,AH +; JZ NOSIGN + JNS POSITIV ; OK if positive + MOV AL,"-" + NEG AH ; Get magnitude if negative +POSITIV: + STOSB +; NOSIGN: + MOV AL,AH + JMP SHORT SAVHEX + +ALUFROMREG: + CALL GETADDR + MOV AL,"," + STOSB +REGFLD: + MOV AL,[MIDFLD] +SAVREG: + MOV SI,OFFSET DG:REG8 + CMP BYTE PTR [AWORD],1 + JNE FNDREG +SAVREG16: + MOV SI,OFFSET DG:REG16 +FNDREG: + CBW + ADD SI,AX + ADD SI,AX + MOVSW + RET + +SEGOP: + SHR AL,1 + SHR AL,1 + SHR AL,1 +SAVSEG: + AND AL,3 + MOV SI,OFFSET DG:SREG + JMP SHORT FNDREG + +REGOP: + AND AL,7 + JMP SHORT SAVREG16 + +MOVSEGTO: + MOV BYTE PTR [AWORD],1 + CALL GETADDR + MOV AL,"," + STOSB + MOV AL,[MIDFLD] + JMP SHORT SAVSEG + +MOVSEGFROM: + CALL GETMODE + CALL SAVSEG + MOV BYTE PTR [AWORD],1 + JMP SHORT MEMOP2 + +GETADDR: + CALL GETMODE + JMP SHORT ADDRMOD + +WORDTOALU: + MOV BYTE PTR [AWORD],1 +ALUTOREG: + CALL GETMODE + CALL REGFLD +MEMOP2: + MOV AL,"," + STOSB +ADDRMOD: + CMP BYTE PTR [MODE],3 + MOV AL,[REGMEM] + JE SAVREG + XOR BX,BX + MOV BYTE PTR [NSEG],3 + MOV BYTE PTR [DI],"[" + INC DI + CMP AL,6 + JNE NODRCT + CMP BYTE PTR [MODE],0 + JE DIRECT ; Mode=0 and R/M=6 means direct addr. +NODRCT: + MOV DL,AL + CMP AL,1 + JBE USEBX + CMP AL,7 + JE USEBX + CMP AL,3 + JBE USEBP + CMP AL,6 + JNE CHKPLS +USEBP: + MOV BX,[BPSAVE] + MOV BYTE PTR [NSEG],2 ; Change default to Stack Segment + MOV AX,BPREG +SAVBASE: + STOSW +CHKPLS: + CMP DL,4 + JAE NOPLUS + MOV AL,"+" + STOSB +NOPLUS: + CMP DL,6 + JAE DOMODE ; No index register + AND DL,1 ; Even for SI, odd for DI + JZ USESI + ADD BX,[DISAVE] + MOV AX,DIREG +SAVINDX: + STOSW +DOMODE: + MOV AL,[MODE] + OR AL,AL + JZ CLOSADD ; If no displacement, then done + CMP AL,2 + JZ ADDDIR + CALL SAVD8 ; Signed 8-bit displacement +ADDCLOS: + ADD BX,DX +CLOSADD: + MOV AL,"]" + STOSB + MOV [INDEX],BX +NOOPERANDS: + RET + +ADDDIR: + MOV AL,"+" + STOSB +DIRECT: + CALL SAV16 + JMP SHORT ADDCLOS + +USEBX: + MOV BX,[BXSAVE] + MOV AX,BXREG + JMP SHORT SAVBASE + +USESI: + ADD BX,[SISAVE] + MOV AX,SIREG + JMP SHORT SAVINDX + +SHORTJMP: + CALL GETDIS + CBW + ADD AX,WORD PTR [DISADD] + XCHG DX,AX +SAVJMP: + MOV AL,DH + CALL SAVHEX + MOV AL,DL + JMP SAVHEX + +JMPCALL: + CALL GETDIS + MOV DL,AL + CALL GETDIS + MOV DH,AL + ADD DX,WORD PTR [DISADD] + JMP SHORT SAVJMP + +XCHGAX: + AND AL,7 + CALL SAVREG16 + MOV AL,"," + STOSB + XOR AL,AL + JMP SAVREG16 + +LOADACC: + XOR AL,AL + CALL SAVREG + MOV AL,"," + STOSB +MEMDIR: + MOV AL,"[" + STOSB + XOR BX,BX + MOV BYTE PTR [NSEG],3 + JMP DIRECT + +STOREACC: + CALL MEMDIR + MOV AL,"," + STOSB + XOR AL,AL + JMP SAVREG + +REGIMMB: + MOV BYTE PTR [AWORD],0 + JMP SHORT REGIMM + +REGIMMW: + MOV BYTE PTR [AWORD],1 +REGIMM: + AND AL,7 + JMP IMM1 + +INT3: + MOV BYTE PTR [DI],"3" + INC DI + RET + +; 8087 instructions whose first byte is 0dfh +M8087_DF: + CALL GET64F + JZ ISDD3 + MOV SI,OFFSET DG:MDF_TAB + JMP NODB3 + +; 8087 instructions whose first byte is 0ddh +M8087_DD: + CALL GET64F + JZ ISDD3 + MOV SI,OFFSET DG:MDD_TAB + JMP NOD93 + +ISDD3: + MOV AL,DL + TEST AL,100B + JZ ISSTI + JMP ESC0 + +ISSTI: + AND AL,11B + MOV SI,OFFSET DG:MDD_TAB2 + MOV CL,AL + CALL MOVBYT + JMP PUTRST + +; 8087 instructions whose first byte is 0dbh +M8087_DB: + CALL GET64F + JZ ISDB3 + MOV SI,OFFSET DG:MDB_TAB +NODB3: + CALL PUTOP + CALL PUTSIZE + JMP ADDRMOD + +ISDB3: + MOV AL,DL + TEST AL,100B + JNZ ISDBIG +ESC0V: + JMP ESC0 + +ISDBIG: + CALL GOTDIS + AND AL,11111B + CMP AL,4 + JAE ESC0V + MOV SI,OFFSET DG:MDB_TAB2 + JMP DOBIG + +; 8087 instructions whose first byte is 0d9h +M8087_D9: + CALL GET64F + JZ ISD93 + + MOV SI,OFFSET DG:MD9_TAB +NOD93: + CALL PUTOP + AND AL,111B + CMP AL,3 + JA NOSHO + MOV AL,DL + CALL PUTSIZE +NOSHO: + JMP ADDRMOD + +ISD93: + MOV AL,DL + TEST AL,100B + JNZ ISD9BIG + AND AL,111B + OR AL,AL + JNZ NOTFLD + MOV AX,"DL" + STOSW + JMP SHORT PUTRST + +NOTFLD: + CMP AL,1 + JNZ NOTFXCH + MOV AX,"CX" + STOSW + MOV AL,"H" + JMP SHORT PUTRST1 + +NOTFXCH: + CMP AL,3 + JNZ NOTFSTP + MOV AX,"TS" + STOSW + MOV AL,"P" +PUTRST1: + STOSB +PUTRST: + MOV AL,9 + STOSB + JMP PUTST0 + +NOTFSTP: + CALL GOTDIS + CMP AL,11010000B ; CHECK FOR FNOP + JZ GOTFNOP + JMP ESC0 + +GOTFNOP: + MOV AX,"ON" + STOSW + MOV AL,"P" + STOSB + RET + +ISD9BIG: + CALL GOTDIS ; GET THE MODE BYTE + MOV SI,OFFSET DG:MD9_TAB2 +DOBIG: + AND AL,11111B + MOV CL,AL + JMP MOVBYT + +; entry point for the remaining 8087 instructions +M8087: + CALL GET64 + CALL PUTFI ; PUT FIRST PART OF OPCODE + MOV AL,DL + CMP BYTE PTR [MODE],11B ; CHECK FOR REGISTER MODE + JZ MODEIS3 + CALL PUTMN ; PUT MIDDLE PART OF OPCODE +NO3: + MOV AL,9 ; OUTPUT A TAB + STOSB + MOV AL,DL + CALL PUTSIZE ; OUTPUT THE OPERAND SIZE + JMP ADDRMOD + +MODEIS3: + TEST AL,100000B ; D BIT SET? + JZ MPUT ; NOPE... + TEST AL,000100B ; FDIV OR FSUB? + JZ MPUT ; NOPE... + XOR AL,1 ; REVERSE SENSE OF R + MOV DL,AL ; SAVE CHANGE +MPUT: + CALL PUTMN ; PUT MIDDLE PART OF OPCODE + MOV AL,DL + TEST AL,010000B + JZ NOPSH + MOV AL,"P" + STOSB +NOPSH: + MOV AL,9 + STOSB + MOV AL,DL + AND AL,00000111B + CMP AL,2 ; FCOM + JZ PUTST0 + CMP AL,3 ; FCOMP + JZ PUTST0 + MOV AL,DL + TEST AL,100000B + JZ PUTSTST0 + +; output 8087 registers in the form st(n),st +PUTST0ST: + CALL PUTST0 + MOV AL,',' +ISCOMP: + STOSB + +PUTST: + MOV AX,"TS" + STOSW + RET + +; output 8087 registers in the form st,st(n) +PUTSTST0: + CALL PUTST + MOV AL,',' + STOSB + +PUTST0: + CALL PUTST + MOV AL,"(" + STOSB + MOV AL,[REGMEM] + ADD AL,"0" + STOSB + MOV AL,")" + STOSB + RET + +; output an 8087 mnemonic +PUTMN: + MOV SI,OFFSET DG:M8087_TAB + MOV CL,AL + AND CL,00000111B + JMP SHORT MOVBYT + +; output either 'FI' or 'F' for first byte of opcode +PUTFI: + MOV SI,OFFSET DG:FI_TAB + JMP SHORT PUTFI2 + +; output size (dword, tbyte, etc.) +PUTSIZE: + MOV SI,OFFSET DG:SIZE_TAB +PUTFI2: + CMP BYTE PTR [MODE],11B ; check if 8087 register + JNZ PUTFI3 + AND AL,111000B ; LOOK FOR INVALID FORM OF 0DAH OPERANDS + CMP AL,010000B + JZ ESC0PJ + MOV AL,DL + CMP AL,110011B ; FCOMPP + JNZ GOFI + CMP BYTE PTR [REGMEM],1 + JZ GOFI +ESC0PJ: + JMP ESC0P + +GOFI: + XOR CL,CL + JMP SHORT MOVBYT + +; Look for qword +PUTFI3: + CMP AL,111101B + JZ GOTQU + CMP AL,111111B + JNZ NOTQU +GOTQU: + MOV CL,2 + JMP SHORT MOVBYT + +; look for tbyte +NOTQU: + CMP AL,011101B + JZ GOTTB + CMP AL,111100B + JZ GOTTB + CMP AL,111110B + JZ GOTTB + CMP AL,011111B + JNZ NOTTB +GOTTB: + MOV CL,5 + JMP SHORT MOVBYT + +NOTTB: + MOV CL,4 + SHR AL,CL + MOV CL,AL +; SI POINTS TO A TABLE OF TEXT SEPARATED BY "$" +; CL = WHICH ELEMENT IN THE TABLE YOU WISH TO COPY TO [DI] +MOVBYT: + PUSH AX + INC CL +MOVBYT1: + DEC CL + JZ MOVBYT3 +MOVBYT2: + LODSB + CMP AL,"$" + JZ MOVBYT1 + JMP MOVBYT2 + +MOVBYT3: + LODSB + CMP AL,'$' + JZ MOVBYT5 + CMP AL,'@' ; THIS MEANS RESVERED OP-CODE + JNZ MOVBYT4 + POP AX + JMP SHORT ESC0P ; GO DO AN ESCAPE COMMAND + +MOVBYT4: + STOSB + JMP MOVBYT3 + +MOVBYT5: + POP AX + RET + +PUTOP: + AND AL,111B + MOV CL,AL + CALL MOVBYT + MOV AL,9 + STOSB + MOV AL,DL + RET + +GET64F: + CALL GET64 + MOV AL,"F" + STOSB + CMP BYTE PTR [MODE],3 + MOV AL,DL + RET + +GET64: + AND AL,7 + MOV DL,AL + CALL GETMODE + SHL DL,1 + SHL DL,1 + SHL DL,1 + OR AL,DL + MOV DL,AL ; SAVE RESULT + RET + +ESC0P: + POP DI ; CLEAN UP STACK +ESC0: + MOV WORD PTR [OPCODE],OFFSET DG:ESCMN + MOV AL,DL + MOV DI,OFFSET DG:OPBUF + JMP SHORT ESC1 + +ESCP: + CALL GET64 +ESC1: + CALL SAVHEX + CMP BYTE PTR [MODE],3 + JZ SHRTESC + MOV BYTE PTR [AWORD],1 + JMP MEMOP2 + +SHRTESC: + MOV AL,"," + STOSB + MOV AL,[REGMEM] + AND AL,7 + JMP SAVREG + +INVARW: + CALL PUTAX + JMP SHORT INVAR + +INVARB: + CALL PUTAL +INVAR: + MOV AL,',' + STOSB + JMP PUTDX + +INFIXW: + CALL PUTAX + JMP SHORT INFIX + +INFIXB: + CALL PUTAL +INFIX: + MOV AL,',' + STOSB + JMP SAV8 + + STOSW ;IS THIS DEAD CODE? EMK + RET + +OUTVARB: + MOV BX,"LA" + JMP SHORT OUTVAR + +OUTVARW: + MOV BX,"XA" +OUTVAR: + CALL PUTDX +OUTFV: + MOV AL,',' + STOSB + MOV AX,BX + STOSW + RET + +OUTFIXB: + MOV BX,"LA" + JMP SHORT OUTFIX + +OUTFIXW: + MOV BX,"XA" +OUTFIX: + CALL SAV8 + JMP OUTFV + +PUTAL: + MOV AX,"A"+4C00H ; "AL" + JMP SHORT PUTX + +PUTAX: + MOV AX,"A"+5800H ; "AX" + JMP SHORT PUTX + +PUTDX: + MOV AX,"D"+5800H ; "DX" +PUTX: + STOSW + RET + +SHFT: + MOV BX,OFFSET DG:SHFTAB + CALL GETMNE +TESTREG: + CMP BYTE PTR [MODE],3 + JZ NOFLG + MOV SI,OFFSET DG:SIZE_TAB + MOV CL,3 + TEST BYTE PTR [AWORD],-1 + JNZ TEST_1 + INC CL +TEST_1: + CALL MOVBYT +NOFLG: + JMP ADDRMOD + +SHIFTV: + CALL SHFT + MOV AL,"," + STOSB + MOV WORD PTR [DI],"C"+4C00H ; "CL" + ADD DI,2 + RET + +SHIFT: + CALL SHFT + MOV AX,"1," + STOSW + RET + +GETMNE: + CALL GETMODE + MOV DL,AL + CBW + SHL AX,1 + ADD BX,AX + MOV AX,[BX] + MOV [OPCODE],AX + MOV AL,DL + RET + +GRP1: + MOV BX,OFFSET DG:GRP1TAB + CALL GETMNE + OR AL,AL + JZ FINIMMJ + JMP TESTREG +FINIMMJ: + JMP FINIMM + +GRP2: + MOV BX,OFFSET DG:GRP2TAB + CALL GETMNE + CMP AL,2 + JB TESTREG + CMP AL,6 + JAE INDIRECT + TEST AL,1 + JZ INDIRECT + MOV AX,"AF" ; "FAR" + STOSW + MOV AX," R" + STOSW +INDIRECT: + JMP ADDRMOD + +CODE ENDS + END UNASSEM + \ 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 @@ + PAGE 60,132 ; + TITLE DEBUG.SAL - DEBUGger for PC DOS + +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DEBUG.SAL +; +; DESCRIPTIVE NAME: DEBUGGING TOOL +; +; FUNCTION: PROVIDES USERS WITH A TOOL FOR DEBUGGING PROGRAMS. +; +; ENTRY POINT: START +; +; INPUT: DOS COMMAND LINE +; DEBUG COMMANDS +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: DEBCOM1 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBCOM2 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBCOM3 - CONTAINS ROUTINES CALLED BY DEBUG +; DEBASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBUASM - CONTAINS ROUTINES CALLED BY DEBUG +; DEBMES - CONTAINS MESSAGE RETRIEVER ROUTINES +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK DEBUG+DEBCOM1+DEBCOM2+DEBCOM3+DEBASM+DEBUASM+DEBERR+ +; DEBCONST+DEBDATA+DEBMES +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT DBCS HANDLING DMS:6/17/87 +; - IMPLEMENT DBCS HANDLING bgb:5/03/88 ;an001;bgb +; - IMPLEMENT MESSAGE RETRIEVER DMS:6/17/87 +; - > 32 MB SUPPORT DMS:6/17/87 +; +; COPYRIGHT: "MS DOS DEBUG UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +; MICROSOFT REVISION HISTORY: +; +; Modified 5/4/82 by AaronR to do all I/O direct to devices +; Runs on MS-DOS 1.28 and above +; +; REV 1.20 +; Tab expansion +; New device interface (1.29 and above) +; REV 2.0 +; line by line assembler added by C. P. +; REV 2.1 +; Uses EXEC system call +; REV 2.2 +; Ztrace mode by zibo. +; Fix dump display to indent properly +; Parity nonsense by zibo +; +; REV 2.3 NP +; Use Printf for all standard output. +; Change to EXE file +; REV 2.4 ARR +; Bug fixes. TEST, XCHG instructions reg order reversed. +; Single step, break point interrupts saved and restored. +; Access denied given on W to read only file. +;======================= END OF SPECIFICATIONS =========================== + + IF1 + %OUT COMPONENT=DEBUG, MODULE=DEBUG + ENDIF +.XLIST +.XCREF + INCLUDE DOSSYM.INC ; ALSO VERSION NUMBER +.CREF +.LIST + INCLUDE DEBEQU.ASM + IF SYSVER +; Structure for system call 72 +SYSINITVAR STRUC +DPBHEAD DD ? ; Pointer to head of DPB-FAT list +SFT_ADDR DD ? ; Pointer to first FCB table +; The following address points to the CLOCK device +BCLOCK DD ? +; The following address is used by DISKSTATCHK it is always +; points to the console input device header +BCON DD ? ; Console device entry points +MAXSEC DW 0 ; Maximum allowed sector size +BUFFHEAD DD ? +CDS DD ? +SFTFCB DD ? +KEEP DW ? +NUMIO DB 0 ; Number of disk tables +NCDS DB ? +DEVHEAD DD ? +SYSINITVAR ENDS + + ENDIF + + +;======================= macro equates =================================== + +dbcs_delim equ 81h ;an000;delimits dbcs char +asian_blk equ 40h ;an000;asian blank +amer_blk equ 20h ;an000;american blank +quote_char equ 22h ;an000;quote delim " + +;======================= end macro equates =============================== + + +;This segment must be the first loaded since we are using it to make +;a CREATE_PROCESS_DATA_BLOCK system call a la 1.0 and .COM files. +;For this system call CS must point to the Program Prefix Header, so +;by setting up a seperate segment just after the header we can issue +;an INT 21H via a long call. So don't move this guy around! + +A_CREATE_BLOCK SEGMENT + + PUBLIC CREATE_CALL + +;The other arguements to this system call have been set up +;by the caller. + +CREATE_CALL PROC FAR + MOV AH,CREATE_PROCESS_DATA_BLOCK + INT 21H + RET + +CREATE_CALL ENDP + +A_CREATE_BLOCK ENDS + + +CODE SEGMENT PUBLIC +CODE ENDS + +CONST SEGMENT PUBLIC +CONST ENDS + +CSTACK SEGMENT STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC +DATA ENDS + +DG GROUP CODE,CONST,CSTACK,DATA + +CONST SEGMENT PUBLIC BYTE + EXTRN BADVER:BYTE,ENDMES_PTR:BYTE,CRLF_PTR:BYTE + IF IBMJAPAN + EXTRN PARITYMES_PTR:BYTE + ENDIF + EXTRN PROMPT_PTR:BYTE,ADD_PTR:BYTE,HEX_PTR:BYTE + EXTRN USER_PROC_PDB:WORD,CSSAVE:WORD,DSSAVE:WORD + EXTRN SPSAVE:WORD,IPSAVE:WORD,LINEBUF:BYTE,QFLAG:BYTE + EXTRN NEWEXEC:BYTE,HEADSAVE:WORD,LBUFSIZ:BYTE,BACMES_PTR:WORD + + IF IBMVER + EXTRN DSIZ:BYTE,NOREGL:BYTE,DISPB:WORD + ENDIF + + IF SYSVER + EXTRN CONFCB:BYTE,POUT:DWORD,COUT:DWORD,CIN:DWORD,IOBUFF:BYTE + EXTRN IOADDR:DWORD,IOCALL:BYTE,IOCOM:BYTE,IOSTAT:WORD,IOCNT:WORD + EXTRN IOSEG:WORD,COLPOS:BYTE,BADDEV_PTR:BYTE,BADLSTMES_PTR:BYTE + EXTRN LBUFFCNT:BYTE,PFLAG:BYTE + ENDIF + + EXTRN NAMESPEC:BYTE + +CONST ENDS + +CSTACK SEGMENT STACK + DB (362 - 80H) + 80H DUP(?) ; (362 - 80H) == IBM'S ROM REQUIREMENTS + ; (NEW - OLD) == SIZE TO GROW STACK +CSTACK ENDS + +DATA SEGMENT PUBLIC BYTE + EXTRN ARG_BUF:BYTE,ADD_ARG:WORD,SUB_ARG:WORD,HEX_ARG1:WORD + EXTRN HEX_ARG2:WORD,STACK:BYTE, PREV24:DWORD, FIN24:BYTE + EXTRN PARSERR:BYTE,DATAEND:WORD,PARITYFLAG:BYTE,DISADD:BYTE + EXTRN ASMADD:BYTE,DEFDUMP:BYTE,BYTEBUF:BYTE,BEGSEG:WORD + EXTRN BPINTSAV:DWORD,SSINTSAV:DWORD ;ARR 2.4 + EXTRN CREATE_LONG:DWORD + + extrn lbtbl:dword ;an000;lead byte table pointer + +DATA ENDS + + EXTRN PRINTF:NEAR ;ac000;changed to NEAR call + +CODE SEGMENT PUBLIC + ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:CSTACK + + PUBLIC RESTART + PUBLIC STD_PRINTF,PRINTF_CRLF + PUBLIC HEX_ADDRESS_ONLY,HEX_ADDRESS_STR + PUBLIC RESTART,SET_TERMINATE_VECTOR,DABORT,TERMINATE,COMMAND + PUBLIC FIND_DEBUG,CRLF,BLANK,TAB,INBUF,SCANB,SCANP + PUBLIC HEX,OUTSI,OUTDI,DIGIT,BACKUP,RBUFIN + public test_lead ;an001;bgb + public test1 ;an001;bgb + + IF SYSVER +; PUBLIC SETUDEV,DEVIOCALL ; kwc 12/10/86 + PUBLIC SETUDEV ; kwc 12/10/86 + EXTRN DISPREG:NEAR,INPT:NEAR + ENDIF + + EXTRN PERR:NEAR,COMPARE:NEAR,DUMP:NEAR,ENTERDATA:NEAR,FILL:NEAR + EXTRN GO:NEAR,INPUT:NEAR,LOAD:NEAR,MOVE:NEAR,NAMED:NEAR + EXTRN REG:NEAR,SEARCH:NEAR,DWRITE:NEAR,UNASSEM:NEAR,ASSEM:NEAR + EXTRN OUTPUT:NEAR,ZTRACE:NEAR,TRACE:NEAR,GETHEX:NEAR,GETEOL:NEAR + EXTRN PREPNAME:NEAR,DEFIO:NEAR,SKIP_FILE:NEAR,DEBUG_FOUND:NEAR + EXTRN TRAPPARITY:NEAR,RELEASEPARITY:NEAR + extrn pre_load_message:near ;an000;load messages + extrn debems:near ;an000;ems support + + + DB 100H DUP (?) + +START: + JMP SHORT DSTRT + +HEADER DB "Vers 2.40" + +DSTRT: +;========================================================================= +; invoke PRE_LOAD_MESSAGE here. If the messages were not loaded we will +; exit with an appropriate error message. +; +; Date : 6/14/87 +;========================================================================= + + push ds ;an000;save regs + push es ;an000;save resg + + push cs ;an000;transfer cs + pop ds ;an000; to ds + + push cs ;an000;transfer cs + pop es ;an000; to es + assume ds:dg,es:dg ;an000;assume them + call PRE_LOAD_MESSAGE ;an000;invoke SYSLOADMSG +; $if c ;an000;if the load was unsuccessful + JNC $$IF1 + mov ax,(exit shl 8) ;an000;exit EDLIN. PRE_LOAD_MESSAGE + ; has already said why + int 21h ;an000;exit +; $endif ;an000; +$$IF1: + + pop es ;an000;restore regs. + pop ds ;an000; + assume ds:nothing,es:nothing ;an000;back to original + + MOV AX,(GET_INTERRUPT_VECTOR SHL 8) OR VEC_BREAKPOINT ;get original contents + INT 21H ; of the BREAKPOINT vector + + MOV WORD PTR [BPINTSAV],BX ; and save that vector for later + MOV WORD PTR [BPINTSAV+WORD],ES ; restoration + + MOV AX,(GET_INTERRUPT_VECTOR SHL 8) OR VEC_SING_STEP ;get original contents + INT 21H ; of the SINGLE STEP vector + + MOV WORD PTR [SSINTSAV],BX ; and save that vector for later + MOV WORD PTR [SSINTSAV+WORD],ES ; restoration + + MOV BEGSEG,DS ; save beginning DS + PUSH CS ; repair damaged ES to be + POP ES ; back to just like CS + XOR SI,SI ; set source and destination + XOR DI,DI ; indices both to zero + MOV CX,256 ; set count to size of PSP + REP MOVSB ; move to es:[di] from ds:[si] + PUSH CS ; set up DS to be just like CS + POP DS ; to match .COM rules of addressability + ASSUME DS:DG,ES:DG ; like CS, also have DS and DS as bases + + CALL TRAPPARITY ; scarf up those parity guys + MOV AH,GET_CURRENT_PDB ;(undocumented function call - 51h) + INT 21H + + MOV [USER_PROC_PDB],BX ; Initially set to DEBUG + + IF SYSVER + MOV [IOSEG],CS + ENDIF + + MOV [PARSERR],AL + + + IF SYSVER + MOV AH,GET_IN_VARS ;(undocumented function call - 52h) + INT 21H + + LDS SI,ES:[BX.BCON] ; get system console device + ASSUME DS:NOTHING + + MOV WORD PTR CS:[CIN+WORD],DS ;save vector to console input device + MOV WORD PTR CS:[CIN],SI + MOV WORD PTR CS:[COUT+WORD],DS ;save vector to console output device + MOV WORD PTR CS:[COUT],SI + PUSH CS ; restore DS to be + POP DS ; just like CS, as before + ASSUME DS:DG + + MOV DX,OFFSET DG:CONFCB ; get system printer device + MOV AH,FCB_OPEN ; open system printer "PRN" + INT 21H + + OR AL,AL ; open ok? + JZ GOTLIST ; yes, it was there + + MOV DX,OFFSET DG:BADLSTMES_ptr ; no list file found... + CALL STD_PRINTF ; tell user + + CALL RBUFIN ; ask for a new one + + CALL CRLF + + MOV CL,[LBUFFCNT] + OR CL,CL + JZ NOLIST1 ; User didn't specify one + + XOR CH,CH + MOV DI,OFFSET DG:(CONFCB + BYTE) + MOV SI,OFFSET DG:LINEBUF ; get one from input line + REP MOVSB + MOV DX,OFFSET DG:CONFCB + MOV AH,FCB_OPEN ; try to open it + INT 21H + + OR AL,AL + JZ GOTLIST ; yep, use it... + + MOV DX,OFFSET DG:BADDEV_Ptr ; complain again + CALL STD_PRINTF +NOLIST1: ; kwc 12/10/86 + MOV WORD PTR [POUT+WORD],CS ; use null device for printer + MOV WORD PTR [POUT],OFFSET DG:LONGRET + JMP NOLIST + +XXX PROC FAR +LONGRET: + RET +XXX ENDP + ENDIF + +GOTLIST: +;DX = OFFSET OF 'CONFCB', WHICH HAS JUST BEEN OPENED OK + IF SYSVER + MOV SI,DX +; LDS SI,DWORD PTR DS:[SI.FCB_FIRCLUS] ; KWC 12/10/86 + LDS SI,DWORD PTR DS:[SI.FCB_NSLD_DRVPTR] ; KWC 12/10/86 + ASSUME DS:NOTHING + + MOV WORD PTR CS:[POUT+WORD],DS + MOV WORD PTR CS:[POUT],SI + ENDIF +NOLIST: + MOV AX,CS ;restore the DS and ES segregs + MOV DS,AX ; to become once again just like CS + MOV ES,AX + ASSUME DS:DG,ES:DG + +; Code to print header +; MOV DX,OFFSET DG:HEADER_PTR +; CALL STD_PRINTF + + CALL SET_TERMINATE_VECTOR + +; Save the current INT 24 vector. We will need this to link to the previous +; handler for handling of int 24 output. + PUSH ES ; save it, about to clobber it... + MOV AX,(GET_INTERRUPT_VECTOR SHL 8) + VEC_CRIT_ERR ; get original contents + INT 21H ; of the int 24h vector + + MOV WORD PTR PREV24,BX ; remember what int 24h used to + MOV WORD PTR PREV24+WORD,ES ; point to + POP ES ; restore ES to be like CS and DS + + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) + VEC_CRIT_ERR ; change int 24h to + MOV DX,OFFSET DG:MY24 ; point to my own int 24h handler + INT 21H + + IF SETCNTC + MOV AL,VEC_CTRL_BREAK ; Set vector 23H + MOV DX,OFFSET DG:DABORT + INT 21H + ENDIF + + MOV DX,CS ;get para of where this pgm starts + MOV AX,OFFSET DG:DATAEND+15 ;get offset of end of this program + MOV CL,4 ; (plus 15 padding for rounding) + SHR AX,CL ; adjusted to number of paragraphs + ADD DX,AX ;get para of where this pgm ends + MOV AX,CS + SUB AX,BEGSEG ; add in size of printf + ADD DX,AX ; create program segment here + CALL [CREATE_LONG] ; and call special routine + + MOV AX,DX +; Initialize the segments + MOV DI,OFFSET DG:DSSAVE + CLD + STOSW + STOSW + STOSW + STOSW + MOV WORD PTR [DISADD+WORD],AX + MOV WORD PTR [ASMADD+WORD],AX + MOV WORD PTR [DEFDUMP+WORD],AX + + MOV AX,100H + MOV WORD PTR[DISADD],AX + MOV WORD PTR[ASMADD],AX + MOV WORD PTR [DEFDUMP],AX + + MOV DS,DX + MOV ES,DX + ASSUME DS:NOTHING,ES:NOTHING + + MOV DX,80H + MOV AH,SET_DMA + INT 21H ; Set default DMA address to 80H +; Set up initial stack. We already have a 'good' stack set up already. DS:6 +; has the number of bytes remaining in the segment. We should take this +; value, add 100h and use it as the Stack pointer. + MOV AX,WORD PTR DS:[6] ; get bytes remaining + MOV BX,AX + ADD AX,100h + +; MOV BX,AX +; CMP AX,0FFF0H +; PUSH CS +; POP DS +; JAE SAVSTK +; MOV AX,WORD PTR DS:[6] +; PUSH BX +; MOV BX,OFFSET DG:DATAEND + 15 +; AND BX,0FFF0H ; Size of DEBUG in bytes (rounded up to PARA) +; SUB AX,BX +; POP BX +;SAVSTK: + PUSH CS + POP DS + ASSUME DS:DG + PUSH BX ; bx is no. bytes remaining from PSP+6 + DEC AX ; ax was no. bytes remaining +100h + DEC AX ; back up one word from end of new stack + MOV BX,AX ; set base to point to last word in new stack + MOV WORD PTR ES:[BX],0 ; set final word in new stack to zero + POP BX ; back to beginning of new stack area + MOV SPSAVE,AX ; remember where new stack is + DEC AH + MOV ES:WORD PTR [6],AX ; change PSP to show usage of + SUB BX,AX ; new stack area + MOV CL,4 + SHR BX,CL + ADD ES:WORD PTR [8],BX + + IF IBMVER +; Get screen size and initialize display related variables + MOV AH,15 ;function = "request current video state" + INT 10H ;set al=screen mode + ; ah=no. char cols on screen + ; bh=current active display page + CMP AH,40 ;is screen in 40 col mode? + JNZ PARSCHK ; no, skip + ; yes, 40 col, continue + ;next fields defined in 'debconst.asm' + MOV BYTE PTR DSIZ,7 ; originally assembled as 0fh + MOV BYTE PTR NOREGL,4 ; originally assembled as 8 + MOV DISPB,64 ; originally assembled as 128 + ENDIF + +PARSCHK: + + + call DEBUG_LEAD_BYTE ;an000;build the dbcs env. table + ; of valid dbcs lead bytes + +;========================================================================= +; prep_command_line requires the use of ds:si. ds is left intact for +; the call. si is initialized to point to the command line input buffer. +; ds and si are saved since we stomp all over them in prep_command_line. +;========================================================================= + + push si ;an000;save si + + mov si,81h ;an000;point to command line + call prep_command_line ;an000;invoke command line conversion + + pop si ;an000;restore si + +;========================================================================= +; we have prepped the command line for dbcs. we can now enter the old +; routines. +;========================================================================= + +; Copy rest of command line to test program's parameter area + MOV DI,FCB ;es[di]=to be filled with unopened FCB + MOV SI,81H ;ds[si]=command line to parse + MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION + ;func=29H, option al=1, which + ; says, drive id byte in fcb is set + ; only if drive specified in command + ; line being parsed. + INT 21H ;parse filename from command to fcb + ; ds:si=points to first char AFTER parsed filename + ; es:di=points to first byte of formatted FCB + + CALL SKIP_FILE ; Make sure si points to delimiter +test1: ;for testing only - u can remove this + CALL PREPNAME + + PUSH CS ;restore ES to point to the + POP ES ; common group +FILECHK: + MOV DI,80H ;point to byte in PSP defining parm length + CMP BYTE PTR ES:[DI],0 ; ANY STUFF FOUND? + JZ COMMAND ; no parms, skip + ; yes parms, continue +FILOOP: + INC DI ;set index to first/next char in parm text + CMP BYTE PTR ES:[DI],CR ; carriage return? (at end of parms) + JZ COMMAND ; yes, at end of parms + ; no, not at end of parms yet, continue + CMP BYTE PTR ES:[DI],CHAR_BLANK ; is this parm text char a blank? + JZ FILOOP ; yes, a blank, skip + ; no, not a blank, continue + CMP BYTE PTR ES:[DI],CHAR_TAB ; is this parm text char a tab? + JZ FILOOP ; yes, a tab, skip + ; no, not a tab, continue + OR [NAMESPEC],1 ; set flag to indicate + ; we have a specified file + ; (this could be set by "N" command also) + CALL DEFIO ; READ in the specified file + + PUSH CS ;restore DS to point to the + POP DS ; common group + + ;perform self-relocation on some internal vectors: + MOV AX,CSSAVE ; pick up the seg id to go to vectors + MOV WORD PTR DISADD+WORD,AX ; shove it into the segid portion + MOV WORD PTR ASMADD+WORD,AX ; of these two vectors + MOV AX,IPSAVE ; pick up the offset to go to vectors + MOV WORD PTR DISADD,AX ; shove it into the offset portion + MOV WORD PTR ASMADD,AX ; of these two vectors +COMMAND: + CLD + MOV AX,CS + MOV DS,AX + MOV ES,AX + cli ;disable before setting up the stack - EMK + MOV SS,AX ;now everything points to the same group + ASSUME SS:DG + + MOV SP,OFFSET DG:STACK + STI ;re-enable + CMP [PARITYFLAG],0 ; did we detect a parity error? + JZ GOPROMPT ; no, go prompt + ; yes, parity error, continue + MOV [PARITYFLAG],0 ; reset flag + IF IBMJAPAN + MOV DX,OFFSET DG:PARITYMES_PTR + CALL STD_PRINTF ;display msg about parity error + ENDIF +GOPROMPT: + MOV DX,OFFSET DG:PROMPT_PTR ;display the user prompt request + CALL STD_PRINTF + + CALL INBUF ; Get command line +; From now and throughout command line processing, DI points +; to next character in command line to be processed. + CALL SCANB ; Scan off leading blanks + + JZ COMMAND ; if zero, Null command, go get another + ; nonzero, got something in response + LODSB ; AL=first non-blank character +; Prepare command letter for table lookup +; converts the first non-blank (assumed to be the command letter) +; to in index in the "comtab" array. + SUB AL,UPPER_A ; Low end range check + JB ERR1 + + CMP AL,UPPER_Z - UPPER_A ; Upper end range check + JA ERR1 + + SHL AL,1 ; Times two + CBW ; Now a 16-bit quantity + XCHG BX,AX ; In BX we can address with it + CALL CS:[BX+COMTAB] ; Execute command + + JMP SHORT COMMAND ; Get next command +ERR1: + JMP PERR + +SET_TERMINATE_VECTOR: + PUSH DS + PUSH CS + POP DS + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_TERM_ADDR ; Set vector 22H + MOV DX,OFFSET DG:TERMINATE + INT 21H + + POP DS + RET + +RESTORE_DEB_VECT: + PUSH DS + PUSH DX + PUSH AX + LDS DX,CS:[BPINTSAV] + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_BREAKPOINT ;Vector 3 + INT 21H + + LDS DX,CS:[SSINTSAV] + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR VEC_SING_STEP ;Vector 1 + INT 21H + + POP AX + POP DX + POP DS + RET + +; Internal INT 24 handler. We allow our parent's handler to decide what to do +; and how to prompt. When our parent returns, we note the return in AL. If +; he said ABORT, we need to see if we are aborting ourselves. If so, we +; cannot turn it into fail; we may get a cascade of errors due to the original +; cause. Instead, we do the ol' disk-reset hack to clean up. This involves +; issuing a disk-reset, ignoring all errors, and then returning to the caller. +MY24: + ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING + +; If we are already inside an INT 24, just ignore this error + TEST FIN24,-1 + JZ DO24 + + MOV AL,0 ; signal ignore + IRET + +; Let the user decide what to do +DO24: + PUSHF + CALL PREV24 ; simulate INT 24 to him + + CMP AL,2 ; was it ABORT? + JNZ DOIRET ; no, let it happen + + PUSH AX + PUSH BX + MOV AH,GET_CURRENT_PDB ; find out who's terminating + INT 21H + + CMP BX,BEGSEG ; is it us? + POP BX + POP AX + JZ DORESET ; no, let it happen + +DOIRET: + IRET + +; We have been instructed to abort ourselves. Since we can't do this, we will +; perform a disk reset to flush out all buffers and then ignore the errors we +; get. +DORESET: + MOV FIN24,-1 ; signal that we ignore errors + MOV AH,DISK_RESET + INT 21H ; clean out cache + + MOV FIN24,0 ; reset flag + JMP COMMAND + +TERMINATE: + ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING + + CMP QFLAG,0 + JNZ QUITING + + MOV AX,BEGSEG + MOV USER_PROC_PDB,AX + CMP NEWEXEC,0 + JZ NORMTERM + + MOV AX,CS + MOV DS,AX + ASSUME DS:DG + ;is CLI/STI needed here ? - emk + CLI + MOV SS,AX + ASSUME SS:DG + + MOV SP,OFFSET DG:STACK + STI + MOV AX,HEADSAVE + JMP DEBUG_FOUND + +NORMTERM: + ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING + + PUSH CS + POP DS + ASSUME DS:DG + + MOV DX,OFFSET DG:ENDMES_PTR + JMP SHORT RESTART + +QUITING: + ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING + + CALL RESTORE_DEB_VECT + + MOV AX,(EXIT SHL 8) + INT 21H + +RESTART: + CALL STD_PRINTF +DABORT: + MOV AX,CS + MOV DS,AX + ASSUME DS:DG + + ;is CLI\STI needed here? - emk + CLI + MOV SS,AX + ASSUME SS:DG + + MOV SP,OFFSET DG:STACK + STI +;;;;;; CALL CRLF + + JMP COMMAND + + IF SYSVER +SETUDEV: + MOV DI,OFFSET DG:CONFCB + MOV AX,(PARSE_FILE_DESCRIPTOR SHL 8) OR SET_DRIVEID_OPTION + INT 21H + + CALL USERDEV + + JMP DISPREG + +USERDEV: + MOV DX,OFFSET DG:CONFCB + MOV AH,FCB_OPEN + INT 21H + + OR AL,AL + JNZ OPENERR + + MOV SI,DX +; TEST BYTE PTR [SI.FCB_DEVID],080H ; Device? ; KWC 12/10/86 +; JZ OPENERR ; NO ; KWC 12/10/86 + MOV AL,BYTE PTR [SI.FCB_NSL_DRIVE] ; KWC 12/10/86 + AND AL,NOT FCBMASK ; KWC 12/10/86 + CMP AL,0C0H ; KWC 12/10/86 + JNE OPENERR ; KWC 12/10/86 + XOR AL,AL ; KWC 12/10/86 + +; LDS SI,DWORD PTR [CONFCB.FCB_FIRCLUS] ; KWC 12/10/86 + LDS SI,DWORD PTR [CONFCB.FCB_NSLD_DRVPTR] ; KWC 12/10/86 + MOV WORD PTR CS:[CIN],SI + MOV WORD PTR CS:[CIN+WORD],DS + + MOV WORD PTR CS:[COUT],SI + MOV WORD PTR CS:[COUT+WORD],DS + PUSH CS + POP DS + RET + +OPENERR: + MOV DX,OFFSET DG:BADDEV_PTR + CALL STD_PRINTF + + RET + ENDIF +; Get input line. Convert all characters NOT in quotes to upper case. +INBUF: + CALL RBUFIN + +;========================================================================= +; prep_command_line requires the use of ds:si. ds is left intact for +; the call. si is initialized to point to the command line input buffer. +; ds and si are saved since we stomp all over them in prep_command_line. +;========================================================================= + + push si ;an000;save si + + mov si,offset dg:linebuf ;an000;point to command line + call prep_command_line ;an000;invoke command line conversion + + pop si ;an000;restore si + +;========================================================================= +; we have prepped the command line for dbcs. we can now enter the old +; routines. +;========================================================================= + + MOV SI,OFFSET DG:LINEBUF + MOV DI,OFFSET DG:BYTEBUF + +CASECHK: + + LODSB + + call Test_Lead ;DBCS lead byte ;an000; dms; +; $if c ;yes - ignore 2nd. byte ;an000; dms; + JNC $$IF3 + stosb ;save the byte ;an000; dms; + lodsb ;pick up the 2nd. character ;an000; dms; + stosb ;save it also ;an000; dms; + jmp CaseChk ;read next character ;an000; dms; +; $endif ; ;an000; dms; +$$IF3: + + CMP AL,LOWER_A + JB NOCONV + + CMP AL,LOWER_Z + JA NOCONV + + ADD AL,UPPER_A - LOWER_A ; Convert to upper case +NOCONV: + STOSB + CMP AL,CR + JZ INDONE + + CMP AL,DOUBLE_QUOTE + JZ QUOTSCAN + + CMP AL,SINGLE_QUOTE + JNZ CASECHK + +QUOTSCAN: + MOV AH,AL +KILLSTR: + LODSB + STOSB + CMP AL,CR ;CARRIAGE RETURN? + JZ INDONE + + CMP AL,AH + JNZ KILLSTR + + JMP SHORT CASECHK + +INDONE: + MOV SI,OFFSET DG:BYTEBUF + CALL CRLF + + RET + +; Physical backspace - blank, backspace, blank +BACKUP: + PUSH DX + MOV DX,OFFSET DG:BACMES_PTR + CALL STD_PRINTF + + POP DX + RET + +; Scan for parameters of a command +SCANP: + CALL SCANB ; Get first non-blank + + CMP BYTE PTR [SI],CHAR_COMMA ; One comma between params OK + JNE EOLCHK ; If not comma, we found param + + INC SI ; Skip over comma +; Scan command line for next non-blank character +SCANB: + PUSH AX +SCANNEXT: + LODSB + CMP AL,CHAR_BLANK ;is this char a "blank"? + JZ SCANNEXT + + CMP AL,CHAR_TAB ;is this char a "tab"? + JZ SCANNEXT + + DEC SI ; Back to first non-blank + POP AX +EOLCHK: + CMP BYTE PTR [SI],CR ;CARRIAGE RETURN + RET + +; Hex addition and subtraction +HEXADD: + MOV CX,4 + CALL GETHEX + + MOV DI,DX + MOV CX,4 + CALL GETHEX + + CALL GETEOL + + PUSH DX + ADD DX,DI + MOV [ADD_ARG],DX + POP DX + SUB DI,DX + MOV [SUB_ARG],DI + MOV DX,OFFSET DG:ADD_PTR + CALL PRINTF_CRLF + + RET + +; Put the hex address in DS:SI in the argument list for a call to printf +OUTSI: + MOV CS:[HEX_ARG1],DS + MOV CS:[HEX_ARG2],SI + RET + +;Put the hex address in ES:DI in the argument list for a call to printf +OUTDI: + MOV [HEX_ARG1],ES + MOV [HEX_ARG2],DI + RET + +HEX_ADDRESS_ONLY: + MOV BYTE PTR [ARG_BUF],0 +HEX_ADDRESS_STR: + MOV DX,OFFSET DG:HEX_PTR +STD_PRINTF: + PUSH DX + CALL PRINTF + POP DX ;ac000;restore dx + + RET + +PRINTF_CRLF: + PUSH DX + CALL PRINTF + POP DX ;ac000;restore dx +CRLF: + MOV DX,OFFSET DG:CRLF_PTR + PUSH DX + CALL PRINTF + POP DX ;ac000;restore dx + + RET + +HEX: + MOV AH,AL ; Save for second digit + PUSH CX + MOV CL,4 + SHR AL,CL + POP CX + + CALL DIGIT ; First digit + + MOV AL,AH ; Now do digit saved in AH +DIGIT: + AND AL,0FH ; Mask to 4 bits + ADD AL,90H + DAA + ADC AL,40H + DAA + AND AL,7FH + STOSB + RET + +RBUFIN: + PUSH AX + PUSH DX + MOV AH,STD_CON_STRING_INPUT + MOV DX,OFFSET DG:LBUFSIZ + INT 21H + + POP DX + POP AX + RET + +; Put one space in the printf output uffer +BLANK: + MOV AL,CHAR_BLANK + STOSB + RET + +; Put CX spaces in the printf output buffer +TAB: + JCXZ TAB_RET + + CALL BLANK + + LOOP TAB +TAB_RET: + RET + +; Command Table. Command letter indexes into table to get +; address of command. PERR prints error for no such command. + +COMTAB DW ASSEM ; A + DW PERR ; B + DW COMPARE ; C + DW DUMP ; D + DW ENTERDATA ; E + DW FILL ; F + DW GO ; G + DW HEXADD ; H + DW INPUT ; I + DW PERR ; J + DW PERR ; K + DW LOAD ; L + DW MOVE ; M + DW NAMED ; N + DW OUTPUT ; O + DW ZTRACE ; P + DW QUIT ; Q (QUIT) + DW REG ; R + DW SEARCH ; S + DW TRACE ; T + DW UNASSEM ; U + DW PERR ; V + DW DWRITE ; W + IF SYSVER + DW SETUDEV ; X + ELSE + DW DEBEMS + ENDIF + DW PERR ; Y + DW PERR ; Z + +QUIT: + INC BYTE PTR [QFLAG] + MOV BX,[USER_PROC_PDB] +FIND_DEBUG: + IF NOT SYSVER + MOV AH,SET_CURRENT_PDB + INT 21H + ENDIF + CALL RELEASEPARITY ; let system do normal parity stuff + + CALL RESTORE_DEB_VECT + + MOV AX,(EXIT SHL 8) + INT 21H + +;======================= proc prep_command_line ========================= +; prep_command_line: This proc converts a Asian DBCS space delimiter (8140h) +; into 2 20h values. In this way we can pass command +; lines throughout DEBUG without major modification +; to the source code. This proc is invoked anywhere +; a command line is initially accessed. In the case +; of DEBUG it is used in PARSCHK and INBUF. +; Any quoted string, a string delimited by ("), will +; be ignored. +; +; input: ds - segment of command line +; si - offset of command line +; +; output: command line with Asian blanks (8140h) converted to +; 2020h. +; +;========================================================================= + +prep_command_line proc near ;command line conversion + push ax ;save affected regs. + push bx ; + push si ; + + mov bl,00h ;initialize flag + ;bl is used to signal + ; a quote delimiter +; $DO ;do while not CR +$$DO5: + mov al,[si] ;move char from cmd line for compare + cmp al,CR ;is it a CR ? +; $LEAVE E ;if CR exit + JE $$EN5 + + cmp al,quote_char ;is it a quote ? +; $IF Z ;if it is a quote + JNZ $$IF7 + xor bl,01h ;set or reset the flag +; $ENDIF +$$IF7: + + cmp bl,01h ;is 1st quote set ? +; $IF NZ ;if not continue + JZ $$IF9 + call TEST_LEAD ;test for dbcs lead byte +; $IF C ;we have a lead byte + JNC $$IF10 + cmp al,dbcs_delim ;is it a dbcs char? 81h +; $IF Z ;if a dbcs char + JNZ $$IF11 + mov al,[si+1] ;move next char al + cmp al,asian_blk ;is it an Asian blank? 40h +; $IF Z ;if an Asian blank + JNZ $$IF12 + mov al,amer_blk ;set up moves + mov [si],al ; to replace + mov [si+1],al ; Asian blank w/20h + inc si ;point to si+1 +; $ELSE ;if not an asian blank + JMP SHORT $$EN12 +$$IF12: + inc si ;point to dbcs char +; $ENDIF ; +$$EN12: +; $ENDIF ; +$$IF11: +; $ENDIF ;end lead byte test +$$IF10: +; $ENDIF ; +$$IF9: + inc si ;point to si+1 +; $ENDDO ;end do while + JMP SHORT $$DO5 +$$EN5: + pop si ;restore affected regs. + pop bx ; + pop ax ; + ret ;return to caller +prep_command_line endp ;end proc + + +;========================================================================= +; DEBUG_LEAD_BYTE - This routine sets the lead-byte-pointers to point +; to the dbcs environmental vector table of lead bytes. +; This table will be used to determine if we have a +; dbcs lead byte. +; +; Inputs - none +; +; Outputs- pointer to dbcs environmental vector table of lead bytes +; LBTBL DD ? +; +; Date : 6/16/87 +;========================================================================= + +DEBUG_LEAD_BYTE proc near ;an000;get lead byte vector + + push ds ;an000;save affected regs + push es ;an000; + push si ;an000; + + mov ax,(ECS_call shl 8) or 00h ;an000;get dbcs env. vector + int 21h ;an000;invoke function + + assume ds:nothing + + mov word ptr cs:lbtbl[0],si ;an000;move offset of table + mov word ptr cs:lbtbl[2],ds ;an000;move segment of table + + pop si ;an000;restore affected regs + pop es ;an000; + pop ds ;an000; + + ret ;an000;return to caller + +DEBUG_LEAD_BYTE endp ;an000;end proc + +;========================================================================= +; TEST_LEAD - This routine will determine whether or not we have a valid +; lead byte for a DBCS character. +; +; Inputs : AL - Holds the byte to compare. Passed by POP. ;an001;bgb +; +; Outputs: Carry set if lead byte +; No carry if not lead byte +; +; Date : 6/16/87 +;========================================================================= + +TEST_LEAD proc near ;an000;check for dbcs lead byte + + push ds ;an000;save affected regs + push si ;an000; + push ax ;an000; + + xchg ah,al ;an000;ah used for compare + mov si,word ptr cs:lbtbl[2] ;an000;get segment of table + mov ds,si ;an000; + mov si,word ptr cs:lbtbl[0] ;an000;get offset of table + +ck_next: + + lodsb ;an000;load al with byte table + or al,al ;an000;end of table? +; $IF z ;an000;yes, end of table + JNZ $$IF19 + jmp lead_exit ;an000;exit with clear carry +; $ELSE ;an000; + JMP SHORT $$EN19 +$$IF19: + cmp al,ah ;an000;start > character? +; $IF a ;an000;it is above + JNA $$IF21 + clc ;an000;clear carry flag + jmp lead_exit ;an000;exit with clear carry +; $ELSE ;an000; + JMP SHORT $$EN21 +$$IF21: + lodsb ;an000;load al with byte table + cmp ah,al ;an000;character > end range +; $IF a ;an000;not a lead + JNA $$IF23 + jmp ck_next ;an000;check next range +; $ELSE ;an000;lead byte found + JMP SHORT $$EN23 +$$IF23: + stc ;an000;set carry flag +; $ENDIF ;an000; +$$EN23: +; $ENDIF ;an000; +$$EN21: +; $ENDIF ;an000; +$$EN19: + +lead_exit: ;an000;exit from check + + pop ax ;an000; + pop si ;an000;restore affected regs. + pop ds ;an000; + + ret ;an000;return to caller + +TEST_LEAD endp ;an000;end proc + + + +CODE ENDS + END START + \ 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 @@ +DEBUG+ +DEBCOM1+ +DEBCOM2+ +DEBCOM3+ +DEBASM+ +DEBUASM+ +DEBERR+ +DEBCONST+ +DEBMES+ +DEBEMS+ +DEBDATA +DEBUG.EXE; + \ 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 @@ +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: DEBMES.FIL +; +; DESCRIPTIVE NAME: MESSAGES USED BY DEBUG +; +; FUNCTION: PROVIDES FASTBLD.EXE THE MESSAGES THAT ARE TO BE USED BY DEBUG. +; +; ENTRY POINT: NA +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: NA +; +; EXTERNAL REFERENCES: NA +; +; NOTES: THIS MODULE IS TO BE PREPPED BY FASTBLD.EXE. +; +; FASTBLD.EXE CREATES: DEBUG.CLA +; DEBUG.CLB +; DEBUG.CLC +; DEBUG.CLD +; DEBUG.CL1 +; DEBUG.CL2 +; +; REVISION HISTORY: NA +; +; +; COPYRIGHT: "THE IBM PERSONAL COMPUTER EDLIN UTILITY" +; "VERSION 3.40 (C) COPYRIGHT IBM CORP 1987" +; "LICENSED MATERIAL - PROGRAM PROPERTY OF IBM" +; +; PROGRAM AUTHOR: DS +; +;======================= END OF SPECIFICATIONS =========================== + +;========================================================================= +;debug utility message file +;========================================================================= + +:util DEBUG ;utility name + +:class 1 ;extended errors + +:class A ;system messages +:use 1 COMMON1 ;"Incorrect DOS version" +:use 2 COMMON2 ;"Insufficient memory" +:use 3 COMMON3 ;"Error loading messages" +:def 4 "Allocation failed or specified buffer too small",CR,LF + ;:def 5 "Bad or missing Msg info",CR,LF + +:class B ;utility messages +:def 6 "Bad device name" ;baddev_ptr +:def 7 "Couldn't open list device PRN",CR,LF +"Enter name of list device? " ;badlstmes_ptr +:def 8 CR,LF ;crlf_ptr +:def 9 CR,LF,"Program terminated normally",CR,LF ;endmes_ptr +:def 10 "Invalid drive specification",CR,LF ;nambad_ptr +:def 12 "File creation error",CR,LF ;noroom_ptr +:def 13 "Insufficient space on disk",CR,LF ;nospace_ptr +:def 14 "Disk error reading drive %1",CR,LF ;dr1_ptr +:def 15 "Disk error writing drive %1",CR,LF ;dr2_ptr +:def 16 "Write protect error reading drive %1",CR,LF ;dr3_ptr +:def 17 "Write protect error writing drive %1",CR,LF ;dr4_ptr +:def 19 "%1^ Error" ;synerr +:def 20 "Error in EXE or HEX file",CR,LF ;exebad_ptr/hexerr_ptr + +:class C +:def 21 "EXE and HEX files cannot be written",CR,LF ;exewrt_ptr/hexwrt_ptr +:def 22 "EXEC failure" ;execemes_ptr +:def 23 "(W)rite error, no destination defined",CR,LF ;nonamespec_ptr +:def 24 "Access denied",CR,LF ;accmes_ptr +:def 25 "Parity error or nonexistant memory error detected" ;paritymes_ptr +:def 26 "-" ;prompt_ptr +:def 27 "%1 -" ;change_flag_ptr +:def 32 "%1%2" ;unassem_ln_ptr +:def 33 "%1:%2 %3" ;hex_ptr +:def 34 "%1 %2" ;add_ptr +:def 35 "%1 %2",CR,LF,":" ;single_reg_ptr +:def 36 "%1=%2 " ;register_ptr +:def 37 "%1 Error" ;errmes_ptr +:def 38 "Writing %1 bytes" ;wrtmes_ptr +:def 39 "%1:%2=" ;loc_ptr +:def 40 "%1" ;little_ptr + +:class D +:def 41 "%1" ;big_ptr +:def 42 "%1:%2 %3 %4 %5:%6" ;comp_ptr +:def 44 32,8 ;bacmes_ptr + ; :def 45 "Unable to allocate message handler",CR,LF + ;fatal_error +:def 46 "%1" ;arg_buf_ptr +:def 47 "%1" ;one_char_buf_ptr + +:def 50 "%1 of a total %2 EMS pages have been allocated",cr,lf +:def 51 "%1 of a total %2 EMS handles have been allocated",cr,lf +:def 55 "Handle created = %1 ",cr,lf +:def 56 "Logical page %1 mapped to physical page %2 ",cr,lf +:def 57 "EMS hardward/software failure",cr,lf +:def 58 "Handle not found",cr,lf +:def 59 "Invalid function code",cr,lf +:def 60 "No free handles",cr,lf +:def 61 "Save/Restore error",cr,lf +:def 62 "Total pages exceeded",cr,lf +:def 63 "Free pages exceeded",cr,lf +:def 64 "Parameter error",cr,lf +:def 65 "Logical Page out of range",cr,lf +:def 66 "Physical Page out of range",cr,lf +:def 67 "Save area already in use",cr,lf +:def 68 "Save area not in use",cr,lf +:def 70 "General EMS error",cr,lf +:def 71 "Missing or invalid EMS parameter",cr,lf +:def 72 "Handle %1 has %2 pages allocated",cr,lf +:def 75 "Physical page %1 = Frame segment %2",cr,lf +:def 76 "Handle %1 deallocated",cr,lf +:def 78 "EMS not installed",cr,lf + +:end + +;========================================================================= +;========================================================================= 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 @@ +#************************** makefile for cmd\append *************************** + +msg =..\..\messages +dos =..\..\dos +inc =..\..\inc +hinc =..\..\h + +# +####################### dependencies begin here. ######################### +# + +all: debug.com + +debug.ctl: debug.skl \ + $(msg)\$(COUNTRY).msg \ + makefile + +debug.obj: debug.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debcom1.obj: debcom1.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debcom2.obj: debcom2.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debcom3.obj: debcom3.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debasm.obj: debasm.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debuasm.obj: debuasm.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +deberr.obj: deberr.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debconst.obj: debconst.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debdata.obj: debdata.asm $(inc)\dossym.inc $(inc)\dosmac.inc \ + $(inc)\bpb.inc $(inc)\buffer.inc $(inc)\sysvar.inc \ + $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ + $(inc)\curdir.inc $(inc)\cpmfcb.inc $(inc)\find.inc \ + $(inc)\pdb.inc $(inc)\sf.inc \ + $(inc)\arena.inc $(inc)\intnat.inc \ + $(inc)\error.inc $(inc)\syscall.inc debequ.asm makefile + +debems.obj: debems.asm debequ.asm makefile + +debmes.obj: debmes.asm $(inc)\msgserv.asm $(inc)\sysmsg.inc \ + debug.ctl \ + debug.cla \ + debug.clb \ + debug.clc \ + debug.cld \ + debug.cl1 \ + debug.cl2 \ + makefile + +debug.com: debug.obj debcom1.obj debcom2.obj debcom3.obj debems.obj \ + debasm.obj debuasm.obj deberr.obj debconst.obj debdata.obj \ + debmes.obj debug.lnk makefile + link @debug.lnk + convert debug.exe + 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 @@ + + + IF1 + %OUT Including ..SYSVER.FAL.. + ENDIF + +SYSVER EQU FALSE ; if true, i/o direct to bios + ; so DOS can be debugged + + \ 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 @@ + + + IF1 + %OUT Including ..SYSVER.FAL.. + ENDIF + +SYSVER EQU FALSE ; if true, i/o direct to bios + ; so DOS can be debugged + + \ 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 @@ + + + IF1 + %OUT Including ..SYSVER.TRU.. + ENDIF + +SYSVER EQU TRUE ; if true, i/o direct to bios + ; so DOS can be debugged + + \ No newline at end of file -- cgit v1.2.3