Cog memory byte addressing in prop assembly code
ght_dak
Posts: 15
Is there an easy (fast)·way to·write / read single bytes·in cog memory?· All the instructions are register (long) aligned (other than the hub memory access instructions)... so i'll need to do a bunch of shifting and bit operations...
I'm trying to build a small byte buffer in cog memory.
-glenn
·
I'm trying to build a small byte buffer in cog memory.
-glenn
·
Comments
movs outbyte,byteVal
wrbyte outbyte,hubdest
could just as well be
wrbyte byteVal,hubdest
word lengths are more fun
movs outword,lowbyte
ror outword,8
movs outword,highbyte
rol outword,8
wrword outword,hubdest
Alas, the long can't do the same trick because a fourth movs would clobber a bit that you really wanted.
You can repeat this 4 times, it catches every hub cycle, and it leaves the packed byte values unchanged (after 4).
You can do the same for packed words like:
This requires that hubDest be a multiple of 2. For longs, you'd have:
In this case, hubDest must be a multiple of 4.
OTOH, here's a great deal of flexibility in how one writes prop assembly code... some of it quite wierd using indirect addressing schemes etc. Perhaps if I played around more with these capabilities, I'd come up with somethig very elegant and fast... then again, maybe not
Edit: But this was just an untested idea :-( Fred did in correct (see below)
Post Edited (deSilva) : 8/15/2007 4:42:24 PM GMT