qasm - A P2 Assembler written in C
Dave Hein
Posts: 6,347
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.
zip
986K
Comments
All we need is a loader source that works and we can have testers that can't use Windows play along!
Thanks, Dave!!
Does it support macros and conditional assemble ?
It could follow the gas format for those directives, for portability.
I found some here
http://cs.mtu.edu/~mmkoksal/blog/?x=entry:entry120116-130037
@jmg, there are no macros or conditional assembly. It just converts opcodes to binary. I am thinking of adding the capability to produce object files that can be linked together by a linker. However, I'm not planning on adhering to any Gnu standards.
Interesting - do you have linking with something else in mind ?
Hi Dave, I heard that. This is cool, thanks for thinking of us rebels.
Does this understand all the syntax of Spin style VAR and DAT sections that PASM may need to use?
I'll mulling over my options right now. PNut.exe is the only loader I presume? Anyone know otherwise?
I was thinking there might be detailed protocol info in the pasm files in Chip's updates but I haven't looked as yet ... must get back to work ....
Peter and Chip were discussing SPI / SD card. If that happens, there is a path for something other than Pnut.
re:I have been working quietly on shrinking Kye's FAT driver, currently for the P1. Once it's done I can convert it to P2.
Great! I just started to work on a project that will use PROP 1 FAT and PROP 2 FAT later. if you need a tester later just let me know.