From 3ff2e7f9ab4aeb9ff4525829811de3c9adf5c59b Mon Sep 17 00:00:00 2001 From: Bradford Lamson-Scribner Date: Wed, 27 May 2020 14:52:39 -0600 Subject: [PATCH] pkg/appleone: add a public appleone pkg Move cpu and opcodes (cpu package) to internal, while adding a public appleone api package to `pkg/` --- {pkg => internal}/cpu/cpu.go | 8 +++++++- {pkg => internal}/cpu/opcodes.go | 0 pkg/appleone/appleone.go | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) rename {pkg => internal}/cpu/cpu.go (95%) rename {pkg => internal}/cpu/opcodes.go (100%) create mode 100644 pkg/appleone/appleone.go diff --git a/pkg/cpu/cpu.go b/internal/cpu/cpu.go similarity index 95% rename from pkg/cpu/cpu.go rename to internal/cpu/cpu.go index b673c52..8b87463 100644 --- a/pkg/cpu/cpu.go +++ b/internal/cpu/cpu.go @@ -48,7 +48,8 @@ const ( zeroPageYIndexed ) -type mos6502cpu struct { +// Mos6502 TODO: docs +type Mos6502 struct { pc uint16 // program counter (16 bit) ac uint8 // accumulator (8 bit) x uint8 // X register (8 bit) @@ -56,3 +57,8 @@ type mos6502cpu struct { sr uint8 // status register [NV-BDIZC] (8 bit) sp uint8 // stack pointer (8 bit) } + +// New TODO: docs +func New() *Mos6502 { + return &Mos6502{} +} diff --git a/pkg/cpu/opcodes.go b/internal/cpu/opcodes.go similarity index 100% rename from pkg/cpu/opcodes.go rename to internal/cpu/opcodes.go diff --git a/pkg/appleone/appleone.go b/pkg/appleone/appleone.go new file mode 100644 index 0000000..a2d14ec --- /dev/null +++ b/pkg/appleone/appleone.go @@ -0,0 +1,13 @@ +package appleone + +import "github.com/bradford-hamilton/apple-1/internal/cpu" + +// Appleone TODO docs +type Appleone struct { + cpu *cpu.Mos6502 +} + +// New TODO: docs +func New() *Appleone { + return &Appleone{cpu: cpu.New()} +}