void VGA_SetupAttr(void) { if (machine==MCH_VGA) { IO_RegisterReadHandler(0x3c0,read_p3c0,IO_MB); IO_RegisterWriteHandler(0x3c0,write_p3c0,IO_MB); IO_RegisterReadHandler(0x3c1,read_p3c1,IO_MB); } }
void VGA_SetupAttr(void) { if (IS_EGAVGA_ARCH) { IO_RegisterWriteHandler(0x3c0,write_p3c0,IO_MB); if (IS_VGA_ARCH) { IO_RegisterReadHandler(0x3c0,read_p3c0,IO_MB); IO_RegisterReadHandler(0x3c1,read_p3c1,IO_MB); } } }
void VGA_SetupGFX(void) { if (IS_EGAVGA_ARCH) { IO_RegisterWriteHandler(0x3ce,write_p3ce,IO_MB); IO_RegisterWriteHandler(0x3cf,write_p3cf,IO_MB); if (IS_VGA_ARCH) { IO_RegisterReadHandler(0x3ce,read_p3ce,IO_MB); IO_RegisterReadHandler(0x3cf,read_p3cf,IO_MB); } } }
void VGA_SetupMisc(void) { if (machine==MCH_VGA) { IO_RegisterReadHandler(0x3ca,read_p3ca,IO_MB); IO_RegisterReadHandler(0x3c2,read_p3c2,IO_MB); IO_RegisterWriteHandler(0x3c2,write_p3c2,IO_MB); IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB); } else if (machine==MCH_CGA || IS_TANDY_ARCH) { IO_RegisterReadHandler(0x3da,vga_read_p3da,IO_MB); } else if (machine==MCH_HERC) { IO_RegisterReadHandler(0x3ba,vga_read_p3da,IO_MB); } }
void VGA_SetupOther(void) { Bitu i; if (machine==MCH_CGA || IS_TANDY_ARCH) { extern Bit8u int10_font_08[256 * 8]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_08[i*8],8); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; } if (machine==MCH_HERC) { extern Bit8u int10_font_14[256 * 14]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_14[i*14],14); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; } if (machine==MCH_CGA) { IO_RegisterWriteHandler(0x3d8,write_cga,IO_MB); IO_RegisterWriteHandler(0x3d9,write_cga,IO_MB); MAPPER_AddHandler(IncreaseHue,MK_f11,MMOD2,"inchue","Inc Hue"); MAPPER_AddHandler(DecreaseHue,MK_f11,0,"dechue","Dec Hue"); } if (machine==MCH_HERC) { vga.herc.enable_bits=0; vga.herc.mode_control=0x8; IO_RegisterWriteHandler(0x3b8,write_hercules,IO_MB); IO_RegisterWriteHandler(0x3bf,write_hercules,IO_MB); } if (machine==MCH_TANDY) { vga.tandy.is_32k_mode=false; IO_RegisterWriteHandler(0x3d8,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3d9,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3de,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3df,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3da,write_tandy,IO_MB); } if (machine==MCH_PCJR) { vga.tandy.mem_bank=7;vga.tandy.disp_bank=7; vga.tandy.is_32k_mode=false;vga.tandy.pcjr_flipflop=false; IO_RegisterWriteHandler(0x3d9,write_pcjr,IO_MB); IO_RegisterWriteHandler(0x3da,write_pcjr,IO_MB); IO_RegisterWriteHandler(0x3df,write_pcjr,IO_MB); } if (machine==MCH_CGA || machine==MCH_HERC || IS_TANDY_ARCH) { Bitu base=machine==MCH_HERC ? 0x3b4 : 0x3d4; IO_RegisterWriteHandler(base,write_crtc_index_other,IO_MB); IO_RegisterWriteHandler(base+1,write_crtc_data_other,IO_MB); IO_RegisterReadHandler(base,read_crtc_index_other,IO_MB); IO_RegisterReadHandler(base+1,read_crtc_data_other,IO_MB); } }
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 IO_ReadHandleObject::Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range) { if(!installed) { installed=true; m_port=port; m_mask=mask; m_range=range; IO_RegisterReadHandler(port,handler,mask,range); } else E_Exit("IO_readHandler already installed port %x",port); }
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(); }
static void write_p3c2(Bitu port,Bitu val,Bitu iolen) { vga.misc_output=val; if (val & 0x1) { IO_RegisterWriteHandler(0x3d4,vga_write_p3d4,IO_MB); IO_RegisterReadHandler(0x3d4,vga_read_p3d4,IO_MB); IO_RegisterReadHandler(0x3da,vga_read_p3da,IO_MB); IO_RegisterWriteHandler(0x3d5,vga_write_p3d5,IO_MB); IO_RegisterReadHandler(0x3d5,vga_read_p3d5,IO_MB); IO_FreeWriteHandler(0x3b4,IO_MB); IO_FreeReadHandler(0x3b4,IO_MB); IO_FreeWriteHandler(0x3b5,IO_MB); IO_FreeReadHandler(0x3b5,IO_MB); IO_FreeReadHandler(0x3ba,IO_MB); } else { IO_RegisterWriteHandler(0x3b4,vga_write_p3d4,IO_MB); IO_RegisterReadHandler(0x3b4,vga_read_p3d4,IO_MB); IO_RegisterReadHandler(0x3ba,vga_read_p3da,IO_MB); IO_RegisterWriteHandler(0x3b5,vga_write_p3d5,IO_MB); IO_RegisterReadHandler(0x3b5,vga_read_p3d5,IO_MB); IO_FreeWriteHandler(0x3d4,IO_MB); IO_FreeReadHandler(0x3d4,IO_MB); IO_FreeWriteHandler(0x3d5,IO_MB); IO_FreeReadHandler(0x3d5,IO_MB); IO_FreeReadHandler(0x3da,IO_MB); } /* 0 If set Color Emulation. Base Address=3Dxh else Mono Emulation. Base Address=3Bxh. 2-3 Clock Select. 0: 25MHz, 1: 28MHz 5 When in Odd/Even modes Select High 64k bank if set 6 Horizontal Sync Polarity. Negative if set 7 Vertical Sync Polarity. Negative if set Bit 6-7 indicates the number of lines on the display: 1: 400, 2: 350, 3: 480 Note: Set to all zero on a hardware reset. Note: This register can be read from port 3CCh. */ }
void VGA_SetupOther(void) { Bitu i; memset( &vga.tandy, 0, sizeof( vga.tandy )); //Initialize values common for most machines, can be overwritten vga.tandy.draw_base = vga.mem.linear; vga.tandy.mem_base = vga.mem.linear; vga.tandy.addr_mask = 8*1024 - 1; vga.tandy.line_mask = 3; vga.tandy.line_shift = 13; if (machine==MCH_CGA || IS_TANDY_ARCH) { extern Bit8u int10_font_08[256 * 8]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_08[i*8],8); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; } if (machine==MCH_HERC) { extern Bit8u int10_font_14[256 * 14]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_14[i*14],14); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; } if (machine==MCH_CGA) { IO_RegisterWriteHandler(0x3d8,write_cga,IO_MB); IO_RegisterWriteHandler(0x3d9,write_cga,IO_MB); MAPPER_AddHandler(IncreaseHue,MK_f11,MMOD2,"inchue","Inc Hue"); MAPPER_AddHandler(DecreaseHue,MK_f11,0,"dechue","Dec Hue"); } if (machine==MCH_TANDY) { write_tandy( 0x3df, 0x0, 0 ); IO_RegisterWriteHandler(0x3d8,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3d9,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3de,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3df,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3da,write_tandy,IO_MB); } if (machine==MCH_PCJR) { //write_pcjr will setup base address write_pcjr( 0x3df, 0x7 | (0x7 << 3), 0 ); IO_RegisterWriteHandler(0x3d9,write_pcjr,IO_MB); IO_RegisterWriteHandler(0x3da,write_pcjr,IO_MB); IO_RegisterWriteHandler(0x3df,write_pcjr,IO_MB); } if (machine==MCH_HERC) { Bitu base=0x3b0; for (Bitu i = 0; i < 4; i++) { // The registers are repeated as the address is not decoded properly; // The official ports are 3b4, 3b5 IO_RegisterWriteHandler(base+i*2,write_crtc_index_other,IO_MB); IO_RegisterWriteHandler(base+i*2+1,write_crtc_data_other,IO_MB); IO_RegisterReadHandler(base+i*2,read_crtc_index_other,IO_MB); IO_RegisterReadHandler(base+i*2+1,read_crtc_data_other,IO_MB); } vga.herc.enable_bits=0; vga.herc.mode_control=0xa; // first mode written will be text mode vga.crtc.underline_location = 13; IO_RegisterWriteHandler(0x3b8,write_hercules,IO_MB); IO_RegisterWriteHandler(0x3bf,write_hercules,IO_MB); IO_RegisterReadHandler(0x3ba,read_herc_status,IO_MB); } if (machine==MCH_CGA) { Bitu base=0x3d0; for (Bitu port_ct=0; port_ct<4; port_ct++) { IO_RegisterWriteHandler(base+port_ct*2,write_crtc_index_other,IO_MB); IO_RegisterWriteHandler(base+port_ct*2+1,write_crtc_data_other,IO_MB); IO_RegisterReadHandler(base+port_ct*2,read_crtc_index_other,IO_MB); IO_RegisterReadHandler(base+port_ct*2+1,read_crtc_data_other,IO_MB); } } if (IS_TANDY_ARCH) { Bitu base=0x3d4; IO_RegisterWriteHandler(base,write_crtc_index_other,IO_MB); IO_RegisterWriteHandler(base+1,write_crtc_data_other,IO_MB); IO_RegisterReadHandler(base,read_crtc_index_other,IO_MB); IO_RegisterReadHandler(base+1,read_crtc_data_other,IO_MB); } }