|
|
1.1 ! root 1: #include "configuration.h" ! 2: #include "NextBus.hpp" ! 3: #include "nbic.h" ! 4: #include "dimension.hpp" ! 5: ! 6: extern "C" void M68000_BusError(Uint32 addr, bool bReadWrite); ! 7: ! 8: static Uint8 bus_error(Uint32 addr, const char* acc) { ! 9: Log_Printf(LOG_WARN, "[NextBus] Bus error %s at %08X", acc, addr); ! 10: M68000_BusError(addr, 1); ! 11: return 0; ! 12: } ! 13: ! 14: NextBusSlot::NextBusSlot(int slot) : slot(slot) {} ! 15: NextBusSlot::~NextBusSlot() {} ! 16: ! 17: Uint32 NextBusSlot::slot_lget(Uint32 addr) {return bus_error(addr, "lget");} ! 18: Uint16 NextBusSlot::slot_wget(Uint32 addr) {return bus_error(addr, "wget");} ! 19: Uint8 NextBusSlot::slot_bget(Uint32 addr) {return bus_error(addr, "bget");} ! 20: ! 21: Uint32 NextBusSlot::board_lget(Uint32 addr) {return bus_error(addr, "lget");} ! 22: Uint16 NextBusSlot::board_wget(Uint32 addr) {return bus_error(addr, "wget");} ! 23: Uint8 NextBusSlot::board_bget(Uint32 addr) {return bus_error(addr, "bget");} ! 24: ! 25: void NextBusSlot::slot_lput(Uint32 addr, Uint32 val) {bus_error(addr, "lput");} ! 26: void NextBusSlot::slot_wput(Uint32 addr, Uint16 val) {bus_error(addr, "wput");} ! 27: void NextBusSlot::slot_bput(Uint32 addr, Uint8 val) {bus_error(addr, "bput");} ! 28: ! 29: void NextBusSlot::board_lput(Uint32 addr, Uint32 val) {bus_error(addr, "lput");} ! 30: void NextBusSlot::board_wput(Uint32 addr, Uint16 val) {bus_error(addr, "wput");} ! 31: void NextBusSlot::board_bput(Uint32 addr, Uint8 val) {bus_error(addr, "bput");} ! 32: ! 33: void NextBusSlot::reset(void) {} ! 34: void NextBusSlot::pause(bool pause) {} ! 35: ! 36: NextBusBoard::NextBusBoard(int slot) : NextBusSlot(slot) {} ! 37: ! 38: class M68KBoard : public NextBusBoard { ! 39: public: ! 40: M68KBoard(int slot) : NextBusBoard(slot) {} ! 41: ! 42: virtual Uint32 slot_lget(Uint32 addr) {return nb_cpu_slot_lget(addr);} ! 43: virtual Uint16 slot_wget(Uint32 addr) {return nb_cpu_slot_wget(addr);} ! 44: virtual Uint8 slot_bget(Uint32 addr) {return nb_cpu_slot_bget(addr);} ! 45: virtual void slot_lput(Uint32 addr, Uint32 val) {nb_cpu_slot_lput(addr, val);} ! 46: virtual void slot_wput(Uint32 addr, Uint16 val) {nb_cpu_slot_wput(addr, val);} ! 47: virtual void slot_bput(Uint32 addr, Uint8 val) {nb_cpu_slot_bput(addr, val);} ! 48: }; ! 49: ! 50: NextBusSlot* nextbus[16] = { ! 51: new NextBusSlot(0), ! 52: new NextBusSlot(1), ! 53: new NextBusSlot(2), ! 54: new NextBusSlot(3), ! 55: new NextBusSlot(4), ! 56: new NextBusSlot(5), ! 57: new NextBusSlot(6), ! 58: new NextBusSlot(7), ! 59: new NextBusSlot(8), ! 60: new NextBusSlot(9), ! 61: new NextBusSlot(10), ! 62: new NextBusSlot(11), ! 63: new NextBusSlot(12), ! 64: new NextBusSlot(13), ! 65: new NextBusSlot(14), ! 66: new NextBusSlot(15), ! 67: }; ! 68: ! 69: extern "C" { ! 70: /* Slot memory */ ! 71: Uint32 nextbus_slot_lget(Uint32 addr) { ! 72: int slot = (addr & 0x0F000000)>>24; ! 73: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: lget at %08X",slot,addr); ! 74: ! 75: return nextbus[slot]->slot_lget(addr); ! 76: } ! 77: ! 78: Uint32 nextbus_slot_wget(Uint32 addr) { ! 79: int slot = (addr & 0x0F000000)>>24; ! 80: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: wget at %08X",slot,addr); ! 81: ! 82: return nextbus[slot]->slot_wget(addr); ! 83: } ! 84: ! 85: Uint32 nextbus_slot_bget(Uint32 addr) { ! 86: int slot = (addr & 0x0F000000)>>24; ! 87: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: bget at %08X",slot,addr); ! 88: ! 89: return nextbus[slot]->slot_bget(addr); ! 90: } ! 91: ! 92: void nextbus_slot_lput(Uint32 addr, Uint32 val) { ! 93: int slot = (addr & 0x0F000000)>>24; ! 94: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: lput at %08X, val %08X",slot,addr,val); ! 95: ! 96: nextbus[slot]->slot_lput(addr, val); ! 97: } ! 98: ! 99: void nextbus_slot_wput(Uint32 addr, Uint32 val) { ! 100: int slot = (addr & 0x0F000000)>>24; ! 101: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: wput at %08X, val %04X",slot,addr,val); ! 102: ! 103: nextbus[slot]->slot_wput(addr, val); ! 104: } ! 105: ! 106: void nextbus_slot_bput(Uint32 addr, Uint32 val) { ! 107: int slot = (addr & 0x0F000000)>>24; ! 108: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Slot %i: bput at %08X, val %02X",slot,addr,val); ! 109: ! 110: nextbus[slot]->slot_bput(addr, val); ! 111: } ! 112: ! 113: /* Board memory */ ! 114: ! 115: Uint32 nextbus_board_lget(Uint32 addr) { ! 116: int board = (addr & 0xF0000000)>>28; ! 117: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: lget at %08X",board,addr); ! 118: ! 119: return nextbus[board]->board_lget(addr); ! 120: } ! 121: ! 122: Uint32 nextbus_board_wget(Uint32 addr) { ! 123: int board = (addr & 0xF0000000)>>28; ! 124: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: wget at %08X",board,addr); ! 125: ! 126: return nextbus[board]->board_wget(addr); ! 127: } ! 128: ! 129: Uint32 nextbus_board_bget(Uint32 addr) { ! 130: int board = (addr & 0xF0000000)>>28; ! 131: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: bget at %08X",board,addr); ! 132: ! 133: return nextbus[board]->board_bget(addr); ! 134: } ! 135: ! 136: void nextbus_board_lput(Uint32 addr, Uint32 val) { ! 137: int board = (addr & 0xF0000000)>>28; ! 138: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: lput at %08X, val %08X",board,addr,val); ! 139: ! 140: nextbus[board]->board_lput(addr, val); ! 141: } ! 142: ! 143: void nextbus_board_wput(Uint32 addr, Uint32 val) { ! 144: int board = (addr & 0xF0000000)>>28; ! 145: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: wput at %08X, val %04X",board,addr,val); ! 146: ! 147: nextbus[board]->board_wput(addr, val); ! 148: } ! 149: ! 150: void nextbus_board_bput(Uint32 addr, Uint32 val) { ! 151: int board = (addr & 0xF0000000)>>28; ! 152: Log_Printf(LOG_NEXTBUS_LEVEL, "[NextBus] Board %i: bput at %08X, val %02X",board,addr,val); ! 153: ! 154: nextbus[board]->board_bput(addr, val); ! 155: } ! 156: ! 157: static void remove_board(int slot) { ! 158: delete nextbus[slot]; ! 159: nextbus[slot] = new NextBusSlot(slot); ! 160: } ! 161: ! 162: static void insert_board(NextBusBoard* board) { ! 163: delete nextbus[board->slot]; ! 164: nextbus[board->slot] = board; ! 165: } ! 166: ! 167: /* Init function for NextBus */ ! 168: void nextbus_init(void) { ! 169: insert_board(new M68KBoard(0)); ! 170: ! 171: for (int i = 0; i < ND_MAX_BOARDS; i++) { ! 172: remove_board(ND_SLOT(i)); ! 173: if (ConfigureParams.Dimension.board[i].bEnabled && ConfigureParams.System.nMachineType != NEXT_STATION) { ! 174: Log_Printf(LOG_WARN, "[NextBus] NeXTdimension board at slot %i", ND_SLOT(i)); ! 175: insert_board(new NextDimension(ND_SLOT(i))); ! 176: } ! 177: } ! 178: } ! 179: ! 180: void NextBus_Reset(void) { ! 181: for(int slot = 0; slot < 16; slot++) ! 182: nextbus[slot]->reset(); ! 183: } ! 184: ! 185: void NextBus_Pause(bool pause) { ! 186: for(int slot = 0; slot < 16; slot++) ! 187: nextbus[slot]->pause(pause); ! 188: } ! 189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.