core

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FragmentSource string = `` /* 126-byte string literal not displayed */
View Source
const OFFSEThRAM uint16 = 0xFF80
View Source
const OFFSETio uint16 = 0xFF00
View Source
const OFFSEToam uint16 = 0xFE00
View Source
const OFFSETsRAM uint16 = 0xA000
View Source
const OFFSETvRAM uint16 = 0x8000
View Source
const OFFSETwRAMlower uint16 = 0xC000
View Source
const OFFSETwRAMupper uint16 = 0xE000
View Source
const ROM_OFFSET_NAME = 0x0134

ROM_OFFSET_NAME is the location in every ROM of the name

View Source
const ROM_OFFSET_RAM_SIZE = 0x0149
View Source
const ROM_OFFSET_ROM_SIZE = 0x0148
View Source
const ROM_OFFSET_TYPE = 0x0147
View Source
const VertexSource string = `#version 460 core
    in vec4 position;

    void main()
    {
        gl_Position = position;
    }`

Variables

View Source
var CPU = CPUType{
	INSTRUCTIONS: INSTRUCTIONS,
	REGISTERS:    &REGISTERS,
	DEBUG:        false,
}

CPU is the exported object used in the system CPU is exported to become a shared variable in the System object

View Source
var GPU = GPUType{
	// contains filtered or unexported fields
}

GPU is the exported object used in the system

GPU is exported to become a shared variable in the System object

View Source
var INSTRUCTIONS = []InstructionType{}/* 256 elements not displayed */

INSTRUCTIONS is the array holding InstructionType elements to build a ROM execution table

View Source
var LogFile *os.File
View Source
var LogFilename string
View Source
var LogTypes = LogType{
	INFO:      0,
	ERROR:     1,
	WARNING:   2,
	COMPLETED: 3,
}
View Source
var MMU = MMUType{}
View Source
var REGISTERS = RegistersType{
	AF: 0x01B0,
	BC: 0x0013,
	DE: 0x00D8,
	HL: 0x014D,
	SP: 0xFFFE,
	PC: 0x0100,
	FLAGS: FlagsType{
		ZERO:       0x80,
		SUBTRACT:   0x40,
		HALF_CARRY: 0x20,
		CARRY:      0x10,
	},
}

REGISTERS is the exported object used in the CPU REGISTERS is exported to become a shared variable in the System object

View Source
var ROM = ROMType{
	// contains filtered or unexported fields
}
View Source
var ROMref []byte
View Source
var System = SystemType{
	CPU: &CPU,
	GPU: &GPU,
	ROM: &ROM,
}
View Source
var UserHome, _ = os.UserHomeDir()

Functions

func Init added in v0.0.10

func Init()

func Notify added in v0.0.10

func Notify(message string)

Notify is a function to display notifications across all platforms (Mac OS X, Linux, and MS Windows 10) This particular version is designed for Linux. It utilizes the godbus/dbus and esiqveland/notify packages to display native notifications.

Types

type CPUType

type CPUType struct {
	INSTRUCTIONS []InstructionType
	REGISTERS    *RegistersType
	DEBUG        bool
}

CPUType is the structure to define what's inside a CPU

CPU Structure
================
---> Instructions Array
---> Registers Structure
---> DEBUG boolean value set with CPU.Run()
================

func (*CPUType) Reset

func (cpu *CPUType) Reset()

Reset will reset the CPU, INTERRUPTS and REGISTERS to their default values

func (*CPUType) Run

func (cpu *CPUType) Run(debug bool)

Run is the thread loop function for the CPU

type FlagsType added in v0.0.10

type FlagsType struct {
	ZERO       byte
	SUBTRACT   byte
	HALF_CARRY byte
	CARRY      byte
}

FlagsType holds the FLAG values required by documentation

type GPUType

type GPUType struct {
	// contains filtered or unexported fields
}

GPUType is the structure to define what's inside a GPU

GPU Structure
================
================

func (*GPUType) Destroy added in v0.0.10

func (gpu *GPUType) Destroy(glarea *gtk.GLArea)

func (*GPUType) Init added in v0.0.10

func (gpu *GPUType) Init(glarea *gtk.GLArea)

func (*GPUType) Run added in v0.0.10

func (gpu *GPUType) Run(glarea *gtk.GLArea) bool

