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

Re: LDA C08C,X



    It makes sense that EOR #$D5 should be used instead of CMP because we
don't want to use Carry Flag, but we want to use Zero Flag.  For example,
Accumulator receives #$D5 from LDA C08C,X before EOR #$D5.  The result will
be zero.  BNE fails to execute.  If it is not #$D5, BNE executes to find
exact #$D5.

> As you can see, the following instructions after testford5 will destroy
> both, the accumulator (LDA $c08c,x) and the carry bit (CMP #$aa). For this
> reason, it is not necessary to use "EOR #$d5" instead of "CMP #$d5". (As a
> matter of fact, I have written a RWTS which puts "CMP #$d5" here, and it
> does work. :-) In addition, I've also verified this on my emulator by
changing
> EOR to CMP.) My guess is that the programmer just wanted to show a
> difference between the instructions "EOR #$d5" and "CMP #$aa", because
"EOR
> #$d5" will be executed again after the test "CMP #$aa" failed. Otherwise
> there does not seem to be any reason for this.
> BTW.: What I find interesting here is that the program will look again for
> the sector header if reading the data header fails, although the sector
> header has been found already, i.e. at $c681 (BNE waitforsector) the
program
> will jump to address $c65c instead of $c65d.
>
> Holger
>