Skip to content

Commit

Permalink
update to latest retrogolib and reuse memory interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk committed Dec 10, 2024
1 parent 6e57beb commit 8f263e3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/retroenv/nesgoemu

go 1.22

require github.com/retroenv/retrogolib v0.0.0-20241210033726-b294e4b1cc68
require github.com/retroenv/retrogolib v0.0.0-20241210185241-c226c3543993

require (
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+xzxf1jTJKMKZw3H0swfWk9RpWbBbDK5+0=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/retroenv/retrogolib v0.0.0-20241210033726-b294e4b1cc68 h1:woI2bmTWznMA9UX0iR5kZs7QfRaF4ZVM+B8mMHaTLCg=
github.com/retroenv/retrogolib v0.0.0-20241210033726-b294e4b1cc68/go.mod h1:8pe9mEjbKL9Z5L4FFzYGSk1Ovhrq1LR6ucwRFj5CIXs=
github.com/retroenv/retrogolib v0.0.0-20241210185241-c226c3543993 h1:RJ+bmTTyUjbnGrS4uUEzDVqm2ogGGSTKxD+HyJdocHg=
github.com/retroenv/retrogolib v0.0.0-20241210185241-c226c3543993/go.mod h1:8pe9mEjbKL9Z5L4FFzYGSk1Ovhrq1LR6ucwRFj5CIXs=
github.com/veandco/go-sdl2 v0.4.40 h1:fZv6wC3zz1Xt167P09gazawnpa0KY5LM7JAvKpX9d/U=
github.com/veandco/go-sdl2 v0.4.40/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=
3 changes: 3 additions & 0 deletions pkg/bus/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
package bus

import (
"github.com/retroenv/retrogolib/arch/cpu/m6502"
"github.com/retroenv/retrogolib/arch/nes/cartridge"
)

type Memory = m6502.BasicMemory

// Bus contains all NES sub system components.
// Since many components access other components, this structure
// allows an easy access and reduces the import dependencies and
Expand Down
2 changes: 1 addition & 1 deletion pkg/bus/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MapperState struct {

// Mapper represents a mapper memory access interface.
type Mapper interface {
BasicMemory
Memory

MirrorMode() cartridge.MirrorMode
State() MapperState
Expand Down
19 changes: 0 additions & 19 deletions pkg/bus/memory.go

This file was deleted.

8 changes: 4 additions & 4 deletions pkg/bus/ppu.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (

// APU represents the Audio Processing Unit.
type APU interface {
BasicMemory
Memory
}

// PPU represents the Picture Processing Unit.
type PPU interface {
BasicMemory
Memory

Image() *image.RGBA
Palette() Palette
Expand All @@ -22,14 +22,14 @@ type PPU interface {

// Palette represents the PPU palette.
type Palette interface {
BasicMemory
Memory

Data() [32]byte
}

// NameTable represents a name table interface.
type NameTable interface {
BasicMemory
Memory

Data() [4][]byte
MirrorMode() cartridge.MirrorMode
Expand Down
4 changes: 2 additions & 2 deletions pkg/ppu/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
type Memory struct {
mapper bus.Mapper
nametable bus.NameTable
palette bus.BasicMemory
palette bus.Memory
}

// New returns a new memory manager.
func New(mapper bus.Mapper, nametable bus.NameTable, palette bus.BasicMemory) *Memory {
func New(mapper bus.Mapper, nametable bus.NameTable, palette bus.Memory) *Memory {
return &Memory{
mapper: mapper,
nametable: nametable,
Expand Down
4 changes: 2 additions & 2 deletions pkg/ppu/tiles/tiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type addressing interface {
// Tiles implements PPU tiles support.
type Tiles struct {
addressing addressing
memory bus.BasicMemory
memory bus.Memory
nameTable bus.NameTable

attribute byte
Expand All @@ -24,7 +24,7 @@ type Tiles struct {
}

// New returns a new tiles manager.
func New(addressing addressing, memory bus.BasicMemory, nameTable bus.NameTable) *Tiles {
func New(addressing addressing, memory bus.Memory, nameTable bus.NameTable) *Tiles {
return &Tiles{
addressing: addressing,
memory: memory,
Expand Down

0 comments on commit 8f263e3

Please sign in to comment.