-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing commas in data declaration adds byte with value $00 #45
Comments
Hm, is that even valid syntax? Everything behind the |
Maybe it's the forum formatting, but the issue is definitely a bug, and it's been with us a while. Prior to git I've been hit by it myself a few times. |
Sorry, I made a code formatting mistake. Please see the modified post. |
This will generate 5 (not 8) bytes, correct? |
I would not say it is a bug. Other assemblers do this as well. Empty values default to 0. In particular, you would want
to be valid and produce the 3 bytes
should produce So I would say it is a common feature and not a bug. |
In my world, a trailing comma producing an extra value is a bug. It is common to have data with trailing comma in some higher level languages. These do not produce an extra value. It is an unexpected, and undesirable side-effect of dasm, IMHO. |
I also don't agree that |
I would agree here too. But I am a bit afraid that this might break existing code. |
That's why I think the safest solution is to have DASM fail on trailing comma's. Then it won't generate wrong output, and allows the developer to fix this. |
I am not so keen on this "break existing code" argument for stopping correct behaviour in the assembler. There are likely to be very few programs which would break, and in any case the assembler would warn of, and indicate the error, and it would be very easy to fix the offending code. In my view, this should be fixed correctly and not worry about "breaking" existing usage. Particularly for this issue! |
If the change creates an error for such cases I am fine. |
Changing the missing-value-as-zero behaviour doesn't affect bB. Its parser strikes any trailing commas in data statements, before turning them into the dasm .byte pseudo-ops. It doesn't otherwise generate any assembly with missing values. |
Sure, if it is undesired that empty values default to 0, then an error
or at least a warning should be given, so that the source can be
corrected.
|
If someone is going to fix this, please check that your correction will have no side effects. For example |
Maybe this should be fixed with an option? Which his disabled by default, but can be enabled if old code should break. |
see issue #67 ... Lets make StrictMode the default! ;-) |
Trailing commas in a data declaration line seems to effectively add a 0 value.
E.g. this code:
will generate 8 bytes.
This is not expected. You would expect an error from dasm, or maybe have dasm ignore it.
The text was updated successfully, but these errors were encountered: