Shop OBEX P1 Docs P2 Docs Learn Events
How do I insert blocks or single lines of assembly from within my SPIN code? — Parallax Forums

How do I insert blocks or single lines of assembly from within my SPIN code?

T&E EngineerT&E Engineer Posts: 1,396
edited 2006-07-29 16:37 in Propeller 1
I know that SX/B allows you to insert assembly code into your SX/B code.
(e.g. ASM ... ENDASM···· or··· \)

How do you do this on the Propeller?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-29 16:37
    Read the manual and look at any of the examples that use assembly code. The DAT section is where assembly instructions go. There are no special commands needed. On the other hand, you can't just stick a few lines of assembly in with your source code because that's not how the propellor works. The SPIN code is interpreted like on the Stamp. The compiler doesn't translate the SPIN code into Propellor instructions, so you can't just stick some instructions inline. Assembly routines are small, self contained programs that run in a COG independent of the SPIN program. They can communicate with a SPIN program via shared variables, shared I/O, and the "locks", otherwise known as semaphores. They have their own address space (512 longs) of 32 bit memory that is completely independent of the memory used by SPIN (and, in fact, can't be accessed from SPIN or another COG's assembly routine).

    Post Edited (Mike Green) : 7/29/2006 4:43:41 PM GMT
Sign In or Register to comment.