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

Revision 19, 767 bytes checked in by pntsvt00, 13 years ago (diff)

ora ho 2 sorgenti SPARC-V9, memory.hex e memory_hello.hex

  • 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."\n";
24        $opcode = substr($line, 12, 2);
25        $opcode2 = substr($line, 15, 2);
26        echo $opcode.$opcode2."\n";
27    }
28    else{
29        for($i=0; $i<1; $i++) fgets($fp);
30     } 
31    }
32
33  // Close the input file
34  fclose($fp);
35
36?>
37     
Note: See TracBrowser for help on using the repository browser.