Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
363 stars 77 forks source link

Parameter failure when adding label to 0x constant ending in E #156

Closed Prof9 closed 5 years ago

Prof9 commented 5 years ago
.gba
.open "input.gba","output.gba",0x8000000

test:
    .dw 0xE+test

.close

This very simple input .asm file throws the following error on 7aa5cba:

src.asm(5) error: Parameter failure
Aborting.

For some reason this ONLY happens when the constant ends with an E. For example: 0xD works, 0xF works. 0x1E fails, 0x2E fails, and so on. I've tried various label names and file addresses, but these don't seem to affect it.

Wrapping the 0xE in parentheses, e.g. .dw (0xE)+test does make it work. But this should not be needed for such a simple addition. Furthermore, formatting the constant differently--such as 0Eh or 14--also makes it work.

What also works is adding spaces around the +. However, if you only add a space to the right, e.g. .dw 0xE+ test, then you get a different error (and again this only happens when the constant ends in E):

src.asm(5) error: Directive not terminated
Aborting.
sp1187 commented 5 years ago

Should be fixed by https://github.com/Kingcom/armips/commit/0292c939f3895779aadec1dd59b67403a2a30fa6.

Prof9 commented 5 years ago

Darn! I was just about to submit the PR. Thanks for the quick fix. I'll just submit my test case instead.

sp1187 commented 5 years ago

If you can find a edge case that I somehow missed, that would be welcome too.