1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-04-20 04:16:47 +00:00

Add comments to CRT header fields

Also, made some minor source code tweaks.
This commit is contained in:
Andy McFadden
2025-12-31 07:39:28 -08:00
parent ac93d22eb2
commit fd375fe65a
3 changed files with 48 additions and 8 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ namespace Asm65 {
}
/// <summary>
/// Addressing mode. This uses the same distinctions as Eyes & Lichty, which for
/// Addressing mode. This uses the same distinctions as Eyes &amp; Lichty, which for
/// most purposes has some redundancy (e.g. StackRTI is only ever used with RTI, so
/// in most cases it could be considered Implied).
///
@@ -282,7 +282,7 @@ namespace Asm65 {
/// the Program Bank Register.
/// </summary>
/// <remarks>
/// As noted in Eyes & Lichty, the Absolute addressing mode uses the Data Bank Register
/// As noted in Eyes &amp; Lichty, the Absolute addressing mode uses the Data Bank Register
/// if locating data, or the Program Bank Register if transferring control. When
/// we "LDA symbol" we can only care about the 16-bit value because we can't know what B
/// will hold at run time. When we "JMP symbol" we can either (1) complain if it's in
+8 -6
View File
@@ -113,10 +113,11 @@ namespace Asm65 {
/// <summary>
/// Short descriptions, USA English.
///
/// Text is adapted from instruction summaries in Eyes & Lichty, which are slightly
/// Text is adapted from instruction summaries in Eyes &amp; Lichty, which are slightly
/// shorter than those in the CPU data sheet.
/// </summary>
private static Dictionary<string, string> sShort_enUS = new Dictionary<string, string>() {
private static readonly Dictionary<string, string> sShort_enUS =
new Dictionary<string, string>() {
// 65816 instructions.
{ OpName.ADC, "Add With Carry" },
{ OpName.AND, "AND Accumulator With Memory" },
@@ -276,7 +277,8 @@ namespace Asm65 {
/// <summary>
/// Long descriptions, USA English.
/// </summary>
private static Dictionary<string, string> sLong_enUS = new Dictionary<string, string>() {
private static readonly Dictionary<string, string> sLong_enUS =
new Dictionary<string, string>() {
{ OpName.ADC,
"Adds the accumulator and a value in memory, storing the result in the " +
"accumulator. Adds one if the carry is set."
@@ -765,7 +767,7 @@ namespace Asm65 {
/// <summary>
/// Address mode short descriptions, USA English.
/// </summary>
private static Dictionary<OpDef.AddressMode, string> sAddrMode_enUS =
private static readonly Dictionary<OpDef.AddressMode, string> sAddrMode_enUS =
new Dictionary<OpDef.AddressMode, string>() {
{ OpDef.AddressMode.Abs, "Absolute" },
{ OpDef.AddressMode.AbsInd, "Absolute Indirect" },
@@ -809,7 +811,7 @@ namespace Asm65 {
/// <summary>
/// Cycle modifier descriptions. These are intended to be very terse.
/// </summary>
private static Dictionary<OpDef.CycleMod, string> sCycleMod_enUS =
private static readonly Dictionary<OpDef.CycleMod, string> sCycleMod_enUS =
new Dictionary<OpDef.CycleMod, string>() {
{ OpDef.CycleMod.OneIfM0, "+1 if M=0" },
{ OpDef.CycleMod.TwoIfM0, "+2 if M=0" },
@@ -824,5 +826,5 @@ namespace Asm65 {
{ OpDef.CycleMod.MinusOneIfNoPage, "-1 if 65C02 and not across page" },
{ OpDef.CycleMod.BlockMove, "+7 per byte" },
};
}
}
}
+38
View File
@@ -24,9 +24,39 @@ namespace SourceGen {
/// <summary>
/// Special handling for VICE .CRT cartridge files.
/// </summary>
/// <remarks>
/// <para>This is based on the format described in section 17.14 of the VICE documentation,
/// <see href="https://vice-emu.sourceforge.io/vice_17.html#SEC442">"The CRT cartridge image format"</see>.
/// </para>
/// </remarks>
public static class ViceCrt {
private static readonly byte[] CBM80 = new byte[] { 0xc3, 0xc2, 0xcd, 0x38, 0x30 };
// End-of-line comments for the file header fields.
private static readonly Dictionary<int, string> sHeaderComments =
new Dictionary<int, string>() {
{ 0x00, "signature" },
{ 0x10, "header length"},
{ 0x14, "cartridge version" },
{ 0x16, "hardware type" },
{ 0x18, "EXROM line status" },
{ 0x19, "GAME line status" },
{ 0x1a, "hardware revision/subtype" },
{ 0x1b, "reserved" },
{ 0x20, "name" },
};
// End-of-line comments for CHIP fields.
private static readonly Dictionary<int, string> sChipComments =
new Dictionary<int, string>() {
{ 0x00, "signature" },
{ 0x04, "packet length" },
{ 0x08, "chip type" },
{ 0x0a, "bank number" },
{ 0x0c, "load address" },
{ 0x0e, "image size" },
};
/// <summary>
/// Cartridge file header.
/// </summary>
@@ -273,6 +303,10 @@ namespace SourceGen {
FormatDescriptor.Type.Fill, FormatDescriptor.SubType.None);
}
foreach (KeyValuePair<int, string> kvp in sHeaderComments) {
project.Comments[kvp.Key] = kvp.Value;
}
// Format data items in CHIP headers.
for (int i = 0; i < chips.Count; i++) {
Chip chip = chips[i];
@@ -293,6 +327,10 @@ namespace SourceGen {
project.OperandFormats[offset + 0x0e] = FormatDescriptor.Create(2,
FormatDescriptor.Type.NumericBE, FormatDescriptor.SubType.None);
foreach (KeyValuePair<int, string> kvp in sChipComments) {
project.Comments[offset + kvp.Key] = kvp.Value;
}
sb.AppendFormat(" #{0:D2}: addr=${1:X4} len=${2:X4}",
i, chip.mLoadAddr, chip.mImageSize);
sb.AppendLine();