Add config option "dos/dos idle api"

This commit is contained in:
finalpatch
2023-02-05 23:37:00 +11:00
parent d0768d6540
commit 7e875101f8
4 changed files with 34 additions and 17 deletions

View File

@@ -723,19 +723,23 @@ bool device_CON::Read(uint8_t * data,uint16_t * size) {
const uint8_t int16_poll_function=(IS_EGAVGA_ARCH)?0x11:0x1;
const uint8_t int16_read_function=(IS_EGAVGA_ARCH)?0x10:0x0;
// Poll the keyboard until there is a key-press ready to read. If there
// is no input (ZF=0) then call INT 28h to release the rest of our
// timeslice to host system.
while (true) {
reg_ah=int16_poll_function;
if (IS_PC98_ARCH)
INT16_Handler_Wrap();
else
CALLBACK_RunRealInt(0x16);
if (GETFLAG(ZF) == 0) {
break;
} else {
CALLBACK_RunRealInt(0x28);
static const bool idle_enabled = ((Section_prop*)control->GetSection("dos"))->Get_bool("dos idle api");
if (idle_enabled) {
// Poll the keyboard until there is a key-press ready to read. If there
// is no input (ZF=0) then call INT 28h to release the rest of our
// timeslice to host system.
while (true) {
reg_ah=int16_poll_function;
if (IS_PC98_ARCH)
INT16_Handler_Wrap();
else
CALLBACK_RunRealInt(0x16);
if (GETFLAG(ZF) == 0) {
break;
} else {
CALLBACK_RunRealInt(0x28);
}
}
}

View File

@@ -4262,7 +4262,11 @@ public:
callback[4].Install(DOS_27Handler,CB_IRET,"DOS Int 27");
callback[4].Set_RealVec(0x27);
callback[5].Install(NULL,CB_INT28,"DOS idle");
if (section->Get_bool("dos idle api")) {
callback[5].Install(NULL,CB_INT28,"DOS idle");
} else {
callback[5].Install(NULL,CB_IRET,"DOS idle");
}
callback[5].Set_RealVec(0x28);
if (IS_PC98_ARCH) {

View File

@@ -397,10 +397,15 @@ static bool DOS_MultiplexFunctions(void) {
return false;
}
case 0x1680: /* RELEASE CURRENT VIRTUAL MACHINE TIME-SLICE */
CPU_STI();
CPU_HLT(reg_eip);
reg_al = 0;
{
static const bool idle_enabled = ((Section_prop*)control->GetSection("dos"))->Get_bool("dos idle api");
if (idle_enabled) {
CPU_STI();
CPU_HLT(reg_eip);
reg_al = 0;
}
return true;
}
case 0x1689: /* Kernel IDLE CALL */
case 0x168f: /* Close awareness crap */
/* Removing warning */

View File

@@ -4503,6 +4503,10 @@ void DOSBOX_SetupConfigSections(void) {
Pbool->Set_help("If set, DOS APIs for communications with the Windows clipboard will be enabled for shared clipboard communications.");
Pbool->SetBasic(true);
Pbool = secprop->Add_bool("dos idle api",Property::Changeable::OnlyAtStart,true);
Pbool->Set_help("If set, DOSBox-X can lower the host system's CPU load when a supported guest program is idle.");
Pbool->SetBasic(true);
secprop=control->AddSection_prop("ipx",&Null_Init,true);
Pbool = secprop->Add_bool("ipx",Property::Changeable::WhenIdle, false);
Pbool->Set_help("Enable ipx over UDP/IP emulation.");