Video memory - 0xA0000 or 0xB8000?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
midir
Member
Member
Posts: 46
Joined: Fri Jun 13, 2008 4:09 pm

Re: Video memory - 0xA0000 or 0xB8000?

Post by midir »

If you use the large or huge memory models (-ml or -mh options on the command line, or under Options -> Compiler -> Code generation), then all pointers will be of far* type automatically, meaning you can do things directly like:

Code: Select all

unsigned char *screen = (unsigned char*)0xB8000000;
It's useful if you intend to do a lot of code this way. It saves having to explicity use the far keyword on pointers and the alternate functions _fmemcpy() and friends for manipulating data in far memory, thus making the code more portable to the 32 or 64-bit flat models. (Only thing that will need to change is the address.)

It's not as efficient in real mode, since in the generated assembly far pointers seem to reload a segment register for nearly every access, but the difference will not be noticeable on any remotely modern hardware.
Mounter
Posts: 8
Joined: Sun Aug 12, 2007 12:45 pm
Location: Feliz, Rio Grande do Sul, Brazil
Contact:

Re: Video memory - 0xA0000 or 0xB8000?

Post by Mounter »

Hello Fergo, I know your 16-bit assembly operating system... And I have accompanying some of your projects, I am also doing an OS, if you're interest to exchange ideas can see my site or send me an email!

Email: osdev AT osdevbrasil DOT net
Site: http://www.osdev.com.br/
Post Reply