bus.cc
来自「AVR 单片机程序设计用到的模拟器」· CC 代码 · 共 57 行
CC
57 行
/* $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 + =
减小字号Ctrl + -
显示快捷键?