1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-02-06 23:30:56 +00:00

Remove excess whitespace after cycle count comments

If a line has a comment with a cycle count and nothing else, it was
getting an extra space or two on the end.

Also, added a few end-of-line comments to the 2020 test to show how
they interact with the cycle counts.
This commit is contained in:
Andy McFadden 2019-09-15 17:09:00 -07:00
parent 88e72d1eb8
commit 65fc2cb86e
6 changed files with 216 additions and 213 deletions

View File

@ -291,9 +291,17 @@ namespace SourceGen.AsmGen {
int cycles = proj.CpuDef.GetCycles(op.Opcode, attr.StatusFlags, attr.BranchTaken, int cycles = proj.CpuDef.GetCycles(op.Opcode, attr.StatusFlags, attr.BranchTaken,
branchCross); branchCross);
if (cycles > 0) { if (cycles > 0) {
eolComment = cycles.ToString() + " " + eolComment; if (!string.IsNullOrEmpty(eolComment)) {
eolComment = cycles.ToString() + " " + eolComment;
} else {
eolComment = cycles.ToString();
}
} else { } else {
eolComment = (-cycles).ToString() + "+ " + eolComment; if (!string.IsNullOrEmpty(eolComment)) {
eolComment = (-cycles).ToString() + "+ " + eolComment;
} else {
eolComment = (-cycles).ToString() + "+";
}
} }
} }
string commentStr = formatter.FormatEolComment(eolComment); string commentStr = formatter.FormatEolComment(eolComment);

View File

@ -13,10 +13,9 @@
"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ "Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{
}, },
"Comments":{ "Comments":{
}, "2":"crosses page boundary","28":"branch always","32":"branch never","37":"branch maybe","39":"BRK with E=1","66":"BRK with E=0","105":"should have no effect on cycle counts on 65816"},
"LongComments":{ "LongComments":{
"-2147483647":{ },
"Text":"6502bench SourceGen v1.3.0-dev6","BoxMode":false,"MaxWidth":80,"BackgroundColor":0}},
"Notes":{ "Notes":{
}, },
"UserLabels":{ "UserLabels":{

View File

@ -1,80 +1,79 @@
;6502bench SourceGen v1.3.0-dev6
.cpu "65816" .cpu "65816"
* = $10f0 * = $10f0
.as .as
.xs .xs
L10F0 sec ;2 L10F0 sec ;2
xce ;2 xce ;2
bra L1108 ;4 bra L1108 ;4 crosses page boundary
.fill 20,$00 .fill 20,$00
L1108 bra L110A ;3 L1108 bra L110A ;3
L110A lda #$00 ;2 L110A lda #$00 ;2
beq L1110 ;3 beq L1110 ;3 branch always
.byte $00 .byte $00
.byte $00 .byte $00
L1110 bne L1110 ;2 L1110 bne L1110 ;2 branch never
lda $1234 ;4 lda $1234 ;4
beq L1119 ;2+ beq L1119 ;2+ branch maybe
brk ;7 brk ;7 BRK with E=1
.byte $01 .byte $01
L1119 lda $22,s ;4 L1119 lda $22,s ;4
trb $02 ;5+ trb $02 ;5+
asl $03,x ;6+ asl $03,x ;6+
clc ;2 clc ;2
xce ;2 xce ;2
rep #$30 ;3 rep #$30 ;3
.al .al
.xl .xl
lda #$0011 ;3 lda #$0011 ;3
ldy #$0022 ;3 ldy #$0022 ;3
trb $04 ;7+ trb $04 ;7+
asl $05,x ;8+ asl $05,x ;8+
ldx $1235 ;5 ldx $1235 ;5
beq L1134 ;2+ beq L1134 ;2+
brk ;8 brk ;8 BRK with E=0
.byte $02 .byte $02
L1134 lda $33,s ;5 L1134 lda $33,s ;5
beq L113A ;2+ beq L113A ;2+
bra L10F0 ;3 bra L10F0 ;3
L113A rep #$20 ;3 L113A rep #$20 ;3
sep #$10 ;3 sep #$10 ;3
.xs .xs
sta $10 ;4+ sta $10 ;4+
stx $11 ;3+ stx $11 ;3+
sty $12 ;3+ sty $12 ;3+
rep #$10 ;3 rep #$10 ;3
.xl .xl
sep #$20 ;3 sep #$20 ;3
.as .as
sta $11 ;3+ sta $11 ;3+
stx $12 ;4+ stx $12 ;4+
sty $13 ;4+ sty $13 ;4+
rep #$30 ;3 rep #$30 ;3
.al .al
lda $1234 ;5 lda $1234 ;5
adc #$0066 ;3 adc #$0066 ;3
adc $1235 ;5 adc $1235 ;5
sed ;2 sed ;2 should have no effect on cycle counts on 65816
adc #$0077 ;3 adc #$0077 ;3
adc $1236 ;5 adc $1236 ;5
sec ;2 sec ;2
xce ;2 xce ;2
.as .as
.xs .xs
sbc #$88 ;2 sbc #$88 ;2
sbc $1237 ;4 sbc $1237 ;4
cld ;2 cld ;2
sbc #$99 ;2 sbc #$99 ;2
sbc $1238 ;4 sbc $1238 ;4
rts ;6 rts ;6

View File

@ -1,75 +1,74 @@
;6502bench SourceGen v1.3.0-dev6
org $10f0 org $10f0
L10F0 sec ;2 L10F0 sec ;2
xce ;2 xce ;2
bra L1108 ;4 bra L1108 ;4 crosses page boundary
ds 20,$00 ds 20,$00
L1108 bra L110A ;3 L1108 bra L110A ;3
L110A lda #$00 ;2 L110A lda #$00 ;2
beq L1110 ;3 beq L1110 ;3 branch always
dfb $00 dfb $00
dfb $00 dfb $00
L1110 bne L1110 ;2 L1110 bne L1110 ;2 branch never
lda $1234 ;4 lda $1234 ;4
beq L1119 ;2+ beq L1119 ;2+ branch maybe
brk ;7 brk ;7 BRK with E=1
dfb $01 dfb $01
L1119 lda $22,S ;4 L1119 lda $22,S ;4
trb $02 ;5+ trb $02 ;5+
asl $03,x ;6+ asl $03,x ;6+
clc ;2 clc ;2
xce ;2 xce ;2
rep #$30 ;3 rep #$30 ;3
mx %00 mx %00
lda #$0011 ;3 lda #$0011 ;3
ldy #$0022 ;3 ldy #$0022 ;3
trb $04 ;7+ trb $04 ;7+
asl $05,x ;8+ asl $05,x ;8+
ldx $1235 ;5 ldx $1235 ;5
beq L1134 ;2+ beq L1134 ;2+
brk ;8 brk ;8 BRK with E=0
dfb $02 dfb $02
L1134 lda $33,S ;5 L1134 lda $33,S ;5
beq L113A ;2+ beq L113A ;2+
bra L10F0 ;3 bra L10F0 ;3
L113A rep #$20 ;3 L113A rep #$20 ;3
sep #$10 ;3 sep #$10 ;3
mx %01 mx %01
sta $10 ;4+ sta $10 ;4+
stx $11 ;3+ stx $11 ;3+
sty $12 ;3+ sty $12 ;3+
rep #$10 ;3 rep #$10 ;3
mx %00 mx %00
sep #$20 ;3 sep #$20 ;3
mx %10 mx %10
sta $11 ;3+ sta $11 ;3+
stx $12 ;4+ stx $12 ;4+
sty $13 ;4+ sty $13 ;4+
rep #$30 ;3 rep #$30 ;3
mx %00 mx %00
lda $1234 ;5 lda $1234 ;5
adc #$0066 ;3 adc #$0066 ;3
adc $1235 ;5 adc $1235 ;5
sed ;2 sed ;2 should have no effect on cycle counts on 65816
adc #$0077 ;3 adc #$0077 ;3
adc $1236 ;5 adc $1236 ;5
sec ;2 sec ;2
xce ;2 xce ;2
mx %11 mx %11
sbc #$88 ;2 sbc #$88 ;2
sbc $1237 ;4 sbc $1237 ;4
cld ;2 cld ;2
sbc #$99 ;2 sbc #$99 ;2
sbc $1238 ;4 sbc $1238 ;4
rts ;6 rts ;6

View File

@ -1,80 +1,79 @@
;6502bench SourceGen v1.3.0-dev6
!cpu 65816 !cpu 65816
* = $10f0 * = $10f0
!as !as
!rs !rs
L10F0 sec ;2 L10F0 sec ;2
xce ;2 xce ;2
bra L1108 ;4 bra L1108 ;4 crosses page boundary
!fill 20,$00 !fill 20,$00
L1108 bra L110A ;3 L1108 bra L110A ;3
L110A lda #$00 ;2 L110A lda #$00 ;2
beq L1110 ;3 beq L1110 ;3 branch always
!byte $00 !byte $00
!byte $00 !byte $00
L1110 bne L1110 ;2 L1110 bne L1110 ;2 branch never
lda $1234 ;4 lda $1234 ;4
beq L1119 ;2+ beq L1119 ;2+ branch maybe
brk ;7 brk ;7 BRK with E=1
!byte $01 !byte $01
L1119 lda $22,S ;4 L1119 lda $22,S ;4
trb $02 ;5+ trb $02 ;5+
asl $03,x ;6+ asl $03,x ;6+
clc ;2 clc ;2
xce ;2 xce ;2
rep #$30 ;3 rep #$30 ;3
!al !al
!rl !rl
lda #$0011 ;3 lda #$0011 ;3
ldy #$0022 ;3 ldy #$0022 ;3
trb $04 ;7+ trb $04 ;7+
asl $05,x ;8+ asl $05,x ;8+
ldx $1235 ;5 ldx $1235 ;5
beq L1134 ;2+ beq L1134 ;2+
brk ;8 brk ;8 BRK with E=0
!byte $02 !byte $02
L1134 lda $33,S ;5 L1134 lda $33,S ;5
beq L113A ;2+ beq L113A ;2+
bra L10F0 ;3 bra L10F0 ;3
L113A rep #$20 ;3 L113A rep #$20 ;3
sep #$10 ;3 sep #$10 ;3
!rs !rs
sta $10 ;4+ sta $10 ;4+
stx $11 ;3+ stx $11 ;3+
sty $12 ;3+ sty $12 ;3+
rep #$10 ;3 rep #$10 ;3
!rl !rl
sep #$20 ;3 sep #$20 ;3
!as !as
sta $11 ;3+ sta $11 ;3+
stx $12 ;4+ stx $12 ;4+
sty $13 ;4+ sty $13 ;4+
rep #$30 ;3 rep #$30 ;3
!al !al
lda $1234 ;5 lda $1234 ;5
adc #$0066 ;3 adc #$0066 ;3
adc $1235 ;5 adc $1235 ;5
sed ;2 sed ;2 should have no effect on cycle counts on 65816
adc #$0077 ;3 adc #$0077 ;3
adc $1236 ;5 adc $1236 ;5
sec ;2 sec ;2
xce ;2 xce ;2
!as !as
!rs !rs
sbc #$88 ;2 sbc #$88 ;2
sbc $1237 ;4 sbc $1237 ;4
cld ;2 cld ;2
sbc #$99 ;2 sbc #$99 ;2
sbc $1238 ;4 sbc $1238 ;4
rts ;6 rts ;6

View File

@ -1,81 +1,80 @@
;6502bench SourceGen v1.3.0-dev6
.setcpu "65816" .setcpu "65816"
; .segment "SEG000" ; .segment "SEG000"
.org $10f0 .org $10f0
.a8 .a8
.i8 .i8
L10F0: sec ;2 L10F0: sec ;2
xce ;2 xce ;2
bra L1108 ;4 bra L1108 ;4 crosses page boundary
.res 20,$00 .res 20,$00
L1108: bra L110A ;3 L1108: bra L110A ;3
L110A: lda #$00 ;2 L110A: lda #$00 ;2
beq L1110 ;3 beq L1110 ;3 branch always
.byte $00 .byte $00
.byte $00 .byte $00
L1110: bne L1110 ;2 L1110: bne L1110 ;2 branch never
lda $1234 ;4 lda $1234 ;4
beq L1119 ;2+ beq L1119 ;2+ branch maybe
brk ;7 brk ;7 BRK with E=1
.byte $01 .byte $01
L1119: lda $22,S ;4 L1119: lda $22,S ;4
trb $02 ;5+ trb $02 ;5+
asl $03,x ;6+ asl $03,x ;6+
clc ;2 clc ;2
xce ;2 xce ;2
rep #$30 ;3 rep #$30 ;3
.a16 .a16
.i16 .i16
lda #$0011 ;3 lda #$0011 ;3
ldy #$0022 ;3 ldy #$0022 ;3
trb $04 ;7+ trb $04 ;7+
asl $05,x ;8+ asl $05,x ;8+
ldx $1235 ;5 ldx $1235 ;5
beq L1134 ;2+ beq L1134 ;2+
brk ;8 brk ;8 BRK with E=0
.byte $02 .byte $02
L1134: lda $33,S ;5 L1134: lda $33,S ;5
beq L113A ;2+ beq L113A ;2+
bra L10F0 ;3 bra L10F0 ;3
L113A: rep #$20 ;3 L113A: rep #$20 ;3
sep #$10 ;3 sep #$10 ;3
.i8 .i8
sta $10 ;4+ sta $10 ;4+
stx $11 ;3+ stx $11 ;3+
sty $12 ;3+ sty $12 ;3+
rep #$10 ;3 rep #$10 ;3
.i16 .i16
sep #$20 ;3 sep #$20 ;3
.a8 .a8
sta $11 ;3+ sta $11 ;3+
stx $12 ;4+ stx $12 ;4+
sty $13 ;4+ sty $13 ;4+
rep #$30 ;3 rep #$30 ;3
.a16 .a16
lda $1234 ;5 lda $1234 ;5
adc #$0066 ;3 adc #$0066 ;3
adc $1235 ;5 adc $1235 ;5
sed ;2 sed ;2 should have no effect on cycle counts on 65816
adc #$0077 ;3 adc #$0077 ;3
adc $1236 ;5 adc $1236 ;5
sec ;2 sec ;2
xce ;2 xce ;2
.a8 .a8
.i8 .i8
sbc #$88 ;2 sbc #$88 ;2
sbc $1237 ;4 sbc $1237 ;4
cld ;2 cld ;2
sbc #$99 ;2 sbc #$99 ;2
sbc $1238 ;4 sbc $1238 ;4
rts ;6 rts ;6