View Single Post
Old 08 September 2022, 21:43   #898
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,564
Quote:
Originally Posted by nonarkitten View Post
So I enumerated every single instruction from Kickstart 1.2 exec disassembly. Here's my findings.

1 word opcodes: 1965 (51.0)
2 word opcodes: 1436 (37.2)
3 word opcodes: 267 (6.9)
4 word opcodes: 92 (2.4)
5 word opcodes: 34 (0.9)
6 word opcodes: 7 (0.2)
7 word opcodes: 17 (0.4)
8 word opcodes: 18 (0.5)
9 word opcodes: 3 (0.1)

So yeah, most are only one word. About 1/3 are only two words and about 90% of all opcodes are either one or two words. I would guess the few 3-word instances are for 32-bit literals/addresses. It really falls off from there. But maybe Kickstart isn't "complex" enough for you.

I would add that Exec is all hand-written 68K assembly and not compiled code. With something like GCC you're going to find even fewer situations where it can make use of 68K's overly complex extended addressing modes. Heck, even getting GCC to reliably emit DBcc is like pulling teeth.
Interesting stats!

This has inspired me to do the same in my disassembler. Here are results for a random selection of programs on my A1200 (only showing instructions with 1% or more of total):-

Program 'dis' (my disassember, asm)
total insts = 23861
1 word insts = 11050, 46%
2 word insts = 10940, 45%
3 word insts = 1834, 7%

Program 'CMP' (asm)
total insts = 1984
1 word insts = 752, 37%
2 word insts = 943, 47%
3 word insts = 217, 10%
4 word insts = 72, 3%

Program 'MBRTest-2' (asm?)
total insts = 25401
1 word insts = 16664, 65%
2 word insts = 7619, 29%
3 word insts = 965, 3%

Program 'Hex'
total insts = 8730
1 word insts = 2935, 33%
2 word insts = 5120, 58%
3 word insts = 646, 7%

Program 'Redit'
total insts = 23984
1 word insts = 8890, 37%
2 word insts = 12025, 50%
3 word insts = 2880, 12%

Program 'cb' (Sierra game "Colonel's bequest")
total insts = 1093
1 word insts = 454, 41%
2 word insts = 561, 51%
3 word insts = 65, 5%
4 word insts = 13, 1%

Program 'AIBB'
total insts = 49748
1 word insts = 22517, 45%
2 word insts = 20943, 42%
3 word insts = 5574, 11%

Program 'moned'
total insts = 5136
1 word insts = 2894, 56%
2 word insts = 2023, 39%
3 word insts = 208, 4%

Program 'AmiModRadio'
total insts = 43042
1 word insts = 24239, 56%
2 word insts = 11125, 25%
3 word insts = 7587, 17%

Program 'wolf3d'
total insts = 40359
1 word insts = 20901, 51%
2 word insts = 11938, 29%
3 word insts = 5932, 14%
4 word insts = 1398, 3%

Program 'IBrowse' (sasc)
total insts = 222475
1 word insts = 115443, 51%
2 word insts = 88699, 39%
3 word insts = 15854, 7%
4 word insts = 2397, 1%

Program 'python2.4' (gcc?)
total insts = 175669
1 word insts = 98758, 56%
2 word insts = 55819, 31%
3 word insts = 19977, 11%

Programs written in C/C++ tend to have mostly single word instructions. Assembler is quite variable, possibly quite application specific (eg. MBR-Test). Some other programs with low single word counts may have been written in a more 'exotic' high level language with less efficient compiler.
Bruce Abbott is offline  
 
Page generated in 0.04404 seconds with 11 queries