VOGONS


First post, by star2doc

User metadata
Rank Newbie
Rank
Newbie

On both my Macintosh G4 and G5 ppc machines, if I run DOSBox in vgaonly mode, the text screen colors are distorted (white text is blueish) and 256 color mode displays the wrong colors in full screen mode.

This patch corrects both vgaonly display issues on the ppc Mac, but has not been tested on any other platforms. Among other things, this patch disables the display of 9bit wide characters. It is, in short, an ugly hack for Macs only.

--- src/hardware/vga_draw.cpp   2010-02-01 21:25:52.000000000 -0500
+++ src/hardware/vga_draw.cpp 2010-02-01 21:34:04.000000000 -0500
@@ -1229,10 +1229,11 @@
case M_VGA:
doublewidth=true;
width<<=2;
- if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
+/* if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
bpp=16;
VGA_DrawLine = VGA_Draw_Xlat16_Linear_Line;
- } else VGA_DrawLine = VGA_Draw_Linear_Line;
+ } else VGA_DrawLine = VGA_Draw_Linear_Line; */
+ VGA_DrawLine = VGA_Draw_Linear_Line;
break;
case M_LIN8:
if (vga.crtc.mode_control & 0x8)
@@ -1270,10 +1271,11 @@
doublewidth=(vga.seq.clocking_mode & 0x8) > 0;
vga.draw.blocks = width;
width<<=3;
- if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
+/* if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
bpp=16;
VGA_DrawLine = VGA_Draw_Xlat16_Linear_Line;
- } else VGA_DrawLine=VGA_Draw_Linear_Line;
+ } else VGA_DrawLine=VGA_Draw_Linear_Line; */
+ VGA_DrawLine=VGA_Draw_Linear_Line;

vga.draw.linear_base = vga.fastmem;
vga.draw.linear_mask = (vga.vmemwrap<<1) - 1;
@@ -1300,18 +1302,20 @@
aspect_ratio=1.0;
vga.draw.blocks=width;
doublewidth=(vga.seq.clocking_mode & 0x8) > 0;
- if ((IS_VGA_ARCH) && (svgaCard==SVGA_None) && !(vga.seq.clocking_mode&0x01)) {
+/* if ((IS_VGA_ARCH) && (svgaCard==SVGA_None) && !(vga.seq.clocking_mode&0x01)) {
width*=9; /* 9 bit wide text font */
- VGA_DrawLine=VGA_TEXT_Xlat16_Draw_Line_9;
+/* VGA_DrawLine=VGA_TEXT_Xlat16_Draw_Line_9;
bpp=16;
// VGA_DrawLine=VGA_TEXT_Draw_Line_9;
} else {
width<<=3; /* 8 bit wide text font */
- if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
+/* if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) {
VGA_DrawLine=VGA_TEXT_Xlat16_Draw_Line;
bpp=16;
} else VGA_DrawLine=VGA_TEXT_Draw_Line;
- }
+ } */
+ width<<=3; /* 8 bit wide text font */
+ VGA_DrawLine=VGA_TEXT_Draw_Line;
break;
case M_HERC_GFX:
aspect_ratio=1.5;

Reply 1 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

you basicly disable vgaonly vgadrawing. not only the 9 bit wide stuff.
Guess the VGA_TEXT_Xlat16_Draw_Line_9
has some endian problem and it might be better to focus on that

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 24, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Do 16bpp games (svga_s3) have the same problem?

1+1=10

Reply 3 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I asked rhoenie to test it:

<Qbix> rhoenie if you happen to get on a PPC machine one of these days. Could you see if dosbox -machine vgaonly looks alright. In our forum there is report
of wrong colours. Feels like an endian issue if it is true
03:43PM <rhoenie> Qbix: oh .. ok.. i can check that today
03:51PM <rhoenie> Please submit a full bug report,
03:51PM <rhoenie> with preprocessed source if appropriate.
03:51PM <rhoenie> See <URL:http://developer.apple.com/bugreporter> for instructions.
03:51PM <rhoenie> make[3]: *** [ems.o] Error 1
03:51PM <rhoenie> *sigh* :-)
03:51PM <rhoenie> compiler crash
03:52PM <rhoenie> ok.. with -O0 ems.cpp compiles fine
<Qbix> hmm ems.cpp is not that complicated :)
03:55PM <rhoenie> ok.. compiled the source from the URL in the topic
03:55PM <rhoenie> works fine.. even with PowerPC G5 optimazations switched on
03:55PM <rhoenie> no false colors or such
03:55PM <rhoenie> (tested three games)
<Qbix> you used dosbox -machine vgaonly
<Qbix> ?
<Qbix> the screen should be wider in that case
<Qbix> (in textmode)
03:57PM <rhoenie> oops
03:57PM <rhoenie> [mac-admin]:~/Sources/DOSBox/dosbox/src $ ./dosbox_dyn -machien vgaonly
03:57PM <rhoenie> %-)
<Qbix> :)
04:01PM <rhoenie> http://6464.at/~rhoenie/dosbox_g5_vgaonly_1.png
04:01PM <rhoenie> http://6464.at/~rhoenie/dosbox_g5_vgaonly_2.png
04:01PM <rhoenie> looks good to me
04:03PM <rhoenie> ah.. btw..
04:03PM <rhoenie> lrwxrwxr-x 1 rhoenie admin 23 May 27 2009 libSDL.dylib -> libSDL-1.2.0.11.2.dylib
04:03PM <rhoenie> maybe its related to SDL?

