EI ; T=69884
DEFS N,0xFB ; T=69888; N 'EI' instructions blocking interrupts
NOP ; T=69888+N*4
and found that an interrupt occurs after the NOP when N=6, but not when N=7. Which implies that the answer is somewhere between 6*4=24 T-states and 7*4=28 T-states - if Fuse is behaving accurately.
SkoolKit - disassemble a game today Pyskool - a remake of Skool Daze and Back to Skool
edjones wrote: ↑Thu Jan 04, 2024 6:53 pm
32T on 48K...
If that means an interrupt can be accepted within 0-31 T-states of a frame boundary, but not after that, then that seems to agree with my Fuse experiment. Thanks!
SkoolKit - disassemble a game today Pyskool - a remake of Skool Daze and Back to Skool
A Z80 interrupt must not be held active for longer than is necessary as this may lead to the Z80 responding to it multiple times. It is documented somewhere that the ZX Spectrum holds the interrupt active for 32 T-states, which is long enough for all instructions to have time to respond to it, but is still long enough for it to be detected more than once.
Last edited by Stefan on Thu Jan 04, 2024 9:29 pm, edited 1 time in total.
SkoolKid wrote: ↑Thu Jan 04, 2024 7:08 pm
If that means an interrupt can be accepted within 0-31 T-states of a frame boundary, but not after that, then that seems to agree with my Fuse experiment. Thanks!
yes. that's what all documentation says, at least, and what most emulators implement. it may be slightly different on clones, though.
and, btw, yes, with just "EI:NOP" interrupt handler could be called twice. "EI:RET" will not work, though. ;-) that is, interrupt ACK and handler call is 19T. EI is 4T. and 4T NOP, because EI is delayed. this is 27T, so the machine could still have INTR active. "EI:RET" is 33T, though.
According to p. 226 of Chris Smith's excellent book "The ZX Spectrum ULA : How to design a microcomputer" the ULA pulls the /INT pin low for exactly 32 T-states.
Stefan wrote: ↑Thu Jan 04, 2024 9:56 pm
According to p. 226 of Chris Smith's excellent book "The ZX Spectrum ULA : How to design a microcomputer" the ULA pulls the /INT pin low for exactly 32 T-states.
You know, I might have come across something like that while searching for the answer to this question, but I wouldn't have understood what it meant in practical terms. I'm just not really a hardware person.
SkoolKit - disassemble a game today Pyskool - a remake of Skool Daze and Back to Skool
SkoolKid wrote: ↑Thu Jan 04, 2024 10:01 pm
You know, I might have come across something like that while searching for the answer to this question, but I wouldn't have understood what it meant in practical terms. I'm just not really a hardware person.
Same here. I have always had the bliss of not having to think about /what/ generates an interrupt. Until now, it was just one of those things that occurred once a frame. I had not considered /what/ was generating that interrupt. My naive knee jerk thought it was the Z80. Duh, of course not.
In the case of the Spectrum it is the ULA pulling the interrupt signal (low or high or whatever ).
It's the ULA pulling the Z80 interrupt signal (/INT) low. Because in it's inactive state, it's logic high.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
SkoolKid wrote: ↑Thu Jan 04, 2024 10:01 pm
You know, I might have come across something like that while searching for the answer to this question, but I wouldn't have understood what it meant in practical terms. I'm just not really a hardware person.
In which case I can recommend watching - even though not for the Z80 - the complete control of the CPU was really pleasing and educational.
yeah, there are a lot of interesting info and answers in reverse-engineered ULA schematics. too bad that i can't read schematics (and most other programmers too, i guess ;-). i know that it is like a program in some low-level language (with implied parallelism in some places), so i hope that someday i'll learn to undertand it. ;-)