I've been reading several tutorials about developing OSes, and one of them mentioned that to write to video ram (in real mode, at least) you write to certain addresses in ram, and while tinkering with my own "OS", I have used the B8000 memory address to write text to the screen. Here's the actual table, copy-pasted:
General x86 Real Mode Memory Map:
0x00000000 - 0x000003FF - Real Mode Interrupt Vector Table
0x00000400 - 0x000004FF - BIOS Data Area
0x00000500 - 0x00007BFF - Unused
0x00007C00 - 0x00007DFF - Our Bootloader
0x00007E00 - 0x0009FFFF - Unused
0x000A0000 - 0x000BFFFF - Video RAM (VRAM) Memory
0x000B0000 - 0x000B7777 - Monochrome Video Memory
0x000B8000 - 0x000BFFFF - Color Video Memory
0x000C0000 - 0x000C7FFF - Video ROM BIOS
0x000C8000 - 0x000EFFFF - BIOS Shadow Area
0x000F0000 - 0x000FFFFF - System BIOS
(source http://www.brokenthorn.com/Resources/OSDev7.html)
This leads me to a few questions:
1. I thought video ram was on the actual graphics card/controller. Why is it RAM?
2. I thought the BIOS was in its own chip. Why is it in RAM?
3. In Pmode or unreal mode, do these addresses correspond to what's in the table?
4. Are these locations usable for general memory storage, or do they (at least in real mode) always mean what that table says they do? (Ex. B8000 - BFFFF will always be colour video memory)
Thanks a bunch
[SOLVED] Question about (real mode) memory mapping
[SOLVED] Question about (real mode) memory mapping
Last edited by Mahkoe on Thu Jul 26, 2012 5:19 pm, edited 1 time in total.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Question about (real mode) memory mapping
It is on the graphics card. It is mapped at that addressMahkoe wrote:1. I thought video ram was on the actual graphics card/controller. Why is it RAM?
The BIOS chip tends to be very slow. It is copied into RAM once the BIOS code has configured the SDRAMMahkoe wrote:2. I thought the BIOS was in its own chip. Why is it in RAM?
YesMahkoe wrote:3. In Pmode or unreal mode, do these addresses correspond to what's in the table?
If you're no longer using the BIOS, 0 to 0x0009FFFF (excluding some portion of the above reserved as the Extended BIOS Data Area) may be used as RAM. The other regions retain their purpose (note that the video portions may have a different purpose when the card is not in VGA compatibility mode)Mahkoe wrote:4. Are these locations usable for general memory storage, or do they (at least in real mode) always mean what that table says they do? (Ex. B8000 - BFFFF will always be colour video memory)
-
- Member
- Posts: 255
- Joined: Tue Jun 15, 2010 9:27 am
- Location: Flyover State, United States
- Contact:
Re: Question about (real mode) memory mapping
Don't get the address space confused with the actual RAM. There can be holes in the address space to which no device is mapped.
Depending on the video mode, VGA memory can be mapped to different locations.
In 80x25 text mode it is almost always B800:0000. Other possible values of the base of video memory are A000:0000 and B000:0000. The size of the mapped memory is also different depending on the mode. Read something like FreeVGA for more info.
Depending on the video mode, VGA memory can be mapped to different locations.
In 80x25 text mode it is almost always B800:0000. Other possible values of the base of video memory are A000:0000 and B000:0000. The size of the mapped memory is also different depending on the mode. Read something like FreeVGA for more info.
Re: Question about (real mode) memory mapping
Thank you very much for the great help.