VOGONS


First post, by glebm

User metadata
Rank Newbie
Rank
Newbie

I'm working on a port of SDL2 for DOS.
So far, I've been testing it with dosbox 0.74 (default install on Ubuntu, default config).

When implementing support for 8-bit palettized 640x480 mode, I've noticed that the DAC only seems to support 6-bits per color according to its Capabilities query result (VBE standard page 13).

When trying to set the DAC colors to 8-bit via the 08h function, I get a very strange result:

bh=8 al=00 ah = 4f

1. bh is 8, but visually it looks like it's still 6 (brighter colors overflow and go dark).
2. ah is 4f which is not part of the spec (section 4.1 VBE Return status)
3. al is 0 which indicates failures

I'm referring to this VBE 2.0 standard document from 1994: https://www.phatcode.net/res/221/files/vbe20.pdf

Am I doing something wrong?
Does the svga_s3 doesn't not support palettized colors with 8 bit depth per channel?
What is the undocument 4f return value in the ah register?

Reply 1 of 5, by glebm

User metadata
Rank Newbie
Rank
Newbie

Diablo 1 looks pretty good even with 6-bits per color, so it's not a major issue but it'd be nice to have the full 8 bits in DOSBox:

The attachment Screenshot From 2025-09-01 18-08-40.png is no longer available

Reply 2 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox only supports a 6-bit DAC, and VBE functions return AL=4Fh if they are supported, meaning INT 10h/4F08h is not supported.

The DOSBox-X fork may have support for 8-bit DAC, but I'm not sure.

Last edited by ripsaw8080 on 2025-09-01, 17:37. Edited 1 time in total.

Reply 3 of 5, by glebm

User metadata
Rank Newbie
Rank
Newbie

I think what's not to spec is DOSBox does not set the `bh` register to `6` when the call fails.

The spec says:

An application can determine if DAC switching is available by querying Bit D0 of the Capabilities field
of the VbeInfoBlock structure returned by VBE Function 00h (Return Controller Information). The
application can then attempt to set the DAC palette width to the desired value. If the display controller
hardware is not capable of selecting the requested palette width, then the next lower value that the
hardware is capable of will be selected. The resulting palette width is returned.

But DOSBox returns 8 rather than the actual value it supports, 6.

Reply 4 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox is not "returning" any value, it is leaving the registers unchanged for an unsupported function.

Reply 5 of 5, by glebm

User metadata
Rank Newbie
Rank
Newbie

Fair enough, I've modified my code to not rely on that bit of the spec.

The spec says "the next lower value .. will be selected" and "the resulting palette width is returned" but I guess this doesn't have to happen if the function is completely unsupported (as indicated by the spec saying that Capabilities should be queried first).