Closed skicattx closed 1 year ago
i agree that the assembler should support different pre/sufixes for numbers, like $00
, 00h
, &00
, etc.
the prefixes are not really a sign of being old Assembly, they are still somewhat commonly used to this day.
also if the assembler natively supported the different pre/sufixes then you shouldn't need any additional functions to convert between them, since they should be perfectly equivalent to eachother.
I think I could add support for these old-style number literals as a command-line option, like --allow-oldstyle-literals
. I could do that for $00
and %00
(%
would probably conflict with the modulo operator, though, so it would need special handling). About the 00h
one, I think it would be ambiguous to parse, unless it always required a 0
in front.
As for using .
for directives, I don't think that would help much? I believe the behavior of the directives isn't really compatible with any other assembler out there.
yea ok i think h
might be a bit too much.
poor assembler would have to deal with stuff like BAh
... is it a label or a hex number?
also how about a shorter command line option? like --alt-lit
or --alt-literals
. "alt" as in "alternative" because calling them old would just make people that still use them feel old...
and other assemblers like AS65 use % for both Modulo and Binary notation, and it seems to work.
I've added support for number literals prefixed with %
or $
without any toggleable configuration -- they're always available. Should be available on the next release!
CustomASM uses # in front of high-level directives like #incbin, #bank, etc., and also uses C (and I guess Rust) style prefixes for hex, binary, etc. but it would be great if we could specify alternate prefixes in order to read traditional or older standard ASM files that use . for directives, and $(or#$) for hex, and %(or#%) for binary. I can't figure a way to hack it in the current setup.
A minor gripe I guess, since some other parsers like VASM use the C style, but it means a lot of search and replace to prepare ASM file for other assemblers to work with CustomASM.
For the latter literal types, a simple addition of a 'cast' operation on values would work. Something like ashex(), asbinary(), etc.
{ add r, ${value} => 0xFF @ ashex(value) }
add r, $EFFE