Allow binary constants also to be defined with a leading '%' (be compatible with other Z80 assembler sources)
Be compatible with Z80 assemblers and Skoolkit that use '%' as leading binary constant identifier.
The problem to solve is that currently '%' is used as MOD operator in Mpm, which must be preserved. Parse intelligently when a '%' symbol is encountered, whether is it used as a MOD operator or as a binary constant symbol. There is a small risk of ambiguity during symbol & expression parsing.
The following examples are tests for Mpm using % as either mod operator or in combination with binary constant:
defb 8 % 3 ; 8 mod 3 = 2 ; space after % is a separator, so % is interpreted as modulus
defb 8 % 10 ; 8 mod 10 = 8 ; space after % is a separator, so % is interpreted as modulus
defb 8%10 ; 8 mod 10 = 8 ; %10 is interpreted as binary constant (2), syntax error is reported (missing operator)
defb 8%%11 ; 8 mod 3 = 2 ; first char after % is a separator, so first % is mod, followed by binconst %11
defb 8% %11 ; 8 mod 3 = 2 ; 8 mod 3 ( %11 = binary)
defb 28%%111 ; 28 mod 7 = 0
defb 28/%11 ; 28 / 3 = 7
defw 360000% 65536
; valid expressions using modulus with integer constant and specified with "large" binary constants:
defb 1000000000%256
defb 1000000000%%100000000
defb 1000000000% 256
defb 1000000000% %100000000
; some simple 8bit binary constants (0Fh,0Fh,0Ah,C0h):
defb %1111, %00001111, %1010, %11000000
; a 16bit binary constant (C080h):
defw %1100000010000000
Edited by Bits4fun