A89: Adding to addresses
[Prev][Next][Index][Thread]
A89: Adding to addresses
Why is it that if I add to an address, I can't seem to add a number greater
than 62? Here's the code I'm using (I know it's inefficient. I started
making it simpler while trying to find the problem.) I want to use it to get
a byte stored in an array with dimentions 124 by 124 (map is the address of
the array). The x coordinate is d6; the y coordinate is d7. (The upper left
corner is 0,0) It works as long as I only get as far as d6=62, d7=0. After
that, it just returns 0. (Most of the array is 0's, so it might just be
reading the wrong byte...)
clr.l d3
move.b d7,d3
mulu.w #124,d3
add.w d6,d3
add.w #0,d3
move.l map,a0
add.l d3,a0
clr.l d3
move.b (a0),d3
Follow-Ups: