Patching directives
I've added a few new directives which should help when making hacks or patches:
-
Can now parse a header from an existing .nes file with
INCINES, or import the .nes file (header and all) withINCNES -
Can seek to any arbitrary location (e.g. within an already-included binary file) to edit with
SEEKABS x,SEEKREL x, andSKIPREL x(the lattermost also updatesaddraka$) This allows jumping to locations without filling the bytes in-between.
The use case for these is that one might have an already-compiled .nes file that one wants to create a patch for, i.e. edit a particular part of the file (then use another program to generate a binary diff to create the patch like a .ips file. Perhaps in a future PR, .ips exporting can be done by asm6f directly?).
Since this is a new feature different from previous ones, I've updated the version number.
Bugfixes
-
Fixed some .nl addresses when $ is unset.
-
Fixed a couple bugs related to the ines/nes2 header. This was the biggest, located in the
outputfunction:
Before:
(byte)(inesmap_num & 0xF0) | (use_nes2 << 3) | (nes2tv_num << 7)
After
(byte)(inesmap_num & 0xF0) | (use_nes2 << 3) | (nes2vs_num)
the << 7 after nes2tv_num seems to be erroneous, so I removed that. On consulting the specifications, it seems that nes2vs_num should be there instead. (Previously, nes2vs_num was not output anywhere.)
Misc
- cleaned up the
outputfunction, breaking it down into a couple different functions (output,output_file(which generates the output file if needed on a new pass), andflush_output(writes the current output buffer to the file)) - extracted common pattern to replace file extension into its own functions,
replace_extandfind_ext. - added a couple comments to the code.
Here is a source file showcasing the new patching directives.