Skip to content
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

Possibility for a strict instruction mode? #367

Open
jwrayth opened this issue Jan 29, 2021 · 6 comments
Open

Possibility for a strict instruction mode? #367

jwrayth opened this issue Jan 29, 2021 · 6 comments

Comments

@jwrayth
Copy link
Contributor

jwrayth commented Jan 29, 2021

I'm targeting the 65816 and I have continually had issues were WLADX infers the wrong sizing for an instruction/operand. From reading past issues, I understand that this is a difficult problem to solve based on the current implementation between the assembler and the linker.

What I would like to suggest is; Would it be feasible to introduce a "strict sizing" mode that requires the programmer to always explicitly declare the size suffix for the instruction/operand and disable all inference? Personally, I would find this much more useful than trying to decorate my code with sizing hint directives.

I'm not sure where to start looking at a feature like this in the codebase, so I wanted to raise it as an issue first to get some expert opinion.

@vhelin
Copy link
Owner

vhelin commented Jan 29, 2021

The place to implement this feature might be in decode_*.c files, I think, as there source code is turned into WLA's internal symbols.

Enhancement idea: Currently decode_*.c files are difficult to edit, so perhaps encapsulating the code inside to a function would make life easier?

@jeffythedragonslayer
Copy link
Contributor

Is there a proposed syntax/compiler flag for this feature?

@vhelin
Copy link
Owner

vhelin commented Feb 21, 2023

No, but if you implement this then you are free to choose the flag as long as it is of the same format as the other flags :)

@jeffythedragonslayer
Copy link
Contributor

Ok. @jwrayth can we get an example code snippet of the kind of code you want to be able to write as well as the way WLA-DX forces you to do it right now?

@jwrayth
Copy link
Contributor Author

jwrayth commented Feb 22, 2023

Sure thing! So in my 65816 project I'm not using directives like .16BIT to allow instructions to infer size, I'm using explicit operand sizing on my instructions.

For example, instead of

.16BIT
lda #$80

I would use

lda.w #$80

I was looking for a mode to disable any inferred sizing, and force the user to explicitly declare the size of the instruction/operand (when applicable). This is so that I can receive errors when the operand sizing has been omitted.

@vhelin
Copy link
Owner

vhelin commented Feb 22, 2023

Just a sidenote (mainly for @jeffythedragonslayer): Instead of giving

lda.w #$80

which is a bit nasty if you think it from the point of a MC68000 programmer, you can also give

lda #$80.w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants