Posted: July 25, 2012
Since I was adding new CPU support to naken430asm I decided to rename it to naken_asm. This is a raw, simple assembler. I have some include files for msp430 and Alexander Zhevak has made more complete include files available from: git clone git://github.com/zhevak/naken430-inc.git. Include files from Microchip for dsPIC work after being run through an included script and Atmel include files work directly from Atmel. As a side project, with help from Joe, we have been putting together a Java .class compiler called Java Grinder which produces output that can be compiled with naken_asm.
Stable here means I've been using it and proved it's working well. Beta means all the code is down but I haven't gotten a chance to write much code around it. If anyone else has been using one of these assemblers / disassemblers and finds it stable please let me know.
The source code is for compiling on Linux, BSD, or any other OS. Just install gcc and type ./configure and then make.
Repository: git clone https://github.com/mikeakohn/naken_asm.git
How To Help
65xx - Support for 6502, 65c02, 6507, 6510, and any chip of this 8 bit family.
W65C816 - Support for the 16 bit version of the 6502. Example of this working here: Apple IIgs Java
680x - Support for CPU's compatible with the 6800 instruction set.
68HC08/CPU08 - 68HC08 microcontroller instruction (CPU08). I did this specifically for the 68HC908GP32.
680x0/CPU32 - My target for this minimum 68000 for Amiga programming or Sega Genesis or such. I may add Amiga executable support for input and output.
8051/8052 - Support for 8051 and 8052 8 bit family chips (also known as MCS-51). I tested some code on an Atmel AT89S52.
ARM - Disassembler and assembler are mostly done for generic instructions. I made a small program to prove it working on the Raspberry Pi here.
STM8 - Added support for STM8. Valentin Dudouyt has created a tool to flash the STM8 Disovery board with Linux: https://github.com/vdudouyt/stm8flash.
TMS1000/TMS1100 - An old TI 4 bit CPU that's used in the Speak & Spell, Speak & Math, some old calculators, and others.
TMS9900 - One of the first 16 bit CPUs. From the looks of it it seems to be the grandfather of the MSP430. I didn't use TMS9900 standard syntax for hex, but I can change it if i get requests.
In order to give confidence that naken_asm isn't going to hinder anyone else's development, I've been adding 3 different types of tests to the build system. The unit and regression tests should be obvious what they do. For the comparison tests, I created a text file with every single instruction, assembled each instruction one by one using someone else's assembler (usually the GNU gas assembler), and used a bash script to compare the output of naken_asm with the output of these assemblers.
Unit Tests: eval_exression(), var.h
Regression Tests: 805x, avr8, dspic, msp430, stm8, tms9900, z80
Comparison Tests: 65xx, ARM (not complete), msp430x, STM8, Z80, dsPIC, Epiphany
I've been working on a README I'm going to start including with the
launchpad_blink.asm - Make 2 LED's blink with the MSP430 Launchpad
April 25, 2015: Progress is still going on here. Joe has added 65816 along with automated tests and rewrote the 6502 assembler. I've added automated testing for 68000 and I'm working on ARM.
December 4, 2014: Fixed a bug in Z80. The bug wasn't producing bad code, but it would possibly cause an assembler error in pass 1 on forward jumps.
November 18, 2014: I have an automated tests done for Parallella / Epiphany which assembles almost all the instructions and compares the results against epiphany-elf-as. Fixed some things and seems pretty stable so far.
TODO: Add float support to eval_expression, automate test on branch instructions, figure out what movfs is (it's documented wrong I believe), figure out how 'double' versions of ldr/str work (undocumented I think), and possibly add 'double' to the new expression evaluation code.
November 16, 2014: Added support for Epiphany (the parallel processors in the Parallella boards). I haven't tested any of it yet so I would guess it still needs some polish, but it's code complete at least.
October 27, 2014: STM8 branch merged. I redid both the assembler and disassembler. I haven't created a test to prove it out yet, but I've eyeballed all the different variations of instructions and it looks good. I marked all the instructions as ST7 so I would make it restrict to ST7 instructions only. Problem is the stm8.pdf file I got (from ST's website) appears to be full of mistakes. Instructions that appear to be STM8 only are marked as ST7 sometimes. There are also spelling errors (for example SWAP is spelled SWAPL) and sometimes the indirect instructions are written as [$10].w instead of [$10.w] for example. Hope it doesn't affect the quality if the assembler.
October 23, 2014: I created a branch for STM8 so I can redo this chip. I was trying to avoid creating a giant table for it and ended up kind of making a mess. The rewrite will have a big ugly table, but will be easier to read. I also plan on assembling all the instructions with ST's assembler so I can have a comparison test to prove the assembler is putting out the appropriate opcodes.
September 9, 2014: I've been adding different types of scripted tests to naken_asm that I can run every time I do a build. Found a few bugs and posted a new release.
March 22, 2014: I added symbols information from ELF to naken_asm so bprint and wprint for example can use the symbol names instead of just numbers. I also added a simulator for avr8 to assist in the avr8 Java Compiler for Java Grinder.
March 16, 2014: I added some code so that naken_util can now execute MSP430 code from the command line without entering the simulator. The purpose for this was to help automate testing of Java Grinder. Now if Joe or I make a change to some critical code, make tests will compile some Java programs, grind them into MSP430, and then execute them with naken_util and test that R15 is the expected value. There are a bunch of tests like this that I've been wanting to add to naken_asm too, but I have so little time.
February 22, 2014: I've been cleaning up some code today. Trying to make some of the older naken430asm code that I moved here easier to read. I've also started changing my spacing system from the x=1 format to the more common x = 1. I fixed a bug that made $ for hex in 65xx stop working and added a .set directive. Now from anywhere in the code .set can be used to set a variable in the address list (same list as labels are put in) except this number can change as many times as the user wants.
Also, I've currently been working on a project called Java Grinder (with Joe Davisson again doing the 65xx part) which uses this assembler.
November 29, 2013: I introduced a bug into the September 18, 2013 release that made naken_asm not deal with single ascii characters inside of '' correctly. This is fixed in the November 29, 2013 version. I removed any versions of naken_asm with that problem from my website.
November 28, 2013: Made some major improvements to ARM. Doing some comparing between GNU's as and naken_asm to make sure it's okay. Eventually I'm planning on making some auto-test of all the instructions like I did with dsPIC. Also, naken_prog can now program LPC chips. I can read the flash back and see that it came back the same way I wrote it so it appears it's working. I also fixed a bug in writing out symbols in ELF output.
November 07, 2013: I fixed a bug in the cycle counter in MSP430 and finished my clean-up of the ARM code. Over the next couple weeks I'm going to do some QA on it to make sure everything is working okay. I also added naken_prog which is currently able to read info and flash from LCP1114 ARM chips (and probably some others). Tomorrow I plan to make it so I can write to the flash of a chip.
October 30, 2013: I started on a major cleanup / rewrite of the ARM code a couple weeks ago. Hopefully in the next couple weeks I'll have a chance to finish it up. If not it's my Thanksgiving project.
July 28, 2013: Major rewrite of dsPIC assembler / disassembler is done. I added a script for converting Microchip's include files to naken_asm style. Working on my first big dsPIC project so I can mark this as stable.
July 21, 2013: Posted the latest. I deleted almost all of the dsPIC assembler and started over. I've been checking every type of instruction against the Microchip assembler and everything is looking really good. I have a couple things to polish up and a little more testing to do. Also, I have 6 DSP instructions that I haven't added yet. Should be done in a couple days I hope. Also, thanks to Ene Alexandru for reporting a segfault in the disassembler for msp430x and sending me a fix. That's included in this release too.
Copyright 1997-2015 - Michael Kohn