void x86_out_keyboard(Bitu port, Bitu val) { //write_log("write %02x %02x\n", port, val); switch(port) { case 0x60: write_p60(port, val, 1); break; case 0x61: write_p61(port, val, 1); break; case 0x64: write_p64(port, val, 1); break; } }
void KEYBOARD_OnReset(Section *sec) { Section_prop *section=static_cast<Section_prop *>(control->GetSection("keyboard")); LOG(LOG_MISC,LOG_DEBUG)("Keyboard reinitializing"); if ((keyb.enable_aux=section->Get_bool("aux")) != false) { LOG(LOG_KEYBOARD,LOG_NORMAL)("Keyboard AUX emulation enabled"); } TIMER_DelTickHandler(&KEYBOARD_TickHandler); allow_keyb_reset = section->Get_bool("allow output port reset"); keyb.ps2mouse.int33_taken = 0; keyb.ps2mouse.reset_mode = MM_STREAM; /* NTS: I was wrong: PS/2 mice default to streaming after reset */ const char * sbtype=section->Get_string("auxdevice"); keyb.ps2mouse.type = MOUSE_NONE; if (sbtype != NULL) { if (!strcasecmp(sbtype,"2button")) keyb.ps2mouse.type=MOUSE_2BUTTON; else if (!strcasecmp(sbtype,"3button")) keyb.ps2mouse.type=MOUSE_3BUTTON; else if (!strcasecmp(sbtype,"intellimouse")) keyb.ps2mouse.type=MOUSE_INTELLIMOUSE; else if (!strcasecmp(sbtype,"intellimouse45")) keyb.ps2mouse.type=MOUSE_INTELLIMOUSE45; else if (!strcasecmp(sbtype,"none")) keyb.ps2mouse.type=MOUSE_NONE; else { keyb.ps2mouse.type=MOUSE_INTELLIMOUSE; LOG(LOG_KEYBOARD,LOG_ERROR)("Assuming PS/2 intellimouse, I don't know what '%s' is",sbtype); } } IO_RegisterWriteHandler(0x60,write_p60,IO_MB); IO_RegisterReadHandler(0x60,read_p60,IO_MB); IO_RegisterWriteHandler(0x61,write_p61,IO_MB); IO_RegisterReadHandler(0x61,read_p61,IO_MB); IO_RegisterWriteHandler(0x64,write_p64,IO_MB); IO_RegisterReadHandler(0x64,read_p64,IO_MB); TIMER_AddTickHandler(&KEYBOARD_TickHandler); write_p61(0,0,0); KEYBOARD_Reset(); AUX_Reset(); }
void KEYBOARD_Init(Section* sec) { IO_RegisterWriteHandler(0x60,write_p60,IO_MB); IO_RegisterReadHandler(0x60,read_p60,IO_MB); IO_RegisterWriteHandler(0x61,write_p61,IO_MB); IO_RegisterReadHandler(0x61,read_p61,IO_MB); IO_RegisterWriteHandler(0x64,write_p64,IO_MB); IO_RegisterReadHandler(0x64,read_p64,IO_MB); TIMER_AddTickHandler(&KEYBOARD_TickHandler); write_p61(0,0,0); /* Init the keyb struct */ keyb.active=true; keyb.scanning=true; keyb.command=CMD_NONE; keyb.p60changed=false; keyb.repeat.key=KBD_NONE; keyb.repeat.pause=500; keyb.repeat.rate=33; keyb.repeat.wait=0; KEYBOARD_ClrBuffer(); }