OpenCores
URL https://opencores.org/ocsvn/sqmusic/sqmusic/trunk

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [1942/] [dump.cc] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 gryzor
/*
2
        Converts binary ROM dump to hexadecimal format
3
        so Verilog can read it
4
 
5
        Requirements:
6
                  TV80, Z80 Verilog module
7
                        Dump of Z80 ROM from 1942 board
8
 
9
  (c) Jose Tejada Gomez, 9th May 2013
10
  You can use this file following the GNU GENERAL PUBLIC LICENSE version 3
11
  Read the details of the license in:
12
  http://www.gnu.org/licenses/gpl.txt
13
 
14
  Send comments to: jose.tejada@ieee.org
15
 
16
*/
17
 
18
// Compile with: g++ dump.cc -o dump
19
 
20
#include <fstream>
21
#include <iostream>
22
 
23
using namespace std;
24
 
25
int main( int argc, char *argv[]) {
26
  if( argc!=2 ) {
27
    cout << "Usage: dump filename\n";
28
    return -1;
29
  }
30
  ifstream f( argv[1] );
31
  unsigned char *buffer = new unsigned char[16*1024];
32
  f.read( (char*)buffer, 16*1024 );
33
  cout << hex;
34
  unsigned char *aux=buffer;
35
  // swap all bytes
36
  /*
37
  for(int k=0;k<32*1024; k+=2) {
38
    unsigned char*p = aux;
39
    unsigned char x0 = *aux++;
40
    unsigned char x1 = *aux;
41
    *p=x1;
42
    *aux=x0;
43
    aux=p+2;
44
  }
45
  aux=buffer;*/
46
  for(int k=0; k<16*1024; k++ ) {
47
    unsigned val = *aux++;
48
    cout << val << "\n";
49
  }
50
 
51
  delete [] buffer;
52
  return 0;
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.