Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions source/xasm/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,19 @@ private:
version (unittest) int testValue(string l) {
line = l;
column = 0;
inOpcode = false;
readValue();
return value;
}

version (unittest) string testValueError(string l) {
try
testValue(l);
catch (Exception e)
return e.msg;
return null;
}

unittest {
auto a = testAssembler();
with (a) {
Expand All @@ -884,6 +893,9 @@ private:
assert(testValue("{nop}") == 0xea);
assert(testValue("{CLC}+{sec}") == 0x50);
assert(testValue("{Jsr}") == 0x20);
assert(testValueError("{lda <") == "Unexpected end of line");
assert(testValue("{bne $12}") == 0xd0);
assert(testValue("{Jsr $1234}") == 0x20);
assert(testValue("{bit a:}") == 0x2c);
assert(testValue("{bIt $7d}") == 0x24);
}
Expand Down Expand Up @@ -945,7 +957,7 @@ private:
case '<':
case '>':
addrMode = AddrMode.IMMEDIATE;
if (inOpcode && line[column] == '}')
if (inOpcode && !eol() && line[column] == '}')
return;
readWord();
final switch (c) {
Expand Down Expand Up @@ -1117,9 +1129,7 @@ private:
}

void readAbsoluteAddrMode() {
if (inOpcode && readChar() == '}') {
column--;
} else {
if (!(inOpcode && !eol() && line[column] == '}')) {
readAddrMode();
switch (addrMode) {
case AddrMode.ABSOLUTE:
Expand Down
3 changes: 3 additions & 0 deletions xasm.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,9 @@ Version 3.3.0 (2026-09-??)
- fixed writing the */t* label table: it no longer closes standard output
when the listing goes to `-`, nor overwrites the listing file when both
*/l* and */t* name the same file (by Adrian Matoga)
- fixed parsing of opcode values: an operand such as in `{jsr $1234}`
is no longer misread, and a line ending with `{lda <` no longer crashes

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean "misread" ? Did readChar() consume the space then readAddrMode() expected that space?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Failed with "Space expected".

(by Adrian Matoga)

Version 3.2.1 (2022-12-08)
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading