qasm - A P2 Assembler written in C
Qasm is a C program that assembles P2 code. I've verified it against the PNUT binaries, and it matches except for some slight differences in floating point constants. I wrote qasm a few years ago so I could write P2 code before PNUT was available. However, even though PNUT is available there are times that I like to run things from the command line. So I brought qasm up to date with the latest P2 instruction definitions. It also generates a list file that might be useful. The list file for all_cogs_blinks looks like this:
dat 00000 orgh 0 ' ' launch cogs 15..0 with blink program ' cogs that don't exist won't blink ' 00000 000 org 00000 000 fce4040c .loop coginit cognum,#@blink 00004 001 f9dc05fe djns cognum,#.loop 00008 002 0000000f cognum long 15 ' ' blink ' 0000c 000 org 0000c 000 fd600e01 blink cogid x 'which cog am I? 00010 001 f463f607 setb dirb,x 'make that pin an output 00014 002 f423fa07 notb outb,x 'flip its output state 00018 003 f1040e10 add x,#16 'add to my id 0001c 004 f0640e12 shl x,#18 'shift up to make it big 00020 005 fd600e28 waitx x 'wait that many clocks 00024 006 fd9fffe4 jmp #blink 'do it again 00028 007 x res 1I included a Windows executable in the zip file. Executables for other platforms can be built from source by running the "buildit" script file.