EX (SP),HL

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Cosmium
Microbot
Posts: 154
Joined: Tue Dec 04, 2018 10:20 pm
Location: USA

Re: EX (SP),HL

Post by Cosmium »

djnzx48 wrote: Sat Sep 21, 2019 2:11 am You can use it as an easy way to swap HL and IX.

PUSH HL
EX (SP), IX
POP HL
That's a neat use of EX (SP), IX!

The alternative:

PUSH HL
PUSH IX
POP HL
POP IX

is 6Ts and 2 bytes longer by my calculations, so a worthwhile trick to add to the toolbox, thanks :)
Post Reply