Posted: July 25, 2012
naken_asm is a lightweight assembler / disassembler with a focus on being easy to compile (no dependencies) and easy to use. It was originally called naken430asm, but since it has been expanded it to support many more CPUs it has been renamed to naken_asm. Additionally, there is also a simulator for some of the supported CPUs.
Stable here means I've been using it and proved it's working well. Beta means all the code is written but I haven't gotten a chance to use it myself. Most of the beta assemblers still have tests run against them that compare against other assemblers. If anyone else has been using one of these assemblers / disassemblers and finds it stable please let me know.
The source repository is really the best place to get naken_asm since it will have all the latest bug fixes and features. It should compile easily 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
launchpad_blink.asm - Make 2 LED's blink with the MSP430 Launchpad
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, data, macros, memory, symbol table, get_token
Regression Tests: 805x, AVR8, dsPIC, msp430, stm8, tms9900, z80
Comparison Tests: 1802, 6502, 8051, 65816, 68000, ARM (not complete), AVR8, Cell, dsPIC, Epiphany, LC-3, MIPS, MSP430, MSP430X, PIC14, PIC32, Playstation 2 Emotion Engine, PowerPC, Propeller, RISC-V, STM8, THUMB, Z80
1802 - Support for RCA 1802 compatible chips.
6502 - Support for 6502, 65c02, 6507, 6510, and any chip of this 8 bit family.
65C816 - Support for the 16 bit version of the 6502. Example of this working here: Apple IIgs Java
68HC08/CPU08 - 68HC08 microcontroller instruction (CPU08). I did this specifically for the 68HC908GP32.
68000/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 and on a Wixel.
ARM - Disassembler and assembler are mostly done for generic instructions. I used it to make Easy Match work on a Raspberry Pi.
Emotion Engine - This is the CPU (based on MIPS) in the Playstation 2. There is support for the two vector units as well.
IBM Cell - This is for the 8 core SPU vector units in the Playstation 3.
STM8 - Added support for STM8. Valentin Dudouyt has created a tool to flash the STM8 Disovery board with Linux: https://github.com/vdudouyt/stm8flash.
Super FX - This is a chip that was originally used as a co-processor in some Super Nintendo games. I wanted to add an assembler for the ARC instruction set used in the Intel Curie and as some chip used on some Intel motherboards. Supposedly that chip was based on this one. As soon as I can find more info on the ARC, I'll directly add it.
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.
I've been working on a README I'm going to start including with the
July 8, 2018: I added (the start) of a linker to naken_asm. Currently it just works with MIPS (Playstation 2). I was using it to link some pieces of ps2dev to try getting sound working. It pretty much just handles functions and doesn't support global variables. Hoping to have it work with global variables and some other CPUs sometime.
June 1, 2018: Since it seems there is a new Intellivision console I decided to add CP1610.
May 12, 2018: Added support for SWEET16 (for Apple II programmers).
April 22, 2018: Added support for RCA 1802.
October 21, 2017: Added a Playstation 3 example using 6 SPU cores to the SIMD Mandelbrots page.
October 15, 2017: Added a Playstation 3 example using AltiVec to the SIMD Mandelbrots page.
October 7, 2017: Added FPU instructions to PowerPC.
September 8, 2017: Altivec support is in.
September 7, 2017: Just an update as to where the assembler stands right now. There have been a few bug fixes lately (I'll probably roll up a new tarball in the next few days) around macros (there was a limit of like 10 parameters, it's now 254) and some bugs in the 6502 simulator that were filed on github. My current work has been adding samples for Playstation 2. In the samples directory I've added code to display a triangle, draw an image, do some texture mapping. Next will probably be the vector units. I also started adding code to the PowerPC base for Altivec. I'm hoping to have some sample code for the Playstation 3 using that and the Cell BE soon. On my list is also to add NEON to the ARM assembler and THUMB-2 to the THUMB assembler. I started working on ARC (a core found in Intel's Curie chip in the Arduino 101 and the Intel ME chip found on Intel motherboards) but that chip is very tedious... maybe I'm missing a better way to implement it.
June 16, 2017: Didn't realize that Parallax Propeller instructions all had condition codes. In the documentation the "cond" field always had 1111 instead of something like CCCC so I figured all these instructions could only be "if_always". I added conditions to the assembler.
May 29, 2017: I added a Mandelbrot generator the Epiphany / Parallella board in the samples directory. I created a Epiphany Mandelbrot page for more info on that. I also added an LC-3 assembler. Hoping I have time to do FPGA work with it.
I've been eyeballing Axis's Etrax (CRIS?) CPU and the ARC CPU (the one that comes with the Intel Curie and on Intel motherboards) as possible future assemblers. If anyone has any requests send me an email.
April 6, 2017: I added automated testing for THUMB comparing the output to GNU's assembler.
March 24, 2017: I added a Playstation 2 include file and a small Playstation 2 program written in assembly. I posted a picture along with a small explanation on a Playstation 2 page.
January 13, 2017: I added Super FX. Some kind of chip used in some Super Nintendo cartridges it seems. Somehow this is supposed to be related the ARC chip inside of the Intel Curie and hidden on some Intel motherboards, but I'm not sure how they relate yet. The instruction set I really wanted to add was ARC.
January 10, 2017: I added PIC14 to the list of supported instruction sets. This should support any Microchip PIC CPU where the opcodes are 14 bits in size.
January 1, 2017: The Cell CPU is code complete and now matches with the assembly output of GNU spu-as assembler. The "stopd" instruction in GNU spu-as unfortunately doesn't match with IBM's documentation. I emailed IBM about it, so hopefully they will respond to me.
December 19, 2016: I've been wanting to write some code to use on the Sony / IBM Cell Broadband Engine on the Playstation 3, so I started added Cell support. It's probably a little more than half done but needs unit tests and stuff. There's a few awkward things in there which I don't have assembler syntax for, the branch prediction instructions for example, but mostly it should be pretty decent.
Copyright 1997-2018 - Michael Kohn