Revision 25,
790 bytes
checked in by pntsvt00, 14 years ago
(diff) |
updated dump2hex.php
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[17] | 1 | #!/usr/bin/php -q |
---|
| 2 | <?php |
---|
| 3 | |
---|
| 4 | // Open the stdin |
---|
| 5 | $fp = fopen("php://stdin", "r"); |
---|
| 6 | |
---|
| 7 | // Discard first lines |
---|
[19] | 8 | for($i=0; $i<7; $i++) fgets($fp); |
---|
[17] | 9 | |
---|
| 10 | // Print only the opcodes to stdout |
---|
| 11 | while (!feof($fp)) { |
---|
| 12 | $line = fgets($fp); |
---|
| 13 | /*$opcode = substr($line, 8, 8); |
---|
| 14 | $caratteri = strlen($opcode); |
---|
| 15 | if($caratteri != 0){ |
---|
| 16 | echo $opcode."\n"; |
---|
| 17 | }*/ |
---|
| 18 | |
---|
[19] | 19 | $opcode = substr($line, 6, 2); |
---|
| 20 | $opcode2 = substr($line, 9, 2); |
---|
[17] | 21 | $caratteri = strlen($opcode); |
---|
| 22 | if($caratteri != 0){ |
---|
[25] | 23 | echo $opcode.$opcode2; |
---|
| 24 | echo "\t //".$line; |
---|
[19] | 25 | $opcode = substr($line, 12, 2); |
---|
| 26 | $opcode2 = substr($line, 15, 2); |
---|
| 27 | echo $opcode.$opcode2."\n"; |
---|
[17] | 28 | } |
---|
| 29 | else{ |
---|
| 30 | for($i=0; $i<1; $i++) fgets($fp); |
---|
| 31 | } |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | // Close the input file |
---|
| 35 | fclose($fp); |
---|
| 36 | |
---|
| 37 | ?> |
---|
| 38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.