It is currently Tue May 21, 2019 12:02 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Feb 06, 2019 4:01 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4071
Location: A world gone mad
Note: I did not change the Subject of the thread to include "(ASM6 bug found)". Someone else did that, and thus decided it's a bug -- and that's completely subjective.

It's a non-user-friendly quirk/bug that can potentially cause very unexpected problems (thread is proof).

***I*** do not care if it gets "fixed" or doesn't. What matters more, IMO, is that if it isn't "fixed" that the documentation be updated to reflect this fact (model/design). Remember: I am strong advocate of assembly programmers needing to read their assembler's documentation (and assemblers without documentation should be ignored). If a design/quirk/whatever is not documented, it's not the user's fault. So, a small paragraph describing this nuance in readme.txt would be enough, IMO.

But I will say existing/established assemblers over the past 40 years behaved more... shall I say... "intuitively" in this regard (parsing). Many enforced strict syntactical compliance for this exact reason -- and that adherence is important.

What I will say, however, is that there *are* established assemblers with good/excellent documentation of syntax, (and, well, everything!). Merlin and ORCA/M are two such examples, but this is far from limited to just those two:

Merlin 8/16:
Attachment:
Capture.PNG
Capture.PNG [ 91.69 KiB | Viewed 2510 times ]

ORCA/M:

Code:
Each line may begin with a label, which is required for a few directives. The label must begin
in column 1, and cannot contain embedded blanks. Each label starts with an alphabetic character,
the tilde (~), or the underscore (_), and is followed by zero or more alphanumeric characters, tildes
(~) or underscores (_). Both tildes and underscores are significant. Labels may be as long as 255
characters. All characters are significant.
Note that labels starting with the tilde character are reserved for use in macros and libraries
supplied by the Byte Works. To avoid conflicts with the standard libraries, you should avoid use
of the tilde.
It is best not to use the single character A as a label, since it can cause confusion between
absolute addressing using the label A and accumulator addressing.

"Column 1", by the way, means literally "the first byte/character at the start of a line" (think: an 80-column text terminal). People who indent their labels and code would throw an absolute hissy fit over this, I assure you. (Remember what I said earlier about spacing?)

Other assemblers require a colon (:) after a label. Others don't allow labels on a single line by themselves (i.e. require an opcode after a label). Others have other nuances, or a combination of these. It all varies. There is literally no standard or norm, thus it becomes very hard to compare assemblers to one another (and further proves why switching from one to another is often painful). Many don't even document these nuances -- instead the programmer finds out the hard way (and accepts it; whinging over syntax is more of a post-90s thing.)

Off-topic-yet-sort-of-not: I spent 2 hours of my time yesterday writing up how 21 different assemblers allow forcing of absolute addressing, and I really don't want to spend several more hours writing up how many different assemblers handle different syntaxes; the term "time vampire" comes to mind. (I will note that in that post, I link to my Assembler Manuals Dropbox directory that has many different manuals. Web-based manuals I do not care to archive/copy. I urge anyone pondering assembler variances or comparisons to take the time to read through what I put there.)


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 4:17 pm 
Offline

Joined: Tue Oct 17, 2017 12:13 am
Posts: 15
I changed the title, because I thought it was interesting and people may want to read. I'll change it again to reflect that it's a subjective opinion.


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 4:24 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11345
Location: Rio de Janeiro - Brazil
koitsu wrote:
But I will say existing/established assemblers over the past 40 years behaved more... shall I say... "intuitively" in this regard (parsing).

And from what I can tell they also offered much less in terms of features, which made the parsing phase much more straightforward. From what I've seen, people used to hardcode the addresses of variables, they didn't use macros or repetition to automate some of the code generation... It's like assemblers hardly did anything more than manage labels.

Once you start adding more functionality and allowing more versatility, quirks are bound to appear. ca65 for example is extremely feature-packed, and the result is that its macro and scope functionalities have tons of quirks. ASM6 is a much simpler program, but the fact it's multi-pass makes it very versatile. I guess it is indeed somewhat lenient with the syntax because it tries to accommodate aspects from many other assemblers, and that may be a problem after all.

I definitely agree about documenting these kinds of quirks in the official manuals.


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 4:41 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 451
xa65 does the same thing, and I get bitten by it on a regular basis. Pre-defining labels named after all the 65C02/65816 opcodes can help (assuming the assembler throws errors on duplicate labels), but it doesn't fix the more serious problem of typos silently producing broken code, which is one of the worst possible language design flaws, IMO.

If I were designing an assembler and wanted it to use this syntax, I'd add [an option for] warnings on unused labels. I don't know if asm6 has such an option, but xa65 doesn't appear to.


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 4:52 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11345
Location: Rio de Janeiro - Brazil
Warnings on unreferenced labels is a good idea!

Preemptively defining problematic labels so you don't do it by accident later also an interesting idea.


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 8:20 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21391
Location: NE Indiana, USA (NTSC)
koitsu wrote:
"Column 1", by the way, means literally "the first byte/character at the start of a line" (think: an 80-column text terminal). People who indent their labels and code would throw an absolute hissy fit over this, I assure you. (Remember what I said earlier about spacing?)

I myself had such a hissy fit over use of "column 1 means label" convention in RGBASM, an assembler targeting the Game Boy CPU, that I ended up writing a preprocessor to dedent labels so that I could use a folding editor. Input is code with "colon means label" convention; output is code with "column 1 means label" convention. I'll probably end up having to do the same thing to convert ca65 code to ASM6 code in order to make my audio driver usable by ASM6 users.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Wed Feb 06, 2019 9:11 pm 
Offline
User avatar

Joined: Fri Nov 24, 2017 2:40 pm
Posts: 153
Hmm. I
tepples wrote:
I myself had such a hissy fit over use of "column 1 means label" convention in RGBASM, an assembler targeting the Game Boy CPU, that I ended up writing a preprocessor to dedent labels so that I could use a folding editor.


I flirted with using macros to define labels so that I could indent them. It worked, but I feel like I was purposefully using RGBDS wrong, lol.


Top
 Profile  
 
PostPosted: Thu Feb 07, 2019 10:34 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1287
Interesting! I also don't see it as a bug, just the price to pay for the convenience of not needing to add : to labels/making whitespace before the line starts not matter.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Thu Feb 07, 2019 10:55 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11345
Location: Rio de Janeiro - Brazil
Speaking of macros, another way to avoid this quirk is to create macros named after all the unsupported instructions you want to avoid, and have them stop assembly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group