s3e: fix build break
[calu.git] / 3c_disasm / dasm.cpp
index 08796f1509558df10aea8eae1c4f11b6e56c8e2a..5a39327a8927054036d1ef7dc81d7d11644c2fb2 100644 (file)
@@ -1,3 +1,24 @@
+/*   `Deep Thought', a softcore CPU implemented on a FPGA
+
+    Copyright (C) 2010 Markus Hofstaetter <markus.manrow@gmx.at>
+    Copyright (C) 2010 Martin Perner <e0725782@student.tuwien.ac.at>
+    Copyright (C) 2010 Stefan Rebernig <stefan.rebernig@gmail.com>
+    Copyright (C) 2010 Manfred Schwarz <e0725898@student.tuwien.ac.at>
+    Copyright (C) 2010 Bernhard Urban <lewurm@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
 #include <iostream>
 #include <fstream>
 #include <boost/tokenizer.hpp>
@@ -7,6 +28,7 @@
 #include <map>
 #include "disasm.h"
 
+
 #include "CInstrFactory.hpp"
 
 using boost::lexical_cast;
@@ -19,6 +41,10 @@ namespace po = boost::program_options;
 
 std::string progName;
 
+
+CCpu* Iinstr::m_cpu;
+disasm* Iinstr::m_disasm;
+
 int main(int argc, char* argv[])
 {
        progName = argv[0];
@@ -69,18 +95,7 @@ int main(int argc, char* argv[])
 
        CInstrFactory instrFab;
        try {
-#ifdef DEBUG
-               cout << "Loaded " << instrFab.searchLibsInDir(dir) << " Libraryfiles" << endl;
-#else
-               instrFab.searchLibsInDir(dir);
-#endif
-               while(instrFab.getNumFiles() >= 1) {
-                       Iinstr* pinstr = instrFab.getNextInstr();
-                       instr.insert(make_pair(pinstr->getOpcode(),pinstr));
-#ifdef DEBUG
-                       cout << "found: " << instr->getName() << " its opcode is : " << instr->getOpcode() << endl;
-#endif
-               }
+               instrFab.loadLibsIntoMap(instr, dir);
        }
        catch(std::bad_alloc& e) {
                cerr << progName << ": bad_alloc caught " << e.what() << endl;
@@ -131,7 +146,7 @@ int main(int argc, char* argv[])
                                                out << "[0x" << *tok_iter << "]: ";
                                        }
                                        else if(count == 2) {
-                                               out << disasm.decode(*tok_iter);
+                                               out << disasm.decodeToString(*tok_iter);
                                        }
                                        else if(count == 3) {
                                                //code saved in hex-file