Added the IBM 5161 ISA expansion for PC and XT;

Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g  / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
This commit is contained in:
OBattler
2019-09-20 14:02:30 +02:00
parent b06296bbf6
commit 552a87ea3d
524 changed files with 129555 additions and 21862 deletions

View File

@@ -8,15 +8,15 @@
*
* Implementation of the XT-style keyboard.
*
* Version: @(#)keyboard_xt.c 1.0.15 2019/01/24
* Version: @(#)keyboard_xt.c 1.0.17 2019/03/05
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van kempen.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van kempen.
*/
#include <stdio.h>
#include <stdint.h>
@@ -24,16 +24,17 @@
#include <string.h>
#include <wchar.h>
#include "86box.h"
#include "device.h"
#include "timer.h"
#include "floppy/fdd.h"
#include "machine/machine.h"
#include "machine/m_xt_t1000.h"
#include "io.h"
#include "pic.h"
#include "pit.h"
#include "ppi.h"
#include "mem.h"
#include "rom.h"
#include "timer.h"
#include "device.h"
#include "sound/sound.h"
#include "sound/snd_speaker.h"
#include "video/video.h"
@@ -58,273 +59,296 @@ typedef struct {
uint8_t pa, pb, pd;
uint8_t key_waiting;
uint8_t type;
pc_timer_t send_delay_timer;
} xtkbd_t;
/*XT keyboard has no escape scancodes, and no scancodes beyond 53*/
const scancode scancode_xt[512] = {
{ {-1}, {-1} }, { {0x01, -1}, {0x81, -1} },
{ {0x02, -1}, {0x82, -1} }, { {0x03, -1}, {0x83, -1} },
{ {0x04, -1}, {0x84, -1} }, { {0x05, -1}, {0x85, -1} },
{ {0x06, -1}, {0x86, -1} }, { {0x07, -1}, {0x87, -1} },
{ {0x08, -1}, {0x88, -1} }, { {0x09, -1}, {0x89, -1} },
{ {0x0a, -1}, {0x8a, -1} }, { {0x0b, -1}, {0x8b, -1} },
{ {0x0c, -1}, {0x8c, -1} }, { {0x0d, -1}, {0x8d, -1} },
{ {0x0e, -1}, {0x8e, -1} }, { {0x0f, -1}, {0x8f, -1} },
{ {0x10, -1}, {0x90, -1} }, { {0x11, -1}, {0x91, -1} },
{ {0x12, -1}, {0x92, -1} }, { {0x13, -1}, {0x93, -1} },
{ {0x14, -1}, {0x94, -1} }, { {0x15, -1}, {0x95, -1} },
{ {0x16, -1}, {0x96, -1} }, { {0x17, -1}, {0x97, -1} },
{ {0x18, -1}, {0x98, -1} }, { {0x19, -1}, {0x99, -1} },
{ {0x1a, -1}, {0x9a, -1} }, { {0x1b, -1}, {0x9b, -1} },
{ {0x1c, -1}, {0x9c, -1} }, { {0x1d, -1}, {0x9d, -1} },
{ {0x1e, -1}, {0x9e, -1} }, { {0x1f, -1}, {0x9f, -1} },
{ {0x20, -1}, {0xa0, -1} }, { {0x21, -1}, {0xa1, -1} },
{ {0x22, -1}, {0xa2, -1} }, { {0x23, -1}, {0xa3, -1} },
{ {0x24, -1}, {0xa4, -1} }, { {0x25, -1}, {0xa5, -1} },
{ {0x26, -1}, {0xa6, -1} }, { {0x27, -1}, {0xa7, -1} },
{ {0x28, -1}, {0xa8, -1} }, { {0x29, -1}, {0xa9, -1} },
{ {0x2a, -1}, {0xaa, -1} }, { {0x2b, -1}, {0xab, -1} },
{ {0x2c, -1}, {0xac, -1} }, { {0x2d, -1}, {0xad, -1} },
{ {0x2e, -1}, {0xae, -1} }, { {0x2f, -1}, {0xaf, -1} },
{ {0x30, -1}, {0xb0, -1} }, { {0x31, -1}, {0xb1, -1} },
{ {0x32, -1}, {0xb2, -1} }, { {0x33, -1}, {0xb3, -1} },
{ {0x34, -1}, {0xb4, -1} }, { {0x35, -1}, {0xb5, -1} },
{ {0x36, -1}, {0xb6, -1} }, { {0x37, -1}, {0xb7, -1} },
{ {0x38, -1}, {0xb8, -1} }, { {0x39, -1}, {0xb9, -1} },
{ {0x3a, -1}, {0xba, -1} }, { {0x3b, -1}, {0xbb, -1} },
{ {0x3c, -1}, {0xbc, -1} }, { {0x3d, -1}, {0xbd, -1} },
{ {0x3e, -1}, {0xbe, -1} }, { {0x3f, -1}, {0xbf, -1} },
{ {0x40, -1}, {0xc0, -1} }, { {0x41, -1}, {0xc1, -1} },
{ {0x42, -1}, {0xc2, -1} }, { {0x43, -1}, {0xc3, -1} },
{ {0x44, -1}, {0xc4, -1} }, { {0x45, -1}, {0xc5, -1} },
{ {0x46, -1}, {0xc6, -1} }, { {0x47, -1}, {0xc7, -1} },
{ {0x48, -1}, {0xc8, -1} }, { {0x49, -1}, {0xc9, -1} },
{ {0x4a, -1}, {0xca, -1} }, { {0x4b, -1}, {0xcb, -1} },
{ {0x4c, -1}, {0xcc, -1} }, { {0x4d, -1}, {0xcd, -1} },
{ {0x4e, -1}, {0xce, -1} }, { {0x4f, -1}, {0xcf, -1} },
{ {0x50, -1}, {0xd0, -1} }, { {0x51, -1}, {0xd1, -1} },
{ {0x52, -1}, {0xd2, -1} }, { {0x53, -1}, {0xd3, -1} },
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*054*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*058*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*05c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*060*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*064*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*068*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*06c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*070*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*074*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*078*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*07c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*080*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*084*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*088*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*08c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*090*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*094*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*098*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*09c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0a0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0a4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0a8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0ac*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0b0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0b4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0b8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0bc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0c0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0c4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0c8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0cc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0d0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0d4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0d8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0dc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0e0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0e4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0e8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0ec*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0f0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0f4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0f8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*0fc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*100*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*104*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*108*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*10c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*110*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*114*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*118*/
{ {0x1c, -1}, {0x9c, -1} }, { {0x1d, -1}, {0x9d, -1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*11c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*120*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*124*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*128*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*12c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*130*/
{ {-1}, {-1} }, { {0x35, -1}, {0xb5, -1} },
{ {-1}, {-1} }, { {0x37, -1}, {0xb7, -1} }, /*134*/
{ {0x38, -1}, {0xb8, -1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*138*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*13c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*140*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {0x46, -1}, {0xc6, -1} }, { {0x47, -1}, {0xc7, -1} }, /*144*/
{ {0x48, -1}, {0xc8, -1} }, { {0x49, -1}, {0xc9, -1} },
{ {-1}, {-1} }, { {0x4b, -1}, {0xcb, -1} }, /*148*/
{ {-1}, {-1} }, { {0x4d, -1}, {0xcd, -1} },
{ {-1}, {-1} }, { {0x4f, -1}, {0xcf, -1} }, /*14c*/
{ {0x50, -1}, {0xd0, -1} }, { {0x51, -1}, {0xd1, -1} },
{ {0x52, -1}, {0xd2, -1} }, { {0x53, -1}, {0xd3, -1} }, /*150*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*154*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*158*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*15c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*160*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*164*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*168*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*16c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*170*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*174*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*148*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*17c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*180*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*184*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*88*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*18c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*190*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*194*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*198*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*19c*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1a0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1a4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1a8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1ac*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1b0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1b4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1b8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1bc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1c0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1c4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1c8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1cc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1d0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1d4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1d8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1dc*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1e0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1e4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1e8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1ec*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1f0*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1f4*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} }, /*1f8*/
{ {-1}, {-1} }, { {-1}, {-1} },
{ {-1}, {-1} }, { {-1}, {-1} } /*1fc*/
{ {0}, {0} }, { {0x01, 0}, {0x81, 0} },
{ {0x02, 0}, {0x82, 0} }, { {0x03, 0}, {0x83, 0} },
{ {0x04, 0}, {0x84, 0} }, { {0x05, 0}, {0x85, 0} },
{ {0x06, 0}, {0x86, 0} }, { {0x07, 0}, {0x87, 0} },
{ {0x08, 0}, {0x88, 0} }, { {0x09, 0}, {0x89, 0} },
{ {0x0a, 0}, {0x8a, 0} }, { {0x0b, 0}, {0x8b, 0} },
{ {0x0c, 0}, {0x8c, 0} }, { {0x0d, 0}, {0x8d, 0} },
{ {0x0e, 0}, {0x8e, 0} }, { {0x0f, 0}, {0x8f, 0} },
{ {0x10, 0}, {0x90, 0} }, { {0x11, 0}, {0x91, 0} },
{ {0x12, 0}, {0x92, 0} }, { {0x13, 0}, {0x93, 0} },
{ {0x14, 0}, {0x94, 0} }, { {0x15, 0}, {0x95, 0} },
{ {0x16, 0}, {0x96, 0} }, { {0x17, 0}, {0x97, 0} },
{ {0x18, 0}, {0x98, 0} }, { {0x19, 0}, {0x99, 0} },
{ {0x1a, 0}, {0x9a, 0} }, { {0x1b, 0}, {0x9b, 0} },
{ {0x1c, 0}, {0x9c, 0} }, { {0x1d, 0}, {0x9d, 0} },
{ {0x1e, 0}, {0x9e, 0} }, { {0x1f, 0}, {0x9f, 0} },
{ {0x20, 0}, {0xa0, 0} }, { {0x21, 0}, {0xa1, 0} },
{ {0x22, 0}, {0xa2, 0} }, { {0x23, 0}, {0xa3, 0} },
{ {0x24, 0}, {0xa4, 0} }, { {0x25, 0}, {0xa5, 0} },
{ {0x26, 0}, {0xa6, 0} }, { {0x27, 0}, {0xa7, 0} },
{ {0x28, 0}, {0xa8, 0} }, { {0x29, 0}, {0xa9, 0} },
{ {0x2a, 0}, {0xaa, 0} }, { {0x2b, 0}, {0xab, 0} },
{ {0x2c, 0}, {0xac, 0} }, { {0x2d, 0}, {0xad, 0} },
{ {0x2e, 0}, {0xae, 0} }, { {0x2f, 0}, {0xaf, 0} },
{ {0x30, 0}, {0xb0, 0} }, { {0x31, 0}, {0xb1, 0} },
{ {0x32, 0}, {0xb2, 0} }, { {0x33, 0}, {0xb3, 0} },
{ {0x34, 0}, {0xb4, 0} }, { {0x35, 0}, {0xb5, 0} },
{ {0x36, 0}, {0xb6, 0} }, { {0x37, 0}, {0xb7, 0} },
{ {0x38, 0}, {0xb8, 0} }, { {0x39, 0}, {0xb9, 0} },
{ {0x3a, 0}, {0xba, 0} }, { {0x3b, 0}, {0xbb, 0} },
{ {0x3c, 0}, {0xbc, 0} }, { {0x3d, 0}, {0xbd, 0} },
{ {0x3e, 0}, {0xbe, 0} }, { {0x3f, 0}, {0xbf, 0} },
{ {0x40, 0}, {0xc0, 0} }, { {0x41, 0}, {0xc1, 0} },
{ {0x42, 0}, {0xc2, 0} }, { {0x43, 0}, {0xc3, 0} },
{ {0x44, 0}, {0xc4, 0} }, { {0x45, 0}, {0xc5, 0} },
{ {0x46, 0}, {0xc6, 0} }, { {0x47, 0}, {0xc7, 0} },
{ {0x48, 0}, {0xc8, 0} }, { {0x49, 0}, {0xc9, 0} },
{ {0x4a, 0}, {0xca, 0} }, { {0x4b, 0}, {0xcb, 0} },
{ {0x4c, 0}, {0xcc, 0} }, { {0x4d, 0}, {0xcd, 0} },
{ {0x4e, 0}, {0xce, 0} }, { {0x4f, 0}, {0xcf, 0} },
{ {0x50, 0}, {0xd0, 0} }, { {0x51, 0}, {0xd1, 0} },
{ {0x52, 0}, {0xd2, 0} }, { {0x53, 0}, {0xd3, 0} },
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*054*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*058*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*05c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*060*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*064*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*068*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*06c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*070*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*074*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*078*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*07c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*080*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*084*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*088*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*08c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*090*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*094*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*098*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*09c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0a0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0a4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0a8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0ac*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0b0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0b4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0b8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0bc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0c0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0c4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0c8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0cc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0d0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0d4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0d8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0dc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0e0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0e4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0e8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0ec*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0f0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0f4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0f8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*0fc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*100*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*104*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*108*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*10c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*110*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*114*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*118*/
{ {0x1c, 0}, {0x9c, 0} }, { {0x1d, 0}, {0x9d, 0} },
{ {0}, {0} }, { {0}, {0} }, /*11c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*120*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*124*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*128*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*12c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*130*/
{ {0}, {0} }, { {0x35, 0}, {0xb5, 0} },
{ {0}, {0} }, { {0x37, 0}, {0xb7, 0} }, /*134*/
{ {0x38, 0}, {0xb8, 0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*138*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*13c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*140*/
{ {0}, {0} }, { {0}, {0} },
{ {0x46, 0}, {0xc6, 0} }, { {0x47, 0}, {0xc7, 0} }, /*144*/
{ {0x48, 0}, {0xc8, 0} }, { {0x49, 0}, {0xc9, 0} },
{ {0}, {0} }, { {0x4b, 0}, {0xcb, 0} }, /*148*/
{ {0}, {0} }, { {0x4d, 0}, {0xcd, 0} },
{ {0}, {0} }, { {0x4f, 0}, {0xcf, 0} }, /*14c*/
{ {0x50, 0}, {0xd0, 0} }, { {0x51, 0}, {0xd1, 0} },
{ {0x52, 0}, {0xd2, 0} }, { {0x53, 0}, {0xd3, 0} }, /*150*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*154*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*158*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*15c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*160*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*164*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*168*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*16c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*170*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*174*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*148*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*17c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*180*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*184*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*88*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*18c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*190*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*194*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*198*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*19c*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1a0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1a4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1a8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1ac*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1b0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1b4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1b8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1bc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1c0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1c4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1c8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1cc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1d0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1d4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1d8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1dc*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1e0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1e4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1e8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1ec*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1f0*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1f4*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} }, /*1f8*/
{ {0}, {0} }, { {0}, {0} },
{ {0}, {0} }, { {0}, {0} } /*1fc*/
};
static uint8_t key_queue[16];
static int key_queue_start,
key_queue_end;
static int key_queue_start = 0,
key_queue_end = 0;
static int is_t1x00 = 0;
#ifdef ENABLE_KEYBOARD_XT_LOG
int keyboard_xt_do_log = ENABLE_KEYBOARD_XT_LOG;
static void
kbd_log(const char *fmt, ...)
{
va_list ap;
if (keyboard_xt_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
#define kbd_log(fmt, ...)
#endif
static void
@@ -332,9 +356,9 @@ kbd_poll(void *priv)
{
xtkbd_t *kbd = (xtkbd_t *)priv;
keyboard_delay += (1000LL * TIMER_USEC);
timer_advance_u64(&kbd->send_delay_timer, 1000 * TIMER_USEC);
if (!(kbd->pb & 0x40) && (romset != ROM_TANDY))
if (!(kbd->pb & 0x40) && (kbd->type != 5))
return;
if (kbd->want_irq) {
@@ -342,14 +366,15 @@ kbd_poll(void *priv)
kbd->pa = kbd->key_waiting;
kbd->blocked = 1;
picint(2);
#ifdef ENABLE_KEYBOARD_XT_LOG
kbd_log("keyboard_xt : take IRQ\n");
#endif
}
if (key_queue_start != key_queue_end && !kbd->blocked) {
kbd->key_waiting = key_queue[key_queue_start];
#if ENABLE_KEYBOARD_LOG
pclog("XTkbd: reading %02X from the key queue at %i\n",
kbd->pa, key_queue_start);
#endif
kbd_log("XTkbd: reading %02X from the key queue at %i\n",
kbd->key_waiting, key_queue_start);
key_queue_start = (key_queue_start + 1) & 0x0f;
kbd->want_irq = 1;
}
@@ -359,11 +384,33 @@ kbd_poll(void *priv)
static void
kbd_adddata(uint16_t val)
{
/* Test for T1000 'Fn' key (Right Alt / Right Ctrl) */
if (is_t1x00) {
if (keyboard_recv(0xb8) || keyboard_recv(0x9d)) { /* 'Fn' pressed */
t1000_syskey(0x00, 0x04, 0x00); /* Set 'Fn' indicator */
switch (val) {
case 0x45: /* Num Lock => toggle numpad */
t1000_syskey(0x00, 0x00, 0x10); break;
case 0x47: /* Home => internal display */
t1000_syskey(0x40, 0x00, 0x00); break;
case 0x49: /* PgDn => turbo on */
t1000_syskey(0x80, 0x00, 0x00); break;
case 0x4D: /* Right => toggle LCD font */
t1000_syskey(0x00, 0x00, 0x20); break;
case 0x4F: /* End => external display */
t1000_syskey(0x00, 0x40, 0x00); break;
case 0x51: /* PgDn => turbo off */
t1000_syskey(0x00, 0x80, 0x00); break;
case 0x54: /* SysRQ => toggle window */
t1000_syskey(0x00, 0x00, 0x08); break;
}
} else
t1000_syskey(0x04, 0x00, 0x00); /* Reset 'Fn' indicator */
}
key_queue[key_queue_end] = val;
#if ENABLE_KEYBOARD_LOG
pclog("XTkbd: %02X added to key queue at %i\n",
val, key_queue_end);
#endif
kbd_log("XTkbd: %02X added to key queue at %i\n",
val, key_queue_end);
key_queue_end = (key_queue_end + 1) & 0x0f;
}
@@ -424,7 +471,7 @@ kbd_adddata_process(uint16_t val, void (*adddata)(uint16_t val))
static void
kbd_adddata_ex(uint16_t val)
{
kbd_adddata_process(val, kbd_adddata);
kbd_adddata_process(val, kbd_adddata);
}
@@ -444,12 +491,13 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
kbd->pb = val;
ppi.pb = val;
timer_process();
timer_update_outstanding();
speaker_update();
speaker_gated = val & 1;
speaker_enable = val & 2;
if ((kbd->type <= 1) && !(kbd->pb & 0x08))
speaker_gated = speaker_enable = 1;
else {
speaker_gated = val & 1;
speaker_enable = val & 2;
}
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
@@ -459,7 +507,18 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
kbd->blocked = 0;
picintc(2);
}
#ifdef ENABLE_KEYBOARD_XT_LOG
if (kbd->type <= 1)
kbd_log("Casette motor is %s\n", !(val & 0x08) ? "ON" : "OFF");
#endif
break;
#ifdef ENABLE_KEYBOARD_XT_LOG
case 0x62:
if (kbd->type <= 1)
kbd_log("Casette IN is %i\n", !!(val & 0x10));
break;
#endif
}
}
@@ -485,7 +544,7 @@ kbd_read(uint16_t port, void *priv)
break;
case 0x62:
if (!kbd->type)
if (kbd->type == 0)
ret = 0x00;
else if (kbd->type == 1) {
if (kbd->pb & 0x04)
@@ -499,7 +558,7 @@ kbd_read(uint16_t port, void *priv)
/* LaserXT = Always 512k RAM;
LaserXT/3 = Bit 0: set = 512k, clear = 256k. */
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
if (kbd->type == 5)
if (kbd->type == 6)
ret = (mem_size == 512) ? 0x0d : 0x0c;
else
#endif
@@ -508,12 +567,17 @@ kbd_read(uint16_t port, void *priv)
}
ret |= (ppispeakon ? 0x20 : 0);
if (kbd->type == 4)
/* This is needed to avoid error 131 (cassette error).
This is serial read: bit 5 = clock, bit 4 = data, cassette header is 256 x 0xff. */
if (kbd->type <= 1)
ret |= (ppispeakon ? 0x10 : 0);
if (kbd->type == 5)
ret |= (tandy1k_eeprom_read() ? 0x10 : 0);
break;
case 0x63:
if ((kbd->type == 2) || (kbd->type == 3))
if ((kbd->type == 2) || (kbd->type == 3) || (kbd->type == 4) || (kbd->type == 6))
ret = kbd->pd;
break;
}
@@ -555,6 +619,10 @@ kbd_init(const device_t *info)
kbd_reset(kbd);
kbd->type = info->local;
key_queue_start = key_queue_end = 0;
video_reset(gfxcard);
if (kbd->type <= 3) {
for (i = 0; i < FDD_NUM; i++) {
if (fdd_get_flags(i))
@@ -570,10 +638,12 @@ kbd_init(const device_t *info)
/* Switches 5, 6 - video. */
if (video_is_mda())
kbd->pd |= 0x30;
else
else if (video_is_cga())
kbd->pd |= 0x20; /* 0x10 would be 40x25 */
else
kbd->pd |= 0x00;
/* Switches 3, 4 - memory size. */
if (kbd->type == 3) {
if ((kbd->type == 3) || (kbd->type == 4) || (kbd->type == 6)) {
switch (mem_size) {
case 256:
kbd->pd |= 0x00;
@@ -589,7 +659,7 @@ kbd_init(const device_t *info)
kbd->pd |= 0x0c;
break;
}
} else if (kbd->type == 2) {
} else if (kbd->type >= 1) {
switch (mem_size) {
case 64:
kbd->pd |= 0x00;
@@ -622,15 +692,21 @@ kbd_init(const device_t *info)
break;
}
}
/* Switch 2 - return bit clear (switch ON) because no 8087 right now. */
/* Switch 2 - 8087 FPU. */
if (hasfpu)
kbd->pd |= 0x02;
/* Switch 1 - always off. */
kbd->pd |= 0x01;
kbd->pd |= 0x01;
}
timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, kbd);
timer_add(&kbd->send_delay_timer, kbd_poll, kbd, 1);
keyboard_set_table(scancode_xt);
is_t1x00 = (kbd->type == 6);
return(kbd);
}
@@ -641,7 +717,7 @@ kbd_close(void *priv)
xtkbd_t *kbd = (xtkbd_t *)priv;
/* Stop the timer. */
keyboard_delay = 0;
timer_disable(&kbd->send_delay_timer);
/* Disable scanning. */
keyboard_scan = 0;
@@ -695,10 +771,30 @@ const device_t keyboard_xt86_device = {
NULL, NULL, NULL
};
const device_t keyboard_xt_compaq_device = {
"Compaq Portable Keyboard",
0,
4,
kbd_init,
kbd_close,
kbd_reset,
NULL, NULL, NULL
};
const device_t keyboard_tandy_device = {
"Tandy 1000 Keyboard",
0,
4,
5,
kbd_init,
kbd_close,
kbd_reset,
NULL, NULL, NULL
};
const device_t keyboard_xt_t1x00_device = {
"Toshiba T1x00 Keyboard",
0,
6,
kbd_init,
kbd_close,
kbd_reset,
@@ -709,7 +805,7 @@ const device_t keyboard_tandy_device = {
const device_t keyboard_xt_lxt3_device = {
"VTech Laser XT3 Keyboard",
0,
/*5*/ 3,
7,
kbd_init,
kbd_close,
kbd_reset,