~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/tools/romtohex.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
  Simple program that produces a hex list of a binary object file
 
3
 
 
4
  @author  Bradford W. Mott
 
5
  @version $Id: romtohex.cxx 1908 2009-11-22 02:32:20Z stephena $
 
6
*/
 
7
 
 
8
#include <iomanip>
 
9
#include <fstream>
 
10
#include <iostream>
 
11
using namespace std;
 
12
 
 
13
int main(int ac, char* av[])
 
14
{
 
15
  ifstream in;
 
16
  in.open("scrom.bin");
 
17
  if(in.is_open())
 
18
  {
 
19
    in.seekg(0, ios::end);
 
20
    int len = (int)in.tellg();
 
21
    in.seekg(0, ios::beg);
 
22
 
 
23
    unsigned char* data = new unsigned char[len];
 
24
    in.read((char*)data, len);
 
25
    in.close();
 
26
 
 
27
    cout << "SIZE = " << (len - 2) << endl << "  ";
 
28
 
 
29
    // Skip first two bytes; they shouldn't be used
 
30
    for(int t = 2; t < len; ++t)
 
31
    {
 
32
      cout << "0x" << setw(2) << setfill('0') << hex << (int)data[t];
 
33
      if(t < len - 1)
 
34
        cout << ", ";
 
35
      if(((t-2) % 8) == 7)
 
36
        cout << endl << "  ";
 
37
    }
 
38
    cout << endl;
 
39
    delete[] data;
 
40
  }
 
41
}