CONTENTS

Home
Updates
Software
Electronics
Music
Resume
Contact


YouTube
Twitter
GitHub
LinkedIn

HTTPS VERSION


naken_asm

Posted: July 25, 2012
Updated: February 10, 2024

Introduction

naken_asm is a lightweight assembler / disassembler with a focus on the following features:

  • Simple to compile (no dependencies, just type ./configure then make).
  • Simple to use (documentation here).
  • Support for many CPUs.
  • Include files for game consoles, microcontrollers, sensors, and other external devices.
  • Many samples to help out plus an MSP430 Tutorial.
  • Simulation for some CPUs.
  • More examples in the Java Grinder project.
  • Well supported (send an email or create a github issue or feature request).

Support for the following CPUs:

CPU asm disasm sim cycle counter Java Grinder Author
1802 /04/05/06 (RCA) Stable Stable   No No Michael Kohn
4004 (Intel MCS-4) RC RC   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
68HC08 RC RC   Yes No Michael Kohn
68000 Stable Stable   No Yes Michael Kohn
8008 (Intel MCS-8) Stable Stable Beta No No Michael Kohn
8048 (MCS-48) RC RC   No No Michael Kohn
8051 / 8052 (MCS-51) Stable Stable   No Yes 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) Stable Stable   Yes No Michael Kohn
CP1610 Stable Stable   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
F100-L (Ferranti) Stable Stable Beta 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
MIPS Stable Stable Stable No Yes Michael Kohn
MSP430 Stable Stable Stable Yes Yes Michael Kohn
MSP430X Stable Stable   No Yes Michael Kohn
Nintendo 64 RSP Stable Stable   No No Michael Kohn
PDP-8 Alpha Beta   No No Lars Brinkhoff
PDK13 RC RC   No No Michael Kohn
PDK14 RC RC   No No Michael Kohn
PDK15 RC RC   No No Michael Kohn
PIC14 RC RC   No No Michael Kohn
PIC18 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
Propeller 2 Stable Stable   Yes No Michael Kohn
PowerPC Stable Stable   No No Michael Kohn
RISC-V Stable Stable Beta No Yes 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
SunPlus unSP RC RC   No No 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
  • Mach-O
  • Raw Binary
  • SREC
  • WDC
  • Amiga

Download
naken_asm-2024-02-10.tar.gz (Source)
naken_asm-2024-02-10.zip (Windows Binary)
naken_asm-2024-02-10-macos-aarch64.tar.gz (MacOSX)
naken_asm-2024.02.10-1.el7.x86_64.rpm (CentOS Linux)

The git 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-2023-12-26.tar.gz (Source)
naken_asm-2023-01-11.tar.gz (Source)
naken_asm-2022-10-29.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

I also started an MSP430 tutorial that might be useful: MSP430 Tutorial. It's still a work in progress.

Include Files

include/

How To Help

  • Use the assembler. Send 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

Microcontrollers / Single Board Computers

Consoles / 80's Retro

FPGA

Test Strategy

In order to give confidence that naken_asm isn't going to hinder anyone else's development, there are 3 different types of tests in the build system. The unit tests test small functions and modules outside the main naken_asm executable. For the comparison tests, there are text files with every single instruction with the output for each instruction assembled using another assembler (such as the GNU gas assembler), and a bash script compares the output of naken_asm with the output of these assemblers.

All tests are in naken_asm's tests/ directory.

History / About

This project was started back in 2010 at first just targeting the MSP430. Back then I found the dev tools for this chip to be a bit frustrating since they typically required a Windows system, an expensive license, or just in general had difficulty detecting the hardware I had.

