mirror of
https://github.com/buserror/mii_emu.git
synced 2024-11-25 05:32:20 +00:00
Removed dead code from mii.c
Keyboard uses a FIFO for a while Signed-off-by: Michel Pollet <buserror@gmail.com>
This commit is contained in:
parent
5d0abefadf
commit
2f2cf15576
40
src/mii.c
40
src/mii.c
@ -416,45 +416,19 @@ mii_access_keyboard(
|
|||||||
switch (addr) {
|
switch (addr) {
|
||||||
case SWKBD:
|
case SWKBD:
|
||||||
if (!write) {
|
if (!write) {
|
||||||
/* If fifo not empty, peek at the next key to process, it already
|
|
||||||
* has the 0x80 bit on -- otherwise, return 0 */
|
|
||||||
res = true;
|
res = true;
|
||||||
#if 1
|
|
||||||
*byte = mii_bank_peek(main, SWKBD);
|
*byte = mii_bank_peek(main, SWKBD);
|
||||||
#else
|
|
||||||
if (mii_key_fifo_isempty(&mii->keys))
|
|
||||||
*byte = 0;
|
|
||||||
else
|
|
||||||
*byte = mii_key_fifo_read_at(&mii->keys, 0).key;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWAKD:
|
case SWAKD: {
|
||||||
res = true;
|
res = true;
|
||||||
#if 1
|
|
||||||
{
|
|
||||||
uint8_t r = mii_bank_peek(main, SWAKD);
|
uint8_t r = mii_bank_peek(main, SWAKD);
|
||||||
if (!write)
|
if (!write)
|
||||||
*byte = r;
|
*byte = r;
|
||||||
r &= 0x7f;
|
r &= 0x7f;
|
||||||
mii_bank_poke(main, SWAKD, r);
|
mii_bank_poke(main, SWAKD, r);
|
||||||
mii_bank_poke(main, SWKBD, r);
|
mii_bank_poke(main, SWKBD, r);
|
||||||
}
|
} break;
|
||||||
#else
|
|
||||||
// if (write) {
|
|
||||||
/* clear latch, and replace it immediately with the new key
|
|
||||||
* if there's one in the FIFO */
|
|
||||||
if (!mii_key_fifo_isempty(&mii->keys)) {
|
|
||||||
mii_key_t k = mii_key_fifo_read(&mii->keys);
|
|
||||||
mii_bank_poke(main, SWAKD, k.key);
|
|
||||||
} else
|
|
||||||
mii_bank_poke(main, SWAKD,
|
|
||||||
mii_bank_peek(main, SWAKD) & ~0x80);
|
|
||||||
// } else
|
|
||||||
if (!write)
|
|
||||||
*byte = mii_bank_peek(main, SWAKD);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case 0xc061 ... 0xc063: // Push Button 0, 1, 2 (Apple Keys)
|
case 0xc061 ... 0xc063: // Push Button 0, 1, 2 (Apple Keys)
|
||||||
res = true;
|
res = true;
|
||||||
if (!write)
|
if (!write)
|
||||||
@ -473,16 +447,6 @@ mii_keypress(
|
|||||||
key |= 0x80;
|
key |= 0x80;
|
||||||
mii_bank_poke(main, SWAKD, key);
|
mii_bank_poke(main, SWAKD, key);
|
||||||
mii_bank_poke(main, SWKBD, key);
|
mii_bank_poke(main, SWKBD, key);
|
||||||
#if 0
|
|
||||||
mii_key_t k = {
|
|
||||||
.key = key | 0x80,
|
|
||||||
};
|
|
||||||
if (!mii_key_fifo_isfull(&mii->keys))
|
|
||||||
mii_key_fifo_write(&mii->keys, k);
|
|
||||||
else {
|
|
||||||
printf("%s key fifo full\n", __func__);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user