Shop OBEX P1 Docs P2 Docs Learn Events
Question about p2asm and flexspin — Parallax Forums

Question about p2asm and flexspin

ReinhardReinhard Posts: 489
edited 2023-07-29 18:12 in Propeller 2

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

Sign In or Register to comment.