What assembly syntax is good to support in an assembler?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: What assembly syntax is good to support in an assembler?

Post by cjs »

BigDumbDinosaur wrote:
Any tools designed to assemble code for the 6502 should be using the MOS Technology standards, not those of an unrelated set of programming tools.
This seems to fall into the trap of "my uses for a tool are the only valid ones." Or it states that even if using MOS syntax is more awkward, time-consuming and expensive, you should waste time and money doing that anyway instead of doing something simpler and cheaper. (And if you can't think of a situation like this, especially after reading this thread, you're not thinking very hard.*) I completely agree with johnwbyrd that, "Before deciding what syntax is 'good,' you have to decide the purpose of your assembler."

(I also recoil in horror at the thought of using GCC assembler syntax for 6502 assembly, but I recognize that that's an emotional respose; it's plausible to me that this is the right direction to go for LLVM.)

I do agree that you should consider carefully what you're doing before deviating from what limited standards MOS provides for assembler syntax, though. And I also agree that there are probably a fair number of assemblers out there where this careful consideration was not done and they suffered for it. But then again, there's a lot of badly designed software out there, some with much larger and worse effects on the world; this doesn't seem to be any kind of special case.
Quote:
Note that the MOS Technology language standard explicitly states that pseudo-ops and macros are not part of the standard.
Hm. That kind of blows up the idea of the standard giving you compatibility between 6502 assemblers, since things like setting the assembly address or defining data are not exactly uncommon operations. I suppose that's usually easily solved with macros; is it ironic that there's no standard for those?

_________
* If you're really stuck, consider in detail what it would have taken to write the first 6502 version of Microsoft BASIC using LDX #TEMPST instad of LDXI TEMPST. Same goes for the original 8080 BASIC, where you can think about how much it would have been delayed (and how much more expensive time on the PDP-10 would have been needed) by a prioritizing "standard syntax" over anything else.
Curt J. Sampson - github.com/0cjs
johnwbyrd
Posts: 89
Joined: 01 May 2017

Re: What assembly syntax is good to support in an assembler?

Post by johnwbyrd »

BigDumbDinosaur wrote:
Any tools designed to assemble code for the 6502 should be using the MOS Technology standards, not those of an unrelated set of programming tools.
I suppose that might be true, if your goal is a faithful historical recreation of its limitations. The original MCS650X assembler allowed six character labels only. And that assembler apparently had no knowlege of macro-like behavior.

Adding all standard MOS instruction formats to llvm, has presented no problems in practice. Recall that gas and llvm-mc must both support various platform-specific instruction formats, such as SPARC and RISC and ARM. Additionally, llvm happens to have support for a few neat features, such as ELF and a linker, which the 65xx port also inherits.

My personal goal has been to see a modern industry-standard assembler and compiler, support MOS as a first-class target. Ideally, this would bring a broader swath of existing tools to bear on the problem of making better 65xx programs.
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: What assembly syntax is good to support in an assembler?

Post by Chromatix »

Not to mention that BBC BASIC's built-in assembler features are very different from those of a conventional assembler, but arguably more powerful since you get to use the considerable features of BBC BASIC as a macro language. Even the prefix designating a hexadecimal constant is different from the usual standard. It's not "wrong", just "different" - and very useful since it ensured that every BBC Micro had a usable assembler out of the box.
Post Reply