Hmmmmm...
Ich bin noch zu unterkoffeiniert für "cogstart" und Co, hab daher FlexSpins Inline-Assembler freiwillig zwangsverpflichtet und das ganze Programm einmal für LMM-PASM und einmal gen Cog-PASM gebacken. Und statt bedingtem Sprung hab ich bedingte "mov"-Befehle bemüht, um den Flag-Zustand in Spin-Variablen umzubetten.
Code: Alles auswählen
$ cat pic.spin
con
_clkmode = xtal1+pll16x
_clkfreq = 80_000_000
obj
ser : "spin/FullDuplexSerial"
pub main
ser.start(31,30,0,115200)
moo1
moo2
waitcnt(_clkfreq+cnt)
ser.stop
cogstop(0)
pub moo1 | cd, tmp1, z, c
z := c := 0
cd := %00000000_00000000_00000_010_00000000
asm
mov tmp1, cd 'Test
cmp cd, tmp1 wc, wz
if_c mov c, #1
if_z mov z, #1
endasm
ser.str(string("moo1",13, 10, 13, 10))
ser.str(string("c == "))
ser.tx(48+c)
ser.str(string(13, 10, "z == "))
ser.tx(48+z)
ser.str(string(13, 10, 13, 10))
pub moo2 | cd, z, c
z := c := 0
cd := %00000000_00000000_00000_010_00000000
asm
cmp cd, cd wc, wz
if_c mov c, #1
if_z mov z, #1
endasm
ser.str(string("moo2",13, 10, 13, 10))
ser.str(string("c == "))
ser.tx(48+c)
ser.str(string(13, 10, "z == "))
ser.tx(48+z)
ser.str(string(13, 10, 13, 10))
Kompilert und durchsimuliert für LMM:
Code: Alles auswählen
$ fastspin pic.spin -o pic.lmm.binary
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
Version 3.9.22 Compiled on: Mar 5 2019
pic.spin
|-FullDuplexSerial.spin
pic.lmm.pasm
Done.
Program size is 2216 bytes
$ spinsim -b pic.lmm.binary
moo1
c == 0
z == 1
moo2
c == 0
z == 1
...und für "echtes" Cog-PASM:
Code: Alles auswählen
$ fastspin pic.spin -o pic.cog.binary --code=cog
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
Version 3.9.22 Compiled on: Mar 5 2019
pic.spin
|-FullDuplexSerial.spin
pic.cog.pasm
Done.
Program size is 1560 bytes
$ spinsim -b pic.cog.binary
moo1
c == 0
z == 1
moo2
c == 0
z == 1
...also beide Male kommt, was ich erwarte: "c == 0" und "z == 1"...
Brauch ich mehr Koffein?
Was überseh' ich?
...ich geh jetzt erstmal kühles Früh-O₂ fangen. Das sollt koffeinähnlich gut wirken...