This bit of code seems overwritten for simply reading two longs from the hub and writing them to cog variables arg0 and arg1.
movd argP,#arg0 ' get 2 arguments ; arg0 to arg1
mov t2,t1 ' │
mov t3,#2 ' ───┘
argP rdlong arg0,t2
add argP,d0 ' point to next long in COG (incr COG ptr)
add t2,#4 ' point to next addr in MAIN (incr MAIN ptr)
djnz t3,#argP
This accomplishes the same thing, modifies the same variables, and there are no shenanigans. This will also translate to Spin2.
You could also it this way in the P2 which would be faster but less obvious (not tested -- I have only done this with ptra in the source position for rdlong).
Comments
MOVD isn't a valid instruction.
hey thanks! need to remember that
Jay
Prop2 is
SETD
You're doing a block transfer from hub to cog -- which is easier in Spin2. Have a look at Ada's online help file here:
-- https://p2docs.github.io/hubmem.html#block-transfers
This bit of code seems overwritten for simply reading two longs from the hub and writing them to cog variables arg0 and arg1.
It seems like it could be simplified to this:
This accomplishes the same thing, modifies the same variables, and there are no shenanigans. This will also translate to Spin2.
You could also it this way in the P2 which would be faster but less obvious (not tested -- I have only done this with ptra in the source position for rdlong).