SETQ2 with LUT RAM

I need a quick sanity check. SETQ2 would be used with RDLONG and WRLUT correct? Something like....
mov t2, #$200 ' Set the LUT address in t2 setq2 #10-1 ' get 10 longs from hub to LUT rdlong t1, ptra ' populate intermediate register with HUB data @ptra wrlut t1, t2 ' write intermediate register data into LUT @t2
Would it increment the intermediate cog register (t2) that is used to shuffle data from HUBram into the LUT?
Am I even close to getting this right?
As always, thanks in advance.
--Terry
Comments
Just the SETQ2+RDLONG is all you need. The SETQ2 completely changes how RDLONG operates.
What you've got there copies ten longwords from hubRAM (beginning at address
ptra
) to lutRAM (beginning at addresst1
). The WRLUT then subsequently places the singular value fromt1
into lutRAM at address #200.There's four types of modal instructions like SETQ. They all have one thing in common - they put a temporary hold on interrupts.
In no particular order:
@evanh so this should work?
No, you need
Yeah, the answer looks odd because the RDLONG assembly syntax is ill-fitting for this. Both operands are addresses but D is immediate direct mode while S is direct indirect mode. You get that when it's a repurposed instruction. ... And then, just to add fun, there's the memory map differences between data space and program space.
Uh, now I am really confused. What is the ($200-$200) syntax? Isn't that $00 ? I thought LUT memory started at $0200
Sorry for being so thick.
Yeah, understandable. Data addressing of lutRAM starts at zero. Only the instruction fetching for program execution maps lutRAM to $200 to $3ff. It's maybe something Chip should've aligned but it wasn't thought much about at the time. EDIT: Acutally, there is a good reason: Direct address values (encoded in the instruction itself) are limited to 9 bits. By keeping the addresses in the 0 to $1ff range the program is more compact and faster running.
Got it. One last, and very dumb question. Can LUTs be reserved for symbols? If so, how is it done?
Yes, as program labels. But that means if you use them for a data access (RDLUT/WRLUT) then it's up to you to subtract the $200 appropriately.
How would that look? I mean, how would it make it's way into the LUT address space?
Here's a list of addressing modes:
Wait, I can use a constant to point to a specific LUT address if I wanted to, right?
Yep. When it's S operand it has a preceding #. When it's the special case block copy then no #.