Just wondering if someone can clear up what I think should be a quick misunderstanding on how rom is addressed in a particular instance.
I don't know too much about the 8051, but I know a little about controllers in general.
Anyway, basic story is, I have the source for a controller which I'm trying to understand, which uses on-chip rom for several lookup tables, however trying to trace some of the table lookups, I'm a bit confused.
I'm at work so I don't have a exact code listing, but from memory the table calls look something like this:
I don't know if that's 100% correct but the idea is you put a base address in the datapointer, put an offset (or the nth value you are looking for) in the accumulator, then move the value held in the address of datapointer+A into the accumulator, where presumably you can then work on the retreived value as your situation warrants.
My question is this, if you look at the direct address (F674) I used as the base of the table, that confuses me. Because the chip size used to hold the program and data only goes up to 7FFF.
I'm sure it's a misunderstanding on my part, and possibly related to the 16 bit nature of the datapointer.
I mean, I don't want to sound daft, but could I be misunderstanding the byte ordering? Could it be 74F6 for example, rather than F674?
I'd feel stupid if that was the reason but... I only thought of that now, and I'm at work so I can't quicly check.
I don't know too much about the 8051, but I know a little about controllers in general.
Anyway, basic story is, I have the source for a controller which I'm trying to understand, which uses on-chip rom for several lookup tables, however trying to trace some of the table lookups, I'm a bit confused.
I'm at work so I don't have a exact code listing, but from memory the table calls look something like this:
Code:
MOV DPTR,#[B]F[/B]674h
MOVC A,@A+DPTR
I don't know if that's 100% correct but the idea is you put a base address in the datapointer, put an offset (or the nth value you are looking for) in the accumulator, then move the value held in the address of datapointer+A into the accumulator, where presumably you can then work on the retreived value as your situation warrants.
My question is this, if you look at the direct address (F674) I used as the base of the table, that confuses me. Because the chip size used to hold the program and data only goes up to 7FFF.
I'm sure it's a misunderstanding on my part, and possibly related to the 16 bit nature of the datapointer.
I mean, I don't want to sound daft, but could I be misunderstanding the byte ordering? Could it be 74F6 for example, rather than F674?
I'd feel stupid if that was the reason but... I only thought of that now, and I'm at work so I can't quicly check.
Last edited: