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

Re: Problems with machine code



>Jayson Smith" <nospamratguyspambegone@nospamplease.bellsouth.ihatespam.net> 
>wrote in message news:O_Yid.40327$T_.34113@bignews4.bellsouth.net...

> 1040  LDX #$0F
> The problem with this routine is that it only reads fifteen sectors, not
> sixteen.  The BNE aparently is falling through when X reaches 1, not 0.

Hi Jayson,

It is in fact DEcreasing X to zero and then equalling zero to skip the 
branch.
The way you are reading the code, is go read sector zero.  The way the
Apple is reading the code is X Reg = 0 so no need to branch back and
read sector zero.  As you do the DEX right prior to the BNE, so it's going
to get to the new value (0) and evaluate it before doing the last sector.

Simply add 1 to your initial X and you'll read all the sectors and exit the
routine cleanly.

So instead of LDX #$0F, try LDX #$10 and see where the day takes you!

Later,
Craig