Which assembler could I possibly use ?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: Which assembler could I possibly use ?

Post by barnacle »

Looking at Mint's repository, 64tass (which has an impressive range of features and processor options), and, yes, xa65 are available. Along with lots of z80 and x86 and DNA fragment assemblers!

Neil
6502inside
Posts: 101
Joined: 03 Jan 2007
Location: Sunny So Cal
Contact:

Re: Which assembler could I possibly use ?

Post by 6502inside »

Fedora also has xa65 in the standard repos. But I just compile it myself. :)
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

I appreciate the suggestion and pointer to a tar file.

I downloaded and tried "make" in my Linux environment. There were lots of warnings associated with things in the Makefile and an error due to a missing file.

I took a look but had no idea how to fix any of the warnings or errors so gave up.

I won't post them here, because I don't think it's worth trying to fix. Judging by the number of source files it is a complicated project and will be too complicated for me to understand.
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

BigDumbDinosaur wrote:
There is also André Fachat’s xa65 crossassembler, which may be built and run Linux (I’ve done so on SuSE Enterprise Linux).
I downloaded the assembler source from the GitHub repository.

Ran make and it compiled first time.

Tried to assemble a "known good" copy of the disassembly. Got lots of errors, strangely the lines shown were all lines which started with a ';' command character., however not all comments were flagged as errors. Wondered whether this assembler used a different character. The example code was no help.

Code: Select all

                                ; note: operand byte is used for BRK hack
AtomOS.a65.asm:line 213: f085:Syntax error
        cmp     #$3A            ; Is it ':', indicating label definition ?
