Beispiel #1
0
func (mmu *MMU) ConnectPeripheral(p components.Peripheral, startAddr, endAddr types.Word) {
	if startAddr == endAddr {
		log.Printf("%s: Connecting MMU to %s on address %s", PREFIX, p.Name(), startAddr)
		mmu.peripheralIOMap[startAddr] = p
	} else {
		log.Printf("%s: Connecting MMU to %s on address range %s to %s", PREFIX, p.Name(), startAddr, endAddr)
		for addr := startAddr; addr <= endAddr; addr++ {
			mmu.peripheralIOMap[addr] = p
		}
	}
}
Beispiel #2
0
//Helper method for connecting peripherals that don't look at contiguous chunks of memory
func (mmu *MMU) ConnectPeripheralOn(p components.Peripheral, addrs ...types.Word) {
	log.Printf("%s: Connecting MMU to %s to address(es): %s", PREFIX, p.Name(), addrs)
	for _, addr := range addrs {
		mmu.peripheralIOMap[addr] = p
	}
}