*
* *
*
scene.org
Log in:
login for 1 year
No account? register here

Scene.org is hosted and supported by:
Scene.org is sponsored by:
* forum - #coders

*
Topic:  Question about Video RAM
* Posted by ChewieRFC Thursday 23 October 2008 - 21:17 
I've seen a couple demos now, usually small byte plasmas, that use the following:

mov al,13h
int 10h
les ax,[bx]

Obviously it's getting into Mode 13h. The next command is setting up ES:AX with whatever is in [CS:BX]. Well, each time that loads 9FFF into the ES register, due to that being the value in the PSP which it's getting its data from. What I have to ask is... when they subsequently use a STOSB instruction to write bytes to that memory segment... it shows graphics... even though VGA graphics are at segment A000. It's driving me nuts. Any idea how writing to segment 9FFF (which is the upper limit of DOS memory) would put graphics on the screen? Any help would be appreciated.

ChewieRFC

* Posted by ChewieRFC Friday 24 October 2008 - 23:49 
Maybe this will help. This is the code (written for FASM):

use16
org 0x100

mov al,0x13
int 0x10

les ax,[bx]

paint:
adc ax, cx
stosb
loop paint
inc ax
jmp paint

[Post edited by ChewieRFC on Friday 24 October 2008 - 23:50]


* Posted by hitchhikr Saturday 25 October 2008 - 23:26 
Using 0x9fff:0000 in es:di is like using the physical address 0x9fff0, the processor calculates the registers pair internally by shifting the value of the 1st one (es) to the left and adding the value of the 2nd one (di) to 0x9fff0, so when di reaching 0x10 the address is incremented to 0xa0000 and all subsequent bytes are written on the screen.

Something like that.
h.

* Posted by ChewieRFC Sunday 26 October 2008 - 22:45 
Ahh yes, ok that makes sense now. It's been a while since I've messed with x86 ASM, I forgot about the real mode addressing scheme. Thanks for the help!

*