# This is the annotated output of the corresponding DEBUG script file. # It shows how to enter small assembler programs into DEBUG and run them. # -IAN! idallen@ncf.ca # # This output file was created by running DEBUG with standard input # redirected to come from the script file: # # C:> debug debug_script_out.txt # # Comments have been edited into the output, prefixed by the "#" character. # Display memory and show that it's full of junk. -d 0100 1426:0100 57 0F 26 89 47 0D 8B 56-F4 8B 46 F2 26 89 57 13 W.&.G..V..F.&.W. 1426:0110 26 89 47 11 EB 4A C4 5E-FC 26 80 7F 34 00 15 14 &.G..J.^.&..4... 1426:0120 26 80 7F 08 04 75 39 8B-56 FE 8B 46 FC 05 19 00 &....u9.V..F.... 1426:0130 52 50 FF 36 15 4A FF 36-13 4A 8B 16 66 4A A1 64 RP.6.J.6.J..fJ.d 1426:0140 4A 05 1D 00 52 50 8B 16-AE 4B A1 AC 4B 05 08 00 J...RP...K..K... 1426:0150 52 50 B8 FA 21 50 B8 04-00 50 E8 DC CF 83 C4 14 RP..!P...P...... 1426:0160 A1 E2 4A 3B 06 CA 4B 74-03 E9 93 FD E8 46 1B B8 ..J;..Kt.....F.. 1426:0170 01 00 5E 8B E5 5D C3 55-8B EC 83 EC 02 8B 1E 11 ..^..].U........ # Fill memory starting at 0100h for a length of 1000h with "FF" bytes. -f 0100 l 1000 ff -d 0100 1426:0100 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0110 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0120 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0130 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0140 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0150 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0160 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 1426:0170 FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ # Fill memory starting at 0100h for a length of 1000h with "00" bytes. -f 0100 l 1000 00 -d 0100 1426:0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # Start assembing instructions line by line, starting at location 0100h -a 0100 1426:0100 mov ax,1234 1426:0103 mov bx,0130 1426:0106 mov [bx],ax 1426:0108 add bx,2 1426:010B mov [bx],ax 1426:010D add bx,4 1426:0110 mov [bx],ax 1426:0112 add bx,a 1426:0115 mov [bx],ax 1426:0117 mov AH,4c 1426:0119 int 21h 1426:011B # Note the blank line that stops the assembly. # Display the assembled bytes in memory: -d 0100 1426:0100 B8 34 12 BB 30 01 89 07-83 C3 02 89 07 83 C3 04 .4..0........... 1426:0110 89 07 83 C3 0A 89 07 B4-4C CD 21 00 00 00 00 00 ........L.!..... 1426:0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # Use the "Unassemble" command to show the bytes as instructions: -u 0100 0119 1426:0100 B83412 MOV AX,1234 1426:0103 BB3001 MOV BX,0130 1426:0106 8907 MOV [BX],AX 1426:0108 83C302 ADD BX,+02 1426:010B 8907 MOV [BX],AX 1426:010D 83C304 ADD BX,+04 1426:0110 8907 MOV [BX],AX 1426:0112 83C30A ADD BX,+0A 1426:0115 8907 MOV [BX],AX 1426:0117 B44C MOV AH,4C 1426:0119 CD21 INT 21 # Show our registers. Note the IP and the next instruction to be executed: -r AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0100 NV UP EI PL NZ NA PO NC 1426:0100 B83412 MOV AX,1234 # From here on, execute single instructions using the "Trace" command. # Trace automatically prints the registers after the execution # and it shows the next instruction ready to be executed: -t AX=1234 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0103 NV UP EI PL NZ NA PO NC 1426:0103 BB3001 MOV BX,0130 -t AX=1234 BX=0130 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0106 NV UP EI PL NZ NA PO NC 1426:0106 8907 MOV [BX],AX DS:0130=0000 -t AX=1234 BX=0130 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0108 NV UP EI PL NZ NA PO NC 1426:0108 83C302 ADD BX,+02 -t AX=1234 BX=0132 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=010B NV UP EI PL NZ NA PO NC 1426:010B 8907 MOV [BX],AX DS:0132=0000 -t AX=1234 BX=0132 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=010D NV UP EI PL NZ NA PO NC 1426:010D 83C304 ADD BX,+04 -t AX=1234 BX=0136 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0110 NV UP EI PL NZ NA PE NC 1426:0110 8907 MOV [BX],AX DS:0136=0000 -t AX=1234 BX=0136 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0112 NV UP EI PL NZ NA PE NC 1426:0112 83C30A ADD BX,+0A -t AX=1234 BX=0140 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0115 NV UP EI PL NZ AC PO NC 1426:0115 8907 MOV [BX],AX DS:0140=0000 -t AX=1234 BX=0140 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1426 ES=1426 SS=1426 CS=1426 IP=0117 NV UP EI PL NZ AC PO NC 1426:0117 B44C MOV AH,4C # We've reached the last instruction. Display the contents of memory, # showing the "1234" values stored at locations 0130, 0132, 0136, 0140: -d 0100 1426:0100 B8 34 12 BB 30 01 89 07-83 C3 02 89 07 83 C3 04 .4..0........... 1426:0110 89 07 83 C3 0A 89 07 B4-4C CD 21 00 00 00 00 00 ........L.!..... 1426:0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0130 34 12 34 12 00 00 34 12-00 00 00 00 00 00 00 00 4.4...4......... 1426:0140 34 12 00 00 00 00 00 00-00 00 00 00 00 00 00 00 4............... 1426:0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1426:0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # Quit DEBUG. -q