source: XOpenSparcT1/trunk/tools/dump2hex.php @ 25

Revision 25, 790 bytes checked in by pntsvt00, 13 years ago (diff)

updated dump2hex.php

  • Property svn:executable set to *
Line 
1#!/usr/bin/php -q
2<?php
3
4  // Open the stdin
5  $fp = fopen("php://stdin", "r");
6
7  // Discard first lines
8  for($i=0; $i<7; $i++) fgets($fp);
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    $opcode = substr($line, 6, 2);
20    $opcode2 = substr($line, 9, 2);
21    $caratteri = strlen($opcode);
22    if($caratteri != 0){
23        echo $opcode.$opcode2;
24        echo "\t //".$line;
25        $opcode = substr($line, 12, 2);
26        $opcode2 = substr($line, 15, 2);
27        echo $opcode.$opcode2."\n";
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.