
October 21st, 2009, 02:59 AM
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 9
Time spent in forums: 2 h 41 m 15 sec
Reputation Power: 0
|
|
|
Assembly - Machine code relative offsets
I am trying to understand how assembly is translated into machine language. I understand how to get the machine coding formats but I'm not sure how to calculate 'rr' in all cases. For the example example bra is 20 rr or 20 03, I know that the relative offset is 03 to get to the iny instruction. But I'm not sure why the rr = F3 for the dbne instruction, how does that relative offset get me to Again? A quick answer would be appreciated, I have a test tomorrow.
Solution to sample problem:
Code:
org $600
ldy #Array ;CD B6 15
ldaa #N ;86 07
clr 7,y ;69 47
Again brclr 0,y %11110000, Not_gtr ;0F 40 F0 02
bra Update ;20 03
Not_gtr inc Count ;72 B6 1C
Update iny ;02
dbne a,Again ;04 30 F3
swi ;
Array fdb 8,7,2
N equ 7
Count rmb 1
|