pc98_usb: Receive extra byte for 0xFB response

PC-9801-119(CMP-6D1Y7)
https://geekhack.org/index.php?topic=110094.msg3164441#msg3164441
This commit is contained in:
tmk 2023-06-15 12:43:16 +09:00
parent db4268bfa1
commit c168e21bd7

View file

@ -60,8 +60,11 @@ static void pc98_send(uint8_t data)
static int16_t pc98_wait_response(void)
{
int16_t code = -1;
uint8_t timeout = 255;
int16_t code;
uint8_t timeout;
RETRY:
code = -1;
timeout = 255;
while (timeout-- && (code = serial_recv2()) == -1) _delay_ms(1);
// Keyboards require RDY pulse >=37us to send next data
@ -71,6 +74,7 @@ static int16_t pc98_wait_response(void)
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
xprintf("r%04X ", code);
if (code == 0xFB) goto RETRY;
return code;
}