|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.6 root 7: //
8: // プリンタポート
9: //
10:
1.1 root 11: #include "printer.h"
1.1.1.3 root 12: #include "mpu.h"
1.1 root 13:
1.1.1.6 root 14: // グローバル参照用
15: PrinterDevice *gPrinter;
1.1.1.4 root 16:
1.1.1.6 root 17: // コンストラクタ
1.1 root 18: PrinterDevice::PrinterDevice()
1.1.1.5 root 19: : inherited("Printer")
1.1 root 20: {
21: devaddr = baseaddr;
22: devlen = 0x2000;
23: }
24:
1.1.1.6 root 25: // デストラクタ
1.1 root 26: PrinterDevice::~PrinterDevice()
27: {
1.1.1.6 root 28: gPrinter = NULL;
1.1 root 29: }
30:
31: uint64
32: PrinterDevice::Read8(uint32 addr)
33: {
34: // 書き込み専用
1.1.1.3 root 35: gMPU->AddCycle(7); // InsideOut p.135
1.1 root 36: return (uint64)-1;
37: }
38:
39: uint64
40: PrinterDevice::Read16(uint32 addr)
41: {
42: // 書き込み専用
1.1.1.3 root 43: gMPU->AddCycle(7); // InsideOut p.135
1.1 root 44: return (uint64)-1;
45: }
46:
47: uint64
48: PrinterDevice::Write8(uint32 addr, uint32 data)
49: {
1.1.1.3 root 50: gMPU->AddCycle(7); // InsideOut p.135
51:
1.1 root 52: uint32 offset = addr - baseaddr;
53: switch (offset) {
54: case 0:
1.1.1.7 ! root 55: // データ書き込み
! 56: putlog(0, "Write Data (NOT IMPLEMENTED)");
1.1 root 57: break;
58: case 3:
1.1.1.7 ! root 59: // ストローブ書き込み
! 60: putlog(0, "Write Strobe (NOT IMPLEMENTED)");
1.1 root 61: return 0;
62: default:
63: break;
64: }
65: return (uint64)-1;
66: }
67:
68: uint64
69: PrinterDevice::Write16(uint32 addr, uint32 data)
70: {
71: return Write8(addr + 1, data);
72: }
73:
74: uint64
75: PrinterDevice::Peek8(uint32 addr)
76: {
77: // XXX
78: return 0xff;
79: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.