1
0
Fork 0

Implement timer 2 output on port 61h; fixes SB detection in Abaron. Also implement port 62h with timer 2 output for CGA and Hercules machine types; fixes Frank Bruno's Boxing and Math Maze.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4187
This commit is contained in:
ripsaw8080 2019-02-04 15:11:50 +00:00
parent 014326476f
commit d4c38121c9
2 changed files with 14 additions and 1 deletions

View file

@ -170,9 +170,11 @@ static void write_p60(Bitu port,Bitu val,Bitu iolen) {
}
}
extern bool TIMER_GetOutput2(void);
static Bit8u port_61_data = 0;
static Bitu read_p61(Bitu port,Bitu iolen) {
port_61_data^=0x20;
if (TIMER_GetOutput2()) port_61_data|=0x20;
else port_61_data&=~0x20;
port_61_data^=0x10;
return port_61_data;
}
@ -186,6 +188,12 @@ static void write_p61(Bitu port,Bitu val,Bitu iolen) {
port_61_data = val;
}
static Bitu read_p62(Bitu port,Bitu iolen) {
Bit8u ret=~0x20;
if (TIMER_GetOutput2()) ret|=0x20;
return ret;
}
static void write_p64(Bitu port,Bitu val,Bitu iolen) {
switch (val) {
case 0xae: /* Activate keyboard */
@ -377,6 +385,7 @@ void KEYBOARD_Init(Section* sec) {
IO_RegisterReadHandler(0x60,read_p60,IO_MB);
IO_RegisterWriteHandler(0x61,write_p61,IO_MB);
IO_RegisterReadHandler(0x61,read_p61,IO_MB);
if (machine==MCH_CGA || machine==MCH_HERC) IO_RegisterReadHandler(0x62,read_p62,IO_MB);
IO_RegisterWriteHandler(0x64,write_p64,IO_MB);
IO_RegisterReadHandler(0x64,read_p64,IO_MB);
TIMER_AddTickHandler(&KEYBOARD_TickHandler);

View file

@ -402,6 +402,10 @@ void TIMER_SetGate2(bool in) {
gate2 = in; //Set it here so the counter_latch above works
}
bool TIMER_GetOutput2(void) {
return counter_output(2);
}
class TIMER:public Module_base{
private:
IO_ReadHandleObject ReadHandler[4];