[A83] Re: IXIY


[Prev][Next][Index][Thread]

[A83] Re: IXIY




IX and IY can be used as equivalents for HL. You can use them as any other 
16 bit register, though they're slower. In fact they also exist out of two 8 
bit registers (IXH, IXL, IYH, IYL), but these are undocumented. What makes 
IX and IY special is in there name, index registers.

Let's say you have a block of data somewhere and that you frequently need to 
access parts of it. Then you can consider using IX or IY. You set one of 
those to the start of that block and when you then need byte number 5, you 
just LD (IX+05h). If you would use HL for that matter you first need to add 
5 before you can read the contents of the byte at that location.

The TIOS uses IY. It sets that register to the start of the ram area where 
all the flags are stored. It is then very simple to set,reset bits or to 
load values from that area.

ionPutSprite uses IX as a normal 16 bit register. Even though this is slower 
than using HL, it is better to use IX, because HL is already used, so you'd 
have to push/pop and that is slower.


>From: Gavin Olson <gtolson@snet.net>
>
>In several recent messages, there has been talk of the index registers
>IX and IY.  I know that ionputsprite uses IX as the address, and the
>set and res statements for changing flags use the IY register as a
>base address, but I have no idea as to what makes these registers
>special, as in why ionputsprite doesn't use hl, and as to how the
>value in IY is always predictable, in that it can be used as a base
>address for those flags, even though many people have code that
>modifies it.
>
>-Gavin Olson
>
>
>
>


_________________________________________________________________
Download MSN Explorer gratis van http://explorer.msn.nl/intl.asp





Follow-Ups: