PASM: Not getting the value for PAR I expect. [Using Gear to evaluate]
Wurlitzer
Posts: 237
I have taken a SPIN program from a much larger running program to play with some different functionality and most of it seems to work except the value passed to PAR for the address of MasterArray seems to point to an unexpected address per GEAR.
Cog 0 is running the SPIN and Cog 1 is running the PASM and the PASM is running based on the proper toggling of 2 pins.
MasterArray is the first variable declared in the SPIN program
"entry" is right after the DAT org 0 for
In Gear, looking into the Cog running PASM I see that PAR = 1F0h ( PAR is used on 4 lines of code and I verified the address of these 4 lines from the address shown in the Prop Development Tool after I compile) so I am confident that Cog1's PAR value is 1F0h.
Based upon this information I am expecting @MasterArray to start at 1F0h but it is not there. Using a dummy fill of $AABBCCDD I found MasterArray at address $814
I tried changing the cog start instruction to use @MasterArray[0] with the exact same results.
Here is the PASM code segment using PAR.
The Prop Tool shows the cog address of DmyLabel to be $0AD and that address and the one before it, and the other 2 after it all show PAR to be $1F0
Cog 0 is running the SPIN and Cog 1 is running the PASM and the PASM is running based on the proper toggling of 2 pins.
MasterArray is the first variable declared in the SPIN program
VAR long MasterArray[268] long ThisCog long cog long lc long indx long LastValue long testread PUB Main | Temp getcaldata ThisCog := cogid ' cog := cognew(@entry,@MasterArray) + 1
"entry" is right after the DAT org 0 for
In Gear, looking into the Cog running PASM I see that PAR = 1F0h ( PAR is used on 4 lines of code and I verified the address of these 4 lines from the address shown in the Prop Development Tool after I compile) so I am confident that Cog1's PAR value is 1F0h.
Based upon this information I am expecting @MasterArray to start at 1F0h but it is not there. Using a dummy fill of $AABBCCDD I found MasterArray at address $814
I tried changing the cog start instruction to use @MasterArray[0] with the exact same results.
Here is the PASM code segment using PAR.
} mov CurrentModeADDR,par DmyLabel mov HUB_PedalPointer, par add HUB_PedalPointer, #4 'offset for pedal current write address mov CirQueStartADDR, par add CirQueStartAddr, #12 'offset for begining of Pedal Queue mov PedalCalStartAddr, par add PedalCalStartAddr, #332 'begin address of HUB data for pedal calibration
The Prop Tool shows the cog address of DmyLabel to be $0AD and that address and the one before it, and the other 2 after it all show PAR to be $1F0
Comments
The MOV instructions you've mentioned all copy the contents of PAR to the destination register (like CurrentModeADDR, CirQueStartADDR, PedalCalStartAddr, etc.) which is what should happen. You then add an offset to each of these and presumably use them in a RDLONG instruction to get the actual data values from hub memory.
That gets me a little closer.
In Cog1 @ $1f0 I see it contains $7C8 which is closer to $814 (where MasterArray seems to start) but no cigar. If I look at the data being obtained by the various destination registers, it does seem they are getting their data based upon the $7C8 address so somehow I seem to be passing something other than MasterArray's starting address but the trees are getting in the way of the forest.
Thanks again Mike.