Feb 14, 2010 9:17 PM
How to define a lookup table?
-
Like (0)
I've got this lookup table I'm generating. I can't figure out how to put it in memory though. I am trying something like this:
org y:$000
BUFFER M,256
dc #$000000 ; word 000
dc #$00C90F ; word 001
...
ENDBUF
But the assembler is unhappy ("ERROR --- Symbols must start with alphabetic character (Operand field)" on the dc lines). What's the right way to define a block of memory?
Thanks.
Hi audioatillery,
a while ago we discussed the problem defining constand blocks in x: and y: memory spaces. Assembler directive DC (Define Constant) does not work, see:
http://line6.com/community/thread/4643 .
The problem is that during the bootload process only the program memory p: can be load. Please use the method I recommend here to fill the memory with constants during runtime.
The assembler error was generated since you declared the constant after using a tap, not left aligned as it should be. Since that the dc assembly directive is interpreted as an unkown instruction.
I know that filling the memory during runtime by using core instruction yields a lengthy program that doesn't fit into the p: memory space below $200 wery soon. For the moment I'm figuring out the problem described in thread http://line6.com/community/message/117946#117946 for that reason.
Best regards
Christian
This is similar to the thread Christian pointed to above, but what I do is put the DC's in a new P data section, below the main (p:$4E) section. I add a DS directive in the X or Y data sections and then use a loop to copy the constants over. That uses less code space than coding individual moves with constants if the number of constants is large.
X or Y data:
Foo ds 4
Initialization section:
move #FOO_CONSTS_0,r0
move #Foo,r1
do #4,_init_foo_done
move p:(r0)+,x0
nop
move x0,x:(r1)+
_init_foo_done
Constant P data section:
section P_DATA_MEMORY global
org p:
FOO_CONSTS_0 dc $056358
FOO_CONSTS_1 dc $352324
FOO_CONSTS_2 dc $fe83a3
FOO_CONSTS_3 dc $98bc23
endsec
Thanks guys. My actual error was writing "dc #$abcdef" instead of "dc $abcdef" (the # sign). But it was good you guys pointed out the inability to DC in data memory. I wonder if you muck with the CPU loader if you could fix that. It clearly is able to initialize the X memory (debug value writes, for example).
RedPanda, why copy the data from program to data memory? So you don't stall the CPU fetching both instructions and data from program memory?
RedPanda, why copy the data from program to data memory? So you don't stall the CPU fetching both instructions and data from program memory?
Yep. Putting data and coefficients in X and Y memory allows you to use parallel moves.
Stay in the mix and in the know.
Latest offers, special deals and insider updates.