Okay, I'm just starting off with my static recompiler and am doing call
tree/depth traversal. The code works so far! Looks like I don't yet have
enough entry...
... Yup - that's the case here, too. There's another spot that contains a jump table or two in there as well. I did find other code laying around. Also, one...
Neil Bradley
nb@...
Jun 29, 2004 3:43 pm
128
... contains a jump ... My initial strategy with the Cinemu was to first tree-walk as much as I could, then have a rapid change/test loop to add new addresses...
1) http://www.dwelch.com/ipod/asteroids.htm I ported Asteroids to the iPod. 2) To disagree with Graham, for the above SBT, what I did was for each instruction...
... I found several places where sequences of code with EX (SP), HL giving a very good hint as to where a jump location could be. It seems to be a common...
Neil Bradley
nb@...
Jun 29, 2004 6:11 pm
131
... Yup. All I have to do is add the entry point to my list: entry 0, 0x08, 0x10, 0x2f8, invaders; and recompile. Done! Fairly simple to do, actually, and when...
Neil Bradley
nb@...
Jun 29, 2004 6:22 pm
132
I'm in the process of creating a static recompiler that is extensible to multiple sources and targets. At this point I have it doing an opcode call tree build...
Neil Bradley
nb@...
Jun 29, 2004 6:40 pm
133
... Be careful there: it depends on what style of emulator you are writing; there are 3 choices: 1) keeping a flag byte up to date to match the CPU status...
... Can't you trap those with a 'default' case and cause a runtime error, rather than just failing to translate the code and dropping through to the wrong part...
... Cool! Any chance I can take a look at the recompiled output? ... What is a "hitlist"? Is it a "list of locations where execution has/will taken place"? ......
Neil Bradley
nb@...
Jun 29, 2004 10:40 pm
136
... Hm... that's something I hadn't considered. At any given point, you can figure out if something else is going to use a given set of flags (on an individual...
Neil Bradley
nb@...
Jun 30, 2004 4:40 am
137
... Each opcode generates several "dump()" calls to output code. Individual calls to dump() include the input and output flags. In the description above when I...
... So are you emitting code on a per instruction basis, or are you developing an in memory tree of everything and taking another pass at it? ... Well, I'm...
Neil Bradley
nb@...
Jun 30, 2004 6:10 am
139
... linear list, only keep enough for a basic block, which means it is flushed on any branch. G...
... You can statically find *most* jump destinations. Then you can run under an emulator and locate the dynamic jumps, with the emulator's help. Once you know...
... [...] ... There is one problem with that approach: I have seen many old programs that used tricks and had a real opcode used as an immediate value: 100...
... I've seen that at Acorn where they would define a new 6502 opcode called "SKP" which was intended to be a 1-byte skip, but was actually just the opcode of...
... You don't necessarily need 2 bytes to encode the destination. You could very well have 1 byte *offsets*. Typically on the 68k switch/case tables use...
... Yes, I know, it's worse than I said. For example on the 6502 if you use a table of 2-byte addresses, you can only have 128 of them and fetching them from...
After, asking stupid questions, I thought it was time to start doing real work. Right now I have a 8080 disassembler that walks down call tree to identify...
... You'd be surprised. Given 8080 input, you're probably making a correct assumption. However, a some (annoying) chips force the use of indirect addressing...
... Things like redundant flag optimizations immediately spring to mind. Also, I think that local optimizations such as constant folding, dead code ...
... I don't think that's the major disadvantage. We're not going to use superblocks in our PPC recompiler because once you exit, you can't easily get back...
... Does it do things like this? http://www.synthcom.com/~nb/invadersLst.zip Not only does it tell you the "jump to" addresses, but it also tells you where it...
Neil Bradley
nb@...
Jul 4, 2004 1:17 am
150
... Weeeeeeeeeeeeeeelllll.... that's not entirely true. If it can be optimized to Z80 instructions, it should be. ... Yeah, already got that in my core: struct...
Neil Bradley
nb@...
Jul 4, 2004 1:26 am
151
... Sorry to follow up on my on post, but please look for the word "Linear" and look downward. That's where the interesting disassembly begins. The first...
Neil Bradley
nb@...
Jul 4, 2004 1:29 am
152
... My bet is that code that old was optimized for space not for speed. That's why I think inlining may be a win... ... I will look at that, thanks for the...
... If you're generating an intermediate code and compiling to binary from that on the fly, all you need to do is insert a label at the appropriate place in...
Are there any CPUs that require more than 4 bytes to decide what the instruction is (Itanium notwithstanding)? I'm not talking about overall length of the...