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

Re: EPZ directive



In article <44913484$0$877$ba4acef3@news.orange.fr>,
 "Guillaume Tello" <houten.van@wanadoo.fr> wrote:

> hello,
> 
> i'm trying to learn 6502 asm. here is a part I don't understand:
> 
> B    EPZ $6    ; low part of adr
> BH    EPZ $7    ; high part of adr
> ...
>     LDA (B,X)
> 
> looking at the first two lines, I can think that the adr is $706.
> but the assembly code for LDA (B,X) is A1 06 meaning that only low part of
> the adress is used, pointing to page zero.
> 
> any idea?
> 
> guillaume.

You have stumbled upon the (little used) indexed indirect address mode. 
In your example, the second byte of the instruction and the value in the 
X register are added to to form a one-byte, zero-page address. The 
contents of that address and the one following become the 16-bit 
effective address from which the accumulator is loaded.

Given

C  EPZ $8
CH EPZ $9

If X is zero, then LDA (B,X) acts like LDA $706.
If X is one,  then LDA (B,X) acts like LDA $807.
If X is two,  then LDA (B,X) acts like LDA $908.
etc.

HTH
-- 
John Matthews
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/