CONTENTS

Home
Updates
Software
Electronics
Android / iOS
Videos
Music
Resume
Contact

HTTPS VERSION


naken_asm

Posted: July 25, 2012
Updated: May 10, 2020

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
1802 /04/05/06 (RCA) RC RC   No No Michael Kohn
4004 (Intel) Beta Beta   No No Michael Kohn
6502 / 6510 Stable Stable Stable Yes Yes Joe Davisson
65C816 Stable Alpha   Yes Yes Joe Davisson
6800 RC RC   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
8048 (MCS-48) RC RC   No No Michael Kohn
8051 / 8052 (MCS-51) Stable Stable   No No Michael Kohn
86000 RC RC   No No Michael Kohn
ARC Alpha Alpha   No No Michael Kohn
ARM RC RC   No No Michael Kohn
ARM64 Alpha Alpha   No No Michael Kohn
Atmel AVR8 Stable Stable Stable Yes Yes Michael Kohn
Cell BE (IBM) Stable Stable   No No Michael Kohn
Copper (Amiga) Beta Beta   Yes No Michael Kohn
CP1610 Beta Beta   No No Michael Kohn
dsPIC Stable Stable   Yes Yes Michael Kohn
Emotion Engine (Sony) Stable Stable   No Yes Michael Kohn
Emotion Engine VU Stable Stable   No No Michael Kohn
Epiphany (Parallela) Stable Stable   No Yes Michael Kohn
Java Beta Beta   No No Michael Kohn
LC-3 RC RC RC No No Michael Kohn
M8C (PSoC 1) RC RC   No No Michael Kohn
MIPS32 Stable Stable Stable 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
PDP-8 Alpha Beta   No No Lars Brinkhoff
PIC14 RC RC   No No Michael Kohn
PIC24 Stable Stable   Yes Yes Michael Kohn
PIC32 (MIPS32) Stable Stable Stable No Yes Michael Kohn
Propeller Stable Stable   Yes Yes Michael Kohn
PowerPC Stable Stable   No No Michael Kohn
RISC-V Stable Stable   No No Michael Kohn
SH-4 RC RC   No No Michael Kohn
STM8 Stable Stable RC Yes No Michael Kohn
Super FX Beta Beta   No No Michael Kohn
SWEET16 RC RC   No No Michael Kohn
THUMB RC RC   No No Michael Kohn
TMS340 / TMS34010 RC RC   No No Michael Kohn
TMS1000 / TMS1100 Stable Stable   No No Michael Kohn
TMS9900 Stable Stable   Yes Yes Michael Kohn
WebAssembly Beta Beta   No No Michael Kohn
Xtensa RC RC   No No Michael Kohn
Z80 Stable Stable Alpha Yes Yes Michael Kohn
  • Stable: The assembler has been used on a project.
  • RC: The assembler has been tested against another assembler for accuracy.
  • Beta: Code complete and should be good.
  • Alpha: The assembler has been started but not complete.

If anyone else has been using one of these assemblers / disassemblers and finds it stable please let me know so I can change the status to stable.

Input / Output file formats:

  • Intel HEX
  • ELF
  • Raw Binary
  • SREC
  • WDC
  • Amiga

Download
naken_asm-2020-04-25.tar.gz (Source)
naken_asm-2020-04-25.zip (Windows Binary)
naken_asm-2020-04-25-macosx10.15-x86_64.tar.gz (MacOSX)
naken_asm-2020.04.25-1.el7.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-2020-01-20.tar.gz (Source)
naken_asm-2019-11-18.tar.gz (Source)
naken_asm-2019-11-07.tar.gz (Source)
naken_asm-2018-03-17.tar.gz (Source)

Documentation

The github repository has a docs directory with a list of all directives and some specific information for certain CPUs:
README

Include Files

include/

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.
Playstation 3 Cell Mandelbrots - Compute Mandelbrots on 6 Playstation 3 Cell cores.
Playstation 2 Demo - A demo written in Java, compiled with Java Grinder, and assembled with naken_asm.
RISC-V - assembly on a HiFive1 board.
TRS80 Coco demo - A demo written in Java using the 6809 support.

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.

All tests are in naken_asm's tests/ directory.

Updates

May 17, 2020: I added TMS340 tests this weekend. Testing against the gspa assembler. I also added some TMS34020 instructions. I wish I had a board to test on :(.

May 10, 2020: I added TMS340 (TMS34010) this weekend. It was used in Mortal Kombat so I thought it might be cool to have it. Just need to do some testing to FINISH IT!

January 20, 2020: I added comparison tests for PSoC M8C (comparing against Cypress's own assembler) and 8048 / MCS-48 (comparing against asm48).

December 17, 2019: I added PSoC M8C. I haven't had a chance to try it yet and there are currently no tests that compare the output with other M8C assemblers.

November 2, 2019: Tests pass for Hitachi SH-4.

October 26, 2019: Added Hitachi SH-4. As of today, it's code complete but hasn't been tested. Should work with the Sega Dreamcast hardware.

March 5, 2019: Added MCS-48 .. seems this was some Intel instruction set used in things like 8048 in the Magnavox Odyssey 2.

February 3, 2019: Added Tensilica's Xtensa instruction set. This is the CPU used in the ESP32 and ESP8266 cheap WiFi modules. So far there are tests against the output of GNU's assembler and everything matches except slli (which looks like a bug in GNU's assembler) plus a bunch of instructions (data cache instructions) that aren't supported by GNU's assembler aren't tested. There is a complete list of instructions tested in the tests/comparison directory under xtensa_template.txt. Also, big endian mode isn't tested yet.

January 5, 2019: Added Java. It can't output class files, so not sure how useful it is at this moment, but I have my reasons for wanting it.. :).

December 25, 2018: Added Amiga's copper co-processor and some developer documentation to help with others wanting to add support for their own CPU.

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.

Copyright 1997-2020 - Michael Kohn