I'm a little lost looking at this piece of code. I know that it sets the jump target to a table, but syntax used is different than what I usually use. I wondering if someone can help me with this. Basically, I don't understand these two lines:
movlw (freqdatable >> 8)
addlw (freqdatatable & h'ff)
;here's the snipplet
freqd movlw (freqdatatable >> 8)
addlw (freqdatatable & h'ff')
;<- freq data goes here ->
--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.
The first one (ie...freqdatable>>8) is saying to shift the
data in the variable 'freqdatable' 8 places to the right.
The second one is a logical operation probably intended to
clear some bit(s). freqdatatable & h'ff means to do a logical
AND on each bit in the variable freqdatatable on a bit by bit
basis. ie lets say the freqdatatable contains '3E' and we are
going to AND this with 'FF'
3Eh = 0011 1110
FFh = 1111 1111
so.... 0011 1110
The after this operation, the result is aded to 'W'. 'W' now
contains (I assume) the offset into the table.
On Mon, 21 February 2000, Josh NG wrote:
James Paul wrote:
> The first one (ie...freqdatable>>8) is saying to shift the
> data in the variable 'freqdatable' 8 places to the right.
> The second one is a logical operation probably intended to
> clear some bit(s).
In broader terms, put the high byte of the address freqdatable into
PCLATH, and use the low byte to add to the value to be put in PCL.
Since the add instruction only takes an 8-bit value anyway, this is
purely to avoid the assembler telling you you are trying to add a number
that is too big.
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- New search...