disassembler things. more to come soon
authorslack <slack@codemaniacs.com>
Sat, 16 Aug 2008 13:11:33 +0000 (15:11 +0200)
committerslack <slack@codemaniacs.com>
Sat, 16 Aug 2008 13:11:33 +0000 (15:11 +0200)
Makefile
wendi/Instruction.h
wendi/wendi.cc

index acc44d2fc31d1bc280bda212367aa677b8088a5e..631e92c02b8fc8a15cdadf74381bc7d87cdd26a6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,6 @@ wendi/wendi: wendi/wendi.cc wendi/CodeBlock.o wendi/disasm.o gbcore.o MBC.o \
        g++ $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
 
 clean:
-       rm -f *.o tests/test_gbrom tests/test_core
+       rm -f *.o wendi/*.o wendi/wendi tests/test_gbrom tests/test_core
 
 .PHONY: clean tests all
index ce463d7535793171de8c8d9c74d7b1bb0ea494ae..41aa0aabe4dea9a17309413203948b4a947dd6ac 100644 (file)
@@ -17,6 +17,12 @@ struct Instruction
                OTHER
        };
 
+       enum InstructionSubType
+       {
+               JP,
+               JR,
+       }
+
        enum Register { A=0,B,C,D,E,H,L,AF,BC,DE,HL,SP,PC };
 
        enum OperandType
index f734df2039fe423f668f133f535b5c5e9d39bf1e..e7ea524343e5fad0a63190df161ed7e0653f2bc8 100644 (file)
@@ -89,7 +89,8 @@ void show_block(const CodeBlock& b)
 bool is_block_end(const Instruction &ins)
 {
        if (ins.type == Instruction::UNCONDITIONAL_JUMP || 
-                       ins.type == Instruction::RET)
+                       ins.type == Instruction::RET ||
+                       ins.type == Instruction::RESET)
                return true;
 
        return false;
@@ -113,7 +114,8 @@ address jump_address(const Instruction &ins)
        {
                if (ins.str.substr(0,2)=="JR")
                        return ins.op2.val;
-               else return ins.op1.val;
+               else if (ins.op1.type == Instruction::INM16)
+                       return ins.op1.val;
        }
        else // RESET
        {