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

Add signed-decimal operand formatting

This allows signed decimal operands to be formatted as such, e.g.
"LDA #$FE" becomes "LDA #-2".  This can be applied to immediate
operands and to numeric data pseudo-ops.

Not all assemblers support this in all situations.  The asm generators
will output unsigned decimal operands if so.

The 20020- and 20022-operand-formats tests have been updated.
This commit is contained in:
Andy McFadden
2025-07-15 13:34:19 -07:00
parent 10e48f15e8
commit 4ea4204ab7
30 changed files with 710 additions and 115 deletions
+22
View File
@@ -730,6 +730,28 @@ namespace Asm65 {
return ((uint)value).ToString();
}
/// <summary>
/// Formats a 32-bit integer value as signed decimal.
/// </summary>
/// <param name="value">Value to convert.</param>
/// <returns>Formatted string.</returns>
public string FormatSignedDecimalValue(int value, int operandLen) {
switch (operandLen) {
case 1:
return ((sbyte)value).ToString();
case 2:
return ((short)value).ToString();
case 3:
value <<= 8; // shift to cause sign-extension
return ((value) >> 8).ToString();
case 4:
return value.ToString();
default:
Debug.Assert(false, "bad operand length " + operandLen);
return "?" + operandLen + "?";
}
}
/// <summary>
/// Formats a value in binary, padding with zeroes so the length is a multiple of 8.
/// </summary>
+1
View File
@@ -471,6 +471,7 @@ namespace PluginCommon {
// For NumericLE/BE
Hex,
Decimal,
SignedDecimal,
Binary,
Address,
Symbol,
+6 -4
View File
@@ -427,6 +427,10 @@ namespace SourceGen.AsmGen {
int length = dfd.Length;
Debug.Assert(length > 0);
PseudoOp.FormatNumericOpFlags flags =
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix |
PseudoOp.FormatNumericOpFlags.AllowSignedDecimal;
bool multiLine = false;
switch (dfd.FormatType) {
case FormatDescriptor.Type.Default:
@@ -442,8 +446,7 @@ namespace SourceGen.AsmGen {
opcodeStr = sDataOpNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix);
mLocalizer.LabelMap, dfd, operand, length, flags);
break;
case FormatDescriptor.Type.NumericBE:
opcodeStr = sDataOpNames.GetDefineBigData(length);
@@ -453,8 +456,7 @@ namespace SourceGen.AsmGen {
} else {
operand = RawData.GetWord(data, offset, length, true);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix);
mLocalizer.LabelMap, dfd, operand, length, flags);
}
break;
case FormatDescriptor.Type.Fill:
+2
View File
@@ -191,6 +191,8 @@ namespace SourceGen.AsmGen {
// Special handling for forward references to zero-page labels is required.
Quirks.SinglePassAssembler = true;
Quirks.NoSignedDecimalImm = true;
mWorkDirectory = workDirectory;
mFileNameBase = fileNameBase;
Settings = settings;
+6 -4
View File
@@ -286,6 +286,10 @@ namespace SourceGen.AsmGen {
int length = dfd.Length;
Debug.Assert(length > 0);
PseudoOp.FormatNumericOpFlags flags =
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix |
PseudoOp.FormatNumericOpFlags.AllowSignedDecimal;
bool multiLine = false;
switch (dfd.FormatType) {
case FormatDescriptor.Type.Default:
@@ -306,8 +310,7 @@ namespace SourceGen.AsmGen {
operandStr = formatter.FormatHexValue(operand, length * 2);
} else {
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix);
mLocalizer.LabelMap, dfd, operand, length, flags);
}
break;
case FormatDescriptor.Type.NumericBE:
@@ -318,8 +321,7 @@ namespace SourceGen.AsmGen {
} else {
operand = RawData.GetWord(data, offset, length, true);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix);
mLocalizer.LabelMap, dfd, operand, length, flags);
}
break;
case FormatDescriptor.Type.Fill:
+3
View File
@@ -286,6 +286,9 @@ namespace SourceGen.AsmGen {
op.AddrMode == OpDef.AddressMode.ImmLongA ||
op.AddrMode == OpDef.AddressMode.ImmLongXY) {
opFlags |= PseudoOp.FormatNumericOpFlags.HasHashPrefix;
if (!gen.Quirks.NoSignedDecimalImm) {
opFlags |= PseudoOp.FormatNumericOpFlags.AllowSignedDecimal;
}
}
if ((opFlags & PseudoOp.FormatNumericOpFlags.IsPcRel) != 0) {
int branchDist = attr.Address - attr.OperandAddress;
+5
View File
@@ -286,6 +286,11 @@ namespace SourceGen.AsmGen {
/// reduce the value to 8 bits?
/// </summary>
public bool ByteSelectionIsShift { get; set; }
/// <summary>
/// Does the assembler not accept signed decimal values for immediate instructions?
/// </summary>
public bool NoSignedDecimalImm { get; set; }
}
/// <summary>
+2
View File
@@ -1296,6 +1296,8 @@ namespace SourceGen {
return FormatDescriptor.SubType.Hex;
case DataSubType.Decimal:
return FormatDescriptor.SubType.Decimal;
case DataSubType.SignedDecimal:
return FormatDescriptor.SubType.SignedDecimal;
case DataSubType.Binary:
return FormatDescriptor.SubType.Binary;
case DataSubType.Address:
+10 -1
View File
@@ -79,6 +79,7 @@ namespace SourceGen {
// NumericLE/BE; default is "raw", which can have a context-specific display format
Hex,
Decimal,
SignedDecimal,
Binary,
Address, // wants to be an address, but no symbol defined
Symbol, // symbolic ref; replace with Expression, someday?
@@ -128,6 +129,8 @@ namespace SourceGen {
Type.NumericLE, SubType.Hex);
private static FormatDescriptor ONE_DECIMAL = new FormatDescriptor(1,
Type.NumericLE, SubType.Decimal);
private static FormatDescriptor ONE_SIGNED_DECIMAL = new FormatDescriptor(1,
Type.NumericLE, SubType.SignedDecimal);
private static FormatDescriptor ONE_BINARY = new FormatDescriptor(1,
Type.NumericLE, SubType.Binary);
private static FormatDescriptor ONE_LOW_ASCII = new FormatDescriptor(1,
@@ -274,6 +277,8 @@ namespace SourceGen {
return ONE_HEX;
case SubType.Decimal:
return ONE_DECIMAL;
case SubType.SignedDecimal:
return ONE_SIGNED_DECIMAL;
case SubType.Binary:
return ONE_BINARY;
case SubType.Ascii:
@@ -408,6 +413,7 @@ namespace SourceGen {
case SubType.Hex:
return 16;
case SubType.Decimal:
case SubType.SignedDecimal:
return 10;
case SubType.Binary:
return 2;
@@ -426,7 +432,7 @@ namespace SourceGen {
public static SubType GetSubTypeForBase(int numBase) {
switch (numBase) {
case 2: return SubType.Binary;
case 10: return SubType.Decimal;
case 10: return SubType.Decimal; // no SignedDecimal; not needed for DefSym
case 16: return SubType.Hex;
default:
Debug.Assert(false);
@@ -564,6 +570,9 @@ namespace SourceGen {
case SubType.Decimal:
retstr += "numeric, Decimal";
break;
case SubType.SignedDecimal:
retstr += "numeric, Signed Decimal";
break;
case SubType.Binary:
retstr += "numeric, Binary";
break;
+2 -1
View File
@@ -1440,7 +1440,8 @@ namespace SourceGen {
} else if (op.AddrMode == OpDef.AddressMode.Imm ||
op.AddrMode == OpDef.AddressMode.ImmLongA ||
op.AddrMode == OpDef.AddressMode.ImmLongXY) {
opFlags = PseudoOp.FormatNumericOpFlags.HasHashPrefix;
opFlags = PseudoOp.FormatNumericOpFlags.HasHashPrefix |
PseudoOp.FormatNumericOpFlags.AllowSignedDecimal;
}
if (op.IsAbsolutePBR) {
opFlags |= PseudoOp.FormatNumericOpFlags.IsAbsolutePBR;
+14 -4
View File
@@ -299,11 +299,14 @@ namespace SourceGen {
/// <summary>
/// Generates a pseudo-op statement for the specified data operation.
///
/// </summary>
/// <remarks>
/// For most operations, only one output line will be generated. For larger items,
/// like dense hex, the value may be split into multiple lines. The sub-index
/// indicates which line should be formatted.
/// </summary>
///
/// This is used for the on-screen formatting. Assembly generators do their own thing.
/// </remarks>
/// <param name="formatter">Format definition.</param>
/// <param name="opNames">Table of pseudo-op names.</param>
/// <param name="symbolTable">Project symbol table.</param>
@@ -352,13 +355,13 @@ namespace SourceGen {
po.Opcode = opNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false);
po.Operand = FormatNumericOperand(formatter, symbolTable, labelMap,
dfd, operand, length, FormatNumericOpFlags.None);
dfd, operand, length, FormatNumericOpFlags.AllowSignedDecimal);
break;
case FormatDescriptor.Type.NumericBE:
po.Opcode = opNames.GetDefineBigData(length);
operand = RawData.GetWord(data, offset, length, true);
po.Operand = FormatNumericOperand(formatter, symbolTable, labelMap,
dfd, operand, length, FormatNumericOpFlags.None);
dfd, operand, length, FormatNumericOpFlags.AllowSignedDecimal);
break;
case FormatDescriptor.Type.Fill:
po.Opcode = opNames.Fill;
@@ -560,6 +563,7 @@ namespace SourceGen {
HasHashPrefix = 1 << 2, // operand has a leading '#', reducing ambiguity
OmitLabelPrefixSuffix = 1 << 3, // don't show annotation char or non-unique prefix
Is64Tass = 1 << 4, // hack to allow 64tass to keep using "common" exp
AllowSignedDecimal = 1 << 5, // argument may be formatted as signed
}
/// <summary>
@@ -643,6 +647,12 @@ namespace SourceGen {
return formatter.FormatHexValue(operandValue, hexMinLen);
case FormatDescriptor.SubType.Decimal:
return formatter.FormatDecimalValue(operandValue);
case FormatDescriptor.SubType.SignedDecimal:
if ((flags & FormatNumericOpFlags.AllowSignedDecimal) != 0) {
return formatter.FormatSignedDecimalValue(operandValue, operandLen);
} else {
return formatter.FormatDecimalValue(operandValue);
}
case FormatDescriptor.SubType.Binary:
return formatter.FormatBinaryValue(operandValue, hexMinLen * 4);
case FormatDescriptor.SubType.Ascii:
Binary file not shown.
+327 -74
View File
@@ -1,8 +1,8 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":3,
"FileDataLength":165,
"FileDataCrc32":-689690654,
"_ContentVersion":6,
"FileDataLength":216,
"FileDataCrc32":766666952,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
@@ -14,7 +14,9 @@
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"SmartPlpHandling":true},
"UseRelocData":false,
"SmartPlpHandling":true,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":[],
@@ -23,7 +25,12 @@
"AddressMap":[{
"Offset":0,
"Addr":4096}],
"Addr":4096,
"Length":-1024,
"PreLabel":"",
"DisallowInward":false,
"DisallowOutward":false,
"IsRelative":false}],
"TypeHints":[{
"Low":0,
"High":0,
@@ -37,6 +44,14 @@
"LongComments":{
"-2147483647":{
"Text":"Project file was edited to force ASCII formatting for some operands.",
"IsFancy":false,
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"164":{
"Text":"Signed-decimal tests. All of these must be formatted as signed decimal; this may require hand-editing or modifications to the instruction operand editor.",
"IsFancy":true,
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
@@ -64,319 +79,372 @@
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"12":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"15":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"17":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"20":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"22":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"25":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"27":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"30":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"32":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"35":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"37":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"43":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"44":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"46":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"49":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"53":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"54":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"56":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"59":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"63":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"64":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"66":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"69":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"73":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"74":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"76":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"79":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"83":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"84":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"86":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"89":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"93":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"95":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"97":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"100":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"102":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"104":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"106":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"108":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"110":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"112":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"114":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"116":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"118":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"120":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"122":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"124":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"129":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"131":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"134":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"136":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"139":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"141":{
"Length":1,
@@ -384,7 +452,9 @@
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"Part":"Low"},
"Extra":null},
"142":{
"Length":1,
@@ -392,91 +462,268 @@
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"High"}},
"Part":"High"},
"Extra":null},
"143":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"145":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"148":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"152":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"154":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"155":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"156":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"157":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"158":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"159":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"160":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"161":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"162":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"163":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null}},
"SymbolRef":null,
"Extra":null},
"165":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"167":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"169":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"171":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"173":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"175":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"177":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"179":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"182":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"185":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"188":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"189":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"190":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"191":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"192":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"193":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"195":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"197":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"199":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"201":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"204":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"207":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"211":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null}},
"LvTables":{
},
@@ -484,4 +731,10 @@
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}
Binary file not shown.
@@ -1,8 +1,8 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":3,
"FileDataLength":62,
"FileDataCrc32":946946401,
"_ContentVersion":6,
"FileDataLength":82,
"FileDataCrc32":1142036862,
"ProjectProps":{
"CpuName":"65816",
"IncludeUndocumentedInstr":false,
@@ -14,7 +14,9 @@
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"SmartPlpHandling":true},
"UseRelocData":false,
"SmartPlpHandling":true,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":[],
@@ -23,7 +25,12 @@
"AddressMap":[{
"Offset":0,
"Addr":4096}],
"Addr":4096,
"Length":-1024,
"PreLabel":"",
"DisallowInward":false,
"DisallowOutward":false,
"IsRelative":false}],
"TypeHints":[{
"Low":0,
"High":0,
@@ -37,6 +44,7 @@
"LongComments":{
"-2147483647":{
"Text":"Project file was edited to force ASCII formatting for some operands.",
"IsFancy":false,
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
@@ -52,85 +60,141 @@
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"10":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"13":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"19":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"22":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"25":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"32":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"36":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"40":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"44":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"47":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"50":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"53":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"SymbolRef":null,
"Extra":null},
"57":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null}},
"SymbolRef":null,
"Extra":null},
"62":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"65":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"68":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"71":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"74":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null},
"77":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"SignedDecimal",
"SymbolRef":null,
"Extra":null}},
"LvTables":{
},
@@ -138,4 +202,10 @@
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}
@@ -86,5 +86,33 @@ more_ascii .byte 'h'
.byte '}' | $80
.byte ',' | $80
L10A4 rts
;Signed-decimal tests. All of these must be formatted as signed decimal; this
;may require hand-editing or modifications to the instruction operand editor.
L10A4 nop
lda #0
lda #1
lda #127
lda #-128
lda #-1
lda 1
lda 254
lda @w1
lda 65534
jmp 4311
.byte 0
.byte 1
.byte 127
.byte 128
.byte 255
.word 1
.word 65534
.byte $00,$02
.byte $ff,$fd
.long 66051
.long 16776957
.dword 16909060
.dword 4294901244
rts
@@ -82,5 +82,33 @@ more_ascii !byte 'h'
!byte '}' | $80
!byte ',' | $80
L10A4 rts
;Signed-decimal tests. All of these must be formatted as signed decimal; this
;may require hand-editing or modifications to the instruction operand editor.
L10A4 nop
lda #0
lda #1
lda #127
lda #-128
lda #-1
lda 1
lda 254
lda+2 1
lda 65534
jmp 4311
!byte 0
!byte 1
!byte 127
!byte -128
!byte -1
!word 1
!word -2
!byte $00,$02
!byte $ff,$fd
!24 66051
!24 -259
!32 16909060
!32 -66052
rts
@@ -82,5 +82,33 @@ more_ascii: .byte 'h'
.byte '}' | $80
.byte ',' | $80
L10A4: rts
;Signed-decimal tests. All of these must be formatted as signed decimal; this
;may require hand-editing or modifications to the instruction operand editor.
L10A4: nop
lda #0
lda #1
lda #127
lda #128
lda #255
lda 1
lda 254
lda a:1
lda 65534
jmp 4311
.byte 0
.byte 1
.byte 127
.byte 128
.byte 255
.word 1
.word 65534
.dbyt 2
.dbyt 65533
.faraddr 66051
.faraddr 16776957
.dword 16909060
.dword 4294901244
rts
@@ -81,5 +81,33 @@ more_ascii dfb 'h'
dfb $fd
dfb ","
L10A4 rts
*Signed-decimal tests. All of these must be formatted as signed decimal; this
*may require hand-editing or modifications to the instruction operand editor.
L10A4 nop
lda #0
lda #1
lda #127
lda #-128
lda #-1
lda 1
lda 254
lda: 1
lda 65534
jmp 4311
dfb 0
dfb 1
dfb 127
dfb -128
dfb -1
dw 1
dw -2
ddb 2
ddb -3
adr 66051
adr -259
adrl 16909060
adrl -66052
rts
@@ -29,5 +29,12 @@
lda #$6868
lda @l'h'
lda @l'H' | $80
nop
lda #0
lda #1
lda #32767
lda #-32768
lda #-1
lda 16776957
rts
@@ -25,5 +25,12 @@
lda #$6868
lda+3 'h'
lda+3 'H' | $80
nop
lda #0
lda #1
lda #32767
lda #-32768
lda #-1
lda+3 16776957
rts
@@ -25,5 +25,12 @@
lda #$6868
lda f:'h'
lda f:'H' | $80
nop
lda #0
lda #1
lda #32767
lda #32768
lda #65535
lda 16776957
rts
@@ -21,5 +21,12 @@
lda #$6868
ldal 'h'
ldal "H"
nop
lda #0
lda #1
lda #32767
lda #-32768
lda #-1
ldal 16776957
rts
@@ -62,7 +62,7 @@
lda #$fe
lda #$ff
jmp end
jmp next1
; Continuing with ASCII
:ascii
@@ -96,4 +96,34 @@
dfb $fd
dfb ","
end rts
; Signed-decimal tests. All operands should be formatted as signed. This
; will require hand-editing or tweaking the operand editor.
next1 nop
lda #$00 ;these should format as signed
lda #$01
lda #$7f
lda #$80
lda #$ff
lda $01 ;these should appear unsigned
lda $fe
lda: $0001
lda $fffe
jmp :skipdat1
dfb $00 ;all of these should appear signed
dfb $01
dfb $7f
dfb $80
dfb $ff
dw $0001
dw $fffe
dw $0200 ;big-endian
dw $fdff ;big-endian
adr $010203
adr $fffefd
adrl $01020304
adrl $fffefdfc
:skipdat1
rts
@@ -37,4 +37,14 @@
ldal $000068 ;'h'
ldal $0000c8 ;"h"
; Signed-decimal tests.
nop
lda #$0000
lda #$0001
lda #$7fff
lda #$8000
lda #$ffff
ldal $fffefd
rts
+4 -1
View File
@@ -93,7 +93,10 @@ limitations under the License.
<RadioButton Name="radioSimpleDataDecimal" Grid.Column="0" Grid.Row="1"
GroupName="Display" Content="_Decimal" Margin="0,4,18,0"
Checked="SimpleDisplay_CheckedChanged"/>
<RadioButton Name="radioSimpleDataBinary" Grid.Column="0" Grid.Row="2"
<RadioButton Name="radioSimpleDataSignedDecimal" Grid.Column="0" Grid.Row="2"
GroupName="Display" Content="Signed decimal" Margin="0,4,18,0"
Checked="SimpleDisplay_CheckedChanged"/>
<RadioButton Name="radioSimpleDataBinary" Grid.Column="1" Grid.Row="3"
GroupName="Display" Content="_Binary" Margin="0,4,0,0"
Checked="SimpleDisplay_CheckedChanged"/>
+5
View File
@@ -839,6 +839,9 @@ namespace SourceGen.WpfGui {
case FormatDescriptor.SubType.Decimal:
radioSimpleDataDecimal.IsChecked = true;
break;
case FormatDescriptor.SubType.SignedDecimal:
radioSimpleDataSignedDecimal.IsChecked = true;
break;
case FormatDescriptor.SubType.Binary:
radioSimpleDataBinary.IsChecked = true;
break;
@@ -1004,6 +1007,8 @@ namespace SourceGen.WpfGui {
subType = FormatDescriptor.SubType.Hex;
} else if (radioSimpleDataDecimal.IsChecked == true) {
subType = FormatDescriptor.SubType.Decimal;
} else if (radioSimpleDataSignedDecimal.IsChecked == true) {
subType = FormatDescriptor.SubType.SignedDecimal;
} else if (radioSimpleDataBinary.IsChecked == true) {
subType = FormatDescriptor.SubType.Binary;
} else if (radioSimpleDataAscii.IsChecked == true) {
@@ -83,6 +83,8 @@ limitations under the License.
IsChecked="{Binding FormatHex}"/>
<RadioButton GroupName="Main" Content="_Decimal" Margin="0,2,0,0"
IsChecked="{Binding FormatDecimal}"/>
<RadioButton GroupName="Main" Content="Signed _Decimal" Margin="0,2,0,0"
IsEnabled="{Binding IsFormatSignedDecimalAllowed}" IsChecked="{Binding FormatSignedDecimal}"/>
<RadioButton GroupName="Main" Content="_Binary" Margin="0,2,0,0"
IsChecked="{Binding FormatBinary}"/>
<RadioButton GroupName="Main" Content="_ASCII (low or high) character" Margin="0,2,0,0"
@@ -389,6 +389,9 @@ namespace SourceGen.WpfGui {
case FormatDescriptor.SubType.Decimal:
sb.Append(mFormatter.FormatDecimalValue(operandValue));
break;
case FormatDescriptor.SubType.SignedDecimal:
sb.Append(mFormatter.FormatSignedDecimalValue(operandValue, dfd.Length - 1));
break;
case FormatDescriptor.SubType.Binary:
sb.Append(mFormatter.FormatBinaryValue(operandValue, 8));
break;
@@ -484,6 +487,18 @@ namespace SourceGen.WpfGui {
}
private bool mFormatDecimal;
public bool IsFormatSignedDecimalAllowed {
get { return mIsFormatSignedDecimalAllowed; }
set { mIsFormatSignedDecimalAllowed = value; OnPropertyChanged(); }
}
private bool mIsFormatSignedDecimalAllowed;
public bool FormatSignedDecimal {
get { return mFormatSignedDecimal; }
set { mFormatSignedDecimal = value; OnPropertyChanged(); UpdateControls(); }
}
private bool mFormatSignedDecimal;
public bool FormatBinary {
get { return mFormatBinary; }
set { mFormatBinary = value; OnPropertyChanged(); UpdateControls(); }
@@ -618,7 +633,9 @@ namespace SourceGen.WpfGui {
} else {
IsFormatAsciiAllowed = IsFormatPetsciiAllowed = IsFormatScreenCodeAllowed =
false;
}
IsFormatSignedDecimalAllowed = mOpDef.IsImmediate;
SymbolLabel = string.Empty;
FormatPartLow = true; // could default to high for MVN/MVP
@@ -640,6 +657,9 @@ namespace SourceGen.WpfGui {
case FormatDescriptor.SubType.Decimal:
FormatDecimal = true;
break;
case FormatDescriptor.SubType.SignedDecimal:
FormatSignedDecimal = true;
break;
case FormatDescriptor.SubType.Binary:
FormatBinary = true;
break;
@@ -760,6 +780,8 @@ namespace SourceGen.WpfGui {
subType = FormatDescriptor.SubType.Hex;
} else if (FormatDecimal) {
subType = FormatDescriptor.SubType.Decimal;
} else if (FormatSignedDecimal) {
subType = FormatDescriptor.SubType.SignedDecimal;
} else if (FormatBinary) {
subType = FormatDescriptor.SubType.Binary;
} else if (FormatAscii) {
+2 -1
View File
@@ -132,7 +132,8 @@ variables will be identified and applied automatically.</p>
<h3 id="explicit-format">Explicit Formats</h3>
<p>Operands can be displayed in a variety of numeric formats, or as a
symbol. The character formats are only available for operands
symbol. Signed decimal is only available for immediate operands.
The character formats are only available for operands
whose value falls into the proper range. The ASCII format handles
both plain and high ASCII; the correct encoding is chosen based on
the operand's value.</p>