joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.66k stars 378 forks source link

Dual screen setup MDA + VGA not fully working #3407

Open boskar opened 2 years ago

boskar commented 2 years ago

Code of Conduct & Contributing Guidelines

Have you checked that no other similar question(s) already exists?

Question

Hello,

I'm actually surprised I went this far, and I feel like I'm a single step from achieving what I'm trying to do.

I've got a piece of software which was running on physical MDA + VGA configuration (+ network using Phonenet AppleTalk, but that's a different story) until recently. I'm trying to migrate it to dosbox-x (or dosbox).

So far I was able to start to compile dosbox-x on my debian box, run it with -display2 "amber", I'm able to:

First thing which came to my mind the software is trying to use Hercules mode instead of MDA, but I highly doubt it, as the physical monitor is 9 pin monochrome (amber actually). The secondary graphic card is w86855af, so hercules compatibile.

I somehow assume it is related to codepage, as the software is polish, and does contain polish symbols, both in terms of interface and data.

What I could do to make it work? (Instead of waiting for dual SDL extension to dosbox-x). Can I modify the codepage somehow? Load a font?

I've tried the patched dosbox on windows (non -x) as well, almost the same result.

Screenshot below. The other window of the software is perfectly OK.

Przechwycenie obrazu ekranu_2022-04-10_12-32-42

rderooy commented 2 years ago

One thing to take into account, is that video modes are 25 lines, while terminals often default to 24 lines. So you should set your terminal to 25x80 to match the video mode. Leaving it at 24 lines can cause weird effects.

Loading other fonts will not work. MDA (and by extension Hercules) has the font embedded in ROM and it cannot be replaced. But you can try to set a different codepage as documented on the wiki.

Until the 2nd monitor code is revised to use a secondary SDL window instead of a terminal window, Hercules cannot be supported.

https://dosbox-x.com/wiki/Guide%3ARegional-settings-in-DOSBox%E2%80%90X https://dosbox-x.com/wiki/Guide%3AVideo-card-support-in-DOSBox%E2%80%90X#_dual_monitor

boskar commented 2 years ago

One thing to take into account, is that video modes are 25 lines, while terminals often default to 24 lines. So you should set your terminal to 25x80 to match the video mode. Leaving it at 24 lines can cause weird effects.

