1
0
Fork 0

add PCJr-compatible keyboard layer;

add support for PCJr cartridges


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2402
This commit is contained in:
Sebastian Strohhäcker 2005-12-04 21:17:29 +00:00
parent 6ede5e436f
commit 90d6d74f99
5 changed files with 91 additions and 46 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: bios.cpp,v 1.52 2005-12-02 13:10:18 c2woody Exp $ */
/* $Id: bios.cpp,v 1.53 2005-12-04 21:17:29 c2woody Exp $ */
#include "dosbox.h"
#include "mem.h"
@ -789,6 +789,13 @@ void BIOS_ZeroExtendedSize(bool in) {
if(other_memsystems < 0) other_memsystems=0;
}
#define RAM_REFRESH_DELAY 16.7f
static void RAMRefresh_Event(Bitu val) {
PIC_ActivateIRQ(5);
PIC_AddEvent(RAMRefresh_Event,RAM_REFRESH_DELAY);
}
void BIOS_SetupKeyboard(void);
void BIOS_SetupDisks(void);
@ -964,7 +971,8 @@ public:
IO_Write(0x70,0x30);
size_extended=IO_Read(0x71);
IO_Write(0x70,0x31);
size_extended|=(IO_Read(0x71) << 8);
size_extended|=(IO_Read(0x71) << 8);
if (machine==MCH_PCJR) PIC_AddEvent(RAMRefresh_Event,RAM_REFRESH_DELAY);
}
~BIOS(){
/* abort DAC playing */

View file

@ -25,7 +25,7 @@
#include "inout.h"
static Bitu call_int16,call_irq1;
static Bitu call_int16,call_irq1,call_irq6;
/* Nice table from BOCHS i should feel bad for ripping this */
#define none 0
@ -438,6 +438,21 @@ irq1_return:
return CBRET_NONE;
}
static bool pcjr_extended_key=false;
static Bitu IRQ6_Handler(void) {
Bit8u scancode=IO_Read(0x60);
Bit16u old_ax=reg_ax;
if (pcjr_extended_key) reg_ax=scancode<<8;
else reg_al=scancode;
pcjr_extended_key=(scancode==0xe0);
/* call the real keyboard IRQ now, with the scancode in AL */
CALLBACK_RunRealInt(0x09);
reg_ax=old_ax;
IO_Write(0x20,0x20);
return CBRET_NONE;
}
/* check whether key combination is enhanced or not,
translate key if necessary */
static bool IsEnhancedKey(Bit16u &key) {
@ -592,6 +607,11 @@ void BIOS_SetupKeyboard(void) {
RealSetVec(0x16,CALLBACK_RealPointer(call_int16));
CALLBACK_Setup(call_irq1,&IRQ1_Handler,CB_IRET,"keyboard irq");
RealSetVec(0x9,CALLBACK_RealPointer(call_irq1));
if (machine==MCH_PCJR) {
call_irq6=CALLBACK_Allocate();
CALLBACK_Setup(call_irq6,&IRQ6_Handler,CB_IRET,"PCJr kb irq");
RealSetVec(0x0e,CALLBACK_RealPointer(call_irq6));
}
/* bring the all port operations outside the callback */
phys_writeb(CB_BASE+(call_irq1<<4)+0x00,(Bit8u)0x50); // push ax