Help porting to PASM
marzec309
Posts: 146
Would any one be willing to help port this little chunk of spin to PASM? I would owe you one.
CON SCLK_IN = 5 DIN = 6 LOAD_IN = 4 VAR long Cog long InputBits long stack[64] PUB Start(InputState) : Okay stop Okay := Cog := cognew(main(InputState),@stack) + 1 PUB stop '' Stop switch driver - frees a cog if cog cogstop(cog~ - 1) PRI Main(InputState) | tmp 'Setup register control bits outa[SCLK_IN]~~ outa[LOAD_IN]~~ dira[DIN]~ dira[SCLK_IN]~~ dira[LOAD_IN]~~ repeat outa[LOAD_IN]~ outa[LOAD_IN]~~ repeat 8 tmp := tmp << 1 tmp := tmp ^ ina[DIN] outa[SCLK_IN]~ outa[SCLK_IN]~~ inputbits := tmp >< 8 bytemove(Inputstate,@inputbits,1)
Comments
thanks again.
Is this a way to fix the program?
Move the address received by Start into a long which is then read by the PASM section?
I'm pretty sure I wouldn't have caught the error myself but once it's pointed out it's easier to see why it causes an error (like most problems).
It compiles.
Duane