Which assembler could I possibly use ?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
Virtual1
Posts: 17
Joined: 01 Aug 2025

Re: Which assembler could I possibly use ?

Post by Virtual1 »

BigDumbDinosaur wrote:
Every assembler I have ever used has required that labels and symbols start at column 1, and that instructions, equates, etc., start at column 2 or later. 
Clearly, FORTRAN die-hards ;)
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Which assembler could I possibly use ?

Post by BigDumbDinosaur »

cjs wrote:
BigDumbDinosaur wrote:
Incidentally, I never leave lines blank in my source files—otherwise blank lines get a semicolon, as in the above examples.  The purpose of doing so is to make it clear to me that nothing is missing from the file. 
If you accidentally deleted something and yet everything still builds and the automated tests pass, it can't have been all that important, right? :-)

Maybe...maybe not.  :?

Quote:
(I do admit that others are probably not as keen on testing as I am, and don't have the thousand or so unit tests that I have for my personal pile of 8-bit code.)

Most of my programs are build around libraries whose code was tested and debugged long ago.  I ran numerous unit tests during library development to qualify functions.  Applications are reams of macro calls to library functions interspersed with code specific to the program.  There’s usually no need to unit test it—logic errors will be in program-specific functions or due to macro invocations being out of order.

Quote:
Which reminds me: one thing I would add to Garth's list would be to accept UTF-8 input, at least in comments...I guess the Kowalski assembler does accept Unicode, since I see you use em-dashes (\u2014) in your header comments.

I don’t enter them as Unicode—I just use Windows keypad entry with the [Alt] key to get things such as em-dashes, section markers (§), etc..
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Which assembler could I possibly use ?

Post by BigDumbDinosaur »

Virtual1 wrote:
BigDumbDinosaur wrote:
Every assembler I have ever used has required that labels and symbols start at column 1, and that instructions, equates, etc., start at column 2 or later. 
Clearly, FORTRAN die-hards ;)

Dunno that you can blame FORTRAN for that, although the very first 6502 assembler I used, the MOS Technology reference assembler that was written in FORTRAN and run on the IBM S360 dinosaur, enforced the labels-at-column-1 requirement.  Assemblers prior to the advent of FORTRAN already had that requirement.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: Which assembler could I possibly use ?

Post by GlennSmith »

Hi all,
I recently wrote my own assembler, in PLASMA, to be included in the self-hosting compiler environment. (PLASMA allows you to include assembler routines in the high-level source code)
I initially thought that insisting that labels start in column 1 would make coding easier. Once I really got into the complexities of detecting and handling labels I found-out that it didn't really matter. Anything that isn't a valid opcode mnemonic (thanks Daryl '8-BIT') is treated as a potential label (and discarded if it isn't referenced anywhere).
Glenn-in-France
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Which assembler could I possibly use ?

Post by cjs »

Virtual1 wrote:
Clearly, FORTRAN die-hards ;)
Naw, not really. If they were, the label would be truncated after column 5, and statements could not start before column 7. Also, you wouldn't be able to use labels starting with `C` because that would be a comment line instead. (And I guess all labels would be purely numeric.)
BigDumbDinosaur wrote:
I don’t enter them as Unicode—I just use Windows keypad entry with the [Alt] key to get things such as em-dashes, section markers (§), etc..
Well, whether you want to or not, you are apparently entering them as Unicode in modern versions of Windows, because that's what's going in your file. (The number you type may not be the Unicode code point number, but then again, when you type the letter 'a' you are not typing a Unicode code point number, either.)
Curt J. Sampson - github.com/0cjs
jimmydmusic
Posts: 9
Joined: 09 Sep 2025

Re: Which assembler could I possibly use ?

Post by jimmydmusic »

I use Ophis
vespacla wrote:
I have always written my programs for various SBC 6502 projects with Kowalski 6502 and then run the assembler and burn the ROMs.
Unfortunately Kowalski works worse and worse with wine, on my new Linux system it just hangs and crashes.
Which assembler would you recommend - possibly for Linux - if I have only used Kowalski 6502 so far?
Thank You.
jgharston
Posts: 181
Joined: 22 Feb 2004

Re: Which assembler could I possibly use ?

Post by jgharston »

drogon wrote:
Over the years, as65 hasn't let me down in this respect - but like everything it just takes a little while to get right.
Does the -i option actually work in as65? I've been fighting with it for six and a half hours so far, and it simply REFUSES to work.

This is my command line:
C:\Apps\Programming\as65\as65 -i -x -w125 -lMini65.lst -oMini65.bin Mini65.asm

It just spews out page after page after page after page of "Invalid mnemonic":
307: AND #15
"Mini65.asm",307 : Invalid mnemonic.
309: PHP
"Mini65.asm",309 : Invalid mnemonic.
310: SED
"Mini65.asm",310 : Invalid mnemonic.

-i is listed in the documentation as "ignore case in mnemonics".

v1.42, which is the latest version on Frank's website.
jgharston
Posts: 181
Joined: 22 Feb 2004

Re: Which assembler could I possibly use ?

Post by jgharston »

