6801 relative address calculations

Scot Sealander Sealand at clarityconnect.com
Fri Feb 19 05:32:02 GMT 1999


Teller.John at orbital.com wrote:

> Does it calculate the branch address from the address of the beginning > of the instruction or from the offset?

It calculates it relative to the PC.  (program counter)

> F02F  20 0C     BRA $F03C  ; F030 + 0C = F03C

That should be F031 + OC  = F03D



> F095  CE 00 61  LDX $0061
> F098  6F 00     CLR [X]
> F09A  09        DEX
> F09B  26 FB     BNE $F096 ; This jumps to the 00 in the LDX 
>                             instruction!

In this case, the PC at the BNE is F09D.  FB + F09D = F098

So this is a loop to clear 0061 down to 0001.

Scot Sealander   Sealand at clarityconnect.com




More information about the Gmecm mailing list