Mike Kohn's naken_asm
Mike Kohn's naken_asm
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.
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.
Because there are never enough Forth implementations: http://www.camelforth.com
Re: Mike Kohn's naken_asm
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:
Cheers
Ed
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.Ed
Re: Mike Kohn's naken_asm
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.
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
Just out of curiosity, what's wrong with the original author here?
Re: Mike Kohn's naken_asm
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
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
- 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
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.)
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.)
mikeakohn wrote:
Just out of curiosity, what's wrong with the original author here?
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
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!
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
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.
I've had a couple of glances at the source code, and it looks fairly straightforward to extend.
Because there are never enough Forth implementations: http://www.camelforth.com
Re: Mike Kohn's naken_asm
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.
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.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Mike Kohn's naken_asm
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
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
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Mike Kohn's naken_asm
barrym95838 wrote:
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 ...
x86? We ain't got no x86. We don't NEED no stinking x86!
-
clockpulse
- Posts: 87
- Joined: 20 Oct 2012
- Location: San Diego
Re: Mike Kohn's naken_asm
I agree also. Zero page is a very special place.
- BitWise
- In Memoriam
- Posts: 996
- Joined: 02 Mar 2004
- Location: Berkshire, UK
- Contact:
Re: Mike Kohn's naken_asm
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.
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.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs