VOGONS

Common searches


First post, by videogamer555

User metadata
Rank Member
Rank
Member

I was reading this http://www.osdever.net/FreeVGA/vga/crtcreg.htm and noticed quite a few registers that control image dimensions, and they are very complicated and seem to all work together. I'm trying to set the screen to the special mode that has the image dimensions 256x256. This will allow for the full 64kB (65536 bytes) of a memory segment to be used to define every pixel in the region (rather than leaving some of the memory space unused, as is the case with 320x200 mode, where only 64000 bytes are used). However, I'm not sure which registers to use to set this special mode. I'm not even sure that DOS Box fully emulates VGA hardware. Which of these VGA hardware registers are supported by DOSBox? And which of them (if supported by DOSBox) will I need to configure?

One thing I noticed is that there is no simple "image width" or "image height" register. And all screen dimensions that are listed, are listed in characters. So how many pixels are in a character? Is each character considered to be just an 8x8 block of pixels?

Reply 2 of 6, by videogamer555

User metadata
Rank Member
Rank
Member
Calvero wrote:

There are 2 versions of the 256x256x256 mode in tweak16b.zip somewhere on the internet.

Does DOSbox support it? Does DOSbox emulate enough of the actual VGA hardware (registers, memory locations, I/O ports, etc) to be able to actually use those features?

Reply 3 of 6, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

Older versions of ZSnes supported all kind of weird resolutions... maybe you could test it?

I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!

Reply 4 of 6, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie
videogamer555 wrote:

One thing I noticed is that there is no simple "image width" or "image height" register. And all screen dimensions that are listed, are listed in characters. So how many pixels are in a character? Is each character considered to be just an 8x8 block of pixels?

It depends on the mode. In 256-colour modes, a character is 4 pixels horizontally. Vertically, the CRTCs in the EGA and VGA cards count scanlines (not characters like CGA does). So for 256 (double-scanned) vertical pixels you'd need to set Vertical Display Enable End to 511.

I think DOSBox supports most VGA registers since lots of games used tweak VGA modes.

Reply 5 of 6, by videogamer555

User metadata
Rank Member
Rank
Member
reenigne wrote:
videogamer555 wrote:

One thing I noticed is that there is no simple "image width" or "image height" register. And all screen dimensions that are listed, are listed in characters. So how many pixels are in a character? Is each character considered to be just an 8x8 block of pixels?

It depends on the mode. In 256-colour modes, a character is 4 pixels horizontally. Vertically, the CRTCs in the EGA and VGA cards count scanlines (not characters like CGA does). So for 256 (double-scanned) vertical pixels you'd need to set Vertical Display Enable End to 511.

I think DOSBox supports most VGA registers since lots of games used tweak VGA modes.

I was just thinking about this. 256-color mode isn't actually a distinct "mode". In fact each of the interrupt activated video modes that are activated with INT 0x10, are actually using IN and OUT on a low level to communicate with the ports in the graphics hardware. Interrupt 0x10 is a BIOS interrupt, meaning that when it's called it jumps to code stored in the computer's BIOS (a ROM chip) and the CPU executes that code, the same way as the CPU normally executes code in RAM. The code in the BIOS is itself a just a bunch of IN and OUT machine language instructions, that allow it to perform the actual actions of changing the CRT registers' settings (which lead to various widths, heights, and bit depths). Therefore, calling INT 0x10 can be thought of as not a special command in itself, but rather just a macro for a truckload of IN and OUT statements. INT 0x10 with AL=0x13 just happens to correspond to setting the CRT register settings in such a way that it gives you a width of 320 pixels, a height of 200 pixels, and a bit depth of 8 bits. You could just as easily flash your ROM chip with a hacked BIOS, where the code for INT 0x10 with AL=0x13 actually corresponded to some completely different width, height, and bit depth. INT 0x10 with AL=0x13 isn't just some magical command to switch to 320x200x8 VGA mode.

Reply 6 of 6, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie
videogamer555 wrote:

I was just thinking about this. 256-color mode isn't actually a distinct "mode".

Well, that depends on how you define "mode" I suppose! The term can get a bit fuzzy since there's no definitive answer to the question of which of the VGA's state bits actually contribute to the "mode". But it's still a useful term if you just think of it as the part of the VGA state which you set up once at the beginning and then leave alone while you do drawing/animation.

videogamer555 wrote:

In fact each of the interrupt activated video modes that are activated with INT 0x10, are actually using IN and OUT on a low level to communicate with the ports in the graphics hardware. Interrupt 0x10 is a BIOS interrupt, meaning that when it's called it jumps to code stored in the computer's BIOS (a ROM chip) and the CPU executes that code, the same way as the CPU normally executes code in RAM. The code in the BIOS is itself a just a bunch of IN and OUT machine language instructions, that allow it to perform the actual actions of changing the CRT registers' settings (which lead to various widths, heights, and bit depths). Therefore, calling INT 0x10 can be thought of as not a special command in itself, but rather just a macro for a truckload of IN and OUT statements. INT 0x10 with AL=0x13 just happens to correspond to setting the CRT register settings in such a way that it gives you a width of 320 pixels, a height of 200 pixels, and a bit depth of 8 bits. You could just as easily flash your ROM chip with a hacked BIOS, where the code for INT 0x10 with AL=0x13 actually corresponded to some completely different width, height, and bit depth. INT 0x10 with AL=0x13 isn't just some magical command to switch to 320x200x8 VGA mode.

On real hardware, this is all true. Though if you did change the "int 0x10" code like that, you'd likely break a lot of software! Also there may have been some VGA cards which needed slightly different sequences of port writes to enter any given mode (and had correspondingly different BIOS code). Finally, this is not always true of emulators. DOSBox, for example, does have a "magic" INT 0x10 implementation which is implemented in host code and which does things that guest code can't do any other way.