Пример #1
0
func (mmu *GbcMMU) 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
		}
	}
}
Пример #2
0
//Helper method for connecting peripherals that don't look at contiguous chunks of memory
func (mmu *GbcMMU) 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
	}
}