Do not use LD A,I to read interrupt enabled state

Page 4/4
1 | 2 | 3 |

By RetroTechie

Paragon (1414)

RetroTechie's picture

28-12-2015, 20:36

True, that's what I meant with "no CPU time left for the main program"... Wink

instruction
-- interrupt
-- interrupt
instruction
-- interrupt

is definitely possible. But at any point in time, you'll have at most 1 interrupt routine "open" (read: one interrupt routine's return address + maybe other data on the stack). Interrupt handler will finish with EI/RET, and then another interrupt may be accepted at exactly that point - before another instruction from main program is processed.

By Grauw

Enlighted (6368)

Grauw's picture

13-08-2017, 01:04

The MSX2 BIOS does this incorrectly for the inter-slot calls as well, making its users vulnerable to timing hangs.

MSX Datapack 3.2.5 Notes on using CALSLT

“ Also, when returning from this routine, interrupts are prohibited in MSX 1, but in MSX 2 it returns to the state it was in before calling. ”

However,

MSX Datapack 7.3.4 Notes on Slot Switching

“ Depending on the characteristics of Z80, MSX 2 may return as a very rare case in the DI state. For programs that require EI interrupt status, we recommend EI immediately after inter slot call. ”

This is the manifestation of the issue.

Since MSX1 always returned with DI, probably it was common practice to issue an EI afterwards anyway, but for software which doesn’t it can introduce rare random failures. Some engineer thought he was smart, but they should’ve left it the way it was. Even without Z80 bug, it introduces possible incompatibilities as it is.

Page 4/4
1 | 2 | 3 |
My MSX profile