ULA Snow and the IY/IX registers - A question

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ULA Snow and the IY/IX registers - A question

Post by Ast A. Moore »

MonkZy wrote: Sat Apr 18, 2020 11:13 pm Can I switch between disabled and enabled safely with the following code :
Sure. Although it would be significantly faster to simply reload IY with $5c3a once you’re done with it. A PUSH IY/POP IY combo is 4 bytes and takes 29 T states, whereas LD IY, $5c3a is the same 4 bytes taking only 14 T states.

I’m curious, do you really have to use both IX and IY in your code? Have you tried refactoring it to use fewer registers? I don’t know what kind of program you’re writing, but I’ve done some pretty complex coding and can only remember a handful of instances when I had to use IY. IX—sure (sparingly, though), but IY—almost never.
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
MonkZy
Manic Miner
Posts: 279
Joined: Thu Feb 08, 2018 1:01 pm

Re: ULA Snow and the IY/IX registers - A question

Post by MonkZy »

Ast A. Moore wrote: Sat Apr 18, 2020 11:49 pm I’m curious, do you really have to use both IX and IY in your code?
To be honest, no. My code is less than optimized at this point. I have already thought of a way to reduce memory consumption and reduce the need to use IY. But..It is working. I got all excited when I found two more registers to use as memory pointers. I now realize the pit-falls of IY on the Spectrum, and also realize IX/IY are avoided because they are very slow registers.

Image

I am making a 16K Spectrum tribute version of Conways LIFE. The cells are checked and re-drawn with no attention to the screen refresh. It takes about 4-5 frames to redraw the table. It looks better on an emulator than my crumby GIF.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ULA Snow and the IY/IX registers - A question

Post by Ast A. Moore »

MonkZy wrote: Sun Apr 19, 2020 7:06 pm It looks better on an emulator than my crumby GIF.
It looks pretty darned good from where I’m standing! Keep on working on it.
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