Yeah, found it myself, did not help, just forgot to mention about it : (

Loading other fonts will not work. MDA (and by extension Hercules) has the font embedded in ROM and it cannot be replaced.

In other words, unless the card has been physically reflashed with other font, it can't be the reason why it's not working?

But you can try to set a different codepage as documented on the wiki.

Shouldn't the incorrect codepage result in 1:1 wrong characters? I've tried to change it, although I'm a bit confused between mode.com provided by dosbox and included in the system. I should use mode command outside C:\dos\ containing DOS 6.22 MS-DOS mode.com, and any ISO.CPI, EGA.CPI etc from the system should not be used?

Until the 2nd monitor code is revised to use a secondary SDL window instead of a terminal window, Hercules cannot be supported.

How do I find out whether the software is expecting Hercules? Is it possible to run any debugger maybe?

rderooy commented 2 years ago

I just tried it with the latest code from git with codepage 437 and after switching to the MDA output I started Norton Commander. image

As you can see all the block drawing characters show unicode question marks, meaning my font does not have the necessary characters. As such you should set a font in your terminal that does.

Worse though, the moment I switched away to another window and came back, the keyboard focus had changed, such that keyboard presses no longer went to DOSBox-X, but rather to the terminal itself (e.g. Pressing ctrl-c killed dosbox-x).

Loading other fonts will not work. MDA (and by extension Hercules) has the font embedded in ROM and it cannot be replaced.

In other words, unless the card has been physically reflashed with other font, it can't be the reason why it's not working?

I don't know if custom fonts were a thing back then. But it may be that for some markets they used different fonts.

But you can try to set a different codepage as documented on the wiki.

Shouldn't the incorrect codepage result in 1:1 wrong characters? I've tried to change it, although I'm a bit confused between mode.com provided by dosbox and included in the system. I should use mode command outside C:\dos\ containing DOS 6.22 MS-DOS mode.com, and any ISO.CPI, EGA.CPI etc from the system should not be used?

You should be able to use either, but you should be able to use the DOSBox-X included tools to set the keyboard layout and codepage. For Polish, normally something like keyb po should be enough, which will also switch you to codepage 858. If instead you want a Polish keyboard with another codepage, you can do e.g., keyb po 437, but then some keys on the Polish keyboard may or may-not give the intended result.

Until the 2nd monitor code is revised to use a secondary SDL window instead of a terminal window, Hercules cannot be supported.

How do I find out whether the software is expecting Hercules? Is it possible to run any debugger maybe?

Can you simply start DOSBox-X with -set machine=mda and see if the application works? If the application only supports MDA (or Hercules) output as second monitor, it is more tricky. The built-in debugger does not work in combination with the 2nd monitor code as they both want the terminal window.

boskar commented 2 years ago

As you can see all the block drawing characters show unicode question marks, meaning my font does not have the necessary characters. As such you should set a font in your terminal that does.

Przechwycenie obrazu ekranu_2022-04-10_20-55-08

Good enough, I don't actually care for question marks as long as I can read the content - like in vc.

Worse though, the moment I switched away to another window and came back, the keyboard focus had changed, such that keyboard presses no longer went to DOSBox-X, but rather to the terminal itself (e.g. Pressing ctrl-c killed dosbox-x).

Not an issue for me - You just need to keep the focus on the SDL dosbox-x window, I've got used to it after 10 minutes.

The funny part - THE MOUSE WORKS in monochrome terminal! You just need to point at the SDL terminal, and it's reaching the other one. Tested with both terminals of the same 80x25 size.

I don't know if custom fonts were a thing back then. But it may be that for some markets they used different fonts.

So what I understand in dosbox-x scenario there is a "font" somewhere, which translates everything to unicode characters and prints out to the terminal, and potentially manipulating that map MIGHT solve the problem?

You should be able to use either, but you should be able to use the DOSBox-X included tools to set the keyboard layout and codepage. For Polish, normally something like keyb po should be enough, which will also switch you to codepage 858. If instead you want a Polish keyboard with another codepage, you can do e.g., keyb po 437, but then some keys on the Polish keyboard may or may-not give the intended result.

As far as I remember old Windows 95 times the proper codepage was usually 852 and keyboard layout was in KEYBRD4.SYS, what is the one correct in this system - I still don't know, I haven't found any significant info in autoexec.bat.

Can you simply start DOSBox-X with -set machine=mda and see if the application works? If the application only supports MDA (or Hercules) output as second monitor, it is more tricky. The built-in debugger does not work in combination with the 2nd monitor code as they both want the terminal window.

No way, the second screen works as a file picker/menu etc., while the main screen is busy for rendering graphics. I've tried, the invoking script starts with mode co80, if I invoke the binary directly it does not start.

I've found a header file for a module (in Turbo-C) - they clearly refer to the second graphics card as Hercules. : (((

rderooy commented 2 years ago

As I mentioned to you on vogons, I tried to use the fonts from dosbox-x/contrib/fonts by placing them in my ~/.fonts directory, and restarting Gnome Terminal. After which I could select one of them for my font for the 2nd display output in Gnome Terminal. This worked as the font style would change, but he unicode question marks remained.

As such I think the issue is the mapping from the DOS codepage to unicode, which is probably not taking place for the second output to the terminal.

boskar commented 2 years ago

Hello, thank You for Your response.

Changing the font did make my xfce4-terminal look more similar to the dosbox one, but it did not solve the problem.

On the other hand I've managed to find encoding settings in the actual xfce4-terminal - After changing to IBM852 Volkov Commander looks better - see below.

One screencap with dosbox provided font, one with general xfce font.

Przechwycenie obrazu ekranu_2022-04-18_11-49-56

Przechwycenie obrazu ekranu_2022-04-18_11-51-05

Regarding the actual software I'm trying to run - does not help at all, it is equally illegible. Less question marks, but still far from anything useful.

rderooy commented 2 years ago

Good point, I had not thought of changing the encodings in the terminal.

Here is with the encoding set to 850 and the "Nouveau IBM" font.

image

Strangely, there is no codepage 437 option, as that would solve some of the missing block drawing characters.

boskar commented 2 years ago

IMG_20220427_0955380 I resurrected the old hardware... It's clearly more then 80x25 terminal, therefore the card must be running in Hercules mode.