Page 1 of 4
Mike Kohn's naken_asm
Posted: Fri Feb 21, 2014 8:03 am
by Brad R
Does anyone here have any experience with Mike Kohn's naken_asm cross-assembler?
http://www.mikekohn.net/micro/naken_asm.php
I ask here because he indicates that support for the 65xx is "stable." I'm interested in some of the other processors as well. I like that it's available for Windows, Mac, and Linux.
Re: Mike Kohn's naken_asm
Posted: Sat Feb 22, 2014 7:53 pm
by BigEd
I just gave it a spin: it has a simulator as part of the package, which will of course help with debugging.
The 6502 test code supplied is actually rejected (It uses $ for hex, but must use 0x) and yet as the code is evidently actively being developed, and the source is available, I feel quite positive.
Perhaps I'll try to run Klaus' testsuite on it...
On windows in a cygwin terminal it looks like this:
Code: Select all
Simulation Register Dump Stack
------------------------------------------------------------
7 6 5 4 3 2 1 0 0x141: 0x00
Status: N V - B D I Z C 0x140: 0x00
0 0 0 0 0 0 1 0 0x13f: 0x08
0x13e: 0x3a
A=0x01 X=0x00 Y=0x00 0x13d: 0x08
SR=0x02 SP=0x41 PC=0x0001 0x13c: 0x9c
6435 clock cycles have passed since last reset.
! 0x083b: rts 6-6
0x083c: lda #0x20 2-2
0x083e: 0x00a2
0x083f: brk 7-7
0x0840: sta 0x0400,x 5-5
0x0843: 0x009d
0x0845: 0x0005
Stopped. PC=0x0001.
6442 clock cycles have passed since last reset.
stopped> run
Running... Press Ctl-C to break.
Stopped. PC=0x0001.
6449 clock cycles have passed since last reset.
Cheers
Ed
Re: Mike Kohn's naken_asm
Posted: Sat Feb 22, 2014 11:22 pm
by Tor
I also tested it yesterday - had to change that $ as well. It looks interesting. The 'speed' setting doesn't seem to change anything, but the 6502 simulator is marked beta. Had a quick look at the source to see how the setup for adding multiple architectures was done. It's encouraging that the 6502 part was implemented by someone who is not the original author (the only part so far, but still.)
So yes, interesting. Will dive deeper later, definitely. I tested with Debian Linux, 32-bit (my very old pentium-M laptop which I bring on travels).
-Tor
P.S. Brad, thanks for the link. I was not aware of the existence of this assembler.
Re: Mike Kohn's naken_asm
Posted: Sun Feb 23, 2014 2:31 am
by mikeakohn
Just out of curiosity, what's wrong with the original author here?
Re: Mike Kohn's naken_asm
Posted: Sun Feb 23, 2014 3:24 am
by mikeakohn
The $ was working at one point, but I ended up breaking it recently. I fixed the issue and just posted a 2014-02-22 version. If you guys find any more bugs or have any requests let me (or Joe) know.
Re: Mike Kohn's naken_asm
Posted: Sun Feb 23, 2014 3:41 am
by joe7
Thought I would take a minute to explain the assembler a bit. It does use a more modern syntax:
- low high bytes are accessed C-style, using "& 0xff" and ">> 8" (not the old > < way)
- there are no local +, ++, +++ or -, --, --- labels
- data is done like "db 0, 1, 2" or "dw 0xc000, 0xc001, 0xc002" etc. (data-byte and data-word)
- generally, data is decimal (0), hex (0x00), binary (00000000b)
- text can be done with db "Hello World"
- there is a limitation where accessing Zero Page at location 0 is always done in absolute mode
The code on this page may clear some things up, uses macros, expressions, and some tables:
http://joe.csoft.net/c64demo.html
Re: Mike Kohn's naken_asm
Posted: Sun Feb 23, 2014 10:37 am
by BigEd
Hi Mike, good to see you here... also Joe!
Thanks for fixing the $.
(I suspect Tor's point was that it's encouraging to see software with more than one contributor - it's a measure of health of a project.)
Posted: Sun Feb 23, 2014 3:29 pm
by Tor
Just out of curiosity, what's wrong with the original author here?
Nothing wrong at all - quite the opposite! What I meant was that the fact that somebody else was able to extend and add a new architecture to the assembler indicates that your software is actually understandable by others - and that's definitely not always the case for a lot of software out there. I've seen tons of code (including assemblers) where in practice only the original author is able to do substantial work on the code because nobody else can understand it without investing a lot of effort, or sometimes it's understandable but not easy to expand on.
In short, even though I only looked briefly at parts of the code, the fact that somebody else (the 6502 author) could contribute tells me, as a programmer, that your code is the type of code I like to see.
-Tor
Re: Mike Kohn's naken_asm
Posted: Sun Feb 23, 2014 3:53 pm
by mikeakohn
Ah, I wasn't sure if that was supposed to be positive or negative so I just thought I'd ask. Thanks for the compliment then

.
As far as the health of this project, along with a naken_asm side project called Java Grinder (which Joe is doing the 65xx work on also), naken_asm is my highest priority. As I said before, if you guys find any issues or have any useful suggestions just let me know.
Btw, glad to see interest in the assembler. Thanks!
Re: Mike Kohn's naken_asm
Posted: Mon Feb 24, 2014 1:05 am
by Brad R
Good to see Mike and Joe here. I've had a very productive email exchange with Mike as I've been trying out the MSP430 assembler, to see if it will assemble my MSP430 Forth. naken_asm seems to have just about the right feature set for that job, and supports most of the MCUs I'm interested in.
I've had a couple of glances at the source code, and it looks fairly straightforward to extend.
Re: Mike Kohn's naken_asm
Posted: Mon Mar 03, 2014 11:00 pm
by joe7
Just changed the assembler a bit to always use absolute mode in regular indexed modes:
https://github.com/mikeakohn/naken_asm
Did this after finding out that indexing in zp wraps around, breaking something I was trying to do. I knew the indirect ones wrapped.
Re: Mike Kohn's naken_asm
Posted: Tue Mar 04, 2014 4:49 am
by barrym95838
Am I the only one thinking that removing zp,x and zp,y from a 6502 assembler is rather harsh? We're talking about bread with no butter here ...
How hard would it be to add an assembler directive or operand pre-fix override?
I'm asking the second question because I genuinely don't know the answer, but I think that I already have a guess for the answer to my first question.
Mike
Re: Mike Kohn's naken_asm
Posted: Tue Mar 04, 2014 6:39 am
by BigDumbDinosaur
Am I the only one thinking that removing zp,x and zp,y from a 6502 assembler is rather harsh? We're talking about bread with no butter here ...
I'd have to agree with you on that one. I can think of a whole lot of code that would be busted if those addressing modes were eliminated. I would not use any assembler that can't properly support the full instruction set of the target processor and/or uses kinky non-standard syntax. What's wrong with sticking with standards that have existed for decades? <Rhetorical question>
Re: Mike Kohn's naken_asm
Posted: Tue Mar 04, 2014 7:25 am
by clockpulse
I agree also. Zero page is a very special place.
Re: Mike Kohn's naken_asm
Posted: Tue Mar 04, 2014 8:39 am
by BitWise
The WDC assembler (and mine) uses an address prefix character to force a particular mode. So |addr or !addr forces an absolute mode, <addr is always zero page and >addr is the 65816 long absolute. You can add the index suffixes after the address as usual (e.g |addr,X).
Very useful when you want to force a particular mode or if the assember can't work out the mode because the value is imported from a different relocatable module.