Daft question about interrupts...

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
R-Tape
Site Admin
Posts: 239
Joined: Thu Nov 09, 2017 11:46 am

Daft question about interrupts...

Post by R-Tape » Wed Dec 06, 2017 11:04 am

The title says it all but I just want to make sure. I'll apologise in advance.

The vector table and routine are in uncontended memory, but if the stack is in contended memory, is there a risk of ULA snow?

The routine would be something like this:

PUSH ....
CALL routine
POP
EI
RET
0 x

User avatar
Ast A. Moore
Dizzy
Posts: 67
Joined: Mon Nov 13, 2017 3:16 pm

Re: Daft question about interrupts...

Post by Ast A. Moore » Wed Dec 06, 2017 12:49 pm

No. As long as the I register is outside the $40–$7f range, you’re good.
Also, the kosher way to return from an ISR is RETI, not RET. ;)
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

User avatar
R-Tape
Site Admin
Posts: 239
Joined: Thu Nov 09, 2017 11:46 am

Re: Daft question about interrupts...

Post by R-Tape » Wed Dec 06, 2017 1:45 pm

Cheers. I usually keep the stack at the top so have never considered this before. I may be using paging this time so stack is at the bottom. And I'm rusty as hell.
0 x

User avatar
Ast A. Moore
Dizzy
Posts: 67
Joined: Mon Nov 13, 2017 3:16 pm

Re: Daft question about interrupts...

Post by Ast A. Moore » Wed Dec 06, 2017 2:41 pm

Different strokes . . .

I, too, usually relocate the stack toward the top of RAM to avoid contention. Keep in mind that contention patterns on the 128K/+2 are different from those on the +2A/+3.
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

AndyC
Berk
Posts: 10
Joined: Mon Nov 13, 2017 5:12 am

Re: Daft question about interrupts...

Post by AndyC » Wed Dec 06, 2017 8:13 pm

Ast A. Moore wrote:
Wed Dec 06, 2017 12:49 pm
No. As long as the I register is outside the $40–$7f range, you’re good.
Also, the kosher way to return from an ISR is RETI, not RET. ;)
Not strictly true. If you set the I register to a value between $C0 and $FF and have contended memory paged in at $C000 you will crash an old school 128K (but not a +2A/+3 where the HAL bug was fixed). This happens even if you aren't using IM2 or if interrupts are disabled. For maximum compatibility you should keep I between $80 and $BF.
0 x

User avatar
Ast A. Moore
Dizzy
Posts: 67
Joined: Mon Nov 13, 2017 3:16 pm

Re: Daft question about interrupts...

Post by Ast A. Moore » Wed Dec 06, 2017 8:46 pm

Thanks, I was only vaguely aware of that!
But, as far as the 48K machine is concerned, I’m correct. The +2A/+3 doesn’t exhibit the snow effect (probably, for the very reason you described). Sadly, there are a couple of games out there that used it as an embellishment.
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

Post Reply