CONTENTS

Home
Updates
Software
Electronics
Android / iOS
Videos
Music
Resume
Contact



HTTPS VERSION


naken_asm

Posted: July 25, 2012
Updated: August 20, 2017

Introduction

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.

CPU asm disasm sim cycle counter Java Grinder Author
4004 Beta Beta   No No Michael Kohn
6502 / 6510 Stable Stable Beta Yes Yes Joe Davisson
65C816 Stable Alpha   Yes Yes Joe Davisson
6800 Beta Beta   No No Michael Kohn
6809 Stable Stable   Yes Yes Michael Kohn
68H08 Beta Beta   Yes No Michael Kohn
68000 Stable Stable   No Yes Michael Kohn
8051 / 8052 Stable Stable   No No Michael Kohn
ARC Alpha Alpha   No No Michael Kohn
ARM Beta Beta   No No Michael Kohn
Atmel AVR8 Stable Stable Beta Yes Yes Michael Kohn
Cell BE Beta Beta   No No Michael Kohn
dsPIC Stable Stable   Yes Yes Michael Kohn
Emotion Engine Beta Beta   No No Michael Kohn
Emotion Engine VU Beta Beta   No No Michael Kohn
Epiphany Stable Stable   No No Michael Kohn
LC-3 Beta Beta Beta No No Michael Kohn
MIPS32 Stable Stable Beta No Yes Michael Kohn
MIPS64 Alpha Alpha   No No Michael Kohn
MSP430 Stable Stable Stable Yes Yes Michael Kohn
MSP430X Stable Stable   No Yes Michael Kohn
PIC14 Beta Beta   No No Michael Kohn
PIC24 Stable Stable   Yes Yes Michael Kohn
PIC32 (MIPS32) Stable Stable Beta No Yes Michael Kohn
Propeller Stable Stable   Yes Yes Michael Kohn
PowerPC Beta Beta   No No Michael Kohn
RISC-V Beta Beta   No No Michael Kohn
STM8 Stable Stable   Yes No Michael Kohn
Super FX Beta Beta   No No Michael Kohn
THUMB Beta Beta   No No Michael Kohn
TMS1000 / TMS1100 Stable Stable   No No Michael Kohn
TMS9900 Stable Stable   Yes Yes Michael Kohn
Z80 Stable Stable Alpha Yes Yes Michael Kohn

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.

Download
naken_asm-2017-08-20.tar.gz (Source)
naken_asm-2017-08-20.zip (Windows Binary)
naken_asm-2017-08-20-macosx10.10-x86_64.tar.gz (MacOSX)
naken_asm-2017.08.20-1.el7.centos.x86_64.rpm (CentOS Linux)

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

Older
naken_asm-2017-07-03.tar.gz (Source)
naken_asm-2017-06-24.tar.gz (Source)
naken_asm-2017-06-04.tar.gz (Source)

Include Files

Alexander Zhevak MSP430 includes

How To Help

  • Use the assembler. Send me bug reports, suggestions, or just let me know you're using it.
  • Spread the word. Link to this page.
  • Create a package for a distribution (BSD/Linux etc).
  • Development boards and other toys would be fun :).

Samples

launchpad_blink.asm - Make 2 LED's blink with the MSP430 Launchpad
CamelForth - Brad Rodriguez has an implementation of Forth assembled with naken_asm.
Sega Genesis Demo - A little demo of code written in Java, compiled with Java Grinder, and assembled with naken_asm.
Apple IIgs Demo - A little demo Joe Davisson made of code written in Java, compiled with Java Grinder, and assembled with naken_asm.
Commodore 64 Demo - A little demo Joe Davisson made showing a Commodore 64 demo written in Java, compiled with Java Grinder, and assembled with naken_asm.
TI99/4A Demo - A little demo of code written in Java, compiled with Java Grinder, and assembled with naken_asm.
dsPIC Mandelbrots - Compute Mandelbrots with the DSP module of the dsPIC
Epiphany Mandelbrot - Compute Mandelbrots on a 16 core Epiphany on a Parallella board.

Test Strategy

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: 6502, 8051, 65816, 68000, ARM (not complete), AVR8, Cell, dsPIC, Epiphany, LC-3, MIPS, MSP430, MSP430X, PIC14, PIC32, Playstation 2 Emotion Engine, Propeller, RISC-V, STM8, THUMB, Z80

Chip Info

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

6800 / 6809 - Support for CPUs compatible with the 6800 / 6809 instruction set. The Java Grinder repository has a TRS80 Coco demo.

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.

MIPS - Thanks to Farnell for donating a chipKIT UNO32 so I can add MIPS support to naken_asm. The Java Grinder repository has a PIC32 Mandelbrot demo.

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.

Documentation

I've been working on a README I'm going to start including with the download:
README

News

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.

November 27, 2016: I added PowerPC (just the standard instructions) and RISC-V lately. All the PowerPC instructions are automated tested against the gnu-as assembler for PowerPC. Most of the RISC-V instructions are being tested. Should be completed in the next few days.

August 4, 2016: Released a new tarball and RPM and such for naken_asm. I decided I should probably run the 8051 through some heavy tests so now the output for every instruction assembled in naken_asm is tested against the output of the c51asm 8051 assembler. Found a couple bugs in there. Also thanks to borstel there are some fixes in the avr8 simulator.

July 9, 2016: Released a new tarball and RPM and such for naken_asm. The biggest change in the new release is Playstation 2 Emotion Engine support.

June 4, 2016: Working on the Playstation 2 Emotion Engine vector unit assembler. Finding what appear to be errors in the documentation for the vector units. The instruction ABS.dest fs, ft appears it should be written as ABS.dest ft, fs. The gnu-as assembler for the vector units want ft, fs. I'm going with the GNU on this, but need to look into this later.

May 12, 2016: Emotion Engine is complete. Now I have to decide if I also want to enter the MIPS SIMD instructions (since MIPS has its own vector instructions that are different from the Playstation 2's vector instructions).

May 8, 2016: I've been adding MIPS64 and Playstation 2 Emotion Engine instructions. I really want to make a Playstation 2 demo, but we'll see. This PDF I'm using with all the Emotion Engine instructions has all kinds of errors in it. Most are easy to pick out (instructions labeled as the wrong version of MIPS) but at least one instruction for sure has the wrong opcode. The tests against gcc for EE should pick those out at least.

Copyright 1997-2017 - Michael Kohn