ASM with PropBasic
Hi,
I can't get ASM Task to work with PropBasic.
In spin I have
I can't get ASM Task to work with PropBasic.
In spin I have
' ASM Test File, runs in own Cog
' ASM_TEST, fgv 21.09.2011
CON
_clkmode = xtal1 + pll16x
_xinfreq = 6_250_000
PUB Main
cognew(@toggle,0)
DAT
org 0
Toggle mov dira, IOP
mov time, cnt
add time, #9
:loop waitcnt time, delay
xor outa, IOP
jmp #:loop
'---------------------------
IOP long %1
delay long 5_000_000
time res 1
That code runs as expected, but in PropBasic this code won't work:
PROGRAM Main
Main:
Cogstart Tog
do
loop
END
' ----- TASK Code ------------------------------------------------------
TASK Tog
ASM
org 0
Entry mov dira, IOP
mov time, cnt
add time, #9
:loop waitcnt time, delay
xor outa, IOP
jmp #:loop
'---------------------------
IOP long %1
delay long 5_000_000
time res 1
ENDASM
ENDTASK
Anybody sees why? I'm out of ideas.... 
Comments
Don't use ORG or define variables in ASM. Declare variables as PropBasic variables.
You can't use RES in ASM...ENDASM. When spin sees the RES it doesn't set the value of any variables after it.
DEVICE P8X32A,XTAL1,PLL16X FREQ 80_000_000 Tog TASK AUTO PROGRAM Main Main: do loop END TASK Tog IOP VAR LONG = %1 delay VAR LONG = 5_000_000 time VAR LONG ASM mov dira, IOP mov time, cnt add time, #9 :loop waitcnt time, delay xor outa, IOP jmp #:loop ENDASM ENDTASKBean
that helped a lot!
Fried