On Tue, Apr 7, 2026, 12:44 AM B9 <[email protected]> wrote: > Following John's hint, I was able to figure out the backwards writing > problem. It turns out to be a bug in the original Norwegian RxHandler code > from INSTAL.BA which was enabling interrupts (EI) before jumping back > into the ROM's handler. Replacing the EI instruction with NOP fixes it. > > Well I'd have to look into the rx hook and where interrupts get disabled and enabled normally. There are two parties at play, the interrupt handler and the hook .
Typically if the hook code you are testing disables interrupts it must also enable them. Hooks are not the same as interrupt handlers. The serial rx interior handler is in rom and cannot be changed. But it calls a hook so you can subclass it I don't remember the etiquette for handling of di/ei. But if they aren't reenabled at some point it will cause problems. Best case is to write code so that you never have to disable them. Typically tricky and sometimes impossible. If it has to disable them, disable them, service the hardware and then enable them. Reentrance issues like you saw occur if interrupts are reenabled before the byte has been read and moved to rx queue. -- John. >
