Quote:
Originally Posted by litwr
I have a lot of tables in my Data section (tab, tab1, tab121, ...). Thus I need to use a register as a section base(a6), I need also an offset to a particular table (tab, ...) and an index to it (d0). For example,
Code:
lea tab,a3 ;tab starts the section
move.b (a4),d1
add.w d1,d1
basereg tab,a6
lea (a3,d1),a6
move.w (tab1213,a6),d2
move.w (tab1011,a6),d3
...
endb a6
Is there any sense to use d1.w instead of a plain d1 in lea (a3,d1),a6? The generated code is identical.
BTW I bought my A500 in Warsaw in 1989. It was an adventure. I am sure you know a "gielda" which worked on weekends that time.
EDIT. I have added a line with [b]a3[/3] to the start of my code.
|
Ok, perhaps i understand, what you need, use next code:
lea Base,A6
move.w tab1213-Base(a6), d2
move.w tab1011-Base(a6),d3
Base
....
tab1011 dc.w 0
...
tab1213 dc.w 0
tab1214 dc.w 0
....
btw. if you use move.b (a4),d1 and add.w d1,d1, be sure than high byte in D0 is 0, or you can set to wrong pointer later.
for assemblers lea (a3,d1),a6 is equal to lea (a3,d1.w),a6.
lea (a3,d1.w),a6 is not equal to lea (a3,d1.l),a6
lea (a3,d1.w),a6
works as next:
move.l a3,a6
add.w d1,a6
lea (a3,d1.l),a6
works as next:
move.l a3,a6
add.l d1,a6
d1.w (16 bit) can be diiferent than d1.l (32 bit)