diff --git a/include/bios.h b/include/bios.h index 213c73d6..4915a52a 100644 --- a/include/bios.h +++ b/include/bios.h @@ -103,6 +103,7 @@ #define BIOS_DEFAULT_HANDLER_LOCATION (RealMake(0xf000,0xff53)) +#define BIOS_DEFAULT_INT5_LOCATION (RealMake(0xf000,0xff54)) #define BIOS_DEFAULT_IRQ0_LOCATION (RealMake(0xf000,0xfea5)) #define BIOS_DEFAULT_IRQ1_LOCATION (RealMake(0xf000,0xe987)) #define BIOS_DEFAULT_IRQ2_LOCATION (RealMake(0xf000,0xff55)) diff --git a/src/cpu/callback.cpp b/src/cpu/callback.cpp index 716608aa..609db80b 100644 --- a/src/cpu/callback.cpp +++ b/src/cpu/callback.cpp @@ -256,7 +256,15 @@ Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_ phys_writew(physAddress+0x0b,(Bit16u)0x20e6); // out 0x20, al phys_writeb(physAddress+0x0d,(Bit8u)0x58); // pop ax phys_writeb(physAddress+0x0e,(Bit8u)0xcf); //An IRET Instruction - return (use_cb?0x15:0x0f); + phys_writeb(physAddress+0x0f,(Bit8u)0xfa); // cli + phys_writew(physAddress+0x10,(Bit16u)0x20b0); // mov al, 0x20 + phys_writew(physAddress+0x12,(Bit16u)0x20e6); // out 0x20, al + phys_writeb(physAddress+0x14,(Bit8u)0x55); // push bp + phys_writew(physAddress+0x15,(Bit16u)0x05cd); // int 5 + phys_writeb(physAddress+0x17,(Bit8u)0x5d); // pop bp + phys_writeb(physAddress+0x18,(Bit8u)0x58); // pop ax + phys_writeb(physAddress+0x19,(Bit8u)0xcf); //An IRET Instruction + return (use_cb?0x20:0x1a); case CB_IRQ9: // pic cascade interrupt if (use_cb) { phys_writeb(physAddress+0x00,(Bit8u)0xFE); //GRP 4 diff --git a/src/hardware/keyboard.cpp b/src/hardware/keyboard.cpp index f3ef7e53..f85f5ab4 100644 --- a/src/hardware/keyboard.cpp +++ b/src/hardware/keyboard.cpp @@ -339,7 +339,10 @@ void KEYBOARD_AddKey(KBD_KEYS keytype,bool pressed) { KEYBOARD_AddBuffer(69|(pressed?0:0x80)); return; case KBD_printscreen: - /* Not handled yet. But usuable in mapper for special events */ + KEYBOARD_AddBuffer(0xe0); + KEYBOARD_AddBuffer(42|(pressed?0:0x80)); + KEYBOARD_AddBuffer(0xe0); + KEYBOARD_AddBuffer(55|(pressed?0:0x80)); return; default: E_Exit("Unsupported key press"); diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index 77e92ae9..34679eb3 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -1102,6 +1102,11 @@ public: CALLBACK_Setup(call_irq2,NULL,CB_IRET_EOI_PIC1,Real2Phys(BIOS_DEFAULT_IRQ2_LOCATION),"irq 2 bios"); RealSetVec(0x0a,BIOS_DEFAULT_IRQ2_LOCATION); + // INT 05h: Print Screen + // IRQ1 handler calls it when PrtSc key is pressed; does nothing unless hooked + phys_writeb(Real2Phys(BIOS_DEFAULT_INT5_LOCATION),0xcf); + RealSetVec(0x05,BIOS_DEFAULT_INT5_LOCATION); + /* Some hardcoded vectors */ phys_writeb(Real2Phys(BIOS_DEFAULT_HANDLER_LOCATION),0xcf); /* bios default interrupt vector location -> IRET */ phys_writew(Real2Phys(RealGetVec(0x12))+0x12,0x20); //Hack for Jurresic diff --git a/src/ints/bios_keyboard.cpp b/src/ints/bios_keyboard.cpp index 8590b43a..7628a22a 100644 --- a/src/ints/bios_keyboard.cpp +++ b/src/ints/bios_keyboard.cpp @@ -284,6 +284,13 @@ static Bitu IRQ1_Handler(void) { case 0xb6: /* Right Shift Released */ flags1 &=~0x01; break; + case 0x37: /* Keypad * or PrtSc Pressed */ + if (!(flags3 &0x02)) goto normal_key; + reg_ip+=7; // call int 5 + break; + case 0xb7: /* Keypad * or PrtSc Released */ + if (!(flags3 &0x02)) goto normal_key; + break; case 0x38: /* Alt Pressed */ flags1 |=0x08; if (flags3 &0x02) flags3 |=0x08; @@ -399,6 +406,7 @@ static Bitu IRQ1_Handler(void) { break; default: /* Normal Key */ +normal_key: Bit16u asciiscan; /* Now Handle the releasing of keys and see if they match up for a code */ /* Handle the actual scancode */ @@ -638,6 +646,14 @@ void BIOS_SetupKeyboard(void) { // out 0x20, al // pop ax // iret + // cli + // mov al, 0x20 + // out 0x20, al + // push bp + // int 0x05 + // pop bp + // pop ax + // iret if (machine==MCH_PCJR) { call_irq6=CALLBACK_Allocate(); @@ -648,7 +664,11 @@ void BIOS_SetupKeyboard(void) { // in al, 0x60 // cmp al, 0xe0 // je skip + // push ds + // push 0x40 + // pop ds // int 0x09 + // pop ds // label skip: // cli // mov al, 0x20