1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-25 14:24:13 +00:00

Optionally treat BRKs as two-byte instructions

Early data sheets listed BRK as one byte, but RTI after a BRK skips
the following byte, effectively making BRK a 2-byte instruction.
Sometimes, such as when diassembling Apple /// SOS code, it's handy
to treat it that way explicitly.

This change makes two-byte BRKs optional, controlled by a checkbox
in the project settings.  In the system definitions it defaults to
true for Apple ///, false for all others.

ACME doesn't allow BRK to have an arg, and cc65 only allows it for
65816 code (?), so it's emitted as a hex blob for those assemblers.
Anyone wishing to target those assemblers should stick to 1-byte mode.

Extension scripts have to switch between formatting one byte of
inline data and formatting an instruction with a one-byte operand.
A helper function has been added to the plugin Util class.

To get some regression test coverage, 2022-extension-scripts has
been configured to use two-byte BRK.

Also, added/corrected some SOS constants.

See also issue #44.
This commit is contained in:
Andy McFadden
2019-10-09 14:55:56 -07:00
parent b8e11215fa
commit dfd5bcab1b
25 changed files with 127 additions and 58 deletions

View File

@@ -28,6 +28,7 @@ namespace SourceGen {
private const string LOAD_ADDRESS = "load-address";
private const string ENTRY_FLAGS = "entry-flags";
private const string UNDOCUMENTED_OPCODES = "undocumented-opcodes";
private const string TWO_BYTE_BRK = "two-byte-brk";
private const string FIRST_WORD_IS_LOAD_ADDR = "first-word-is-load-addr";
private const string DEFAULT_TEXT_ENCODING = "default-text-encoding";
@@ -105,6 +106,15 @@ namespace SourceGen {
return GetBoolParam(sysDef, UNDOCUMENTED_OPCODES, false);
}
/// <summary>
/// Gets the default setting for two-byte BRKs.
/// </summary>
/// <param name="sysDef">SystemDef instance.</param>
/// <returns>Enable/disable value.</returns>
public static bool GetTwoByteBrk(SystemDef sysDef) {
return GetBoolParam(sysDef, TWO_BYTE_BRK, false);
}
/// <summary>
/// Gets the default setting for using the first two bytes of the file as the
/// load address.