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

Enable size specifications #15

Open
dvanhorn opened this issue Nov 10, 2024 · 0 comments
Open

Enable size specifications #15

dvanhorn opened this issue Nov 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dvanhorn
Copy link
Member

dvanhorn commented Nov 10, 2024

It's possible to specify the size of operands in nasm, but a86 does not allow this. This prevents being able to do some things like writing a literal to memory:

(Mov (Offset rbx) 99)

since it's unclear based on 99 how much memory should be written. The workaround is to move the literal to a register, which implicitly specifies the size. In nasm, you could just write:

mov [rbx], qword 99

It would be nice to be able to specify operand sizes. We could also have a qword default so that the first example would just work.

I'm not quite sure what the right approach is here. These are really not instruction-level annotations because you can have multiple size specifiers, e.g. mov word [dword 0x12345678], 0x9ABC moves 16 bits of data to an address given by a 32-bit offset.

We could provide "argument constructors" like qword, etc. So that the example would be (Mov (Offset rbx) (Qword 99)) and the Mov constructor could wrap the argument with the default if not given explicitly. So the latter example would be (Mov (Word (Offset (Dword #x12345678))) #x9ABC).

@dvanhorn dvanhorn added the enhancement New feature or request label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant