I tweaked a copy of
lib6502 and collected some numbers - but not from games! Find below some dynamic instruction frequencies, down to 0.5% level.
Edit: I feel a bit dubious now about some of the numbers below. Possibly I've lost out because of 32-bit integers wrapping. Or done something else wrong. See further below for a more reliable investigation in a JavaScript emulator.
First off, the
CLOCKSP benchmark, a BASIC program covering strings, trigs, floats, loops, calls:
Code:
b1 184574 17.39% lda (zp),Y
c8 174013 16.39% iny
10 120410 11.34% bpl rel
d0 103806 9.78% bne rel
c9 69484 6.55% cmp imm
90 68522 6.45% bcc rel
a0 36727 3.46% ldy imm
d1 36703 3.46% cmp (zp),Y
85 36392 3.43% sta zp
65 33902 3.19% adc zp
4c 32483 3.06% jmp abs
98 31903 3.01% tya
38 30779 2.90% sec
91 20117 1.90% sta (zp),Y
f0 10655 1.00% beq rel
b0 9550 0.90% bcs rel
9d 8221 0.77% sta abs,X
ca 8193 0.77% dex
20 6053 0.57% jsr abs
60 5888 0.55% rts
Basic one-liner, computing and printing 4*ATN(1):
Code:
b1 184029 17.41% lda (zp),Y
c8 173426 16.41% iny
10 120044 11.36% bpl rel
d0 103334 9.78% bne rel
c9 69180 6.55% cmp imm
90 68302 6.46% bcc rel
a0 36616 3.46% ldy imm
d1 36560 3.46% cmp (zp),Y
85 36225 3.43% sta zp
65 33800 3.20% adc zp
4c 32384 3.06% jmp abs
98 31800 3.01% tya
38 30678 2.90% sec
91 20103 1.90% sta (zp),Y
f0 10507 0.99% beq rel
b0 9496 0.90% bcs rel
ca 8064 0.76% dex
9d 8064 0.76% sta abs,X
20 5963 0.56% jsr abs
60 5836 0.55% rts
The BBC Micro's OS and Basic initialisation from cold boot - dominated by memory test:
Code:
d0 32733 19.52% bne abs
f0 31918 19.03% beq abs
c8 31848 18.99% iny
91 31624 18.86% sta (zp),Y
c5 31622 18.86% cmp zp
9d 1772 1.06% sta abs,X
And here's the OS and Basic init with the memory test filtered out:
Code:
9d 1772 19.47% sta abs,X
d0 1112 12.22% bne rel
e8 691 7.59% inx
ca 570 6.26% dex
10 453 4.98% bpl rel
f0 297 3.26% beq rel
6c 293 3.22% jmp (ind)
b9 243 2.67% lda abs,Y
88 243 2.67% dey
99 192 2.11% sta abs,Y
20 172 1.89% jsr abs
8d 171 1.88% sta abs
90 159 1.75% bcc rel
e0 154 1.69% cpx imm
a9 149 1.64% lda imm
fe 144 1.58% inc abs,X
de 144 1.58% dec abs,X
a0 133 1.46% ldy imm
60 133 1.46% rts
8c 119 1.31% sty abs
bd 108 1.19% lda abs,X
c8 103 1.13% iny
8e 92 1.01% stx abs
85 85 0.93% sta zp
48 73 0.80% pha
68 72 0.79% pla
a2 68 0.75% ldx imm
b1 60 0.66% lda (zp),Y
ad 57 0.63% lda abs
4a 47 0.52% lsra
08 47 0.52% php
aa 45 0.49% tax
98 45 0.49% tya