Posted: July 25, 2012
naken_asm is a lightweight assembler / disassembler with a focus on the following features:
Support for the following CPUs:
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:
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
The github repository has a docs directory with a list of all directives
and some specific information for certain CPUs:
I also started an MSP430 tutorial that might be useful: MSP430 Tutorial. It's still a work in progress though.
How To Help
Microcontrollers / Single Board Computers
Consoles / 80's Retro
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:
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