| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is exclusive to 'nasm' and it allows the developer to explicitly
tell the assembler than a "fall through" condition is actually desired:
it's not a mistake.
This comes in two flavors. The first, without arguments, just makes this
explicit without much enforcement. The second allows you to pass an
argument which is the name of the function or label you are expecting to
fall through. The assembler will error out if the fall through address
is not the expected one, hence telling the programmer whenever the fall
through condition they thought in the past is no longer true (e.g. the
function has moved somewhere else in the code).
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes performing some 'jmp'/'jsr' can be quite pointless, and the
programmer might not be fully aware of this because of the layout of the
code. Imagine:
.proc foo
;; code
jmp bar
.endproc
;; Documentation, comments, extra space, etc.
.proc bar
;; whatever
.endproc
The 'jmp' in the code above tries to perform a call stack optimization,
but it's actually not needed because the next instruction after 'jmp' is
the one inside of 'bar', but that's obfuscated because of the layout.
In these sort of cases (and also for 'jsr' and branches) warn the
programmer about it so it can remove that instruction.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
|
| |
|
|
|
|
|
|
| |
For tests which the resulting binary is not needed, redirect the
output (i.e. the ROM file) to /dev/null. This way we don't litter the
workspace with dummy out.nes files.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This way, if you define a constant like:
MY_BUFFER_LEN_IN_BYTES = $10
You can then declare your buffer like so:
zp_buffer = $00 ; asan:reserve MY_BUFFER_LEN_IN_BYTES
And then further in the code you can rely on just using the constant for
bound checking, and then the address sanitizer will check on bound
checks via static analysis as well.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
|
| |
|
|
|
|
|
|
|
| |
The examples listed here don't follow the basic rules required by the
address sanitizer either for learning purposes or out of
simplicity. Hence, let's disable it for all cases and we'll bring it
back for future repositories.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
This check ensures that asan-friendly names actually match their
expected scope.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The address sanitizer is now able to detect whenever in an instruction a
memory access is done without using variables. This is now detected for
all instructions except for branching, which falls outside of this
scope.
Moreover, simple arithmetics is allowed and bounds are checked for
simple cases. That being said, more involved bound checks should be done
with other tools (e.g. emulators).
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
| |
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
| |
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
This provides a more up-to-date experience, while also allowing to test
more cases. Moreover, the latest flags from 'xa65' are being used.
All in all, both 'code.nes' and 'aoc2023.nes' appear to be working after
the latest fixes.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
This allows users to define variables directly from the command line,
which is useful for testing purposes.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
| |
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
Update the underlying code.nes test data so it uses a tighter
configuration for NROM which in turn frees nasm from complaining about
empty segments. This makes room to allo for -Werror so we catch warnings
that might appear in the future.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
| |
This way I can simply compress all the examples to traverse with a
single file, and thus no longer polluting this repository from code from
other repositories.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This needed some heavy lifting when it comes to how files were located.
This means that statements like .include/.incbin now take into
consideration a new list made out of SourceInfo, which holds enough
information to translate from which file a node comes from. This has
also been added into errors, so they are more informative on what went
wrong.
In order to tests this, besides all the regular unit tests, a new e2e
test has been added.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
| |
I have also added an end-to-end test for it.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
|
|
For now I have added the most simple example for an NES/Famicom game,
which I already had on a private repository (that I plan to open source
soonish).
Tests simply run `nasm` on known source files and compares the results
with an .nes ROM file that has the exact bytes that we expect.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|