MS-DOS game: Garbled symbols displayed instead of text.

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

Hello, I've been trying to get a game for DOS working on an MS-DOS 5.0 guest in VirtualBox. The game in question is Grandmaster Chess (1993), and it almost works if not for the garbled text which plagues both the installer and, to a lesser extent, the game itself. This problem makes configuration nearly impossible, since much of the informative text is getting rendered by VBox as special characters (like ALT-chars), or sometimes what look like parts of some font or glyph. I've taken three screenshots (two of the installation process, the third in-game where board coordinates are unintelligibly rendered), to clarify the situation.
Tried were different versions of VBox (5.2.44, 6.0.24, 6.1.32),different versions of DOS (i.e. MS-DOS 5.0, PC DOS 2000, FreeDOS 1.2), combining them with VBoxVGA, VMVGA, and VBoxSVGA adaptors in different modes (scale, full-screen), all to no effect. I've also done a bit of research on similar problems but I could find nothing specifically about this game. A TSR, FIX8X14, was employed as a last resort, but it would seem that the VBox virtual adaptors already include those 8x14 and 8x16 fonts (based on what FIX8X14 tells me). So it would seem the likely culprits (8x14 and 8x16 fonts) are indeed accounted for, so that leaves me with nothing else to go on. For the record, I've also selected all three video modes offered by the installer, none of which changed the appearance of the corrupted text.
If anyone recognizes these symptoms, I'd sure appreciate some advice on how to remedy this:
Grandmaster Chess installer running in VirtualBox.
Grandmaster Chess installer running in VirtualBox.
VirtualBox_gmchess_installer_garbled-1.png (11.2 KiB) Viewed 30303 times
Grandmaster Chess installer running in VirtualBox.
Grandmaster Chess installer running in VirtualBox.
VirtualBox_gmchess_installer_garbled-2.png (6 KiB) Viewed 30303 times
Grandmaster Chess running in VirtualBox. Notice garbled co-ordinates at left edge of board.
Grandmaster Chess running in VirtualBox. Notice garbled co-ordinates at left edge of board.
VirtualBox_gmchess_boardcoords_garbled.png (16.16 KiB) Viewed 30303 times
Thanks in advance.

P.S. My host system specs are AMD A8, 8 GB RAM, Windows 7 x64, running VirtualBox 6.1.32.
The MS-DOS 5.00 guest system is allocated 16MB RAM, 8 MB VRAM and the standard VBox VGA adaptor (although all have been tried).
Last edited by Peter Wajorski on 16. Feb 2022, 19:22, edited 2 times in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by mpack »

Recognition is easy enough. Your "garbled symbols" seem to be the top or bottom halves of glyphs from the IBM PC ROM font.

