Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
Other Calculators
»
z80 opcode usage stats
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: z80 opcode usage stats (Read 3912 times)
0 Members and 1 Guest are viewing this topic.
harold
LV5
Advanced (Next: 300)
Posts: 226
Rating: +41/-3
z80 opcode usage stats
«
on:
July 31, 2011, 09:49:28 am »
I did a primitive order-1 frequency analysis of z80 opcodes as used in TIOS.
It's pretty useless really, but it shows some interesting things.
For example, it's clear that control flow instructions are particularly popular.
Also, there's a general bias towards low values. This bias is much higher for immediate values (as in ld a,imm8 and cp imm8)
Perhaps something to keep in mind when writing a compressor for programs.
Logged
+2/-0 karm for this message
Blog about bitmath:
bitmath.blogspot.nl
Check the
haroldbot thread
for the supported commands and syntax.
You can use haroldbot from
this website
.
p2
LV8
Addict (Next: 1000)
Posts: 849
Rating: +51/-11
I'm back :)
Re: z80 opcode usage stats
«
Reply #1 on:
July 31, 2011, 11:55:13 am »
And what can we learn from this pic?
looks funny!
Logged
*insert supercool signature*
SirCmpwn
Guest
Re: z80 opcode usage stats
«
Reply #2 on:
July 31, 2011, 12:22:35 pm »
Is there a key? What do the colors represent?
Logged
harold
LV5
Advanced (Next: 300)
Posts: 226
Rating: +41/-3
Re: z80 opcode usage stats
«
Reply #3 on:
July 31, 2011, 12:43:59 pm »
Hotter colours are more common.
In order, black, gray, green, yellow, red, purple
One of the things I noticed is that the ED prefix isn't rare in itself, but doesn't have one of those "lines" across the map - it's only common in combination with a few select bytes following it.
«
Last Edit: July 31, 2011, 12:45:42 pm by harold
»
Logged
Blog about bitmath:
bitmath.blogspot.nl
Check the
haroldbot thread
for the supported commands and syntax.
You can use haroldbot from
this website
.
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Re: z80 opcode usage stats
«
Reply #4 on:
July 31, 2011, 12:58:13 pm »
Interesting Harold.
One thing to keep in mind, however, is that TI apparently hardly optimized their OS code (judging by the reactions from BrandonW while he was examinating the code during a video livestream last year), so I wouldn't be surprised if the average ASM source by people on this forum gave different results.
By the way how did you generate this pic?
«
Last Edit: July 31, 2011, 12:58:46 pm by DJ_O
»
Logged
harold
LV5
Advanced (Next: 300)
Posts: 226
Rating: +41/-3
Re: z80 opcode usage stats
«
Reply #5 on:
July 31, 2011, 01:22:52 pm »
I wrote a small C# program, barely a dozen lines of code..
Then I took a look at it and marked some lines.
My guess is that optimized assembly has a higher arithmetic/control-flow ratio (and also less cp's, by using the flags from other instructions better), but I couldn't quickly gather enough proper material to analyze.
In the upper left part of the lower right quadrant (so, just off the middle), there are a couple of intriguing diagonal lines - does anyone have any thoughts on that?
«
Last Edit: July 31, 2011, 02:04:54 pm by harold
»
Logged
Blog about bitmath:
bitmath.blogspot.nl
Check the
haroldbot thread
for the supported commands and syntax.
You can use haroldbot from
this website
.
ralphdspam
LV8
Addict (Next: 1000)
Posts: 841
Rating: +38/-1
My name is actually Matt.
Re: z80 opcode usage stats
«
Reply #6 on:
July 31, 2011, 02:37:59 pm »
Lol, look at the NOPs at the top.
I thought TI's most common instruction was ld a,a.
«
Last Edit: July 31, 2011, 02:57:54 pm by ralphdspam
»
Logged
ld a, 0
ld a, a
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
Other Calculators
»
z80 opcode usage stats