Skip to content

Commit be900cb

Browse files
committed
update to new retrolib architecture
1 parent 01112dc commit be900cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+227
-215
lines changed

cmd/nesgoemu/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"os"
88

99
"github.com/retroenv/nesgo/pkg/nes"
10+
"github.com/retroenv/retrogolib/arch/nes/cartridge"
1011
"github.com/retroenv/retrogolib/buildinfo"
11-
"github.com/retroenv/retrogolib/nes/cartridge"
1212
)
1313

1414
type optionFlags struct {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/retroenv/nesgo
22

33
go 1.19
44

5-
require github.com/retroenv/retrogolib v0.0.0-20230308050250-05304443fd7e
5+
require github.com/retroenv/retrogolib v0.0.0-20230531002314-647312eaa5e7
66

77
require (
88
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOY
44
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
55
github.com/retroenv/retrogolib v0.0.0-20230308050250-05304443fd7e h1:8xdOsiViIs4/8SpgkxYHE2PVr0NnQyR+mBIBQGwdx9k=
66
github.com/retroenv/retrogolib v0.0.0-20230308050250-05304443fd7e/go.mod h1:pMMX8dgBDAwp6JlyHEY6h+6Q6UFc8yzQ1KruSqdf5ZY=
7+
github.com/retroenv/retrogolib v0.0.0-20230531002314-647312eaa5e7 h1:k6JvKJBpFen4pcomtT7r4YCcMvnDpNaOY8mIoLI1dlc=
8+
github.com/retroenv/retrogolib v0.0.0-20230531002314-647312eaa5e7/go.mod h1:ZCml4OmbI+OADbH286m94Sg6hBQllIPTBurWv8dl0PU=
79
github.com/veandco/go-sdl2 v0.5.0-alpha.4 h1:+XyPktayFrjYA6n3qUWiQDw6jOVJye27q8gmXvnYAHQ=
810
github.com/veandco/go-sdl2 v0.5.0-alpha.4/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=

internal/ast/branching.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/retroenv/retrogolib/nes/cpu"
7+
"github.com/retroenv/retrogolib/arch/cpu/m6502"
88
)
99

1010
const (
@@ -70,15 +70,15 @@ func NewCall(expr *Identifier, arg any) (Node, error) {
7070
return nil, nil // nolint: nilnil
7171
}
7272

73-
if _, ok := cpu.BranchingInstructions[name]; ok {
73+
if _, ok := m6502.BranchingInstructions[name]; ok {
7474
var destination string
7575
if ins, ok := arg.(*Instruction); ok {
7676
destination = ins.Name
7777
}
7878
return NewBranching(name, destination)
7979
}
8080

81-
if _, isInst := cpu.Instructions[name]; isInst {
81+
if _, isInst := m6502.Instructions[name]; isInst {
8282
i, err := newInstruction(name, arg)
8383
if err != nil {
8484
return nil, err

internal/ast/instruction.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"strconv"
77
"strings"
88

9-
. "github.com/retroenv/retrogolib/nes/addressing"
10-
"github.com/retroenv/retrogolib/nes/cpu"
9+
. "github.com/retroenv/retrogolib/addressing"
10+
"github.com/retroenv/retrogolib/arch/cpu/m6502"
11+
"github.com/retroenv/retrogolib/cpu"
1112
)
1213

1314
// Instruction is an instruction declaration.
@@ -25,7 +26,7 @@ func newInstruction(name string, arg any) (*Instruction, error) {
2526
Name: name,
2627
}
2728
if arg != nil {
28-
info := cpu.Instructions[name]
29+
info := m6502.Instructions[name]
2930
if info == nil {
3031
return nil, fmt.Errorf("missing instruction info for '%s'", name)
3132
}

internal/compiler/output.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"strings"
77

88
"github.com/retroenv/nesgo/internal/ast"
9-
. "github.com/retroenv/retrogolib/nes/addressing"
10-
"github.com/retroenv/retrogolib/nes/cpu"
9+
. "github.com/retroenv/retrogolib/addressing"
10+
"github.com/retroenv/retrogolib/arch/cpu/m6502"
11+
"github.com/retroenv/retrogolib/cpu"
1112
)
1213

1314
// TODO refactor to use asmoutput pkg
@@ -114,7 +115,7 @@ func (c *Compiler) outputLineWithComment(comment, format string, a ...any) {
114115
}
115116

116117
func (c *Compiler) outputInstruction(ins *ast.Instruction) error {
117-
info := cpu.Instructions[ins.Name]
118+
info := m6502.Instructions[ins.Name]
118119

119120
switch len(ins.Arguments) {
120121
case 0:

internal/testroms/nestest/nestest_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"testing"
88

99
"github.com/retroenv/nesgo/pkg/nes"
10+
"github.com/retroenv/retrogolib/arch/cpu/m6502"
11+
"github.com/retroenv/retrogolib/arch/nes/cartridge"
1012
"github.com/retroenv/retrogolib/assert"
11-
"github.com/retroenv/retrogolib/nes/cartridge"
12-
"github.com/retroenv/retrogolib/nes/cpu"
1313
)
1414

1515
func TestNestest(t *testing.T) {
@@ -23,7 +23,7 @@ func TestNestest(t *testing.T) {
2323
var buffer bytes.Buffer
2424
trace := bufio.NewWriter(&buffer)
2525

26-
cpu.Isc.Name = "isb"
26+
m6502.Isc.Name = "isb"
2727

2828
options := []nes.Option{
2929
nes.WithEmulator(),

pkg/apu/const_translation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
package apu
44

5-
import . "github.com/retroenv/retrogolib/nes/addressing"
5+
import . "github.com/retroenv/retrogolib/addressing"
66

77
// AddressToName maps address constants from address to name.
88
var AddressToName = map[uint16]AccessModeConstant{

pkg/bus/bus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package bus
33

44
import (
5-
"github.com/retroenv/retrogolib/nes/cartridge"
5+
"github.com/retroenv/retrogolib/arch/nes/cartridge"
66
)
77

88
// Bus contains all NES sub system components.

pkg/bus/mapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package bus
22

3-
import "github.com/retroenv/retrogolib/nes/cartridge"
3+
import "github.com/retroenv/retrogolib/arch/nes/cartridge"
44

55
// MapperState contains the current state of the mapper.
66
type MapperState struct {

0 commit comments

Comments
 (0)