Annotation of nono/vm/printer.cpp, revision 1.1.1.6

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:
                     55:                putlog(0, "未実装データ書き込み");
                     56:                break;
                     57:         case 3:
                     58:                putlog(0, "未実装ストローブ書き込み");
                     59:                return 0;
                     60:         default:
                     61:                break;
                     62:        }
                     63:        return (uint64)-1;
                     64: }
                     65: 
                     66: uint64
                     67: PrinterDevice::Write16(uint32 addr, uint32 data)
                     68: {
                     69:        return Write8(addr + 1, data);
                     70: }
                     71: 
                     72: uint64
                     73: PrinterDevice::Peek8(uint32 addr)
                     74: {
                     75:        // XXX
                     76:        return 0xff;
                     77: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.