|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2017 [email protected] ! 4: // ! 5: ! 6: #include "header.h" ! 7: #include "m68030core.h" ! 8: #include "bus.h" ! 9: ! 10: #define OP_PROTO(name) extern void __CONCAT(op_,name)(m68kcpu *cpu) ! 11: ! 12: #include "m68030ops.h" ! 13: ! 14: uint8 mem[32]; ! 15: uint32 pc; ! 16: ! 17: void ! 18: set_8(uint32 addr, uint32 data) ! 19: { ! 20: mem[HLB(addr)] = data; ! 21: } ! 22: ! 23: void ! 24: set_16(uint32 addr, uint32 data) ! 25: { ! 26: *(uint16 *)&mem[HLW(addr)] = data; ! 27: } ! 28: ! 29: void ! 30: set_32(uint32 addr, uint32 data) ! 31: { ! 32: *(uint32 *)&mem[addr] = data; ! 33: } ! 34: ! 35: uint32 ! 36: m68030_phys_read_8(uint32 addr) ! 37: { ! 38: return mem[HLB(addr)]; ! 39: } ! 40: ! 41: uint32 ! 42: m68030_phys_read_16(uint32 addr) ! 43: { ! 44: return *(uint16 *)&mem[HLW(addr)]; ! 45: } ! 46: ! 47: uint32 ! 48: m68030_phys_read_32(uint32 addr) ! 49: { ! 50: return *(uint32 *)&mem[addr]; ! 51: } ! 52: ! 53: void ! 54: m68030_phys_write_8(uint32 addr, uint32 data) ! 55: { ! 56: } ! 57: ! 58: void ! 59: m68030_phys_write_16(uint32 addr, uint32 data) ! 60: { ! 61: } ! 62: ! 63: void ! 64: m68030_phys_write_32(uint32 addr, uint32 data) ! 65: { ! 66: } ! 67: ! 68: // バイトデータ ! 69: uint8 data_8[] = { ! 70: 0x00, ! 71: 0x01, ! 72: 0x55, ! 73: 0x7f, ! 74: 0x80, ! 75: 0xaa, ! 76: 0xff, ! 77: }; ! 78: // ワードデータ ! 79: uint16 data_16[] = { ! 80: 0x0000, ! 81: 0x0001, ! 82: 0x007f, ! 83: 0x0080, ! 84: 0x00ff, ! 85: 0x5555, ! 86: 0x7fff, ! 87: 0x8000, ! 88: 0xaaaa, ! 89: 0xfffe, ! 90: 0xffff, ! 91: }; ! 92: // ロングデータ ! 93: uint32 data_32[] = { ! 94: 0x00000000, ! 95: 0x00000001, ! 96: 0x0000007f, ! 97: 0x00000080, ! 98: 0x000000ff, ! 99: 0x00007fff, ! 100: 0x00008000, ! 101: 0x0000ffff, ! 102: 0x55555555, ! 103: 0x7fffffff, ! 104: 0x80000000, ! 105: 0xaaaaaaaa, ! 106: 0xffffffff, ! 107: }; ! 108: ! 109: // ! 110: // ! 111: // ! 112: ! 113: m68kcpu *cpu; ! 114: ! 115: void ! 116: Init() ! 117: { ! 118: cpu->prev = cpu->reg; ! 119: RegA(0) = 0x10; ! 120: RegPC = 0; ! 121: } ! 122: ! 123: #define Test(expr) do { \ ! 124: if (!(expr)) \ ! 125: printf(#expr " failed at %d\n", __LINE__); \ ! 126: } while (0) ! 127: ! 128: ! 129: // ! 130: // ! 131: // ! 132: void ! 133: test_ori_b() ! 134: { ! 135: // ORI.B #<data>,D0 ! 136: int x = 0; ! 137: for (int i = 0; i < countof(data_8); i++) { ! 138: for (int j = 0; j < countof(data_32); i++) { ! 139: set_16(0, data_8[i]); ! 140: RegD(0) = data_32[j]; ! 141: Init(); ! 142: op_ori_b(cpu); ! 143: Test(RegD(0) == (data_32[j] | (data_32[i] & 0xff))); ! 144: Test(ccr.IsX() == cpu->prev.ccr.IsX()); ! 145: Test(ccr.IsN() == (((data_32[j] | data_32[i]) & 0x80) != 0)); ! 146: Test(ccr.IsZ() == (((data_32[j] | data_32[i]) & 0xff) == 0)); ! 147: Test(ccr.IsV() == 0); ! 148: Test(ccr.IsC() == 0); ! 149: } ! 150: } ! 151: } ! 152: ! 153: int ! 154: main(int ac, char *av[]) ! 155: { ! 156: cpu = (m68kcpu *)malloc(sizeof(*cpu)); ! 157: memset(&cpu, 0, sizeof(cpu)); ! 158: ! 159: test_ori_b(); ! 160: ! 161: return 0; ! 162: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.