BIOS and DOS CON device: Make STOP key work the same way as CTRL+C and CTRL+BREAK

This commit is contained in:
Jonathan Campbell
2020-10-16 10:55:47 -07:00
parent 5b7704b8a8
commit bb7f91b865
3 changed files with 28 additions and 1 deletions

View File

@@ -672,6 +672,12 @@ bool device_CON::Read(uint8_t * data,uint16_t * size) {
continue;
}
// Make STOP key work
if (IS_PC98_ARCH && DOS_BreakFlag) {
data[count++]=0x03; // CTRL+C
continue;
}
reg_ah=(IS_EGAVGA_ARCH)?0x10:0x0;
/* FIXME: PC-98 emulation should eventually use CONIO emulation that

View File

@@ -6972,10 +6972,17 @@ uint32_t BIOS_get_PC98_INT_STUB(void) {
Bitu call_pc98_default_stop;
extern bool DOS_BreakFlag;
static Bitu pc98_default_stop_handler(void) {
// INT 06h, which means someone pressed the STOP key... or the CPU is signalling an invalid opcode.
// The overlap makes it extremely unclear.
LOG_MSG("Invalid opcode or unhandled PC-98 STOP key interrupt 06h");
// try to make it work as CTRL+BREAK in the built-in DOS environment.
if (!dos_kernel_disabled)
DOS_BreakFlag = true;
return CBRET_NONE;
}

View File

@@ -1402,6 +1402,8 @@ static bool IsEnhancedKey(uint16_t &key) {
return false;
}
extern bool DOS_BreakFlag;
bool int16_unmask_irq1_on_read = true;
bool int16_ah_01_cf_undoc = true;
@@ -1412,6 +1414,12 @@ Bitu INT16_Handler(void) {
if (int16_unmask_irq1_on_read)
PIC_SetIRQMask(1,false); /* unmask keyboard */
// HACK: Make STOP key work
if (IS_PC98_ARCH && DOS_BreakFlag) {
reg_ax=0;
return CBRET_NONE;
}
if ((get_key(temp)) && (!IsEnhancedKey(temp))) {
/* normal key found, return translated key in ax */
reg_ax=temp;
@@ -1424,6 +1432,12 @@ Bitu INT16_Handler(void) {
if (int16_unmask_irq1_on_read)
PIC_SetIRQMask(1,false); /* unmask keyboard */
// HACK: Make STOP key work
if (IS_PC98_ARCH && DOS_BreakFlag) {
reg_ax=0;
return CBRET_NONE;
}
if (get_key(temp)) {
if (!IS_PC98_ARCH && ((temp&0xff)==0xf0) && (temp>>8)) {
/* special enhanced key, clear low part before returning key */