Hooray for unit tests !
It is also incredibly satisfying to watch the tests complete successfully or to follow the operations step by step and see the instructions actually doing the right thing :-)
Java Amiga Emulator
public enum DataSize{Nibble(0, 2, 0x000f,"", 0x0008, 4), Byte(1, 2, 0x00ff,".b", 0x0080, 8),Word(2, 2, 0x0000ffff,".w",0x00008000, 16), Long(4, 4, 0xffffffff,".l",0x80000000, 32),Unsized(0, 0,0,"",0, 0);private final int readSize;private final int byteSize;private final int mask;private final String ext;private final int msb;private final int bitSize;DataSize(int byteSize, int readSize, int mask, String ext, int msb, int bitSize){this.byteSize = byteSize;this.readSize = readSize;this.mask = mask;this.ext = ext;this.msb = msb;this.bitSize = bitSize;}
disasm.sh [-b <address>][-o <file>] filename-b address -> The base address to use for the disassembly output.-o offset -> Byte offset into the file to start disassembling from.
while(running)short opcode = readMemWord(reg_pc)Instruction i = Instructions.get(opcode & 0xFFC0)i.execute(opcode)end while
public interface Instruction{public int execute(int opcode);public DecodedInstruction disassemble(int address, int opcode);}