6502 assembler _in_ 6502 assembler?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
hjalfi
Posts: 107
Joined: 12 Oct 2017

6502 assembler _in_ 6502 assembler?

Post by hjalfi »

Does anyone know a reasonably good (and properly licensed) 6502 assembler written in actual machine code, which I can run _on_ a 6502 machine? I'm looking for something simple that will just read a text file of some kind of file system, assemble it, write something back, and terminate. No editor or debugging support required.
fachat
Posts: 1124
Joined: 05 Jul 2005
Location: near Heidelberg, Germany
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by fachat »

Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/
pzembrod
Posts: 22
Joined: 05 Sep 2020
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by pzembrod »

A few related prior discussions:

viewtopic.php?f=2&t=6475 where Gragathaz talks about his Editor Not Included Assembler - currently inaccessibly stuffed away is a storage.

https://atariwiki.org/wiki/Wiki.jsp?page=BiboAssembler - an Atari 8-bit assembler

https://www.commanderx16.com/forum/inde ... mment-7183
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 6502 assembler _in_ 6502 assembler?

Post by floobydust »

Rich Leary wrote one for his DOS/65 system. I recently ported it over to WDC Tools and have it running on my C02 Pocket SBC (under DOS/65 of course).

I used it assemble several of the DOS/65 tools and utilities, like the basic compiler, runtime, editor, etc.

According to the source file, this was written by Rich and nobody else. His license for DOS/65 is pretty simple.
User avatar
hjalfi
Posts: 107
Joined: 12 Oct 2017

Re: 6502 assembler _in_ 6502 assembler?

Post by hjalfi »

I've looked at the DOS/65 assembler --- it'd be ideal if it weren't for the no-commercial-use license license...
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by BigDumbDinosaur »

hjalfi wrote:
I've looked at the DOS/65 assembler --- it'd be ideal if it weren't for the no-commercial-use license license...

Sounds like a good reason to write your own assembler. :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 6502 assembler _in_ 6502 assembler?

Post by floobydust »

Hmmm... I went back to all of the documentation and code that Richard sent me last year. In his Version 2.1 documentation, he specifically states:
Quote:
This documentation and the associated software is not public domain, freeware, or
shareware. It is still commercial documentation and software.
Permission is granted by Richard A. Leary to distribute this documentation and software
free to individuals for personal, non-commercial use.
This means that you may not sell it. Unless you have obtained permission from Richard
A. Leary, you may not re-distribute it. Please do not abuse this.
CP/M is a trademark of Caldera.
In his more recent V3 ROM version, he's changed to a GNU GPL V3 license and states:
Quote:
The DOS/65 V3 ROM software and all other DOS/65 software are free software; you
can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of the license, or any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with this
program; if not, see <http://www.gnu.org/licenses/>.
CP/M is a trademark of Caldera.
Not sure if the license change helps in this situation, but he does include all other DOS/65 software, so that( would/should/could) include previous versions.
Dietrich
Posts: 45
Joined: 01 Jan 2003

Re: 6502 assembler _in_ 6502 assembler?

Post by Dietrich »

You might have a look at my assembler: https://github.com/Dietrich-L/CPM-65/tree/main/ASM

It was optimized for speed and assembles 35 lines/s or 0,45 kB code/s nearly indepentent of the size of the source on my 1 MHz Elektor Junior Computer. My largest source was 70 kB with 5000 lines resulting in 10 kB code.

Dietrich
My system: Elektor Junior Computer, GitHub https://github.com/Dietrich-L
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by BigDumbDinosaur »

Dietrich wrote:
You might have a look at my assembler: https://github.com/Dietrich-L/CPM-65/tree/main/ASM

No support for the 65C02?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by BigEd »

(Welcome, Dietrich, you have shown enormous self-control in making your first post nearly 20 years after signing up!)
Dietrich
Posts: 45
Joined: 01 Jan 2003

Re: 6502 assembler _in_ 6502 assembler?

Post by Dietrich »

Well, unfortunately no 65C02 support, mainly because I don‘t have one.

With regard to self control - it was more an issue between ignorance, lacking competence and laziness on my part

But if my code is of use for somebody, it is worth any effort

Dietrich
My system: Elektor Junior Computer, GitHub https://github.com/Dietrich-L
User avatar
hjalfi
Posts: 107
Joined: 12 Oct 2017

Re: 6502 assembler _in_ 6502 assembler?

Post by hjalfi »

Dietrich wrote:
You might have a look at my assembler: https://github.com/Dietrich-L/CPM-65/tree/main/ASM
I did not know this project existed! Oh, well, I wasn't using those 45 hours of my life anyway...

There's definitely stuff I can steal here; your BDOS seems to be a lot smaller than mine. It's a little simpler due to not needing to be relocatable but that doesn't account for a lot of it. I think I can do a lot of optimisation.

I've also observed (through an attempt to write my own assembler) that requiring relocatable output makes things much more complicated. It requires tracking the types of expressions so as to know whether they're relocatable addresses or not, as well as needing somewhere to put the relocation table during assembly. I was primarily thinking that would happen via creating an object file and then linking, but this rules out simple assembler-loaders, which is unfortunate. It is possible to assemble the file three times at slightly different addresses and then comparing the results to figure out what needs relocation, but that's really slow and I was hoping not to have to.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by BigEd »

Many thanks for sharing your code, Dietrich, and breaking your habit of silence!
User avatar
Mike Naberezny
Site Admin
Posts: 295
Joined: 30 Aug 2002
Location: Northern California
Contact:

Re: 6502 assembler _in_ 6502 assembler?

Post by Mike Naberezny »

BigEd wrote:
(Welcome, Dietrich, you have shown enormous self-control in making your first post nearly 20 years after signing up!)
I'd say it was worth the wait! I've been looking through Dietrich's repository and there is a tremendous amount of work there.

Another open source assembler not mentioned here is the one included in Craig Bruce's ACE operating system, which Craig released as public domain:
Post Reply