EX (SP),HL

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

Re: EX (SP),HL

Post by Cosmium » Sat Sep 21, 2019 4:06 am

djnzx48 wrote:
Sat Sep 21, 2019 1: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 :)
0 x

Post Reply