Page 1 of 1

Hello again...

Posted: Sat Oct 27, 2007 12:54 pm
by matias_beretta
After a month, I am again interested in osdev and i continued my real mode os.

One month ago i asked in the forum about a pointer to video memory. I didn't get the answers i wanted so i investigated for myself and i found this:

Code: Select all

char _es *video;
This pointer is based in the _es value: lets suppose that es is 0xb800 and the pointer is 3, so it will point 0xb803.

This works in Turbo C++ 3.0...

Bye

Posted: Sat Oct 27, 2007 2:00 pm
by XCHG
When the CPU wants to translate a Real Mode address to its physical address, it will shift the segment value to the left 4 bits and then add the offset to it. So the 3rd byte (0..2 = 3) in the Video RAM is:

(0xB800 << 0x04) + 0x0002 = 0x000B8000 + 0x0002 = 0x000B8002.