|
|
1.1 ! root 1: #!/usr/bin/perl -w ! 2: # ! 3: # Simple script used to parse cpuemu.c and to generate ! 4: # a new cpuemu.c where each opcode sets CurrentInstrCycles ! 5: # to the value that would be returned at the end of this ! 6: # opcode's processing. ! 7: # ! 8: # This allows to know how many cycles an instructions will take ! 9: # while handling its memory accesses (this is needed for ! 10: # accurate border removal emulation). ! 11: # ! 12: # This script is not perfect (doesn't give correct cycles ! 13: # values for variable cycles intr. like rol, lsl, movem, ...) ! 14: # but it is enough for border removal as instruction are ! 15: # often move or clr with fixed cycles count. ! 16: # ! 17: # 2007/03/07 [NP] OK ! 18: ! 19: ! 20: ! 21: $in_func = 0; ! 22: ! 23: while ( <> ) ! 24: { ! 25: $line = $_; ! 26: ! 27: # not in a function, we print back to stdout ! 28: if ( $in_func == 0 ) ! 29: { ! 30: print $line; ! 31: $in_func = 1 if $line =~ /^{/; ! 32: } ! 33: ! 34: # we're entering in a function ; we buffer everything ! 35: # until we reach the 'return' line, then we print ! 36: # the CurrentInstrCycles based on the numeric value in ! 37: # the 'return' line, finally we print the buffered lines. ! 38: else ! 39: { ! 40: push @buf , $line; # create a buffer for the function's body ! 41: ! 42: if ( $line =~ /return \(?(\d+)/ ) ! 43: { ! 44: print "CurrentInstrCycles = $1;\n"; ! 45: print @buf; ! 46: @buf = (); ! 47: $in_func = 0; ! 48: } ! 49: } ! 50: } ! 51:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.