<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools.nes/lib/xixanta/src/assembler.rs, branch main</title>
<subtitle>Tools for NES/Famicom development.
</subtitle>
<id>https://git.mssola.com/nes/tools.nes/atom?h=main</id>
<link rel='self' href='https://git.mssola.com/nes/tools.nes/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/'/>
<updated>2026-08-18T14:41:34Z</updated>
<entry>
<title>Validate labels when walking through the context</title>
<updated>2026-08-18T14:41:34Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-08-18T14:41:34Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6cb4215f55876a7fffb1fd33f2bd061283d2389f'/>
<id>urn:sha1:6cb4215f55876a7fffb1fd33f2bd061283d2389f</id>
<content type='text'>
The parser does not validate label names completely (it only takes care
of validating that it something that makes sense syntactically). The
assembler can tell whether the label is actually taking a reserved name,
or an invalid hexadecimal constant, etc.

Before this commit a user would get a cryptic "invalid identifier"
message when referencing an invalid label (e.g. "jmp 1234"). Fix this by
validating the identifier there, but also when the label was defined
before any of this.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add global labels</title>
<updated>2026-08-18T14:39:37Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-08-18T14:39:37Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=fcd4c9a267b407e653ed6b21ae87f219f3e4c4af'/>
<id>urn:sha1:fcd4c9a267b407e653ed6b21ae87f219f3e4c4af</id>
<content type='text'>
These are labels that are declared by prefixing a '#' symbol to the
name, and it allows the label to be declared at the global scope instead
of the current one.

This is a feature which is not to be abused so to not make scopes
pointless, but it can be quite handy with some optimizations while not
abandoning scopes completely.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>readrom: implement the -d/--disassemble option</title>
<updated>2026-07-15T20:11:50Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-15T20:11:50Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=9d790bb4acddae689c5dda667f9d160041bdd4b8'/>
<id>urn:sha1:9d790bb4acddae689c5dda667f9d160041bdd4b8</id>
<content type='text'>
This option can also be coupled with -n/--nasm-directory, and you can
then get a human-readable disassembling of any proc or label you might
be thinking on.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Save known addresses into .nasm/addresses.txt</title>
<updated>2026-07-15T06:10:45Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-15T05:58:08Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=61b9ce33d54bc643b0ece227101d8bf571fd86e5'/>
<id>urn:sha1:61b9ce33d54bc643b0ece227101d8bf571fd86e5</id>
<content type='text'>
This new file contains all the addresses that are known to the
assembler, belonging to either proc's or plain labels. For the former we
will further be able to tell the "end" of the proc. With that, the file
follows a simple CSV format, with the name, start and end.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Generalize MemoryRange into Range</title>
<updated>2026-07-14T05:36:14Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-14T05:36:14Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=1fcfa6b2bdafb797175d0c3a1be2bca700d4c260'/>
<id>urn:sha1:1fcfa6b2bdafb797175d0c3a1be2bca700d4c260</id>
<content type='text'>
Leading up to also having address ranges exported to callers, which
should be using the same infrastructure.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Use 'full_name' everywhere in check()</title>
<updated>2026-07-14T05:11:59Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-14T05:11:59Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=949208d430fe963f0b29f4656ac21e63a1641d44'/>
<id>urn:sha1:949208d430fe963f0b29f4656ac21e63a1641d44</id>
<content type='text'>
Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Prevent out of bounds panics on range_to_human()</title>
<updated>2026-07-09T20:15:43Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-09T20:15:43Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=426aa0d30b9e708ccb4072a17ade49bf5a245d63'/>
<id>urn:sha1:426aa0d30b9e708ccb4072a17ade49bf5a245d63</id>
<content type='text'>
On range_to_human(), if the range is completely broken for some reason,
we might get a start = 0 and end = 0. In this case, then we would get
into an 'end - 1' computation for an 'usize', resulting in bad
arithmetics.

This can be avoided altogether if the 'start + 1' computation from the
start of the function not only results to be equal, but also larger than
'end'. This, of course, doesn't make much sense, and it's most probably
a bandaid; but it has been detected via fuzzy testing with wild
inputs. Hence, it's fine if this function doesn't return a coherent
string representation for deranged inputs.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add support for the asan:fixed-segments comment</title>
<updated>2026-07-09T20:14:22Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-09T20:07:47Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6f58e4ab8d90166cac4e4da269a77c5134f12f1e'/>
<id>urn:sha1:6f58e4ab8d90166cac4e4da269a77c5134f12f1e</id>
<content type='text'>
This magic comment allows for the definition of segments that are fixed
and for which references are always safe. This goes in tandem with the
asan:safe comment, which can then be used more sporadically.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add a warning for unknown cross-mapping references</title>
<updated>2026-07-08T19:27:49Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-08T19:13:00Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=0664f0bad653ca750d320e513f685ab0c852f359'/>
<id>urn:sha1:0664f0bad653ca750d320e513f685ab0c852f359</id>
<content type='text'>
Some segments, like the 'vectors' one, will reference code that is
outside of its mapping. But in some other configurations, segments
cannot make these cross-mapping references so happily. Imagine:

    .segment "SWAPPABLE"

    .proc foo
        rts
    .endproc

    .segment "FIXED"

    jsr foo

Here the assembler will properly detect the address of 'foo' in the
context of the 'SWAPPABLE' segment. But what this assembler doesn't know
is that this segment is swappable (e.g. UNROM chip). Hence, if the bank
being mapped right now is not the one containing the 'SWAPPABLE'
segment, then the address computed for 'foo' and used in that 'jsr'
instruction will point to something else entirely. This would be similar
to a use-after-free bug.

This is something that can only be inspected at runtime, and so the
assembler cannot be of much help here. Hence, this commit adds a warning
so the programmer can understand the potentially dangerous operation.

All of that being said, this commit also adds support for "asan:safe" or
"check:safe", which is a magic comment that the programmer can write to
re-assure the assembler that this operation is fine (e.g. there is a
guarantee that the mapped bank is that one we are expecting). Hence, the
code above could now be written like so:

    jsr foo      ; check:safe

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Upgrade to the 2024 edition of Rust</title>
<updated>2026-07-08T19:09:42Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-08T18:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6333dc7ee02332cd06e20b56cefd3210368e54f8'/>
<id>urn:sha1:6333dc7ee02332cd06e20b56cefd3210368e54f8</id>
<content type='text'>
And also adjust the code so the clippy from the 2024 edition is fine
with it.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
</feed>
