Page 1 of 2

6502 assembler _in_ 6502 assembler?

Posted: Mon Sep 19, 2022 3:46 pm
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.

Re: 6502 assembler _in_ 6502 assembler?

Posted: Mon Sep 19, 2022 3:54 pm
by rwiker

Re: 6502 assembler _in_ 6502 assembler?

Posted: Mon Sep 19, 2022 6:42 pm
by fachat

Re: 6502 assembler _in_ 6502 assembler?

Posted: Fri Oct 07, 2022 6:33 pm
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

Re: 6502 assembler _in_ 6502 assembler?

Posted: Fri Oct 07, 2022 8:16 pm
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.

Re: 6502 assembler _in_ 6502 assembler?

Posted: Fri Oct 07, 2022 9:23 pm
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...

Re: 6502 assembler _in_ 6502 assembler?

Posted: Fri Oct 07, 2022 10:10 pm
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

Re: 6502 assembler _in_ 6502 assembler?

Posted: Fri Oct 07, 2022 11:31 pm
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.

Re: 6502 assembler _in_ 6502 assembler?

Posted: Mon Nov 07, 2022 7:56 pm
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

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 8:11 am
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?

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 8:30 am
by BigEd
(Welcome, Dietrich, you have shown enormous self-control in making your first post nearly 20 years after signing up!)

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 9:13 am
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

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 10:15 am
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.

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 11:14 am
by BigEd
Many thanks for sharing your code, Dietrich, and breaking your habit of silence!

Re: 6502 assembler _in_ 6502 assembler?

Posted: Tue Nov 08, 2022 4:29 pm
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: