davidgiven / cpm65

CP/M for the 6502
BSD 2-Clause "Simplified" License
264 stars 24 forks source link

asm: allow ";" to start a comment #94

Closed SvOlli closed 7 months ago

SvOlli commented 8 months ago

I'm having a big problem with "\" starting a comment. Every 6502 assembler I've worked with so far was using ";" for this. So I added this feature to "asm.com" as well.

davidgiven commented 8 months ago

That conflicts with the statement separator --- look at line 379.

I picked \ because it's very slightly standard (used on the BBC Micro assembler), but I still hate it. I don't think anybody is using the statement separator yet, so it's probably possible to change. . or :, maybe?

SvOlli commented 8 months ago

Ah, I see what you mean. However, then using the colon ":" as the separator imho makes more sense, since I've seen that one in 6502 assemblers before. Those might have taken this over from BASIC.

ivop commented 8 months ago

Recently I read large parts of source code of the cassette version of Elite for the BBC and noticed the \ used for comments and figured that's where you got it from. Never encountered it before your cpm65 asm, but you get used to it quickly.

SvOlli commented 8 months ago

... but you get used to it quickly.

Nope. I've been working on CP/M stuff for weeks now. Seeing a single backslash still triggers my mind on "continue on next line" what it means almost everywhere else. (Like shell, Makefile, etc.)

However, I pushed a change here, changing the instruction separator from ";" to ":".

SvOlli commented 8 months ago

Browsing again through the code, I figured out my change of the code separators is incomplete, because I was not taking into account where the data stream gets modified into a separator. Working on it.

davidgiven commented 7 months ago

Sorry for the delay --- yes, that looks good.

davidgiven commented 7 months ago

No, it doesn't! : conflicts with label definitions, and there was a fair amount of other things internally which assumed ';' was the statement separator.

SvOlli commented 7 months ago

Yes. The completion of this is on my todo list. Other things got in the way.

SvOlli commented 7 months ago

So, I've updated the code with some non-functional changes. Mainly it's about replacing the tokens for instruction separator and comment. So if I figured out everything correctly, a switch should be rather easy, just change the defines, add the "old-style" comment and everything should be good.

About the colon ending a label: I was under the assumption, that this colon was read in a "tight loop", so it doesn't interfere with the others. Or do you mean that a missing colon in the label might trigger a problem with the internal structure where then a "separator-colon" is read as a "labelend-colon"?

SvOlli commented 7 months ago

Only slightly off-topic: the README.md states "The build system supports cc65 assembler and llvm-mos C programs." Is this correct? If so, is there an example?