joncampbell123 / dosbox-x

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

Make EMS page frame segment user adjustable #1166

Open yksoft1 opened 5 years ago

yksoft1 commented 5 years ago

one PC-98 application, 256-color Paint Tool (256色お絵描きツール), requires that EMS page frame segment to be set to C000 instead of D000 as hardcoded in src/ints/ems.cpp.

image

yksoft1 commented 5 years ago

You could find this tool here: http://slt.retroprograms.com/256Colour.html

joncampbell123 commented 5 years ago

Why would a programmer do that? It was never specified what segment the EMS page frame should be so one should assume it could be anything.

At least the programmer checks first before assuming.

joncampbell123 commented 5 years ago

The HDI image works in DOSBox-X, though.

yksoft1 commented 5 years ago

The HDI image works in DOSBox-X, though.

Of course the HDI worked because that EMM386.EXE had /F=C000 set.

joncampbell123 commented 5 years ago

I see that. According to the debugger the HDI guest runs entirely in VM86 mode which can allow that kind of remapping.

I understand what you're asking for, you want DOSBox-X to allow the EMS page frame to exist at C000h. That can be done. I've already made the EMS page frame location and size variable (DOSBox SVN makes then compile-time constants), it's just a matter of making it a dosbox.conf option where to locate them.

By the way if the EMS page frame occupies C000h it may get in the way of the PC-98 sound BIOS, if that's OK.

joncampbell123 commented 5 years ago

So to make this work, several things need to be done.

First, the EMM emulation is hard-coded to emulate a 64KB region. That needs to be changed so that the size can be any multiple of 16KB configurable by the user.

Then, setting the EMS page frame at C000h in PC-98 mode conflicts with the DOS private area, the UMB emulation, and the PC-98 sound BIOS, so if the EMS page frame is moved down that low, DOS emulation must force it's private area down into conventional memory and UMBs must be disabled. If the EMM page frame overlaps the PC-98 sound BIOS, then the EMM region must be clipped to avoid that conflict and a message must be printed to the log notifying the user that this happened.

In IBM PC mode the EMS page frame must be limited so as not to overlap the VGA BIOS at C000h. It can exist at C000h if emulating a machine where there is no VGA BIOS (CGA/MDA/Hercules emulation).

It will happen but it's a bit more work than I initially thought.