Table in assembly
Lafet
Posts: 23
Hello,
I need copy values from tables in COG memory to the HUB memory.
When I start this code with "ptr from 0 to 5", State contains next values:
Where I make error please?
Thanks Lafet
I need copy values from tables in COG memory to the HUB memory.
... VAR Byte State OBJ debug : "FullDuplexSerialPlus" PUB Main Debug.start(31, 30, 0, 57600) coginit(6,@entry, @State) Debug.bin(State,6) repeat DAT entry mov ptr, #2 ' for an example, get third value call #look :stop jmp #:stop look mov data, ptr ' ptr is a table index (0 to n-1) add data, #table 'pointer to Table + offset mov :inline, data nop 'pause for pipelining :inline mov data,0-0 ' get byte value from table wrbyte data, par 'save table values to HUB memory -> State look_ret ret table byte %100110 byte %010110 byte %010011 byte %001011 byte %001101 byte %100101 data res 1 ptr res 1
When I start this code with "ptr from 0 to 5", State contains next values:
ptr State 0 001010 1 001011 2 001100 3 001101 4 001110 5 001111
Where I make error please?
Thanks Lafet
Comments
Edit: BTW, you need not intermediately store the table value; you can directly write from the table, in that case use MOVD
Further Edit: To explain your read values: As you force a NOP with your MOV, they are just the addresses of the table entries, formerly contained in DATA, as TABLE starts at cell 10 =%1010.
For some unclear reasons the COG has loaded fast enough... I should have thought Ariba were right with his second remark.....
Post Edited (deSilva) : 10/3/2007 9:35:06 PM GMT
An other problem is that you don't wait after coginit until the Assembly cog is startet and has written the State value before you do the 'Debug.bin(State,6)'. You can add a waitcnt-Delay or wait for a value <>0 in State.
You can use PASD for debugging such problems:
http://forums.parallax.com/showpost.php?p=0
Andy