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

Error A2237: Constant value too large #205

Open
mrfearless opened this issue Aug 4, 2024 · 3 comments
Open

Error A2237: Constant value too large #205

mrfearless opened this issue Aug 4, 2024 · 3 comments
Labels
Milestone

Comments

@mrfearless
Copy link

Just in case it wasn't on your radar to have a look at, large immediate values in uasm64 throw an Error A2237

for example when using AND or some other instruction with say 8000000000000000h, will stop the assembly.

As mentioned here: https://masm32.com/board/index.php?topic=10026.0

Thanks.

@john-terraspace john-terraspace added this to the V2.57 milestone Aug 5, 2024
@mrfearless
Copy link
Author

Just to add to this, I believe it is any value greater than a 32bit value that triggers this error in UASM64. I had a look at the code a few weeks ago to see if I could track down the area that was issuing the error and think its in the parser.c, maybe the switch case statements that dont have a case 8 for qword size which emits the INVALID_OPERAND_SIZE? But I could be wrong.

@john-terraspace
Copy link
Member

`
;mov rax, 8000000000000000h ;ok => valid 48 B8 00 00 00 00 00 00 00 80 movabs rax, 0x8000000000000000
;and rax, 8000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h
;test rax, 800000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h
;test rax, 8000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

test rax, 80000000000000000h
mov rax, 80000000000000000h
`

The first 4 examples work, only MOV supports 64bit immediates, AND/TEST etc do not.
The last two fail silently because the immediate is > 64bit which the parser/tokenizer don't even see.

@john-terraspace
Copy link
Member

john-terraspace commented Aug 5, 2024

`
or rax, 0xffffffff0 ;ok => Error A2237: Constant value too large: 800000000000000h

or rax, 8000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

mov rax, 8000000000000000h ;ok => valid 48 B8 00 00 00 00 00 00 00 80 movabs rax, 0x8000000000000000

and rax, 8000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

test rax, 800000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

test rax, 8000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

test rax, 80000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

mov rax, 80000000000000000h ;ok => Error A2237: Constant value too large: 800000000000000h

`
Working now in 2.57 including >64bit case.

john-terraspace added a commit that referenced this issue Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants