Question about p2asm and flexspin
I have a question regarding p2asm translated with flexspin.
The background is a larger project.
A translator from Python source code to p2asm.
Using the Python bytecode, I turn the stack-oriented structure into a register-oriented structure.
I've only made it a small way and I still have a long way to go.
At least I can already run some test succesful.
And now to the question:
From this Python test code
a=0
while(True):
a=not(a)
the bytecode is obtained in the first step:
LOAD_CONST 0 (0)
STORE_NAME 0 (a)
NOP
LOAD_NAME 0 (a)
UNARY_NOT
STORE_NAME 0 (a)
JUMP_ABSOLUTE 3 (to 6)
and from this creates the file forever.spin2: !Here is the question!
------------------- File Begin -----------------------------------------
' forever.py --> forever.spin2
con
_clkfreq = 160000000
_clkmode = 16779259
None = 0
dat
org 0
mov reg0 , #0
mov a , reg0
nop
Label6
mov reg0 , a
NOT reg0
mov a , reg0
jmp #Label6
a res 1
reg0 res 1
--------------------- End of File ----------------------------------------------
This is what happens when compiling:
flexspin forever.spin2
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2023 Total Spectrum Software Inc. and contributors
Version 6.1.6-- Compiled on: Jun 10 2023
forever.spin2
forever.spin2:13: error: syntax error, unexpected NOT (!!)
Why doesn't the compiler like that?
edit: I read the Assembler Documentation again and again, but I find no reason.
Comments
you need to use
flexspin -2 forever.spin2
if you want to target P2. P1 does not have a NOT opcode, thus the error.@Wuerfel_21
Thank you, I forgot the -2 argument.