AtomOS.a65.asm:line 987: f3ad:Syntax error
;  - Entry: Old position X coordinate (#52,#53)
AtomOS.a65.asm:line 1333: f5cf:Syntax error
;  - Uses:  Change  in   X coordinate (#52,#53)
AtomOS.a65.asm:line 1339: f5cf:Label already defined error
;  - Screen Resolution: X=0 to 63, Y=0 TO 47.
AtomOS.a65.asm:line 1577: f702:Label already defined error
;  - Requires : #5A, #5B = X coordinate.
AtomOS.a65.asm:line 1578: f702:Syntax error
;  - Entry: (#5F) = Byte address
AtomOS.a65.asm:line 1630: f750:Syntax error
;  - Screen Resolution: X=0 to 127, Y=0 TO 64.
AtomOS.a65.asm:line 1666: f76b:Label already defined error
;  - Requires : #5A, #5B = X coordinate
AtomOS.a65.asm:line 1667: f76b:Syntax error
;  - Screen Resolution: X=0 to 127, Y=0 TO 95.
AtomOS.a65.asm:line 1693: f78a:Label already defined error
;  - Requires : #5A, #5B = X coordinate
AtomOS.a65.asm:line 1694: f78a:Syntax error
;  - Screen Resolution: X=0 to 127, Y=0 TO 191.
AtomOS.a65.asm:line 1720: f7a9:Label already defined error
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Which assembler could I possibly use ?

Post by BigEd »

Maybe this will help:

From the man page https://www.floodgap.com/retrotech/xa/xa.1.html
"""
use the -XMASM compatibility mode to allow colons within comments
"""
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

soci wrote:
Not too surprisingly I use this one:

https://tass64.sourceforge.net/

If the latest version isn't packaged yet it's easy to compile it.
I downloaded the above from a repo on Github.

Lots of files. Typed make and it appeared to have hung up, but I was simply too impatient and it needed a longer time to compile, which it eventually did with no errors. Online is an impressive set of instructions.

Tried to assemble "known good" version of the Acorn Rom disassemly code. Limited set of error messages all related to text strings. These were defined using .byte and I had previous edited the delimiter to be a single quote. I changed the .byte to .text and changed the quotes to double quotes. It now compiled with no errors.

I wanted to compare with the Acorn ROM binary file. The assembler supports a wide range of formats but I didn't see a way to create a small 4k image. I was able to create a 64k binary file (-f option). I tried to use "gvim" in hex mode to edit away the unwanted 60k bytes of NUL, and this worked except gvim added a linefeed as a bonus character when saving. Converted this file and the Atom ROM to text using "xxd". Both files matched using "diff" (except the linefeed).

The best so far.
fachat
Posts: 1123
Joined: 05 Jul 2005
Location: near Heidelberg, Germany
Contact:

Re: Which assembler could I possibly use ?

Post by fachat »

BigEd wrote:
Maybe this will help:

From the man page https://www.floodgap.com/retrotech/xa/xa.1.html
"""
use the -XMASM compatibility mode to allow colons within comments
"""
Indeed this is the most annoying remnant of its history where I used it to assemble source code written in Commodore 's BASIC editor, where assembly statements were separated by colon just like BASIC statements. (Edit: and even accepted the BASIC line numbers as ok)
This will change in one of the following releases...
Last edited by fachat on Sun Jun 15, 2025 10:17 pm, edited 1 time in total.
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/
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

BigEd wrote:
Maybe this will help:

From the man page https://www.floodgap.com/retrotech/xa/xa.1.html
"""
use the -XMASM compatibility mode to allow colons within comments
"""
Thank you. I never would have figured that out.

With the above switch the code assembles with a small number of errors.

The thing to be fixed is to remove the "a" (accumulator) parameter from asl/asr/rol/ror instructions.
This assembler was happy with strings defined using .byte and was also OK with the use of single quotes.

Did the usual "xxd" to create a text file for diffing, which matched the Atom ROM text file.
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

Before re-visiting the thread I was searching around and found an assembler with sources "a65v106.zip". There is no indication of who the author is. It was found on a Commodore C64 fan website (Zimmer?).

This interested me since there was only a single C source file.

It compiled first time but with quite a few warnings.

When run on the disassembly source there were errors.

One annoying issue was that it didn't like spaces in opcodes using ",x" and ",y" addressing, or sometimes assembled without warning to the wrong value.

Also annoying was that it only accepted one byte parameter per .byte statement, which was a pain to fix since the code had byte values separated with commas. Each byte had to have its own line. Also it didn't warn but assembled only the first value.

I was able to modify the source assembly so that it would assemble without errors and I finally go t a binary which matched the Atom ROM binary.

I spent quite a few hours modifying the code to remove the warnings. I changed a few types and introduced a nasty bug where an index into the symbol table array was tested for a negative value under specific circumstances. I was hoping to fix the above mentioned problems. An observation was that the C code was pretty generic and would likely easily compile on any platform having a C compiler. The symbol table inserted structs, but the use of "structs" was not used and the symbol table was a just a char array with the struct structure "manually" maintained.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Which assembler could I possibly use ?

Post by BigEd »

I think "as65" might be the most reused project name around here!
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Which assembler could I possibly use ?

Post by cjs »

migry wrote:
Briefly looked at Macroassembler-AS, but I had no idea how to use Git to download the sources.
To download my Git repo of the releases:

Code: Select all

    git clone https://github.com/Macroassembler-AS/asl-releases.git
It doesn't build from the `main` branch, which is just documentation, a `Makefile.def` for most Linux systems, and a script for grabbing new versions and committing them to to the repo. The imported code is on the `upstream` branch. There's a "Building ASL" section in the README on the main branch with instructions for building. The core of it is:

Code: Select all

    #   Debian/Ubuntu package manager and package names: tweak for your distro.
    sudo apt-get install build-essential texlive texlive-lang-german
    git checkout upstream
    git show origin/main:gitignore    > .gitignore
    git show origin/main:Makefile.def > Makefile.def
    #   Edit Makefile.def to set install path if you wish.
    make -j8        # does not build docs
    make install    # optional, but needed for it to find libary include files
Curt J. Sampson - github.com/0cjs
soci
Posts: 20
Joined: 18 Nov 2019

Re: Which assembler could I possibly use ?

Post by soci »

migry wrote:
soci wrote:
Not too surprisingly I use this one:

https://tass64.sourceforge.net/

If the latest version isn't packaged yet it's easy to compile it.
I downloaded the above from a repo on Github.
Thanks for checking it out! If it was from Irmen's unofficial mirror then you were lucky this time as currently the only difference is that the version.h file is missing. Not a big deal, just the version number will be truncated.

The official release versions are here:
https://sourceforge.net/projects/tass64/files/source/

Before a new release I spend weeks on testing and fixing bug. There are always some in new code and changed parts, but that tends to take care of them.

Unfortunately development versions in the repo can have silly mistakes which get fixed the next day (or weeks) but if a snapshot is taken somewhere in between then well, bad luck.
migry wrote:
Lots of files. Typed make and it appeared to have hung up, but I was simply too impatient and it needed a longer time to compile, which it eventually did with no errors. Online is an impressive set of instructions.
Yes, it's not simple any more and so had to split it. I like silent builds and this was also patched out somewhere for packaging as the build system wanted some noise. So I had to keep it that way even in the release version's Makefile just to not break such a patch.
migry wrote:
Tried to assemble "known good" version of the Acorn Rom disassemly code. Limited set of error messages all related to text strings. These were defined using .byte and I had previous edited the delimiter to be a single quote. I changed the .byte to .text and changed the quotes to double quotes. It now compiled with no errors.
That's one of the things which frequently comes up. Some assembler don't care, some do. The idea is that the byte directive only accepts bytes, same like a word does words. Longer strings usually need more than a byte and so need the .text directive, which allows that.

There's no difference between the two quotes (' and ") so if one of them needs to be in a string then the other one can be used.
migry wrote:
I wanted to compare with the Acorn ROM binary file. The assembler supports a wide range of formats but I didn't see a way to create a small 4k image. I was able to create a 64k binary file (-f option). I tried to use "gvim" in hex mode to edit away the unwanted 60k bytes of NUL, and this worked except gvim added a linefeed as a bonus character when saving. Converted this file and the Atom ROM to text using "xxd". Both files matched using "diff" (except the linefeed).
If it's a binary ROM file and the source has something like *=$F000 at the beginning then "-f" (or --flat) is not the right format as it saves everything from address zero.

Use "-b" (--nostart) instead as that creates a binary from the first used byte to the last one. It's called "nostart" because the default format is a CBM binary file for historical reasons and that has a start address word in front.
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

Thank you for the information. Just FYI, I am a total noob when it comes to git.

I went back to the install dir and tried again.
cjs wrote:

Code: Select all

    #   Debian/Ubuntu package manager and package names: tweak for your distro.
    sudo apt-get install build-essential texlive texlive-lang-german
 
This appeared to work, although nothing happened presumably as no files needed to be updated.
cjs wrote:

Code: Select all

    
    git checkout upstream
   
I got an error message "fatal: not a git repository (or any of the parent directories): .git

It is likely I haven't installed git correctly or haven't setup git correctly.

I don't want to clog this thread with unrelated git help. If anyone has suggestion, possibly could you please DM me?
TBH now I have one or two working assemblers, that is good enough to continue my "Acorn Atom" project.
migry
Posts: 9
Joined: 20 Feb 2018

Re: Which assembler could I possibly use ?

Post by migry »

soci wrote:
Thanks for checking it out! If it was from Irmen's unofficial mirror then you were lucky this time as currently the only difference is that the version.h file is missing. Not a big deal, just the version number will be truncated.
Thank you for replying to the issues I encountered. I will go back and try the option to get a simple binary file. Nice to know that the author is contactable.

TBH I was very impressed with the documentation. In fact it was so detailed I wasn't sure if there was a switch to solve my binary dump issue or if I had simply not looked in the right place in the documentation :-) .

Modifying the source was no issue, since it was not clear to me whether the disassembly was in a recognised 6502 format or not. Luckily it was, with some trivial exceptions.

Nevertheless there were several cases where a string was mixed with a byte or list of byte on a single line. I think when I have used ".db" in the past (I forget the processor - 8088?). it was possibly to mix text and bytes together using the '.db' directive, useful when CR and LF needed to terminate a string.

e.g.

Code: Select all

 .byte 6,12,15,"ACORN ATOM",10,10,13
           lda #$82

 .byte "NAME"
   nop
I believe that the string print is terminated by a negative byte (not just a zero value), which saves a few bytes throughout the OS code. In some places the following instruction is a nop since the next instruction has a positive opcode.

NOTE: I'm not asking for any changes, just making an observation. I have no problems putting ".text" on a separate line now I know this is required.
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: Which assembler could I possibly use ?

Post by SamCoVT »

64tass' .text directive can handle comma separated lists of numbers mixed in with the strings, so you can just change those lines from .byte to .text and don't need to edit them further. Here's the listing of that code snippet assembled to $F000 (you can get a listing with "-L filename.lst" or "--list=filename.lst" (without the quotes) added to the command line). The output is on the left, in hex, and the source code on the right.

Code: Select all

; 64tass Turbo Assembler Macro V1.59.3120 listing file
; 64tass -b -L testing.lst testing.asm
; Wed Jun 18 08:06:21 2025

;Offset ;Hex            ;Monitor        ;Source

;******  Processing input file: testing.asm

>f000   06 0c 0f 41 43 4f 52 4e         .text 6,12,15,"ACORN ATOM",10,10,13
>f008   20 41 54 4f 4d 0a 0a 0d
.f010   a9 82           lda #$82            lda #$82
>f012   4e 41 4d 45                     .text "NAME"
.f016   ea              nop                 nop

;******  End of listing
P.S.
I love 64tass! Thanks so much for all of your work, Soci!
Post Reply