The main parts of naken_asm were written in a modular way to allow other CPUs to be added, so after completing MSP430 I started on dsPIC. At that time Joe Davisson (who I've known since college... the band he played guitar in would play at the same clubs the band I was in was playing) started adding 6502 code. Joe also did all the 6502 / 65C816 work in Java Grinder along with the Atari 2600 and C64 coding.

The name of the assembler "naken_asm" is kind of a long story. It was originally called naken430asm, which I considered to be a very stripped down assembler. It compiled to about 50k and had plenty of features without all the complexity. I was trying to think of a better, more professional sounding name for it when support for more CPUs was being added, but I couldn't think of anything that wasn't already taken. I asked a friend of mine if he had some ideas and he basically told me, "why would you change that?". So here it is... naken_asm. If anyone is curious how to pronounce it, it doesn't sound like "naked" it sounds more like "who can it be knockin' at my door". Anyway, here are a couple songs that have the word:

https://youtu.be/vFyB5_7WXNY - Cajsastina Åkerström / En Enkel Sång @ 1:23 and @ 2:28

https://youtu.be/FkUx8KqAfb8 - Kent / 999 @ 3:39 (nakenhet... close enough).

Updates

December 26, 2023: It's been a while since I posted a binary for naken_asm, so I built new binaries today. Unfortunately, my MacMini is now Apple Silicon, so the MacOS binary won't work on x86. I still have an old laptop I haven't gotten rid of yet, so I can build it for MacOS x86, but it takes some work and I'm not sure if anyone uses it.

The new naken_asm is now C++ and will be going through more changes to cleanup the source code. I've done a lot of work recently on the RISC-V code, adding pseudo instructions and the compressed 16 bit instructions. I plan to add the vector instructions sometime soon, kind of waiting to get a (cheap) board I can test them on. I also updated the RISC-V ELF output so I can now link a .o file generated from naken_asm with a C executable compiled with gcc on a VisionFive2 board.

I also added F100-L, some 1970's 16 bit CPU used in the European defense industry. I started adding that to Java Grinder (I can make LED blink!). Anyway, that's all for now. If anyone has suggestions, issues, etc, send me an email.

July 4, 2023: Added test for PIC18 comparing it to Microchip's mpasmx. There's some weird stuff I found. The a value of some instructions seems to default to 0 and sometimes to 1. Also, this behavior doesn't always match what I've found in the documentation. So naken_asm will follow what the mpasmx assembler does unless I find out it's wrong. Also, the lfsr instruction is weird... it seems to store the k literal value big endian (upper 4 bits in the first word, lower 8 bits in the second word). All the other instructions seem to get divided up in 2 word instructions in a little endian format.

July 3, 2023: Added PIC18.

June 27, 2023: I recently did a big cleanup in the source code. The cleanup could help potentially turn naken_asm / naken_util into a library... possibly with Python hooks?

I've actually been contemplating changing this project from C to C++. Most of this project is alright a kind of object oriented C. If this could be C++... well, the simulator modules for example. There could be an abstract base class and all the different CPUs could be a subclass. The function names could be smaller (simulate_run_ebpf() would just simply be run() inside an Ebpf class) and the first paramter Simulate *simulate would be invisibly passed in as "this". Things like that could make it easier to read. If the std::'s didn't make the code run slower, they could possibly replace some awkward code.

On the negative side, I think it will compile slower and I have a feeling this project done in C possibly keeps certain coders away.

October 29, 2022: Added support for Padauk PDK13, PDK14, PDK15. To test it an asm file was created with all the instructions for each arch and was assembled with Padauk's official IDE. It was then disassembled with the fppa-pdk-tools open source package. There is support for PDK16 but fppa-pdk-tools didn't seem to want to decode the .pdk file that the official IDE created, so there is no way to test it at the moment.

April 17, 2021: Added support for SunPlus unSP (used in some toys and consoles like V.Smile and I believe some Leapfrog systems). There are new tests that compare to the offical xasm16.exe assembler.

February 1, 2021: Added tests that compare the output of naken_asm with other assemblers for 4004, 68HC08, and CP1610. I upgraded those to RC and built a new release.

December 31, 2020: Added tests for Parallax Propeller 2 comparing the output to another assembler.

December 17, 2020: Added Parallax Propeller 2 support. No tests written yet so it's in a pretty unknown state.

November 29, 2020: I added Nintendo 64 RSP instructions. I used the SGI Nintendo 64 RSP Programmer's guide (official PDF from SGI) to add the instructions. To test I played around with 3 other assemblers (bass, armips, and rspasm from the n64chain project) but ended up using armips for different reasons.

Anyway, I tested naken_asm against the 3 assemblers and verified against the PDF. I'm 99% sure I got this right, but if anyone has some information please let me know.

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!

Copyright 1997-2024 - Michael Kohn