Mercurial > repos > blastem
diff upd78k2_util.c @ 2714:d30e7f605ff8
Get uPD78k/II timer interrupts actually working and implement instructions needed for them to run to completion
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 10 Jul 2025 20:27:49 -0700 |
parents | a88eff3fb5d8 |
children | 033d8d4308e3 |
line wrap: on
line diff
--- a/upd78k2_util.c Thu Jul 10 16:07:04 2025 -0700 +++ b/upd78k2_util.c Thu Jul 10 20:27:49 2025 -0700 @@ -193,6 +193,18 @@ } switch (address) { + case 0x10: + return upd->cr00; + case 0x11: + return upd->cr00 >> 8; + case 0x12: + return upd->cr01; + case 0x13: + return upd->cr01 >> 8; + case 0x14: + return upd->cr10; + case 0x1C: + return upd->cr11; case 0x21: case 0x26: return upd->port_mode[address & 0x7]; @@ -269,7 +281,7 @@ upd78k2_update_timer0(upd); upd->cr01 &= 0xFF00; upd->cr01 |= value; - printf("CR01: %04X\n", upd->cr00); + printf("CR01: %04X\n", upd->cr01); upd78k2_calc_next_int(upd); break; case 0x13: @@ -438,12 +450,15 @@ { uint32_t pending_enabled = upd->scratch1; uint32_t vector = 0x6; + uint32_t bit = 1; while (pending_enabled) { if (pending_enabled & 1) { + upd->if0 &= ~bit; upd->scratch1 = vector; return; } + bit <<= 1; pending_enabled >>= 1; vector += 2; if (vector == 0xE) {