Skip to content

Commit

Permalink
updated go minimum version to 1.20
Browse files Browse the repository at this point in the history
applied gofmt to source tree to update the documentation comments
  • Loading branch information
JetSetIlly committed Feb 12, 2023
1 parent 73a9c91 commit 178f05f
Show file tree
Hide file tree
Showing 45 changed files with 320 additions and 322 deletions.
19 changes: 9 additions & 10 deletions cartridgeloader/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
// As well as the filename, the Loader type allows the cartridge mapping to be
// specified, if required. The simplest instantiation therefore is:
//
// cl := cartridgeloader.Loader{
// Filename: "roms/Pitfall.bin",
// }
// cl := cartridgeloader.Loader{
// Filename: "roms/Pitfall.bin",
// }
//
// It is stronly preferred however, that the NewLoader() function is used to
// initialise the Loader or important fields risk being initialised
Expand All @@ -36,7 +36,7 @@
// cases the mapper will be "AUTO" to indicate that we don't know (or
// particular care) what the mapping format is.
//
// File Extensions
// # File Extensions
//
// The file extension of a file will specify the cartridge mapping and will
// cause the emulation to use that mapping. Most 2600 ROM files have the
Expand Down Expand Up @@ -85,7 +85,7 @@
//
// Fingerprinting is not handled by the cartridlgeloader package.
//
// Hash
// # Hash
//
// The Hash field of the Loader type contains the SHA1 value of the loaded
// data. It is valid after the Load() function has completed successfully. If
Expand All @@ -99,7 +99,7 @@
//
// The hash value is invalid/unused in the case of streamed data
//
// Streaming
// # Streaming
//
// For some cartridge types it is necessary to stream bytes from the file
// rather than load them all at once. For these types of cartridges the Load()
Expand All @@ -111,21 +111,20 @@
// For streaming to work NewLoader() must have been used to instantiate the
// Loader type.
//
// Closing
// # Closing
//
// Instances of Loader must be closed with Close() when it is no longer
// required.
//
// OnInserted
// # OnInserted
//
// The OnInserted field is used by some cartridges to indicate when the
// cartridge data has been loaded into memory and something else needs to
// happen that is outside of the scope of the cartridge package. Currently,
// this is used by the Supercharder and PlusROM.
//
// Notification Hook
// # Notification Hook
//
// Some cartridge mappers will generate notifications (see notification.Notify type). The
// NotifcationHook can be specified in order to respond to those events.
//
package cartridgeloader
14 changes: 7 additions & 7 deletions debugger/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// Package debugger implements a reaonably comprehensive debugging tool.
// Features include:
//
// - cartridge disassembly
// - memory peek and poke
// - cpu and video cycle stepping
// - basic scripting
// - breakpoints
// - traps
// - watches
// - cartridge disassembly
// - memory peek and poke
// - cpu and video cycle stepping
// - basic scripting
// - breakpoints
// - traps
// - watches
//
// Some of these features come courtesy of other packages, described elsewhere,
// and some are inherent in the gopher2600's emulation strategy, but all are
Expand Down
4 changes: 2 additions & 2 deletions debugger/halt_breakpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ func (bp breakpoints) list() {

// parse token and add new breakpoint. for example:
//
// PC 0xf000
// adds a new breakpoint to the PC
// PC 0xf000
// adds a new breakpoint to the PC
//
// in addition to the description in the HELP file, the breakpoint parser has
// some additional features which should probably be removed. if only because
Expand Down
4 changes: 2 additions & 2 deletions debugger/terminal/commandline/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ func (n node) usageString() string {
// optimised in this case means the absence of superfluous group indicators.
// for example:
//
// TEST [1 [2] [3] [4] [5]]
// TEST [1 [2] [3] [4] [5]]
//
// is the same as:
//
// TEST [1 2 3 4 5]
// TEST [1 2 3 4 5]
//
// note: string should not be called directly except as a recursive call
// or as an initial call from String() and usageString().
Expand Down
22 changes: 12 additions & 10 deletions debugger/terminal/commandline/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,25 @@ import (
// into a machine friendly representation
//
// Syntax
// [ a ] required keyword
// ( a ) optional keyword
// [ a | b | ... ] required selection
// ( a | b | ... ) optional selection
//
// [ a ] required keyword
// ( a ) optional keyword
// [ a | b | ... ] required selection
// ( a | b | ... ) optional selection
//
// groups can be embedded in one another
//
// Placeholders
// %N numeric value
// %P irrational number value
// %S string (numbers can be strings too)
// %F file name
//
// %N numeric value
// %P irrational number value
// %S string (numbers can be strings too)
// %F file name
//
// Placeholders can be labelled. For example:
//
// %<first name>S
// %<age>N
// %<first name>S
// %<age>N
func ParseCommandTemplate(template []string) (*Commands, error) {
cmds := &Commands{
cmds: make([]*node, 0, 10),
Expand Down
2 changes: 1 addition & 1 deletion disassembly/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// of the Disassembly instance and will "survive" calls to the FromMemory() and
// FromCartridge() functions.
//
// Segmented Cartridges
// # Segmented Cartridges
//
// The disassembly package treats small bank sized (those less than 4k) by
// performing the disassembly with the cartridge rooted at each origin point -
Expand Down
1 change: 1 addition & 0 deletions disassembly/symbols/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (t table) String() string {
}

// make sure symbols is normalised:
//
// no leading or trailing space
// internal space compressed and replaced with underscores
func (t *table) normaliseSymbol(symbol string) string {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jetsetilly/gopher2600

go 1.18
go 1.20

require (
github.com/go-audio/audio v1.0.0
Expand Down
5 changes: 1 addition & 4 deletions gui/fonts/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
// pixel width; Converted to SVG with the help of Inkscape's Trace Bitmap
// function; and finally imported into an empty TTF file using FontForge.
//
// Licencing
// # Licencing
//
// Gopher2600-Icons.ttf is licenced by Stephen Illingworth, under the Creative
// Commons Attribution 4.0 International licence.
//
// https://creativecommons.org/licenses/by/4.0/legalcode
//
//
// The FontAwesome font (fa-solid-900.ttf) was downloaded on 18th March 2020
// from https://fontawesome.com/download using the "Free for Web" button. Full
// URL was:
Expand All @@ -41,13 +40,11 @@
//
// FontAwesome is licenced under the Font Awesome Free License.
//
//
// Hack-Regular was downloaded on 20th December 2021 from permalink URL:
//
// https://github.com/source-foundry/Hack/blob/a737c121cabb337fdfe655d8c7304729f351e30f/build/ttf/Hack-Regular.ttf
//
// Hack-Regular is licenced under the MIT License.
//
//
// JetBrainsMono-Regular is licenced under the OFL-1.1 License
package fonts
13 changes: 6 additions & 7 deletions gui/sdlimgui/framebuffer/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
//
// For example, to create a framebuffer sequence with two textures:
//
// seq := NewSequence(2)
// seq := NewSequence(2)
//
// The Setup() function must be called at least once after NewSequence() and
// called as often as necessary to ensure the dimensions (width and height) are
// correct.
//
// hasChanged := seq.Setup(800, 600)
// hasChanged := seq.Setup(800, 600)
//
// Setup() returns true if the texture data has been recreated in accordance
// with the new dimensions.
Expand All @@ -39,13 +39,12 @@
// returned and can be used for presentation of as the input for the next call
// to Process() (via the draw() function).
//
// texture := seq.Process(0, func() {
// // 1. set up shader
// // 2. OpenGL draw (eg. gl.DrawElements()
// })
// texture := seq.Process(0, func() {
// // 1. set up shader
// // 2. OpenGL draw (eg. gl.DrawElements()
// })
//
// Note that much of the work of chaning a sequence of shaders must be
// performed by the user of the package. The package does however, hide a lot
// of detail behind the Process() and Setup() functions.
//
package framebuffer
4 changes: 2 additions & 2 deletions gui/sdlimgui/imgui_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ func imguiBooleanButton(trueCol imgui.Vec4, falseCol imgui.Vec4, state bool, tex
// imguiLabel(), you can use the empty string or use the double hash construct.
// For example
//
// imgui.SliderInt("##foo", &v, s, e)
// imguiLabel("My Slider")
// imgui.SliderInt("##foo", &v, s, e)
// imguiLabel("My Slider")
func imguiLabel(text string) {
imgui.AlignTextToFramePadding()
imgui.Text(text)
Expand Down
31 changes: 13 additions & 18 deletions gui/sdlimgui/lazyvalues/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,19 @@
// be used. There is currently no way of pushing events onto the emulator
// unless the debugging loop is in use.
//
//
// Example
// -------
//
// Retrieving the foreground color of the playfield:
//
// col := lazyval.Playfield.ForegroundColor
//
// col := lazyval.Playfield.ForegroundColor
//
// Writing the playfield values is done thought debugger's "raw event" system:
//
// lazyval.Dbg.PushFunction(func() {
// lazyval.VCS.TIA.Video.Playfield.ForegroundColor = col
// })
//
//
// Implementation
// --------------
//
Expand All @@ -69,16 +66,16 @@
// The pseudocode below shows how the Refresh() updates the values in every
// type in the lazyvalues system, at the same time as requesting new values.
//
// func Refresh() { .------------------.
// debugger.PushFunction() -----> | CPU.push() |
// | RAM.push() |
// CPU.update() | Playfield.push() |
// RAM.update() | . |
// . | . |
// . | . |
// . | Log.push() |
// Log.update() ------------------
// }
// func Refresh() { .------------------.
// debugger.PushFunction() -----> | CPU.push() |
// | RAM.push() |
// CPU.update() | Playfield.push() |
// RAM.update() | . |
// . | . |
// . | . |
// . | Log.push() |
// Log.update() ------------------
// }
//
// The update() and push() functions (not visible from outside the lazyvalues
// package) of each type handle the retreiving and updating of emulation
Expand All @@ -102,8 +99,8 @@
// the array. For example, the RAM package has code equivalent to this; an
// array of atomic.Value stored as an atomic value:
//
// var ram atomic.Value
// ram.Store(make([]atomic.Value, size)
// var ram atomic.Value
// ram.Store(make([]atomic.Value, size)
//
// The exception to all the rules is the LazyBreakpoints type. Like LazyRAM it
// employs an array of atomic.Values storied as an atomic Value but unlike
Expand All @@ -116,7 +113,6 @@
// be other ways of achieving the same effect, but whatever way we do it the
// additional context provided by the disassembly.Entry is required.
//
//
// Ensuring Up-To-Date Information
// -------------------------------
//
Expand All @@ -131,5 +127,4 @@
// setting the Wait flag to true.
//
// Use of "wait" should be kept to a minimum to ensure system responsiveness.
//
package lazyvalues
32 changes: 16 additions & 16 deletions hardware/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (mc *CPU) LoadPC(directAddress uint16) error {
// read8Bit returns 8bit value from the specified address
//
// side-effects:
// * calls cycleCallback after memory read
// - calls cycleCallback after memory read
func (mc *CPU) read8Bit(address uint16, phantom bool) (uint8, error) {
mc.PhantomMemAccess = phantom

Expand All @@ -227,7 +227,7 @@ func (mc *CPU) read8Bit(address uint16, phantom bool) (uint8, error) {
// read8BitZero returns 8bit value from the specified zero-page address
//
// side-effects:
// * calls cycleCallback after memory read
// - calls cycleCallback after memory read
func (mc *CPU) read8BitZeroPage(address uint8) (uint8, error) {
mc.PhantomMemAccess = false

Expand Down Expand Up @@ -269,7 +269,7 @@ func (mc *CPU) write8Bit(address uint16, value uint8, phantom bool) error {
// read16Bit returns 16bit value from the specified address
//
// side-effects:
// * calls cycleCallback after each 8bit read
// - calls cycleCallback after each 8bit read
func (mc *CPU) read16Bit(address uint16) (uint16, error) {
mc.PhantomMemAccess = false

Expand Down Expand Up @@ -320,10 +320,10 @@ const (
// read8BitPC reads 8 bits from the memory location pointed to by PC
//
// side-effects:
// * updates program counter
// * calls cycleCallback at end of function
// * updates LastResult.ByteCount
// * additional side effect updates LastResult as appropriate
// - updates program counter
// - calls cycleCallback at end of function
// - updates LastResult.ByteCount
// - additional side effect updates LastResult as appropriate
func (mc *CPU) read8BitPC(effect read8BitPCeffect) error {
v, err := mc.mem.Read(mc.PC.Address())

Expand Down Expand Up @@ -381,12 +381,12 @@ func (mc *CPU) read8BitPC(effect read8BitPCeffect) error {
// read16BitPC reads 16 bits from the memory location pointed to by PC
//
// side-effects:
// * updates program counter
// * calls cycleCallback after each 8 bit read
// * updates LastResult.ByteCount
// * updates InstructionData field, once before each call to cycleCallback
// - no callback function because this function is only ever used
// to read operands
// - updates program counter
// - calls cycleCallback after each 8 bit read
// - updates LastResult.ByteCount
// - updates InstructionData field, once before each call to cycleCallback
// - no callback function because this function is only ever used
// to read operands
func (mc *CPU) read16BitPC() error {
lo, err := mc.mem.Read(mc.PC.Address())
if err != nil {
Expand Down Expand Up @@ -518,9 +518,9 @@ const (
// ExecuteInstruction steps CPU forward one instruction. The basic process when
// executing an instruction is this:
//
// 1. read opcode and look up instruction definition
// 2. read operands (if any) according to the addressing mode of the instruction
// 3. using the operator as a guide, perform the instruction on the data
// 1. read opcode and look up instruction definition
// 2. read operands (if any) according to the addressing mode of the instruction
// 3. using the operator as a guide, perform the instruction on the data
//
// All instructions take at least 2 cycle. After each cycle, the
// cycleCallback() function is run, thereby allowing the rest of the VCS
Expand Down
Loading

0 comments on commit 178f05f

Please sign in to comment.