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 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
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, 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.
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 some 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!
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: PSoC M8C was added. 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.
Copyright 1997-2023 - Michael Kohn