1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-26 19:29:17 +00:00

Split 2002x-operand-formats test

My original goal was to add a sign-extended decimal format, but that
turned out to be awkward.  It works for data items and instructions
with immediate operands (e.g. "LDA #-1"), but is either wrong or
useless for address operands, since most assemblers treat integers
as 32-bit values.  (LDA -1 is not LDA $FFFF, it's LDA $FFFFFFFF,
which is not useful unless your asm is doing an implicit mod.)

There's also a bit of variability in how assemblers treat negative
values, so I'm shelving the idea for now.  I'm keeping the updated
tests, which are now split into 6502 / 65816 parts.

Also, updated the formatter to output all decimal values as unsigned.
Most assemblers were fine with negative values, but 64tass .dword
insists on positive.  Rather than make the opcode conditional on the
value's range, we now just always output unsigned decimal, which
all current assemblers accept.
This commit is contained in:
Andy McFadden 2020-06-08 17:47:26 -07:00
parent bb830a29db
commit b43fd07688
18 changed files with 1086 additions and 699 deletions

View File

@ -535,12 +535,12 @@ namespace Asm65 {
}
/// <summary>
/// Formats a value as decimal.
/// Formats a 32-bit integer value as unsigned decimal.
/// </summary>
/// <param name="value">Value to convert.</param>
/// <returns>Formatted string.</returns>
public string FormatDecimalValue(int value) {
return value.ToString();
return ((uint)value).ToString();
}
/// <summary>

View File

@ -90,5 +90,20 @@ namespace CommonUtil {
// all the bits to the right of it, then just count the 1s.
return CountOneBits(IsolateLeastSignificantOne(val) - 1);
}
/// <summary>
/// Sign-extends an integer value.
/// </summary>
/// <param name="val">Value to extend.</param>
/// <param name="byteLen">Number of significant bytes (1-4).</param>
/// <returns>Sign-extended value, or original value if byteLen is invalid.</returns>
public static int SignExtend(int val, int byteLen) {
if (byteLen < 1 || byteLen >= 4) {
// invalid, or nothing to do
return val;
}
int shiftCount = (4 - byteLen) * 8;
return (val << shiftCount) >> shiftCount;
}
}
}

Binary file not shown.

View File

