dasm-assembler / dasm

Macro assembler with support for several 8-bit microprocessors

Home Page:https://dasm-assembler.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remove the strict mode flag (or revert its meaning)

thomas374b opened this issue · comments

Why should an obviously wrong statement be no error without the strict mode flag ?

Assembly language is difficult to learn and understand. Tools should help us and not hiding errors. Strict mode should be the default/always on. If legacy code would not assemble you probably have either a long forgotten bug inside or it was related to issue #64 where error codes from the first pass persisted.

This is a follow-up to issue #60. Imagine the value would be calculated from other symbols. You include some additional code, the value grows and will not fit into the desired space/register. The result would be definitely wrong code. Would you like to allow it ?

BTW: The deleted 'positive' testcases would fail also without strict mode flag. I recommend to include also commit a999a9d into the pull request.

I commented a working testcase for both with and without -S flag commit c08bc1e

Why should an obviously wrong statement be no error without the strict mode flag ?

You're only considering the trivial case. If one is working on a target with a program size > 64k, regular label references will be larger than word size. Is it "obviously wrong" that one needs to wrap references to these labels in a (LABEL & 0xffff) construct? Is is serving the user base better to enforce the trivial case (which is obviously wrong) and to force them to use more cumbersome constructs? For me the answer is "no"

Why should an obviously wrong statement be no error without the strict mode flag ?

[..] Is it "obviously wrong" that one needs to wrap references to these labels in a (LABEL & 0xffff) construct?

No, it is not. With

.word NUMBER

you only tell the assembler "There are two bytes reserved for the next number to be put in"
you are NOT telling "If NUMBER evaluates to something bigger, it is allowed to wrap it".
The second statement is done with the AND mask and was done implicitly without StrictMode. And only you knew about, it's not written/reflected in the code.

I want to be alarmed if there is something that I've not foreseen.

Lets make StrictMode the default! ;-)