LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   can not edit B800:0000 in pure dos (https://www.linuxquestions.org/questions/programming-9/can-not-edit-b800-0000-in-pure-dos-843599/)

PhillipHuang 11-11-2010 01:20 AM

can not edit B800:0000 in pure dos
 
1 Attachment(s)
Hello folks,

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

assume cs:code

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

        mov byte ptr ds:[bx],'a'
        inc bx

        mov byte ptr ds:[bx],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.
Code:

"Welcome to dosemu 1.4.0.1!"
 D:\masm>debug h1.exe
-r
AX=0000  BX=0000  CX=000F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
DS=07D2  ES=07D2  SS=07E2  CS=07E2  IP=0000  NV UP DI PL NZ NA PO NC
07E2:0000 B800B8        MOV    AX,B800
-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 [BX],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 [BX],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.(pls see attachment picture).

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

PhillipHuang 11-11-2010 02:48 AM

Update by myself.

I try to run the program directly in dos mode,
Code:

D:\masm>h1.exe
'a' is display!

Perhaps it is caused by debug.exe(16bit mode)?

resetreset 11-11-2010 12:30 PM

Sorry, but your English leaves me wondering as to what you want, could you try a *bit* harder? :)
You're trying to write to the video buffer in text mode, right? Well, according to your 2nd post, you've succeeded...? If not, then what are exactly are you trying to DO?

PhillipHuang 11-11-2010 07:03 PM

Hi resetreset, thanks for your reply. My question is, when run the program in "debug" mode, I can not write the expected data into video buffer "B8000-BFFFF". While I can get success by run the program in command line directly(After run as command line, and use debug to check later, the video buffer data is modified as expected).

resetreset 11-15-2010 08:02 AM

Oh,.... :) I would rather suspect that Debug takes OVER the whole screen, so that a write to video RAM would be pointless. Exactly HOW it does it, I don't know, it's been a while since I dabbled in stuff like this - this *should* teach you about the perils of using Microsoft software :)
If you're talking about using debug to SINGLE-STEP through a program, well, I think it's virtually impossible to keep your "a" on screen while it does so - the amount of stuff that happens is probably just too much.
May I ask what you're dabbling IN, that you want to do all this stuff, in this day and age?
If you're interested in old school gfx programming, may I take this opportunity to tell you and hopefully recruit you into the demoscene? :) :
en.wikipedia.org/wiki/Demoscene

Tell me what you thought of it, I'd love to make a new friend with similar interests as mine :)

PhillipHuang 11-15-2010 07:44 PM

Hello resetreset,

I google for my question, and think that it is caused by "debug.exe" would keep current environment so that it will not display 'a' as expect while run it directly in command line can do. My favor is Perl. Though Assemble language is old, I study it in order to know computer system deeply, what happened in underlying system. Thanks for your kindly introduction, Demoscene is very cool! I will try to draw some in future days, :)

Phillip


All times are GMT -5. The time now is 02:45 PM.