Probably this game is relying on a non-standard BIOS font existing in a certain ROM location and a certain size. Clearly those assumptions are violated in whatever DOS era PC VirtualBox is closest to (presumably IBM PS/2 since it supports 3.25" floppy drives).

Guessing, I believe your game assumes that the font is 8x8 and therefore fills 2K of ROM. VirtualBox actually seems to be using an 8x16 font (or thereabouts) which therefore occupies 4K. When the software attempts to access a second font at <first font>+2K, it is in fact accessing the second half of the first font. And of course it gets the display size wrong too.
Attachments
pc0-8x8.png
pc0-8x8.png (8.1 KiB) Viewed 30281 times
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

mpack wrote:Your "garbled symbols" seem to be the top or bottom halves of glyphs from the IBM PC ROM font.

Probably this game is relying on a non-standard BIOS font.

Was this game written for MS-DOS, or was it PC-DOS? Yes the two environments are similar, but there are different hardware assumptions.
Thanks for the reply, mpack. Grandmaster Chess system requirements seem to indicate either PC DOS or MS-DOS will do. Like I've mentioned, both were tried in VirtualBox with no difference in font appearance.
The possibility of it using a non-standard font is intriguing: I'm now wondering how to determine which fonts are supported natively by the VBox VGA adaptor, and which font is getting used by the Grandmaster Chess program itself. Maybe the missing font can be easily added without re-coding VirtualBox, something I would not be able to do...
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by mpack »

Peter Wajorski wrote: Grandmaster Chess system requirements seem to indicate either PC DOS or MS-DOS will do
In fact my question was misplaced. The choice of DOS version obviously does not affect the contents of the BIOS ROM on your (virtual) PC motherboard.

I would guess that the era that your DOS game was written for is prior to the BIOS era emulated by VirtualBox.

The BIOS font is fixed. You would have to provide a new BIOS build, but be aware that having the BIOS from the wrong era could have serious consequences.

It would be better for the software itself not to rely on font definitions from the BIOS ROM. It should define its own. Perhaps it has an option for that.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

I see..It looks like there's no convenient fix, then.

Well, at leaset I've gained a bit of knowledge. Thanks again for the clear explanation.
Last edited by Peter Wajorski on 20. Feb 2022, 21:50, edited 2 times in total.
AndyCot
Posts: 303
Joined: 29. Feb 2020, 03:04

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by AndyCot »

I would try a DosBox fork as these are designed for running DOS rather that a newer OSThese forks both include a GUI that allows you to config allot of things without having to manually mod the dosbox config file:
a) Dosbox-X (https://dosbox-x.com/)
b) Dosbox-staging (https://dosbox-staging.github.io/)

I do not use the upstream DosBOX for various reasons and I do not want to start a flame war. There are other DosBox forks out there that you could try if the ones above do not suit your real needs. BTW these both support real serial ports as I need to use DosBox to run an old app on dos for a serial port protocol due to timing and incompatibilities when running under Windows.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

AndyCot wrote:I would try a DosBox fork as these are designed for running DOS rather that a newer OSThese forks both include a GUI that allows you to config allot of things without having to manually mod the dosbox config file:
a) Dosbox-X
b) Dosbox-staging

I do not use the upstream DosBOX for various reasons and I do not want to start a flame war. There are other DosBox forks out there that you could try if the ones above do not suit your real needs. BTW these both support real serial ports as I need to use DosBox to run an old app on dos for a serial port protocol due to timing and incompatibilities when running under Windows.

I second your sentiment on DOSBox-X, and I've got it on my hard drive alongside VBox. In fact, that original GM Chess installer was ripped from the GOG release, which happens to use regular ol' DOSBox to launch the game under Windows, and it runs fine; everything is displayed properly. But I have reasons to prefer VBox at this time: I find it handles several DPMI programs better than other virtualizers or emulators I've tested. There are certain programs by Borland, for example, which crash on VMware Player, Virtual PC and DOSBox-X, whereas VBox has no problems running them at all. I'm assuming this is an indicator of good low-level compatibility. And since I'm a lazy sort of person, I'd just prefer to keep one DOS VM open for all my needs.
But for cases like this I'll resort to DOSBox-X, which works very well (I kinda like having the co-ordinates displayed right). But I'm still hoping to get this resolved within VBox, if that's possible.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

mpack wrote:It would be better for the software itself not to rely on font definitions from the BIOS ROM. It should define its own. Perhaps it has an option for that.
It has the option to hide the co-ordinates, unfortunately none for defining another font.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

It looks like the VirtualBox firmware has an 8x8 font already defined in font8x8.inc, and supposedly loaded at address offset FA6E (hex).
I can't see what the problem is.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by mpack »

Can you give a reference to the source code line you looked at that establishes a fixed base address for the 8x8 font? Or a test that you did to confirm?

And assuming that you are correct, how do you know that your chess program is looking at VGABIOS:+0xFA6E?

Your earlier results seem to indicate that both statements cannot be true.
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

mpack wrote:Can you give a reference to the source code line you looked at that establishes a fixed base address for the 8x8 font? Or a test that you did to confirm?

And assuming that you are correct, how do you know that your chess program is looking at VGABIOS:+0xFA6E?

Your earlier results seem to indicate that both statements cannot be true.

Or I'm in over my depth. :oops: It's the first good look I've given DOS for some time.

Those files I was referencing are:
https://www.virtualbox.org/svn/vbox/tru ... S/orgs.asm
Which contains the directive

and immediately afterwards includes font8x8.inc
font8x8.inc:
https://www.virtualbox.org/svn/vbox/tru ... ont8x8.inc

That part about address FA6Eh was me thinking out loud. Since orgs.asm references that particular address for 8x8, and since my system seems to have the full compliment VGA fonts installed, I loaded the chess program's INSTALL.EXE into Turbo Debugger, but wasn't able to track down any tell-tale code like INT 10h calls which might help me determine the video mode it sets. But my skills with this stuff are rusty, at very best.


