tebe6502/Mad-Assembler

Unable to have binary literal containing space in macro instruction "mva"

Closed this issue · 5 comments

mirao commented

Steps:

  • Assemble a code with the instruction mva #%1100 0000 GPRIOR (MVA docs is here)

Expected result:

  • Success. E.g. it works in and #%1011 1111, see #4.

Actual result:

  • It fails: ERROR: Extra characters on line

Assembler seems to parse the 0000 as a second argument of mva instead of the second part of binary literal.

Used SW:

  • MADS 2.1.5, Ubuntu 22.04
mirao commented

A solution would be allowing the _ separator for binary literals, e.g. mva #%1100_0000 GPRIOR

mva #[% 1 1 0 0 0 0 0 0] GPRIOR

mirao commented

@tebe6502 Thank you very much, that's it.
E.g. mva #[%0010 1010] SDMCTL works as expected.

mirao commented

This case is a bit tricky:

.by %1010 0011

It stores two bytes (instead of one byte originally expected by me) because .by allows a space separator:

  1. $0a, it's binary 1010
  2. $0b, it's decimal 0011

It can be solved by [] too:

.by [%1010 0011]

or by using of .byte instead of .by

.byte %1010 0011

Both produce the expected byte $a3

Yes, "white spaces" are the equivalent of a comma sign for the .xx: .by, .wo, .he, .sb etc.

default is 'DTA' (dta b( ) is equivalent .BYTE)

dta %1010 0011
dta b(%1010 0011)
dta a(%1010 0011)