1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-05-28 07:41:32 +00:00
i6502/ram.go

22 lines
339 B
Go
Raw Normal View History

2014-08-13 07:26:33 +00:00
package i6502
type Ram struct {
data []byte
}
func NewRam(size int) (*Ram, error) {
return &Ram{data: make([]byte, size)}, nil
}
func (r *Ram) Size() uint16 {
return uint16(len(r.data))
}
func (r *Ram) Read(address uint16) byte {
return r.data[address]
}
func (r *Ram) Write(address uint16, data byte) {
r.data[address] = data
}