Documentation
¶
Index ¶
- Constants
- Variables
- func Init()
- func Notify(message string)
- type CPUType
- type FlagsType
- type GPUType
- type INTERRUPTSType
- type InstructionType
- type LogType
- type LoggerType
- type MMUType
- func (mmu *MMUType) ReadByte(address uint16) byte
- func (mmu *MMUType) ReadShort(address uint16) uint16
- func (mmu *MMUType) ReadShortFromStack() uint16
- func (mmu *MMUType) WriteByte(address uint16, value byte)
- func (mmu *MMUType) WriteShort(address uint16, value uint16)
- func (mmu *MMUType) WriteShortToStack(value uint16)
- type ROMType
- type RegistersType
- func (r *RegistersType) A() byte
- func (r *RegistersType) ADD16(destination uint16, source uint16) uint16
- func (r *RegistersType) ADD8(destination byte, source byte) byte
- func (r *RegistersType) ADDC(value byte)
- func (r *RegistersType) AND(value byte)
- func (r *RegistersType) B() byte
- func (r *RegistersType) C() byte
- func (r *RegistersType) CombineTo16(lower byte, upper byte) uint16
- func (r *RegistersType) D() byte
- func (r *RegistersType) E() byte
- func (r *RegistersType) F() byte
- func (r *RegistersType) FLAG_CLEAR(flag byte)
- func (r *RegistersType) FLAG_ISSET(flag byte) bool
- func (r *RegistersType) FLAG_SET(flag byte)
- func (r *RegistersType) H() byte
- func (r *RegistersType) INC(value byte) byte
- func (r *RegistersType) L() byte
- func (r *RegistersType) OR(value byte)
- func (r *RegistersType) Print()
- func (r *RegistersType) Register16toString(register uint16) string
- func (r *RegistersType) Register8toString(register byte) string
- func (r *RegistersType) SUB(value byte)
- func (r *RegistersType) SUBC(value byte)
- func (r *RegistersType) SetA(value byte)
- func (r *RegistersType) SetB(value byte)
- func (r *RegistersType) SetC(value byte)
- func (r *RegistersType) SetD(value byte)
- func (r *RegistersType) SetE(value byte)
- func (r *RegistersType) SetF(value byte)
- func (r *RegistersType) SetH(value byte)
- func (r *RegistersType) SetL(value byte)
- func (r *RegistersType) XOR(value byte)
- type SystemType
Constants ¶
const FragmentSource string = `` /* 126-byte string literal not displayed */
const OFFSEThRAM uint16 = 0xFF80
const OFFSETio uint16 = 0xFF00
const OFFSEToam uint16 = 0xFE00
const OFFSETsRAM uint16 = 0xA000
const OFFSETvRAM uint16 = 0x8000
const OFFSETwRAMlower uint16 = 0xC000
const OFFSETwRAMupper uint16 = 0xE000
const ROM_OFFSET_NAME = 0x0134
ROM_OFFSET_NAME is the location in every ROM of the name
const ROM_OFFSET_RAM_SIZE = 0x0149
const ROM_OFFSET_ROM_SIZE = 0x0148
const ROM_OFFSET_TYPE = 0x0147
const VertexSource string = `#version 460 core
in vec4 position;
void main()
{
gl_Position = position;
}`
Variables ¶
var AppRef *gtk.Application
var CPU = CPUType{ INSTRUCTIONS: INSTRUCTIONS, REGISTERS: ®ISTERS, DEBUG: false, }
CPU is the exported object used in the system CPU is exported to become a shared variable in the System object
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
var INSTRUCTIONS = []InstructionType{}/* 256 elements not displayed */
INSTRUCTIONS is the array holding InstructionType elements to build a ROM execution table
var LogFile *os.File
var LogFilename string
var LogTypes = LogType{
INFO: 0,
ERROR: 1,
WARNING: 2,
COMPLETED: 3,
}
var MMU = MMUType{}
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
var ROM = ROMType{ // contains filtered or unexported fields }
var ROMref []byte
var System = SystemType{ CPU: &CPU, GPU: &GPU, ROM: &ROM, }
var UserHome, _ = os.UserHomeDir()
Functions ¶
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() ================
type GPUType ¶
type GPUType struct {
// contains filtered or unexported fields
}
GPUType is the structure to define what's inside a GPU
GPU Structure ================ ================
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 LoggerType ¶ added in v0.0.10
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) ReadShortFromStack ¶ added in v0.0.10
func (*MMUType) WriteShort ¶ added in v0.0.10
func (*MMUType) WriteShortToStack ¶ added in v0.0.10
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
GetName gets the name of the ROM from within the ROM's file
func (*ROMType) GetRAMSize ¶ added in v0.0.10
GetRAMSize get the size of the ROM's RAM from within the ROM's file
func (*ROMType) GetROMSize ¶ added in v0.0.10
GetROMSize get the size 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 ¶
SystemType is the object definition type
System Structure ================ CPU Structure ---> Instructions Array ---> Registers Structure ---> MMU Structure GPU Structure ---> Graphics Processing ---> Screen Pipeline