I've been going through my 6502 projects with the intention of making them easier for other people to build with assemblers other people use. A lot of my code has been written with the BBC BASIC assembler to take advantage of being able to use BASIC features, but a lot of my code doesn't need that, and can be assembled with a plain assembler.

Some of the code has if/else/endif blocks so needs that functionality. Some needs something like a command-line -DEFINE option, but that can often be avoided by having a "launch" file that then includes the main code.

I've got several assemblers:
as65
vasm65
cc65
beebasm

but it's a fight trying to get code into a state where it is minimally simple to convert to different assembler syntax. byte vs db vs .byte, if vs .if, equ vs =, $hex &hex 0xhex, -ignorecase options don't, everything must be lower case (don't mind everything upper case, that's my habit), sometimes always label: sometimes always label, sometimes label: or label depending on context or the phase of the moon, argh!!!!

I've got some bits of code I've put together that manages to automate converting between some formats. What advice would people recommend for a most-common-case target?

Here are some samples:
https://mdfs.net/Info/Comp/6502/Code/ansi.src
https://mdfs.net/Info/Comp/6502/Code/input.asm
https://mdfs.net/Info/Comp/6502/Code/Ha ... s2kbd1.asm
https://mdfs.net/Software/Tube/6502/Mini65.asm
https://mdfs.net/Info/Comp/ProgTips/GST ... rans65.asm
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Which assembler could I possibly use ?

Post by BigDumbDinosaur »

jgharston wrote:
I've been going through my 6502 projects with the intention of making them easier for other people to build with assemblers other people use...

Anything that was written to work with the Beeb assembler is going to be a problem for anyone who is using a syntactically-compliant assembler, e.g., the WDC assembler or the Kowalski assembler when the .opt caseinsensistive,swapbin options are used.  I guess whomever wrote the Beeb assembler hadn’t read the MOS Technology assembly language standard.  :evil:  CMP #&22:BEQ gsinit1 ... what the heck is that?  :?  Every assembler I’ve used to date would choke on it.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Which assembler could I possibly use ?

Post by BigEd »

Beebasm has been a leap forward as it’s multi platform.

Any assembler which is stable or maintained and has a reasonably large and preferably supportive user base is a good choice.

For me, the acorn community and beebasm fits the bill. It’s not the only one which does that of course - a person might be closer to the apple or the commodore communities. Or Atari, which for some reason I tend to forget!

There’s certainly no universal choice.
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Which assembler could I possibly use ?

Post by cjs »

BigDumbDinosaur wrote:
I guess whomever wrote the Beeb assembler hadn’t read the MOS Technology assembly language standard.  :evil:  CMP #&22:BEQ gsinit1 ... what the heck is that?  :?  Every assembler I’ve used to date would choke on it.
That's an interesting view. And you think that whatever 6502 assembler they used to write BBC BASIC also used '&' instead of '$' for hex? I wonder what assembler that would have been. And you're quite sure that using '$' for hex in the embedded assembler wouldn't have interfered with string indirection ('$a = "hello"') and embedding BASIC variable and function names (such as 'STRING$(...)') in assembly code?
BigEd wrote:
Beebasm has been a leap forward as it’s multi platform.
Was it really that early? The first commit in the repo says "BeebASM v0.01 - first released Dec 20 2007" which would, to provide but one example, put it a good decade or more after the first C version of ASL, which was multi-platform in both senses of the word that come to my mind ("runs on multiple operating systems" or "supports multiple CPUs").
Curt J. Sampson - github.com/0cjs
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Which assembler could I possibly use ?

Post by BigEd »

Fair point, anything written in reasonably simple C should be portable and multi-platform.

I suppose I'm thinking of modern times, especially for people who like an IDE... but most of all, BeebAsm gives you the additional features of something very like an assembler embedded in Basic. Like having a preprocessor and macros, but even more so (because a programming language)
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Which assembler could I possibly use ?

Post by barrym95838 »

Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)
electricdawn
Posts: 34
Joined: 23 Nov 2025

Re: Which assembler could I possibly use ?

Post by electricdawn »

I really like vasm. It works very well for me and you don't have to run a linker if you don't want to. And it's still being updated.

http://sun.hasenbraten.de/vasm/
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Which assembler could I possibly use ?

Post by BigDumbDinosaur »

electricdawn wrote:
I really like vasm.

vsam is mostly the work of Dr. Volker Barthelmann, also the author of the vbc ANSI C compiler.  vasm is tailored for use as the vcc back end that generates what ultimately becomes the executable binary—the linker, obviously, is part of the compilation workflow.

That said, I use the Kowalski editor/assembler/simulator.  Just about all 65C816-compatible assemblers require the use of pseudo-ops to tell the assembler when a 65C816 immediate-mode operand is eight or 16 bits.  I find that to be an annoyance, disruptive when I’m on a coding roll, and a good source of insidious bugs.  In the Kowalski assembler, a 16-bit immediate-mode operand is indicated with !#, e.g., LDA !#$1234, which is a lot more convenient, and also is more obvious when reading the source.

The only real negative with the Kowalski package is it only runs on MS Windows.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply