|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2023 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // ! 8: // 拡張エリアセット ! 9: // ! 10: ! 11: // 拡張エリアセットの範囲は $eaff80 〜 $eaffff までの 128バイトで、 ! 12: // 他は (現状デバイスがないので) バスエラーになる。 ! 13: // X68kIODevice の構造の都合上、$eae000 〜 $eaffff までの 8KB のアクセスが ! 14: // すべてここに来るので、BusIO を使わず自前でさばく必要がある。 ! 15: // (本来は MuxDevice で分離すべき) ! 16: ! 17: #include "extarea.h" ! 18: #include "mpu.h" ! 19: #include "x68kio.h" ! 20: ! 21: // コンストラクタ ! 22: ExtAreaDevice::ExtAreaDevice() ! 23: : inherited(OBJ_EXTAREA) ! 24: { ! 25: } ! 26: ! 27: // デストラクタ ! 28: ExtAreaDevice::~ExtAreaDevice() ! 29: { ! 30: } ! 31: ! 32: // 初期化 ! 33: bool ! 34: ExtAreaDevice::Init() ! 35: { ! 36: if (inherited::Init() == false) { ! 37: return false; ! 38: } ! 39: ! 40: x68kio = GetX68kIODevice(); ! 41: ! 42: return true; ! 43: } ! 44: ! 45: // リセット ! 46: void ! 47: ExtAreaDevice::ResetHard(bool poweron) ! 48: { ! 49: // リセット時はすべて 0 らしい。(X68030 Inside/Out) ! 50: for (int i = 0; i < 5; i++) { ! 51: x68kio->SetExtarea(i, 0x00); ! 52: } ! 53: } ! 54: ! 55: busdata ! 56: ExtAreaDevice::Read8(uint32 addr) ! 57: { ! 58: if (addr >= 0xeaff80) { ! 59: // 拡張エリアセット部分は書き込み専用で読み出しはすべてバスエラー。 ! 60: putlog(2, "Read $%06x.B (BusErr)", addr); ! 61: } ! 62: // 他はすべてバスエラー。 ! 63: // XXX wait? ! 64: return busdata::BusErr; ! 65: } ! 66: ! 67: busdata ! 68: ExtAreaDevice::Read16(uint32 addr) ! 69: { ! 70: if (addr >= 0xeaff80) { ! 71: // 拡張エリアセット部分は書き込み専用で読み出しはすべてバスエラー。 ! 72: putlog(2, "Read $%06x.W (BusErr)", addr); ! 73: } ! 74: // 他はすべてバスエラー。 ! 75: // XXX wait? ! 76: return busdata::BusErr; ! 77: } ! 78: ! 79: busdata ! 80: ExtAreaDevice::Write8(uint32 addr, uint32 data) ! 81: { ! 82: busdata r; ! 83: ! 84: if (addr >= 0xeaff80) { ! 85: // 拡張エリアセット内は16バイト単位でミラー。 ! 86: uint32 offset = addr & 0x0f; ! 87: ! 88: // 偶数アドレスはバスエラー。 ! 89: // 奇数アドレスはレジスタ部分は書き込み可能。以降はバスエラー。 ! 90: switch (offset) { ! 91: case 0x01: ! 92: case 0x03: ! 93: case 0x05: ! 94: case 0x07: ! 95: case 0x09: ! 96: offset >>= 1; ! 97: putlog(1, "$%06x [%d] <- $%02x", addr, offset, data); ! 98: x68kio->SetExtarea(offset, data); ! 99: r = 0; ! 100: break; ! 101: default: ! 102: putlog(2, "Write $%06x.B (BusErr)", addr); ! 103: r.SetBusErr(); ! 104: break; ! 105: } ! 106: } else { ! 107: // 他はすべてバスエラー。 ! 108: r.SetBusErr(); ! 109: } ! 110: ! 111: // XXX wait? ! 112: return r; ! 113: } ! 114: ! 115: busdata ! 116: ExtAreaDevice::Write16(uint32 addr, uint32 data) ! 117: { ! 118: // 拡張エリアセット内は EB 構造。 ! 119: return Write8(addr + 1, data & 0xff); ! 120: } ! 121: ! 122: busdata ! 123: ExtAreaDevice::Peek8(uint32 addr) ! 124: { ! 125: return busdata::BusErr; ! 126: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.