📄 bus.cc
字号:
/* $Id: Bus.cc,v 1.4 2000/09/24 12:57:54 pure Exp $ */#include <iostream.h>#include "Bus.h"Bus::Bus() { root = 0;}void Bus::attach(Device* device){ device->next = (Device*) 0; if (!root) { root = device; return; } Device* p = root; while (p->next) p = p->next; p->next = device;}byte Bus::readb(unsigned addr){ for (Device* p = root; p; p = p->next) { if (p->cs(addr)) { return p->readb(addr); } } cerr << __FILE__ << ": reading from illegal address " << hex << addr << endl;}void Bus::writeb(unsigned addr, byte data){ for (Device* p = root; p; p = p->next) { if (p->cs(addr)) { p->writeb(addr, data); return; } } cerr << __FILE__ << ": writing to illegal address " << hex << addr << endl;}unsigned Bus::irq(){ unsigned highest_prio = 0xffffffff; for (Device* p = root; p; p = p->next) { unsigned n = p->irq(); if (n < highest_prio) { highest_prio = n; } } return highest_prio;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -