Hello folks,

I write the below sample program named "h1.asm"?

assume cs:code

code segment
       mov ax,0B800H
       mov ds,ax
       mov bx,0

       mov byte ptr ds:,'a'
       inc bx

       mov byte ptr ds:,02

code ends

end


1. In Windows platform +MASM 5.0, run "command" and use "debug.exe" to see what would happen. As step by step check, I see B800:000 is not modified as expected.
2. In Ubuntu 10.04 + dosemu 1.4.0.1, run the program in two ways:
  a. If exec dosemu in command line as "$dosemu -dumb", yes, it's in shell mode. and then use debug to check, "B800:0000" can be modified as expected.
 

  D:\masm>debug h1.exe
-d b800:0000
B800:0000  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
-t
AX=B800  BX=0000  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=07D2  ES=07D2  SS=07E2  CS=07E2  IP=0003   NV UP DI PL NZ NA PO NC
07E2:0003 8ED8          MOV     DS,AX
-t
AX=B800  BX=0000  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=B800  ES=07D2  SS=07E2  CS=07E2  IP=0005   NV UP DI PL NZ NA PO NC
07E2:0005 BB0000        MOV     BX,0000
-t
AX=B800  BX=0000  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=B800  ES=07D2  SS=07E2  CS=07E2  IP=0008   NV UP DI PL NZ NA PO NC
07E2:0008 C60761        MOV     BYTE PTR ,61                     DS:0000=00
-t
AX=B800  BX=0000  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=B800  ES=07D2  SS=07E2  CS=07E2  IP=000B   NV UP DI PL NZ NA PO NC
07E2:000B 43            INC     BX
-t
AX=B800  BX=0001  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=B800  ES=07D2  SS=07E2  CS=07E2  IP=000C   NV UP DI PL NZ NA PO NC
07E2:000C C60702        MOV     BYTE PTR ,02                     DS:0001=00
-t
AX=B800  BX=0001  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=B800  ES=07D2  SS=07E2  CS=07E2  IP=000F   NV UP DI PL NZ NA PO NC
07E2:000F 158B46        ADC     AX,468B
-d b800:0000
B800:0000  61 02 00 00 00 00 00 00-00 00 00 00 00 00 00 00   a...............
B800:0010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
B800:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................

 




  b. If exec dosemu in command line as "$dosemu", and run the program again, the symptom is as same as 1.

3. In Windows, I replace "mov ax,0B800H" to "mov ax,2000H" and try again, it would be edited well. So I wonder if it is coursed by "B800" segment address.

All above make me confused, would you give me any suggestion?

Thanks in advanced,

Phillip
Posted on 2010-11-10 23:57:53 by Phillip
Phillip,

In DOS (and NTVDM as well) videobuffer is shared between debug's output and your code's. Didn't you forgot about scrolling? Hint: use cls before running debug h1.exe, then execute code all at once with g f you'll see the difference.

t 6, while giving you details about instructions' execution, will use 6*4==24 lines and happily scroll the result off screen. You may use mode con: lines=50 before running debug, though.

There are full screen debuggers that perform screen buffer swapping, you may find them useful.
Posted on 2010-11-12 11:11:38 by baldr