<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools.nes/lib/xixanta/src/object.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:39:37Z</updated>
<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>Minor style fixes from an upgraded clippy</title>
<updated>2026-07-09T20:14:40Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-09T20:14:40Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=a012d260db4ad9a234a2ef29e8c0f7f6ef5f6a4e'/>
<id>urn:sha1:a012d260db4ad9a234a2ef29e8c0f7f6ef5f6a4e</id>
<content type='text'>
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>Let arguments be able to reference their macro</title>
<updated>2026-07-07T21:51:17Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-07T21:51:17Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=5fca76b56034554d965b77d1485f92685d79bc84'/>
<id>urn:sha1:5fca76b56034554d965b77d1485f92685d79bc84</id>
<content type='text'>
The enum type for macro arguments has been adjusted so it accepts a
String. This is then used to store the name of the macro for this
argument.

This is a bit of a circlejerk, but in the end it stems from the fact
that macro arguments were sort of a hack defined ad-hoc each time they
were needed. That being said, if we want to report macro arguments being
unused, we need to reference the actual macro definition, not the macro
call.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Preserve the 'accessed' member on macro arguments</title>
<updated>2026-07-07T21:15:00Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-07T21:15:00Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6b43fd7c0773bd97c4bd80145a17d67062afd4ea'/>
<id>urn:sha1:6b43fd7c0773bd97c4bd80145a17d67062afd4ea</id>
<content type='text'>
Macro arguments get tampered with every time a new call has to be
bundled. Deep down this is done by cloning the underlying object, but
this resets any increase on the 'accessed' member, giving always the
impression that macro arguments are never accessed. Fix this by at least
preserving this member when cloning a macro argument.

Note that this is neither the most elegant solution, and probably not
the most correct. As in, it will probably get into a non-precise count
after some calls. But at least it will be a non-zero value, which is
more than enough to what this is actually used for.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Refer to the original file for unused objects</title>
<updated>2026-06-05T21:32:39Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-06-05T21:32:39Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=85a68dbdcd0200a711bacda9c7170129350813c8'/>
<id>urn:sha1:85a68dbdcd0200a711bacda9c7170129350813c8</id>
<content type='text'>
When warning users on unused objects (e.g. variables, proc's), we have
to pick up the source of origin for this warning. In places where the
original PNode is not available, then we go with the last source we have
at hand, as that's the usual way to go (i.e. the error occurred at the
current source/context).

That being said, for unused objects that's not desirable, because we
might otherwise claim the error to happen on the file we first
targetted, but it's way more useful to understand where the object was
defined.

Hence, when defining a variable, address or proc, let's actually store
the PNode associated with it as well. This way the checker can hopefully
get the source from this PNode and be more clear to the user.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Rename "raw address" to "label"</title>
<updated>2026-04-30T11:17:52Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-30T11:17:52Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=af7a9b22bd010d37685169889b4d3fba5b48b844'/>
<id>urn:sha1:af7a9b22bd010d37685169889b4d3fba5b48b844</id>
<content type='text'>
This is much clearer to the programmer.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add a new 'check' stage in assemble()</title>
<updated>2026-04-30T10:23:12Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-30T08:34:23Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6a9dea943c078876061eda0f6203647b0c5aadd4'/>
<id>urn:sha1:6a9dea943c078876061eda0f6203647b0c5aadd4</id>
<content type='text'>
This is actually an expansion from asan(), but it also checks for stuff
that goes outside of the realm of address sanitation. In this aspect,
asan() has been integrated inside of the new check() function.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Send an error for unused .proc's</title>
<updated>2026-04-28T14:23:14Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-28T14:06:33Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=f7b42b2c26481734a4214aac856b33a942c93c23'/>
<id>urn:sha1:f7b42b2c26481734a4214aac856b33a942c93c23</id>
<content type='text'>
We cannot safely detect all scenarios in which there is dead code, but
we can safely do it for .proc's. Even if they are not called directly,
they might be referenced via jump tables and shenanigans like that. Long
story short, if you are not referencing a .proc in any meaningful way,
then we have dead code.

A pattern could also be given in which a function that was too long has
been splitted into smaller functions which are not called
directly. This is, in my opinion, an anti-pattern (as we generally
expect an rts or a jmp from .proc's), and anyways can be avoided via the
use of __fallthrough__ if the programmer is really set to write this
kind of code.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add the context's name into memory ranges</title>
<updated>2026-04-25T20:57:57Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-25T20:57:57Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=5d4116881f2cc4d053fad66c1a6d00d2dcbead90'/>
<id>urn:sha1:5d4116881f2cc4d053fad66c1a6d00d2dcbead90</id>
<content type='text'>
This is applied whenever a given memory range name is not under the
global context. The end result is that scopes will be shown into the
memory.txt file when using '--write-info'.

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