In this new update I added a couple of new features:
I added a new directive .format to replace the old .setting "OutputFormat" solution. It's strange I haven't done this sooner, but now it's here.
I added a new Setting HandleLongBranch. The instructions that use relative addressing, typically branching instructions like bne or beq can only handle a certain address range, especially on 8-bit CPUs. When this range is exceeded, the assembler shows an error message about it. If you enable this setting, the assembler tries to resolve these errors by automatically replacing the generated code with a counterpart that can handle long jumps to absolute addresses.
Label nop (Lots of instructions here, over $80 bytes worth) bne Label (Other instructions)
This fails because Label is way too far away for a relative address jump. The assembler will compile this instead:
Label nop (Lots of instructions here, over $80 bytes worth) beq AfterJmp //Branch counterpart for "bne" jmp Label //Jump to an absolute address. AfterJmp //The label that's accessible as a short relative jump. (Other instructions)
It's handled like this on 6502, 65C02 and 65816, with all the branch instructions of these CPUs. On Z80 and Gameboy CPUs the case is simpler, the jr instructions get replaced with the appropriate jp instructions.
Of course this is not ideal if your goal is writing code that can be relocated to any memory address, but that's rare and then you surely know what you are doing. The feature is not turned on by default, but if you need it, and most people likely would, it can be enabled, even for just a section of the code, by
The rest of the changes can be filed under Good Housekeeping:
- The .if directive block no longer closes @Local labels, so you can reference @Local labels created before and after the .if block.
- Setting AllowUndocumentedInstructions added and set to True by default. This makes undocumented instructions enabled for participating CPUs, but you can disable this manually in your source code (or in the Settings Xml file) if you want to turn them off.
- The -u command line switch for undocumented instructions is now used only in Disassembler mode, where it matters to select it from the command line.
- The -L command line switch has been replaced by -l, but the old switch option still works for VS Code's Build & Launch
- Setting LaunchEnabled has been renamed to Launch. The old name still works, but shows a warning.
- The VS Code extension and the Notepad++ files handle the new .format directive, with Code Snippets.
See the documentation for details.
Download the latest version from the Retro Assembler page!