type INTERRUPTSType

type INTERRUPTSType struct {
	// contains filtered or unexported fields
}

INTERRUPTSType is the structure to define constant values used to identify an interrupt

var INTERRUPTS INTERRUPTSType = INTERRUPTSType{
	// contains filtered or unexported fields
}

INTERRUPTS is the exported object used in the system

INTERRUPTS is exported for value setting in other files

type InstructionType added in v0.0.10

type InstructionType struct {
	Exec        func() // executed code
	Opcode      uint8  // opcode
	Name        string // name
	NumOperands byte   // number of operands
	Operands    []byte // operands
	Cycles      uint8  // cpu cycles

}

InstructionType is the structure that holds the execution function, opcode value, the name, number of operands, operand locations, and CPU cycles

type LogType added in v0.0.10

type LogType struct {
	INFO      byte
	ERROR     byte
	WARNING   byte
	COMPLETED byte
}

type LoggerType added in v0.0.10

type LoggerType struct {
	InternalLogger *log.Logger
}
var Logger LoggerType

func (*LoggerType) Log added in v0.0.10

func (logger *LoggerType) Log(Ltype byte, v ...interface{})

func (*LoggerType) Logf added in v0.0.10

func (logger *LoggerType) Logf(Ltype byte, format string, v ...interface{})

func (*LoggerType) Panic added in v0.0.10

func (logger *LoggerType) Panic(v ...interface{})

type MMUType added in v0.0.10

type MMUType struct {
}

func (*MMUType) ReadByte added in v0.0.10

func (mmu *MMUType) ReadByte(address uint16) byte

func (*MMUType) ReadShort added in v0.0.10

func (mmu *MMUType) ReadShort(address uint16) uint16

func (*MMUType) ReadShortFromStack added in v0.0.10

func (mmu *MMUType) ReadShortFromStack() uint16

func (*MMUType) WriteByte added in v0.0.10

func (mmu *MMUType) WriteByte(address uint16, value byte)

func (*MMUType) WriteShort added in v0.0.10

func (mmu *MMUType) WriteShort(address uint16, value uint16)

func (*MMUType) WriteShortToStack added in v0.0.10

func (mmu *MMUType) WriteShortToStack(value uint16)

type ROMType

type ROMType struct {
	// contains filtered or unexported fields
}

func (*ROMType) BuildModel added in v0.0.10

func (rom *ROMType) BuildModel()

BuildModel builds a GTK TreeModel using an instruction map

func (*ROMType) GetName added in v0.0.10

func (rom *ROMType) GetName() string

GetName gets the name of the ROM from within the ROM's file

func (*ROMType) GetRAMSize added in v0.0.10

func (rom *ROMType) GetRAMSize() int

GetRAMSize get the size of the ROM's RAM from within the ROM's file

func (*ROMType) GetROMSize added in v0.0.10

func (rom *ROMType) GetROMSize() int

GetROMSize get the size of the ROM from within the ROM's file

func (*ROMType) GetType added in v0.0.10

func (rom *ROMType) GetType() string

GetType gets the ROM Type of the ROM from within the ROM's file

type RegistersType added in v0.0.10

type RegistersType struct {
	AF    uint16
	BC    uint16
	DE    uint16
	HL    uint16
	SP    uint16
	PC    uint16
	FLAGS FlagsType
}

RegistersType is the strucutre that holds the individual registers of the CPU

func (*RegistersType) A added in v0.0.10

func (r *RegistersType) A() byte

A is the accessor for REGISTER A

func (*RegistersType) ADD16 added in v0.0.10

func (r *RegistersType) ADD16(destination uint16, source uint16) uint16

ADD16 addes two 16-bit registers

func (*RegistersType) ADD8 added in v0.0.10

func (r *RegistersType) ADD8(destination byte, source byte) byte

ADD8 addes two 8-bit registers

func (*RegistersType) ADDC added in v0.0.10

func (r *RegistersType) ADDC(value byte)

ADDC is a helper function to add-carry

func (*RegistersType) AND added in v0.0.10

func (r *RegistersType) AND(value byte)

AND is a helper function to and the value to Register A

func (*RegistersType) B added in v0.0.10

func (r *RegistersType) B() byte

B is the accessor for REGISTER B

func (*RegistersType) C added in v0.0.10