@ -0,0 +1,487 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":3,
"FileDataLength":165,
"FileDataCrc32":-689690654,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":false,
"EntryFlags":32702671,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"SmartPlpHandling":true},
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":[],
"ProjectSyms":{
}},
"AddressMap":[{
"Offset":0,
"Addr":4096}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Code"}],
"StatusFlagOverrides":{
},
"Comments":{
},
"LongComments":{
"-2147483647":{
"Text":"Project file was edited to force ASCII formatting for some operands.",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
"Notes":{
},
"UserLabels":{
"129":{
"Label":"more_ascii",
"Value":4225,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"93":{
"Label":"skipdata",
"Value":4189,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"}},
"OperandFormats":{
"10":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"12":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"15":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"17":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"20":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"22":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"25":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"27":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"30":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"32":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"35":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"37":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"43":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"44":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"46":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"49":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"53":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"54":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"56":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"59":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"63":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"64":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"66":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"69":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"73":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"74":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"76":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"79":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"83":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"84":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"86":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"89":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"93":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"95":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"97":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"100":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"102":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"104":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"106":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"108":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"110":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"112":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"114":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"116":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"118":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"120":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"122":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"124":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"129":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"131":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"134":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"136":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"139":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"141":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"142":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"High"}},
"143":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"145":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"148":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"152":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"154":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"155":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"156":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"157":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"158":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"159":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"160":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"161":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"162":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"163":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null}},
"LvTables":{
},
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
}}

View File

@ -1,13 +1,13 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":3,
"FileDataLength":143,
"FileDataCrc32":-2044577818,
"FileDataLength":62,
"FileDataCrc32":946946401,
"ProjectProps":{
"CpuName":"65816",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":false,
"EntryFlags":33489103,
"EntryFlags":32702671,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
@ -36,7 +36,7 @@
"LongComments":{
"-2147483647":{
"Text":"Project file was edited for some ASCII operands.",
"Text":"Project file was edited to force ASCII formatting for some operands.",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
@ -45,405 +45,89 @@
},
"UserLabels":{
"63":{
"Label":"skipdata",
"Value":4159,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"112":{
"Label":"more_ascii",
"Value":4208,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"}},
},
"OperandFormats":{
"4":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"6":{
"7":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SubFormat":"Decimal",
"SymbolRef":null},
"9":{
"Length":4,
"10":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SubFormat":"Decimal",
"SymbolRef":null},
"13":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"15":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SubFormat":"Binary",
"SymbolRef":null},
"18":{
"Length":4,
"19":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"22":{
"Length":2,
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SubFormat":"Decimal",
"SymbolRef":null},
"24":{
"25":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"27":{
"32":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"33":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"34":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SubFormat":"Decimal",
"SymbolRef":null},
"36":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"39":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Hex",
"SubFormat":"Decimal",
"SymbolRef":null},
"43":{
"Length":1,
"40":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SubFormat":"Binary",
"SymbolRef":null},
"44":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"46":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SubFormat":"Ascii",
"SymbolRef":null},
"49":{
"Length":4,
"47":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SubFormat":"HighAscii",
"SymbolRef":null},
"50":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"53":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"54":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"56":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"59":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"63":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"65":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"67":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"70":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"74":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"76":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"78":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"80":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"82":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"84":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"86":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"88":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"90":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"92":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"94":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"96":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"98":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"100":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"102":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"105":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"108":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"112":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"113":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"114":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"117":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"119":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"122":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"124":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"125":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"High"}},
"126":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"128":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"131":{
"Length":2,
"Format":"NumericBE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"133":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"134":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"135":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"136":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"137":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"138":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"139":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"140":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"141":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"142":{
"Length":1,
"57":{
"Length":4,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null}},

View File

@ -0,0 +1,90 @@
;Project file was edited to force ASCII formatting for some operands.
.cpu "6502"
.enc sg_hiascii
.cdef $20,$7e,$a0
.enc sg_ascii
.cdef $20,$7e,$20
* = $1000
lda $01
lda $0102
lda $fe
lda $feff
lda 1
lda 258
lda 254
lda 65279
lda 1
lda 258
lda 254
lda 65279
lda %00000001
lda %0000000100000010
lda %11111110
lda %1111111011111111
jmp skipdata
.byte $01
.word $0201
.long $030201
.dword $04030201
.byte 1
.word 513
.long 197121
.dword 67305985
.byte 1
.word 513
.long 197121
.dword 67305985
.byte %00000001
.word %0000001000000001
.long %000000110000001000000001
.dword %00000100000000110000001000000001
.byte 255
.word 65279
.long 16645887
.dword 4244504319
skipdata lda #'h'
lda 'h'
lda @w'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
jmp L10A4
more_ascii .byte 'h'
.byte $80
.word $6868
.byte $80
.word skipdata
.long skipdata
.byte $10,$5d
.byte <more_ascii
.byte >more_ascii
.word more_ascii
.long more_ascii
.dword more_ascii
.byte $10,$81
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80
L10A4 rts

View File

@ -0,0 +1,85 @@
;Project file was edited to force ASCII formatting for some operands.
org $1000
lda $01
lda $0102
lda $fe
lda $feff
lda 1
lda 258
lda 254
lda 65279
lda 1
lda 258
lda 254
lda 65279
lda %00000001
lda %0000000100000010
lda %11111110
lda %1111111011111111
jmp skipdata
dfb $01
dw $0201
adr $030201
adrl $04030201
dfb 1
dw 513
adr 197121
adrl 67305985
dfb 1
dw 513
adr 197121
adrl 67305985
dfb %00000001
dw %0000001000000001
adr %000000110000001000000001
adrl %00000100000000110000001000000001
dfb 255
dw 65279
adr 16645887
adrl 4244504319
skipdata lda #'h'
lda 'h'
lda: 'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #" "
lda #$a2
lda #"'"
lda #"~"
lda #$ff
jmp L10A4
more_ascii dfb 'h'
dfb $80
dw $6868
dfb $80
dw skipdata
adr skipdata
ddb skipdata
dfb <more_ascii
dfb >more_ascii
dw more_ascii
adr more_ascii
adrl more_ascii
ddb more_ascii
dfb '['
dfb $7b
dfb '|'
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb "|"
dfb $fd
dfb ","
L10A4 rts

View File

@ -0,0 +1,86 @@
;Project file was edited to force ASCII formatting for some operands.
!cpu 6502
* = $1000
lda $01
lda $0102
lda $fe
lda $feff
lda 1
lda 258
lda 254
lda 65279
lda 1
lda 258
lda 254
lda 65279
lda %00000001
lda %0000000100000010
lda %11111110
lda %1111111011111111
jmp skipdata
!byte $01
!word $0201
!24 $030201
!32 $04030201
!byte 1
!word 513
!24 197121
!32 67305985
!byte 1
!word 513
!24 197121
!32 67305985
!byte %00000001
!word %0000001000000001
!24 %000000110000001000000001
!32 %00000100000000110000001000000001
!byte 255
!word 65279
!24 16645887
!32 4244504319
skipdata lda #'h'
lda 'h'
lda+2 'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
jmp L10A4
more_ascii !byte 'h'
!byte $80
!word $6868
!byte $80
!word skipdata
!24 skipdata
!byte $10,$5d
!byte <more_ascii
!byte >more_ascii
!word more_ascii
!24 more_ascii
!32 more_ascii
!byte $10,$81
!byte '['
!byte '{'
!byte '|'
!byte '}'
!byte ','
!byte '[' | $80
!byte '{' | $80
!byte '|' | $80
!byte '}' | $80
!byte ',' | $80
L10A4 rts

View File

@ -0,0 +1,87 @@
;Project file was edited to force ASCII formatting for some operands.
.setcpu "6502"
; .segment "SEG000"
.org $1000
lda $01
lda $0102
lda $fe
lda $feff
lda 1
lda 258
lda 254
lda 65279
lda 1
lda 258
lda 254
lda 65279
lda %00000001
lda %0000000100000010
lda %11111110
lda %1111111011111111
jmp skipdata
.byte $01
.word $0201
.faraddr $030201
.dword $04030201
.byte 1
.word 513
.faraddr 197121
.dword 67305985
.byte 1
.word 513
.faraddr 197121
.dword 67305985
.byte %00000001
.word %0000001000000001
.faraddr %000000110000001000000001
.dword %00000100000000110000001000000001
.byte 255
.word 65279
.faraddr 16645887
.dword 4244504319
skipdata: lda #'h'
lda 'h'
lda a:'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
jmp L10A4
more_ascii: .byte 'h'
.byte $80
.word $6868
.byte $80
.word skipdata
.faraddr skipdata
.dbyt skipdata
.byte <more_ascii
.byte >more_ascii
.word more_ascii
.faraddr more_ascii
.dword more_ascii
.dbyt more_ascii
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80
L10A4: rts

View File

@ -0,0 +1,11 @@
# 6502bench SourceGen generated linker script for 20020-operand-formats
MEMORY {
MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=165;
}
SEGMENTS {
CODE: load=MAIN, type=rw;
# SEG000: load=MEM000, type=rw;
}
FEATURES {}
SYMBOLS {}

View File

@ -1,4 +1,4 @@
;Project file was edited for some ASCII operands.
;Project file was edited to force ASCII formatting for some operands.
.cpu "65816"
.enc sg_hiascii
.cdef $20,$7e,$a0
@ -9,75 +9,25 @@
.xs
clc
xce
sep #$30
lda $01
lda $0102
lda $010203
lda 1
lda 258
lda 66051
lda %00000001
lda %0000000100000010
lda %000000010000001000000011
bra skipdata
.byte $01
.word $0201
.long $030201
.dword $04030201
.byte 1
.word 513
.long 197121
.dword 67305985
.byte %00000001
.word %0000001000000001
.long %000000110000001000000001
.dword %00000100000000110000001000000001
skipdata lda #'h'
lda 'h'
lda @w'h'
lda @l'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
rep #'0'
rep #$30
.al
.xl
lda #$1234
lda #4660
lda #4660
lda #%0001001000110100
lda #$fffe
lda #65534
lda #65534
lda #%1111111111111110
lda $fffefd
lda 16776957
lda 16776957
lda %111111111111111011111101
lda #'h'
lda #'H' | $80
lda #$6868
lda @l'h'
lda @l'H' | $80
rts
_more_ascii .byte 'h'
.byte $80
.word $6868
.byte $80
.word skipdata
.long skipdata
.byte $10,$3f
.byte <_more_ascii
.byte >_more_ascii
.word _more_ascii
.long _more_ascii
.byte $10,$70
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80

View File

@ -1,75 +1,25 @@
;Project file was edited for some ASCII operands.
;Project file was edited to force ASCII formatting for some operands.
org $1000
clc
xce
sep #$30
lda $01
lda $0102
ldal $010203
lda 1
lda 258
ldal 66051
lda %00000001
lda %0000000100000010
ldal %000000010000001000000011
bra skipdata
dfb $01
dw $0201
adr $030201
adrl $04030201
dfb 1
dw 513
adr 197121
adrl 67305985
dfb %00000001
dw %0000001000000001
adr %000000110000001000000001
adrl %00000100000000110000001000000001
skipdata lda #'h'
lda 'h'
lda: 'h'
ldal 'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #" "
lda #$a2
lda #"'"
lda #"~"
lda #$ff
rep #'0'
rep #$30
mx %00
lda #$1234
lda #4660
lda #4660
lda #%0001001000110100
lda #$fffe
lda #65534
lda #65534
lda #%1111111111111110
ldal $fffefd
ldal 16776957
ldal 16776957
ldal %111111111111111011111101
lda #'h'
lda #"H"
lda #$6868
ldal 'h'
ldal "H"
rts
:more_ascii dfb 'h'
dfb $80
dw $6868
dfb $80
dw skipdata
adr skipdata
ddb skipdata
dfb <:more_ascii
dfb >:more_ascii
dw :more_ascii
adr :more_ascii
ddb :more_ascii
dfb '['
dfb $7b
dfb '|'
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb "|"
dfb $fd
dfb ","

View File

@ -1,79 +1,29 @@
;Project file was edited for some ASCII operands.
;Project file was edited to force ASCII formatting for some operands.
!cpu 65816
* = $1000
!as
!rs
clc
xce
sep #$30
lda $01
lda $0102
lda+3 $010203
lda 1
lda 258
lda+3 66051
lda %00000001
lda %0000000100000010
lda+3 %000000010000001000000011
bra skipdata
!byte $01
!word $0201
!24 $030201
!32 $04030201
!byte 1
!word 513
!24 197121
!32 67305985
!byte %00000001
!word %0000001000000001
!24 %000000110000001000000001
!32 %00000100000000110000001000000001
skipdata lda #'h'
lda 'h'
lda+2 'h'
lda+3 'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
rep #'0'
rep #$30
!al
!rl
lda #$1234
lda #4660
lda #4660
lda #%0001001000110100
lda #$fffe
lda #65534
lda #65534
lda #%1111111111111110
lda+3 $fffefd
lda+3 16776957
lda+3 16776957
lda+3 %111111111111111011111101
lda #'h'
lda #'H' | $80
lda #$6868
lda+3 'h'
lda+3 'H' | $80
rts
@more_ascii !byte 'h'
!byte $80
!word $6868
!byte $80
!word skipdata
!24 skipdata
!byte $10,$3f
!byte <@more_ascii
!byte >@more_ascii
!word @more_ascii
!24 @more_ascii
!byte $10,$70
!byte '['
!byte '{'
!byte '|'
!byte '}'
!byte ','
!byte '[' | $80
!byte '{' | $80
!byte '|' | $80
!byte '}' | $80
!byte ',' | $80

View File

@ -1,4 +1,4 @@
;Project file was edited for some ASCII operands.
;Project file was edited to force ASCII formatting for some operands.
.setcpu "65816"
; .segment "SEG000"
.org $1000
@ -6,75 +6,25 @@
.i8
clc
xce
sep #$30
lda $01
lda $0102
lda $010203
lda 1
lda 258
lda 66051
lda %00000001
lda %0000000100000010
lda %000000010000001000000011
bra skipdata
.byte $01
.word $0201
.faraddr $030201
.dword $04030201
.byte 1
.word 513
.faraddr 197121
.dword 67305985
.byte %00000001
.word %0000001000000001
.faraddr %000000110000001000000001
.dword %00000100000000110000001000000001
skipdata: lda #'h'
lda 'h'
lda a:'h'
lda f:'h'
lda #$1f
lda #' '
lda #'"'
lda #$27
lda #'~'
lda #$7f
lda #$80
lda #$9f
lda #' ' | $80
lda #'"' | $80
lda #$a7
lda #'~' | $80
lda #$ff
rep #'0'
rep #$30
.a16
.i16
lda #$1234
lda #4660
lda #4660
lda #%0001001000110100
lda #$fffe
lda #65534
lda #65534
lda #%1111111111111110
lda $fffefd
lda 16776957
lda 16776957
lda %111111111111111011111101
lda #'h'
lda #'H' | $80
lda #$6868
lda f:'h'
lda f:'H' | $80
rts
@more_ascii: .byte 'h'
.byte $80
.word $6868
.byte $80
.word skipdata
.faraddr skipdata
.dbyt skipdata
.byte <@more_ascii
.byte >@more_ascii
.word @more_ascii
.faraddr @more_ascii
.dbyt @more_ascii
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80

View File

@ -1,7 +1,7 @@
# 6502bench SourceGen generated linker script for 20022-operand-formats
MEMORY {
MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=143;
# MEM000: file=%O, start=$1000, size=62;
}
SEGMENTS {
CODE: load=MAIN, type=rw;

View File

@ -0,0 +1,99 @@
; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Basic tests for 6502.
;
; Assembler: Merlin 32
org $1000
; Basic operand formats. Show first set as hex, second as decimal,
; third as sign-extended decimal, fourth as binary.
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
lda $01
lda $0102
lda $fe
lda $feff
jmp :skipdata
; Now hex/decimal/sdec/binary, each with .dd1/.dd2/.dd3/.dd4
hex 01010201020301020304
hex 01010201020301020304
hex 01010201020301020304
hex 01010201020301020304
; bonus round for sdec
hex fffffefffefdfffefdfc
:skipdata
; Convert these to ASCII; requires editing file. The code generator
; should display some of these as hex.
lda #$68
lda $68
lda: $0068
lda #$1f
lda #$20
lda #$22
lda #$27
lda #$7e
lda #$7f
lda #$80
lda #$9f
lda #$a0
lda #$a2
lda #$a7
lda #$fe
lda #$ff
jmp end
; Continuing with ASCII
:ascii
dfb $68
dfb $80
dw $6868
dfb $80
; Format first set as address, second set as symbol.
dw :skipdata
adr :skipdata
dfb >:skipdata,:skipdata ;format as big-endian address
dfb :ascii
dfb >:ascii
dw :ascii
adr :ascii
adrl :ascii
dfb >:ascii,:ascii ;format as big-endian symbol
; Merlin 1.0 has trouble with "DFB '{'". Test it and the neighbors.
dfb '['
dfb $7b
dfb $7c
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb $fc
dfb $fd
dfb ","
end rts

View File

@ -1,97 +1,40 @@
; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Extended tests for 65816.
;
; Assembler: Merlin 32
org $1000
; 65816 with short regs
; 65816 with long regs
clc
xce
sep #$30
mx %11
; Basic operand formats. Show first set as hex, second as decimal,
; third as binary.
lda $01
lda $0102
ldal $010203
lda $01
lda $0102
ldal $010203
lda $01
lda $0102
ldal $010203
bra :skipdata
; Now hex/decimal/binary, 1-2-3-4 bytes, in data area.
hex 01010201020301020304
hex 01010201020301020304
hex 01010201020301020304
:skipdata
; Convert these to ASCII; requires editing file. The code generator
; should display some of these as hex.
lda #$68
lda $68
lda: $0068
ldal $000068
lda #$1f
lda #$20
lda #$22
lda #$27
lda #$7e
lda #$7f
lda #$80
lda #$9f
lda #$a0
lda #$a2
lda #$a7
lda #$fe
lda #$ff
; Switch to long regs, continue with ASCII.
rep #$30
mx %00
lda #$0068
lda #$00c8
; hex/dec/sdec/bin
lda #$1234
lda #$1234
lda #$1234
lda #$1234
lda #$fffe
lda #$fffe
lda #$fffe
lda #$fffe
ldal $fffefd
ldal $fffefd
ldal $fffefd
ldal $fffefd
; ASCII
lda #$0068 ;'h'
lda #$00c8 ;"h"
lda #$6868
ldal $000068 ;'h'
ldal $0000c8 ;"h"
rts
; Continuing with ASCII
:ascii
dfb $68
dfb $80
dw $6868
dfb $80
; Format first set as address, second set as symbol.
dw :skipdata
adr :skipdata
dfb >:skipdata,:skipdata ;format as big-endian address
dfb :ascii
dfb >:ascii
dw :ascii
adr :ascii
dfb >:ascii,:ascii ;format as big-endian symbol
; Merlin 1.0 has trouble with "DFB '{'".
dfb '['
dfb $7b
dfb $7c
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb $fc
dfb $fd
dfb ","