OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 9:33 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: mode 03h bank switching
PostPosted: Fri May 20, 2011 7:03 am 
Offline

Joined: Thu Mar 03, 2011 4:05 am
Posts: 17
Hi, how can I switch banks in text mode 03h to access more video memory than 32KB, that adress space window at 0xb8000 allows. Thanks.


Top
 Profile  
 
 Post subject: Re: mode 03h bank switching
PostPosted: Fri May 20, 2011 1:15 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
Technically, the VGA has no VESA-style bank-switching support at all. Instead it has a plane mask register where you can enable writes to one of four separate planes. Worse, in text mode, Odd-even mode is in use which partially overrides the plane selection based on bit 0 of the address. Text mode also dedicates banks to their respective purposes: you can only use plane 0+1 for character and attribute data, leaving 128k max to use.

There are two partial solutions here:
- change the mapping from 32k at 0xb8000 to 64k at 0xa0000, which allows you to access double the memory amount without the need of any planeswitching code.
- disable odd-even mode. You can then use the mask register to switch between planes 0-3, and write either characters, attributes, or font data. You get 4x the VGA ram at your disposal, or 2x more character-attribute pairs. You might also want to make sure you're in byte mode so that the display can actually display the newly accessible characters. If you do this, you'll have to adapt all writing routines to match. It also gives more opportunity to use VGA latches if you want to bother with them.

If you do both, you have access to 64k of characters and 64k of attributes, as well as the complete font set if you feel a need to change it.

Be careful though, VGA emulation in this regard is a bit flaky. Depending on the amount of tricks you try to pull off here, you'll lose increasingly more emulators that actually do what you want. Bochs and qemu(-clones) are generally the first to go. Real hardware is pretty conformant, fortunately.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: mode 03h bank switching
PostPosted: Sat May 21, 2011 11:56 am 
Offline

Joined: Thu Mar 03, 2011 4:05 am
Posts: 17
I have also find out that I can map 2*64KB starting at 0xa0000 so I can access whole textmode memory (character + attribute planes interleaved) without need for any switching. So this solves my problem, which was that screen wraps around 2*64KB border that I wasnt able to access. But out of curiosity, is there a way to make screen wrap before memory planes ends, for example at the 2*16KB border which is accessible in standard mode 03h?


Top
 Profile  
 
 Post subject: Re: mode 03h bank switching
PostPosted: Sat May 21, 2011 3:37 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
There's splitscreens (see the line compare register) which you can use to approximate wrapping.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], eekee, Google [Bot], SemrushBot [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group