func (r *RegistersType) C() byte

C is the accessor for REGISTER C

func (*RegistersType) CombineTo16 added in v0.0.10

func (r *RegistersType) CombineTo16(lower byte, upper byte) uint16

CombineTo16 combines two 8-bit registers into a 16-bit register

func (*RegistersType) D added in v0.0.10

func (r *RegistersType) D() byte

D is the accessor for REGISTER D

func (*RegistersType) E added in v0.0.10

func (r *RegistersType) E() byte

E is the accessor for REGISTER E

func (*RegistersType) F added in v0.0.10

func (r *RegistersType) F() byte

F is the accessor for REGISTER F

func (*RegistersType) FLAG_CLEAR added in v0.0.10

func (r *RegistersType) FLAG_CLEAR(flag byte)

FLAG_CLEAR is a helper function to clear flags

func (*RegistersType) FLAG_ISSET added in v0.0.10

func (r *RegistersType) FLAG_ISSET(flag byte) bool

FLAG_ISSET is a helper function to check if a flag is set

func (*RegistersType) FLAG_SET added in v0.0.10

func (r *RegistersType) FLAG_SET(flag byte)

FLAG_SET is a helper function to set flags

func (*RegistersType) H added in v0.0.10

func (r *RegistersType) H() byte

H is the accessor for REGISTER H

func (*RegistersType) INC added in v0.0.10

func (r *RegistersType) INC(value byte) byte

INC is a helper function to increment the value

func (*RegistersType) L added in v0.0.10

func (r *RegistersType) L() byte

L is the accessor for REGISTER L

func (*RegistersType) OR added in v0.0.10

func (r *RegistersType) OR(value byte)

OR is a helper function to or the value to Register A

func (*RegistersType) Print added in v0.0.10

func (r *RegistersType) Print()

Print will print all registers, preformatted

func (*RegistersType) Register16toString added in v0.0.10

func (r *RegistersType) Register16toString(register uint16) string

Register16toString converts a register (uint16) to a string, preformatted

func (*RegistersType) Register8toString added in v0.0.10

func (r *RegistersType) Register8toString(register byte) string

Register8toString converts a register (byte) to a string, preformatted

func (*RegistersType) SUB added in v0.0.10

func (r *RegistersType) SUB(value byte)

func (*RegistersType) SUBC added in v0.0.10

func (r *RegistersType) SUBC(value byte)

SUBC is a helper function to sub-carry

func (*RegistersType) SetA added in v0.0.10

func (r *RegistersType) SetA(value byte)

SetA is the setter for REGISTER A

func (*RegistersType) SetB added in v0.0.10

func (r *RegistersType) SetB(value byte)

SetB is the setter for REGISTER B

func (*RegistersType) SetC added in v0.0.10

func (r *RegistersType) SetC(value byte)

SetC is the setter for REGISTER C

func (*RegistersType) SetD added in v0.0.10

func (r *RegistersType) SetD(value byte)

SetD is the setter for REGISTER D

func (*RegistersType) SetE added in v0.0.10

func (r *RegistersType) SetE(value byte)

SetE is the setter for REGISTER E

func (*RegistersType) SetF added in v0.0.10

func (r *RegistersType) SetF(value byte)

SetF is the setter for REGISTER F

func (*RegistersType) SetH added in v0.0.10

func (r *RegistersType) SetH(value byte)

SetH is the setter for REGISTER H

func (*RegistersType) SetL added in v0.0.10

func (r *RegistersType) SetL(value byte)

SetL is the setter for REGISTER L

func (*RegistersType) XOR added in v0.0.10

func (r *RegistersType) XOR(value byte)

XOR is a helper function to xor the value to Register A

type SystemType

type SystemType struct {
	CPU *CPUType
	GPU *GPUType
	ROM *ROMType
}

SystemType is the object definition type

System Structure
================
CPU Structure
 ---> Instructions Array
 ---> Registers Structure
 ---> MMU Structure
GPU Structure
 ---> Graphics Processing
 ---> Screen Pipeline

func (*SystemType) LoadROM

func (system *SystemType) LoadROM(location string, romListStore *gtk.ListStore,
	romTreeView *gtk.TreeView, romProgressBar *gtk.ProgressBar,
	menuDebug *gtk.MenuItem, menuRun *gtk.MenuItem)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL