From 17df9a44f01802e45731a811da9c85f7d626f1d9 Mon Sep 17 00:00:00 2001 From: Bradford Lamson-Scribner Date: Wed, 27 May 2020 14:59:16 -0600 Subject: [PATCH] docs: add/update some godoc comments --- internal/cpu/opcodes.go | 4 ++++ pkg/appleone/appleone.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/cpu/opcodes.go b/internal/cpu/opcodes.go index c9160ed..841a58c 100644 --- a/internal/cpu/opcodes.go +++ b/internal/cpu/opcodes.go @@ -1,5 +1,7 @@ package cpu +// op represents an operation. It includes the name of the op, it's 8 bit hexidecimal +// opcode, how many bytes it occupies (it's size), as well as it's addressing mode. type op struct { name string opcode uint8 @@ -16,6 +18,8 @@ func newOp(name string, opcode, size uint8, addressingMode addressingMode) op { } } +// opcodes represent all of the Apple 1 opcodes available. Each 8 bit opcode is mapped to a corresponding +// "op" which is just a struct holding metadata about the operation. var opcodes = map[uint8]op{ // BRK Force Break // addressing assembler opc bytes cyles diff --git a/pkg/appleone/appleone.go b/pkg/appleone/appleone.go index a2d14ec..08d1f26 100644 --- a/pkg/appleone/appleone.go +++ b/pkg/appleone/appleone.go @@ -2,12 +2,12 @@ package appleone import "github.com/bradford-hamilton/apple-1/internal/cpu" -// Appleone TODO docs +// Appleone represents our virtual Apple 1 computer type Appleone struct { cpu *cpu.Mos6502 } -// New TODO: docs +// New returns a pointer to an initialized Appleone with a brand spankin new CPU func New() *Appleone { return &Appleone{cpu: cpu.New()} }