Added code to autosize VGA BIOS first, then pick private space, and then

UMB block. When compatible mapping is disabled, it helps pack adapter
ROM usage down and allows up to 176KB of extra space should DOS programs
use any UMBs.
This commit is contained in:
Jonathan Campbell 2014-01-18 18:28:57 -08:00
parent 3db3ec4105
commit 2f3e09b356
4 changed files with 26 additions and 16 deletions

View File

@ -46,6 +46,10 @@ RealPt DOS_TableLowCase;
extern bool mainline_compatible_mapping;
extern Bitu INT10_VGA_BIOS_Size;
extern Bitu INT10_VGA_BIOS_SEG;
extern Bitu INT10_VGA_BIOS_SEG_END;
static Bitu call_casemap;
static Bit16u dos_memseg=0;//DOS_PRIVATE_SEGMENT;
@ -66,10 +70,21 @@ void DOS_GetMemory_Choose() {
DOS_PRIVATE_SEGMENT=0xc800;
DOS_PRIVATE_SEGMENT_END=0xc800 + DOS_PRIVATE_SEGMENT_Size;
}
else {
else if (INT10_VGA_BIOS_SEG_END == 0) {
fprintf(stderr,"WARNING: VGA ROM BIOS not initialized, assuming default\n");
DOS_PRIVATE_SEGMENT=0xc800;
DOS_PRIVATE_SEGMENT_END=0xc800 + DOS_PRIVATE_SEGMENT_Size;
}
else {
/* automatically position ourself just past the VGA BIOS */
DOS_PRIVATE_SEGMENT=INT10_VGA_BIOS_SEG_END;
DOS_PRIVATE_SEGMENT_END=INT10_VGA_BIOS_SEG_END + DOS_PRIVATE_SEGMENT_Size;
}
if (DOS_PRIVATE_SEGMENT >= 0xA000) {
memset((char*)MemBase+(DOS_PRIVATE_SEGMENT<<4),0x00,(DOS_PRIVATE_SEGMENT_END-DOS_PRIVATE_SEGMENT)<<4);
MEM_map_RAM_physmem(DOS_PRIVATE_SEGMENT<<4,(DOS_PRIVATE_SEGMENT_END<<4)-1);
}
fprintf(stderr,"DOS private segment set to 0x%04x-0x%04x\n",DOS_PRIVATE_SEGMENT,DOS_PRIVATE_SEGMENT_END-1);
}

View File

@ -971,9 +971,9 @@ void DOSBOX_Init(void) {
Pint->Set_values(rates);
Pint->Set_help("Sample rate of the PS1 audio emulation.");
secprop=control->AddSection_prop("joystick",&BIOS_Init,false);//done
secprop=control->AddSection_prop("joystick",&JOYSTICK_Init,false);//done
secprop->AddInitFunction(&BIOS_Init); // <- FIXME: BIOS was moved here to take precedence over DOS kernel init. Did we break anything by doing this?
secprop->AddInitFunction(&INT10_Init);
secprop->AddInitFunction(&JOYSTICK_Init);
const char* joytypes[] = { "auto", "2axis", "4axis", "4axis_2", "fcs", "ch", "none",0};
Pstring = secprop->Add_string("joysticktype",Property::Changeable::WhenIdle,"auto");
Pstring->Set_values(joytypes);

View File

@ -800,17 +800,6 @@ public:
for (i=0xf0;i<0x100;i++) {
memory.phandlers[i] = &rom_page_handler;
}
/* except for a 32KB region C800:0000 which is used as a private area for DOSBox (mainline DOSBox behavior), */
/* NTS: The DOS XMS emulation will later modify this memory map to enable the UMB region if umb=true */
DOS_GetMemory_Choose();
if (DOS_PRIVATE_SEGMENT >= 0xA000) {
assert(DOS_PRIVATE_SEGMENT < DOS_PRIVATE_SEGMENT_END);
memset((char*)MemBase+(DOS_PRIVATE_SEGMENT<<4),0x00,(DOS_PRIVATE_SEGMENT_END-DOS_PRIVATE_SEGMENT)<<4);
for (i=(DOS_PRIVATE_SEGMENT>>8);i<((DOS_PRIVATE_SEGMENT_END+0xFF)>>8);i++) {
memory.phandlers[i] = ram_ptr; /* <- NTS: Must be RAM. Mapping as ROM only causes an infinite loop */
memory.mhandles[i] = 0; //Set to 0 for memory allocation
}
}
if (machine==MCH_PCJR) {
/* Setup cartridge rom at 0xe0000-0xf0000 */
for (i=0xe0;i<0xf0;i++) {

View File

@ -419,6 +419,10 @@ Bitu XMS_Handler(void) {
extern bool mainline_compatible_mapping;
extern Bitu INT10_VGA_BIOS_Size;
extern Bitu INT10_VGA_BIOS_SEG;
extern Bitu INT10_VGA_BIOS_SEG_END;
Bitu GetEMSType(Section_prop * section);
void DOS_GetMemory_Choose();
@ -467,8 +471,10 @@ public:
}
if (first_umb_size == 0) first_umb_size = 0xEFFF;
if (first_umb_seg < 0xC800 || first_umb_seg < DOS_PRIVATE_SEGMENT_END) {
fprintf(stderr,"UMB warning: UMB blocks before 0xD000 conflict with VGA (0xA000-0xBFFF), VGA BIOS (0xC000-0xC7FF) and DOSBox private area (0x%04x-0x%04x)\n",
if (first_umb_seg < 0xC000 || first_umb_seg < DOS_PRIVATE_SEGMENT_END) {
fprintf(stderr,"UMB warning: UMB blocks before 0xD000 conflict with VGA (0xA000-0xBFFF), "
"VGA BIOS (0x%04x-0x%04x) and DOSBox private area (0x%04x-0x%04x)\n",
INT10_VGA_BIOS_SEG,INT10_VGA_BIOS_SEG_END-1,
DOS_PRIVATE_SEGMENT,DOS_PRIVATE_SEGMENT_END-1);
first_umb_seg = std::max((Bitu)0xC800,(Bitu)DOS_PRIVATE_SEGMENT_END);
}