From 5d24932e78cf210ec0ce03f632cd792c30d3cc21 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 8 Sep 2018 21:23:30 +0900 Subject: [PATCH] pc98_usb: Update reset and LED control command --- converter/pc98_usb/README | 23 +++++++++++ converter/pc98_usb/config.h | 2 +- converter/pc98_usb/matrix.c | 77 +++++++++++++++++++++---------------- 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/converter/pc98_usb/README b/converter/pc98_usb/README index 24200d83..4d0d0bfe 100644 --- a/converter/pc98_usb/README +++ b/converter/pc98_usb/README @@ -147,6 +147,7 @@ Its scan code map is very different from standard types. This is not tested. Other PC98 converter projects and resource ------------------------------------------ PC-9800シリーズ テクニカルデータブック HARDWARE 編 1993年 p139, p343 +https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n151 https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n355 PC98 to USB @@ -158,3 +159,25 @@ http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm scan code: http://ixsvr.dyndns.org/usb2pc98 + + + +NOTES +----- +### Tested on +- PC-9801V +- DIGITAL WAVE Dboard + + +### RDY +Current firmware does not control RDY line and it is drived as low to receive data always. While sending command firmware drive the line high. + +PC98 host keeps RDY line high to prevent keyboard from sending data while processing. + +https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n359 + +### Inhibit key repeating +The command(9Ch, 70h) works with Raku Raku keybaord but not with Dboard. + +### LED indicater +Dboard has LEDs but it seems to ignore LED control command. diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h index c6315d00..c74b434b 100644 --- a/converter/pc98_usb/config.h +++ b/converter/pc98_usb/config.h @@ -43,7 +43,7 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE /* Control LED indicatiors, which doesn't work well with locking support */ -//#define PC98_LED_CONTROL +#define PC98_LED_CONTROL /* PC98 Reset Port shared with TXD */ diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c index 54bb3041..39afb43c 100644 --- a/converter/pc98_usb/matrix.c +++ b/converter/pc98_usb/matrix.c @@ -68,23 +68,34 @@ static int16_t pc98_wait_response(void) static void pc98_inhibit_repeat(void) { uint16_t code; - - // clear recv buffer - while (serial_recv()) ; RETRY: - _delay_ms(100); pc98_send(0x9C); code = pc98_wait_response(); if (code != -1) xprintf("PC98: send 9C: %02X\n", code); if (code != 0xFA) goto RETRY; - _delay_ms(100); pc98_send(0x70); code = pc98_wait_response(); if (code != -1) xprintf("PC98: send 70: %02X\n", code); if (code != 0xFA) goto RETRY; } +static uint8_t pc98_led = 0; +static void pc98_led_set(void) +{ + uint16_t code; +RETRY: + pc98_send(0x9D); + code = pc98_wait_response(); + if (code != -1) xprintf("PC98: send 9D: %02X\n", code); + if (code != 0xFA) goto RETRY; + + pc98_send(pc98_led); + code = pc98_wait_response(); + if (code != -1) xprintf("PC98: send %02X: %02X\n", pc98_led, code); + if (code != 0xFA) goto RETRY; +} + void matrix_init(void) { debug_keyboard = true; @@ -99,36 +110,40 @@ void matrix_init(void) serial_init(); // PC98 reset -/* - PC98_RST_PORT &= ~(1< 13us + PC98_RST_PORT |= (1<