I'm not sure it adds anything to the discussion but I'll post the following screenshot of Grandmaster Chess running under DOSBox, which renders those problematic fonts correctly:
Attachments
A fresh game of Grandmaster Chess, running under DOSBox. The co-ordinates are rendered correctly here.
A fresh game of Grandmaster Chess, running under DOSBox. The co-ordinates are rendered correctly here.
Grandmaster_Chess-DOSBox.png (74.78 KiB) Viewed 30081 times
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by mpack »

Good job finding that "orgs.asm" line. I agree that it seems to be locating the 8x8 font at BIOS:+0xFA6E.

Now all we need to establish is that your Chess program is following the rules. To get a pointer to the font it should be doing a BIOS call to int 10h, function 11h subfunction 30h (get font info), which returns the base address of a font selected in BH. BH should be 3 to select the first half of the character defs (0-127) and 4 to fetch info about the second half (128-255).

I note that the image you provided is probably intended for VGA (it is close to VGA*2, which I suspect is caused by you applying x2 scaling to the DOS display). That hints that the game came from the late 1980s.

Chess display with scaling and padding removed - exactly VGA sized (640x480):
Attachments
Grandmaster_Chess-DOSBox.png
Grandmaster_Chess-DOSBox.png (23.22 KiB) Viewed 30075 times
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Any and all
Contact:

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by michaln »

The fonts are garbled because the VirtualBox VGA BIOS doesn't implement INT 10H/1122H, INT 10H/1123H, and INT 10H/1120H. The chess game uses those calls rather than the much more obvious INT 10H/1130H that mpack pointed out.

I can only speculate that the game engine was originally written to run on the EGA which had no INT 10H/1130H. But the program uses 8x16 fonts that don't exist on the EGA, and runs in VGA mode 12h, so I don't think it'll work anyway. At first I thought the game might be using the BIOS to draw the text, but of course it's not. It calls INT 10H/112xH and saves off the INT 43H vector in order to access each of the three different fonts.

I'll see if I can fix that.

Edit: Actually the EGA supported INT 10H/1130H already. What the game does makes no real sense, although it should still work.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by mpack »

Hey! Michaln is still around. Haven't seen you in a while. Michal is your guy if you want low level DOS/BIOS stuff in VirtualBox.

Anyway, I have here a book "IBM ROM BIOS" by Ray Duncan, Microsoft Press 1988. That's what I referenced to get info on function int 10h/1130h above. This book also documents the 1120h, 1122h and 1223h calls (and a number of other 11xxh calls). Legends beside the descriptions show that these were indeed supported by the EGA and most in MCGA too, including 1130h. But... I don't see any mention that they return anything... Oh I see. They store pointers in int1Fh and int43h and the Chess program copies the pointers out. Looks like I'm missing vital info, like why font pointers live as int table vectors - obviously some convention that I never needed to know about (99.9% of my DOS programming was text based).
Peter Wajorski
Posts: 10
Joined: 16. Feb 2022, 18:19

Re: MS-DOS game: Garbled symbols displayed instead of text.

Post by Peter Wajorski »

mpack wrote:Hey! Michaln is still around. Haven't seen you in a while. Michal is your guy if you want low level DOS/BIOS stuff in VirtualBox.

Anyway, I have here a book "IBM ROM BIOS" by Ray Duncan, Microsoft Press 1988. That's what I referenced to get info on function int 10h/1130h above. This book also documents the 1120h, 1122h and 1223h calls (and a number of other 11xxh calls). Legends beside the descriptions show that these were indeed supported by the EGA and most in MCGA too, including 1130h. But... I don't see any mention that they return anything... Oh I see. They store pointers in int1Fh and int43h and the Chess program copies the pointers out. Looks like I'm missing vital info, like why font pointers live as int table vectors - obviously some convention that I never needed to know about (99.9% of my DOS programming was text based).
Looks like I could've chosen a simpler example for compatibility testing!
Your descriptions of how a font gets stored and indexed, the different BIOS video modes, etc. got me thinking on stuff I'd probably not have looked into if not for your efforts. The help you've provided is greatly appreciated, mpack.
Post Reply