1
0
Fork 0

Add support for Print Screen key and interrupt. The keypress allows Descent 1 and 2 ingame screenshot feature to be used, the keypress and interrupt allow the Horror Hotel (TSR text adventure) hotkey to work, and the compatible interrupt handler location fixes a game bug in The Forgotten Land.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3961
This commit is contained in:
ripsaw8080 2016-02-05 13:41:22 +00:00
parent 18f5c4c565
commit 26dd1635b5
5 changed files with 39 additions and 2 deletions

View file

@ -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))

View file

@ -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

View file

@ -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");

View file

@ -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

View file

@ -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