diff options
| author | sik | 2017-07-25 03:53:56 -0300 |
|---|---|---|
| committer | sik | 2017-07-25 03:53:56 -0300 |
| commit | 7d516cc248777ae239c5a4e50fa325365ddd7d53 (patch) | |
| tree | 7f392dbe0fb285350c050b649a501b555ab8cd36 /c/echo.c | |
| parent | 12d03b44f8895e86ac38fe8f83a2400dbc837087 (diff) | |
Cheating with the driver status to match programmer expectations (even if this is pretty much futurism)
Diffstat (limited to 'c/echo.c')
| -rw-r--r-- | c/echo.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -375,6 +375,16 @@ void echo_set_pcm_rate(uint8_t rate) { //*************************************************************************** uint16_t echo_get_status(void) { + // Look-up tables used to work around the fact that playing/stopping + // won't set the status immediately (only when Echo processes the command) + // and this can catch programmers off guard + static const uint8_t and_flags[] = { + 0xFF,0xFF, 0xFF,0xFE,0xFF,0xFD, 0xFF,0xFF,0xFF + }; + static const uint8_t or_flags[] = { + 0x00,0x00, 0x01,0x00,0x02,0x00, 0x00,0x00,0x00 + }; + // We need access to the Z80 Z80_REQUEST(); @@ -386,6 +396,15 @@ uint16_t echo_get_status(void) { if (z80_ram[0x1F00] != 0xFF) status |= ECHO_STAT_DIRBUSY; + // Look ahead in the queue for any pending commands + // Adjust the flags accordingly if needed + uint8_t command = z80_ram[0x1FFF]; + status &= and_flags[command]; + status |= or_flags[command]; + command = z80_ram[0x1FFB]; + status &= and_flags[command]; + status |= or_flags[command]; + // Done with the Z80 Z80_RELEASE(); |
