|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2020 [email protected] ! 4: // ! 5: ! 6: // MPU (m88xx0) ! 7: ! 8: #include "mpu88xx0.h" ! 9: #include "config.h" ! 10: ! 11: // コンストラクタ ! 12: MPU88xx0Device::MPU88xx0Device(uint32 addr) ! 13: { ! 14: monitor.Init(79, 15); ! 15: ! 16: // リセットベクタアドレスは Reset() で指定するので保持しておく ! 17: reset_vector = addr; ! 18: ! 19: cpu.reset(new m88kcpu()); ! 20: } ! 21: ! 22: // デストラクタ ! 23: MPU88xx0Device::~MPU88xx0Device() ! 24: { ! 25: } ! 26: ! 27: // リセット ! 28: // (MPU が動くのはこの後 Scheduler::Run() を発行した後) ! 29: void ! 30: MPU88xx0Device::ResetHard() ! 31: { ! 32: cpu->Reset(reset_vector); ! 33: } ! 34: ! 35: // モニター更新 ! 36: bool ! 37: MPU88xx0Device::MonitorUpdate() ! 38: { ! 39: m88100reg reg; ! 40: int x; ! 41: int y; ! 42: ! 43: monitor.Clear(); ! 44: ! 45: // ローカルにコピー ! 46: reg = *cpu; ! 47: ! 48: // ! 49: for (int i = 0; i < countof(reg.r); i++) { ! 50: monitor.Print((i / 8) * 14, i % 8, "r%-2d:%08x", i, reg.r[i]); ! 51: } ! 52: ! 53: // 制御レジスタ ! 54: x = 0; ! 55: y = 9; ! 56: monitor.Print(x, y++, "pid (cr0):%08x(arch=$%02x ver=$%02x %c)", ! 57: reg.pid, ! 58: (reg.pid >> 8) & 0xff, ! 59: (reg.pid & 0xfe), ! 60: (reg.pid & 1) ? 'M' : '-'); ! 61: monitor.Print(x, y++, "psr (cr1):%08x(%c,%s,%s,%s %s,%s,%s,%s)", ! 62: reg.psr, ! 63: (reg.psr & m88100reg::PSR_SUPER) ? 'S' : '-', ! 64: (reg.psr & m88100reg::PSR_BO_LE) ? "LE" : "BE", ! 65: (reg.psr & m88100reg::PSR_SER) ? "CON" : "SER", ! 66: (reg.psr & m88100reg::PSR_C) ? "Cy" : "--", ! 67: (reg.psr & m88100reg::PSR_SFD1) ? "SFD1" : "----", ! 68: (reg.psr & m88100reg::PSR_MXM) ? "MXM" : "---", ! 69: (reg.psr & m88100reg::PSR_IND) ? "IND" : "---", ! 70: (reg.psr & m88100reg::PSR_SFRZ) ? "SFRZ" : "----"); ! 71: monitor.Print(x, y++, "epsr(cr2):%08x(%c,%s,%s,%s %s,%s,%s,%s)", ! 72: reg.epsr, ! 73: (reg.epsr & m88100reg::PSR_SUPER) ? 'S' : '-', ! 74: (reg.epsr & m88100reg::PSR_BO_LE) ? "LE" : "BE", ! 75: (reg.epsr & m88100reg::PSR_SER) ? "CON" : "SER", ! 76: (reg.epsr & m88100reg::PSR_C) ? "Cy" : "--", ! 77: (reg.epsr & m88100reg::PSR_SFD1) ? "SFD1" : "----", ! 78: (reg.epsr & m88100reg::PSR_MXM) ? "MXM" : "---", ! 79: (reg.epsr & m88100reg::PSR_IND) ? "IND" : "---", ! 80: (reg.epsr & m88100reg::PSR_SFRZ) ? "SFRZ" : "----"); ! 81: ! 82: // 制御レジスタ(左下; *IP) ! 83: x = 0; ! 84: y = 12; ! 85: monitor.Print(x, y + 0, "xip:%08x opX:%08x(%c%c)", ! 86: reg.xip, (uint32)reg.opX, ! 87: cpu->OpIsBusErr(reg.opX) ? 'B' : '-', ! 88: cpu->OpIsDelay(reg.opX) ? 'D' : '-'); ! 89: monitor.Print(x, y + 1, "nip:%08x opF:%08x(%c%c)", ! 90: reg.nip, (uint32)reg.opF, ! 91: cpu->OpIsBusErr(reg.opF) ? 'B' : '-', ! 92: cpu->OpIsDelay(reg.opF) ? 'D' : '-'); ! 93: monitor.Print(x, y + 2, "fip:%08x", reg.fip); ! 94: ! 95: // 制御レジスタ (S*IP) ! 96: x = 32; ! 97: for (int i = 0; i < 3; i++) { ! 98: monitor.Print(x, y + i, "%s(cr%d):%08x:%c%c", ! 99: m88100reg::sipname[i], 4 + i, ! 100: (reg.cr[4 + i] & m88100reg::SIP_MASK), ! 101: (reg.cr[4 + i] & m88100reg::SIP_V) ? 'V' : '-', ! 102: (reg.cr[4 + i] & m88100reg::SIP_E) ? 'E' : '-'); ! 103: } ! 104: ! 105: // 制御レジスタ(右列) ! 106: x = 55; ! 107: y = 9; ! 108: monitor.Print(x, y++, "ssbr(cr3):%08x", reg.ssbr); ! 109: monitor.Print(x, y++, "vbr (cr7):%08x", reg.vbr); ! 110: for (int i = 0; i < 4; i++) { ! 111: int rn = 17 + i; ! 112: monitor.Print(x, y + i, "sr%d(cr%d):%08x", i, rn, reg.cr[rn]); ! 113: } ! 114: ! 115: return true; ! 116: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.