Navigation
Home & news
Random page
All pages
Site search:
Databases
Fortune cookies
Haikus
SID themes
Page collections
Blag
Chip music
Chipophone
Games
Hardware projects
Music downloads
Obfuscated programming
Piano music
Sane programming
Scene productions
SID related pages
Software downloads
Video downloads
Featured pages
A Chipful of Love For You
Air on a Rasterline
Autosokoban
Beagleboard VGA
Binary Art
Bitbuf
Brainfuck
Chipophone
Chopin romance
Craft
Elements of Chip Music
Fratres
GCR decoding on the fly
Gravazoid
Hardsync
Kernighan's lever
Klämrisk Hero
Live at LCP 2011
Parallelogram
Phasor
Pipe Logic
Poems for bugs
Rasp64
Raster paper
Reverberations
Safe VSP
Shards of Fancy
Sidreloc
Spindle
Swan
TTY demystified
Think Twice III
VIC Timing Chart
We learn the nibbles
Don't miss

Intercal
Forum
Register
Log in
Latest comments
Syndication
RSS feed
Feedback
  • Swedish content
  • Personal content
  • Offensive content

Plasma

The Propeller Low-level Assembly Aggregator

Plasma is a small (637 lines of source code) tool for compiling and concatenating propeller assembly language (PASM) and binary data. It extends PASM with some new features, most notably ARM-like constant pools.

Background

When I began to work on my Turbulence demo, I soon realized that I was going to have to write my own assembler. The one from Parallax was bulky and inflexibly locked to the spin environment for which it was designed, and had to be run through wine. The open source alternatives weren't stable enough at the time. Consequently, I hacked together some prolog code and a bison parser.

I've decided to publish the source code here, as free software, in the hope that somebody will find it useful and inspiring.

Documentation

Documentation is scarce, because this tool was developed for my own private use. The source code is quite readable, though, since it's short and written in a high level programming language.

Here is an example of plasma source code, illustrating some of the new features. For the ultimate example, please refer to the turbulence source code.

' Constant declaration. Must begin at start of line, just like labels.
ABC         = $1000

' Every label will refer to one cog address and one hub address (accessible with @).
' Consider the following code, for example:
            org         0
	    horg        $1000

start       mov         r1, #start      ' Place the value 0 in r1.
            'mov         r1, #@start     ' This would cause an error, since $1000 doesn't fit in 9 bits.
	    mov         r1, =@start     ' Allocate a register in the constant pool, then refer to it.
	    mov         r1, =ABC	' Plasma will re-use the same constant pool register here.
            jmp         #start

            byte        "hello"         ' We are no longer aligned on a long boundary.
mylabel                                 ' @mylabel = $1015, mylabel = undefined due to unalignment.
	    align       4               ' Insert padding bytes until the cog address is long aligned (3 bytes).

            pool                        ' Plasma will put a long here, with the value $1000.

r1          res         1

            vfit        496             ' Verbose fit. Like 'fit', but prints how many registers are used.
	    vhfit       $2000           ' Verbose hub fit. Counts bytes rather than registers.

Download

Install

To build, you'll need SWI-prolog, flex, bison and gcc. Edit the makefile to point out the include directory where your SWI-Prolog.h is located. You will end up with two files; plasma (the executable) and native.so. You have to specify the location of native.so when you run plasma, using the -l flag.

Run

Plasma is invoked like this:

plasma -l native.so -o output.bin input.s

Posted Monday 11-May-2009 16:47

Discuss this page

There are no comments here yet.