1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-06-08 18:29:33 +00:00
i6502/bus/offset_memory.go

21 lines
489 B
Go
Raw Normal View History

2014-08-07 07:15:41 +00:00
package bus
import (
"github.com/ariejan/i6502/memory"
)
// The AddressDecoder routes a full 16-bit address to the
// appropriate relatie Memory component address.
type OffsetMemory struct {
Offset uint16
memory.Memory
}
func (offsetMemory OffsetMemory) Read(address uint16) byte {
return offsetMemory.Memory.Read(address - offsetMemory.Offset)
}
func (offsetMemory OffsetMemory) Write(address uint16, value byte) {
offsetMemory.Memory.Write(address-offsetMemory.Offset, value)
}