Looks alright to me. Which SDL version do you have installed ?

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 24, by star2doc

User metadata
Rank Newbie
Rank
Newbie

I have no 16bit games to test in DOSBox. svga_s3 (and the other svga settings) do not have these problems, only the vgaonly setting.

Reply 5 of 24, by star2doc

User metadata
Rank Newbie
Rank
Newbie

I have SDL 1.2.(13?) I have no problems with other SDL based apps. It works with the changes shown above.

Reply 6 of 24, by star2doc

User metadata
Rank Newbie
Rank
Newbie

you basicly disable vgaonly vgadrawing. not only the 9 bit wide stuff.
Guess the VGA_TEXT_Xlat16_Draw_Line_9
has some endian problem and it might be better to focus on that

Both VGA_TEXT_Xlat16_Draw_Line_9 and VGA_Draw_Xlat16_Linear_Line

?

Reply 7 of 24, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

In

//Set entry in 16bit output lookup table
vga.dac.xlat16[index] = ((blue>>1)&0x1f) | (((green)&0x3f)<<5) | (((red>>1)&0x1f) << 11);

in vga_dac.cpp if at all.

But I think we need to get or set the color bit order with SDL somewhere.
Dominus had reported a similar color endian issue.

1+1=10

Reply 8 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

it might be related to the SDL version.

Water flows down the stream
How to ask questions the smart way!

Reply 9 of 24, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

But I think we need to get or set the color bit order with SDL somewhere.
Dominus had reported a similar color endian issue.

I'm game for testing anything 😀

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 10 of 24, by star2doc

User metadata
Rank Newbie
Rank
Newbie

If you have a ppc Macintosh it's easy to reproduce. Just set full screen mode, and set vgaonly. You should imediately see the text screen issues. Run any 320 256 color mode game to see the palette issue. I ran Masters of Orion.

FYI: My other issue, for some reason Masters of Orion runs faster on my 1ghz G4 laptop than on my 1.6ghz iMac G5? Noticably faster.

Reply 11 of 24, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I can confirm this on Intel Mac OS X 10.6.2. with SDL 1.2.14 (and 1.2.x SVN)

Reply 12 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

in sdlmain.cpp
below this"

                if (sdl.surface) {
switch (sdl.surface->format->BitsPerPixel) {
case 8:
retFlags = GFX_CAN_8;
break;
case 15:
retFlags = GFX_CAN_15;
break;
case 16:
retFlags = GFX_CAN_16;
break;
case 32:
retFlags = GFX_CAN_32;
break;
}

can you add some logging that prints

                                        sdl.surface->format->Rmask,
sdl.surface->format->Gmask,
sdl.surface->format->Bmask

you can use LOG_MSG() for that. The syntax for that one is identical to printf.

Water flows down the stream
How to ask questions the smart way!

Reply 13 of 24, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Can you be a bit more elaborate about that? Meaning you need to spell this out for me what to write exactly so it logs to log_msg. As I've probably written before, I can compile things and I can change the files and sometimes get my thinking around it, but when it comes to even the simple programming stuff, I'm lost. Even more so, with stuff like this logging which I have been explained before and forget quicker than it has been taken to explain it to me.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 14 of 24, by star2doc

User metadata
Rank Newbie
Rank
Newbie

I can't try this right now, but I think he means something like...

LOG_MSG("Rmask=%x,Gmask=%x,Bmask=%x\n",sdl.surface->format->Rmask, sdl.surface->format->Gmask, sdl.surface->format->Bmask);

?

Reply 15 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

yeah, I'll post a patch for it tomorrow. might throw in some more variables, but I think they changed the order or format internally in SDL

Water flows down the stream
How to ask questions the smart way!

Reply 16 of 24, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Thanks star2doc.
I have got this log:

Rmask=7c00,Gmask=3e0,Bmask=1f

Rmask=ff00,Gmask=ff0000,Bmask=ff000000

Dosbox started in fullscreen and the second Rmask is from when I switched back to windowed view, which is also falsely coloured (it's also falsely coloured when you start in windowed mode).
I'm attaching screenshots of both windowed and fullscreen mode.

Reply 17 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

the set blaster line has some blueish as well

Water flows down the stream
How to ask questions the smart way!

Reply 18 of 24, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

interestingly, the oficial 0.73 release for mac which colors generally works fine for me, does have the blueish prompt in fullscreen/machine=vgaonly. The windowed mode is correctly coloured.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 19 of 24, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

the official release is as far as I know staticly linked against an older version of SDL

Water flows down the stream
How to ask questions the smart way!