Documentation
¶
Index ¶
- Constants
- Variables
- func ArcTan(gba *GBA)
- func ArcTan2(gba *GBA)
- func BGAffineSet(gba *GBA) int
- func BitUnPack(gba *GBA)
- func CheckEeprom(gba *GBA, addr uint32) bool
- func CpuFastSet(gba *GBA) int
- func CpuSet(gba *GBA) int
- func DecompressDiff8bit(gba *GBA, src, dst uint32) int
- func DecompressDiff16bit(gba *GBA, src, dst uint32) int
- func DecompressHuff(gba *GBA, src, dst uint32) int
- func DecompressLZ77(gba *GBA, src, dst uint32, half bool) int
- func DecompressRLU(gba *GBA, src, dst uint32) int
- func Div(gba *GBA, arm bool)
- func DivOld(gba *GBA, arm bool)
- func GetBiosChecksum(gba *GBA)
- func Huff(gba *GBA) int
- func HuffUnCompReadNormal(gba *GBA) int
- func InitTrig()
- func LZ77UnCompReadNormalWrite8bit(gba *GBA) int
- func LZ77UnCompReadNormalWrite16bit(gba *GBA) int
- func MidiKey2Freq(gba *GBA)
- func ObjAffineSet(gba *GBA) int
- func RLUUnCompReadNormalWrite8bit(gba *GBA) int
- func RLUUnCompReadNormalWrite16bit(gba *GBA) int
- func ReadSound(addr uint32, a *apu.Apu) uint8
- func RegisterRamReset(gba *GBA)
- func SoftReset(gba *GBA)
- func Sqrt(gba *GBA)
- func UpdateAffineParams(obj *Object, m *Memory)
- func WriteSound(addr uint32, v uint8, a *apu.Apu)
- type Alu
- type Background
- type Blend
- type BlendPalettes
- type Block
- type Cond
- type Cpu
- func (cpu *Cpu) Alu(opcode uint32)
- func (cpu *Cpu) B(opcode uint32)
- func (cpu *Cpu) BX(opcode uint32)
- func (c *Cpu) Block(opcode uint32)
- func (cpu *Cpu) CheckCond(cond uint32) bool
- func (cpu *Cpu) DecodeARM() int
- func (cpu *Cpu) DecodeTHUMB() int
- func (c *Cpu) Execute() int
- func (cpu *Cpu) GetOp2(opcode uint32) (uint32, bool)
- func (c *Cpu) Half(opcode uint32)
- func (cpu *Cpu) HiRegBX(opcode uint16) int
- func (cpu *Cpu) Mul(opcode uint32)
- func (cpu *Cpu) Psr(opcode uint32)
- func (c *Cpu) Sdt(opcode uint32) uint32
- func (cpu *Cpu) Swp(opcode uint32)
- func (cpu *Cpu) ThumbAddSub(opcode uint16)
- func (cpu *Cpu) ThumbAlu(opcode uint16)
- type DMA
- type Debugger
- type Dispcnt
- type Dispstat
- type GBA
- func (gba *GBA) Close()
- func (gba *GBA) ExitException(mode uint32)
- func (gba *GBA) InputHandler(keys []ebiten.Key, buttons []ebiten.StandardGamepadButton)
- func (gba *GBA) LoadBios()
- func (gba *GBA) LoadGame(path string)
- func (gba *GBA) SetIdleAddr()
- func (gba *GBA) SoftReset()
- func (gba *GBA) SysCall(inst uint32) (int, bool)
- func (gba *GBA) Tick(cycles uint32)
- func (gba *GBA) ToggleMute() bool
- func (gba *GBA) TogglePause() bool
- func (gba *GBA) Update()
- func (gba *GBA) UpdateTimers(cycles uint32)
- func (gba *GBA) VideoUpdate(cycles uint32)
- type Half
- type Irq
- type Keypad
- type Logger
- type Memory
- func (m *Memory) InitSaveLoop()
- func (m *Memory) Read(addr uint32) uint8
- func (m *Memory) Read8(addr uint32) uint32
- func (m *Memory) Read16(addr uint32) uint32
- func (m *Memory) Read32(addr uint32) uint32
- func (m *Memory) ReadBadRom(addr uint32, bytesRead uint8) uint32
- func (m *Memory) ReadBios(addr uint32) uint8
- func (m *Memory) ReadIO(addr uint32) uint8
- func (m *Memory) ReadIODirect(addr uint32, size uint32) uint32
- func (m *Memory) ReadIODirectByte(addr uint32) uint32
- func (m *Memory) ReadOpenBus(addr uint32) uint8
- func (m *Memory) ReadSoundIO(addr uint32) uint8
- func (m *Memory) Write(addr uint32, v uint8, byteWrite bool)
- func (m *Memory) Write8(addr uint32, v uint8)
- func (m *Memory) Write16(addr uint32, v uint16)
- func (m *Memory) Write32(addr uint32, v uint32)
- func (m *Memory) WriteIO(addr uint32, v uint8)
- type Mosaic
- type Object
- type PPU
- type PSR
- type Reg
- type Sdt
- type ThumbAlu
- type Timer
- type Window
- type Windows
Constants ¶
View Source
const ( AND = iota EOR SUB RSB ADD ADC SBC RSC TST TEQ CMP CMN ORR MOV BIC MVN )
View Source
const ( MUL = 0b0 MLA = 0b1 UMAAL = 0b010 UMULL = 0b100 UMLAL = 0b101 SMULL = 0b110 SMLAL = 0b111 )
View Source
const ( STR = iota LDR_PLD )
View Source
const ( RESERVED = 0 STRH = 1 LDRD = 2 STRD = 3 LDRH = 1 LDRSB = 2 LDRSH = 3 )
View Source
const ( PRIV_MASK uint32 = 0xF8FF_03DF USR_MASK uint32 = 0xF8FF_0000 STATE_MASK uint32 = 0x0100_0020 )
View Source
const ( INTRWAIT_NONE = 0 INTRWAIT_VBLANK = 1 )
View Source
const ( SYS_SoftReset = 0x00 SYS_RegisterRamReset = 0x01 SYS_Halt = 0x02 SYS_StopSleep = 0x03 SYS_IntrWait = 0x04 SYS_VBlankIntrWait = 0x05 SYS_Div = 0x06 SYS_DivArm = 0x07 SYS_Sqrt = 0x08 SYS_ArcTan = 0x09 SYS_ArcTan2 = 0x0A SYS_CpuSet = 0x0B SYS_CpuFastSet = 0x0C SYS_GetBiosChecksum = 0x0D SYS_BgAffineSet = 0x0E SYS_ObjAffineSet = 0x0F SYS_BitUnPack = 0x10 SYS_LZ77UnCompReadNormalWrite8bit = 0x11 SYS_LZ77UnCompReadNormalWrite16bit = 0x12 SYS_HuffUnCompReadNormal = 0x13 SYS_RLUnCompReadNormalWrite8bit = 0x14 SYS_RLUnCompReadNormalWrite16bit = 0x15 SYS_Diff8bitUnFilterWrite8bit = 0x16 SYS_Diff8bitUnFilterWrite16bit = 0x17 SYS_Diff16bitUnFilter = 0x18 SYS_SoundBias = 0x19 SYS_SoundDriverInit = 0x1A SYS_SoundDriverMode = 0x1B SYS_SoundDriverMain = 0x1C SYS_SoundDriverVSync = 0x1D SYS_SoundChannelClear = 0x1E SYS_MidiKey2Freq = 0x1F SYS_SoundWhatever0 = 0x20 SYS_SoundWhatever1 = 0x21 SYS_SoundWhatever2 = 0x22 SYS_SoundWhatever3 = 0x23 SYS_SoundWhatever4 = 0x24 SYS_MultiBoot = 0x25 SYS_HardReset = 0x26 SYS_CustomHalt = 0x27 SYS_SoundDriverVSyncOff = 0x28 SYS_SoundDriverVSyncOn = 0x29 SYS_SoundGetJumpList = 0x2A )
View Source
const ( SP = 13 LR = 14 PC = 15 FLAG_N = 31 FLAG_Z = 30 FLAG_C = 29 FLAG_V = 28 FLAG_Q = 27 FLAG_I = 7 FLAG_F = 6 FLAG_T = 5 MODE_USR = 0x10 MODE_FIQ = 0x11 MODE_IRQ = 0x12 MODE_SWI = 0x13 MODE_ABT = 0x17 MODE_UND = 0x1B MODE_SYS = 0x1F BIOS_STARTUP = 0 BIOS_SWI = 1 BIOS_IRQ = 2 BIOS_IRQ_POST = 3 )
View Source
const ( DMA_MODE_IMM = 0 DMA_MODE_VBL = 1 DMA_MODE_HBL = 2 DMA_MODE_REF = 3 DMA_ADJ_INC = 0 DMA_ADJ_DEC = 1 DMA_ADJ_NON = 2 DMA_ADJ_RES = 3 IRQ_DMA_0 = 8 IRQ_DMA_1 = 9 IRQ_DMA_2 = 10 IRQ_DMA_3 = 11 )
View Source
const ( VEC_RESET = 0x00 VEC_UND = 0x04 VEC_SWI = 0x08 VEC_PREFETCHABORT = 0x0C VEC_DATAABORT = 0x10 VEC_ADDR26BIT = 0x14 VEC_IRQ = 0x18 VEC_FIQ = 0x1C )
View Source
const ( SCREEN_WIDTH = 240 SCREEN_HEIGHT = 160 NUM_SCANLINES = SCREEN_HEIGHT + 68 CYCLES_HDRAW = 1006 CYCLES_HBLANK = 226 CYCLES_SCANLINE = CYCLES_HDRAW + CYCLES_HBLANK CYCLES_VDRAW = CYCLES_SCANLINE * SCREEN_HEIGHT CYCLES_VBLANK = CYCLES_SCANLINE * 68 CYCLES_FRAME = CYCLES_VDRAW + CYCLES_VBLANK )
View Source
const ( MAX_HEIGHT = 256 MAX_WIDTH = 512 )
View Source
const ( BLD_MODE_OFF = 0 BLD_MODE_STD = 1 BLD_MODE_WHITE = 2 BLD_MODE_BLACK = 3 )
View Source
const ( THUMB_AND = iota THUMB_EOR THUMB_LSL THUMB_LSR THUMB_ASR THUMB_ADC THUMB_SBC THUMB_ROR THUMB_TST THUMB_NEG // arm eq is RSBS THUMB_CMP THUMB_CMN THUMB_ORR THUMB_MUL THUMB_BIC THUMB_MVN )
View Source
const ( THUMB_ADD = iota THUMB_SUB THUMB_ADDMOV THUMB_SUBImm )
View Source
const ( THUMB_IMM_MOV = iota THUMB_IMM_CMP THUMB_IMM_ADD THUMB_IMM_SUB )
View Source
const ( THUMB_STRH = iota THUMB_LDSB THUMB_LDRH THUMB_LDSH )
View Source
const ( THUMB_STR_REG = iota THUMB_STRB_REG THUMB_LDR_REG THUMB_LDRB_REG )
View Source
const ( THUMB_STR_IMM = iota THUMB_LDR_IMM THUMB_STRB_IMM THUMB_LDRB_IMM )
Variables ¶
View Source
var BANK_ID = map[uint32]uint32{ MODE_USR: 0, MODE_SYS: 0, MODE_FIQ: 1, MODE_IRQ: 2, MODE_SWI: 3, MODE_ABT: 4, MODE_UND: 5, }
View Source
var BIOS_ADDR = map[uint32]uint32{ BIOS_STARTUP: 0xE129F000, BIOS_SWI: 0xE3A02004, BIOS_IRQ: 0xE25EF004, BIOS_IRQ_POST: 0xE55EC002, }
View Source
var CURR_INST = uint64(0)
Functions ¶
func BGAffineSet ¶
func CheckEeprom ¶
func CpuFastSet ¶
func DecompressDiff8bit ¶
func DecompressDiff16bit ¶
func DecompressHuff ¶
func DecompressRLU ¶
func GetBiosChecksum ¶
func GetBiosChecksum(gba *GBA)
func HuffUnCompReadNormal ¶
func MidiKey2Freq ¶
func MidiKey2Freq(gba *GBA)
func ObjAffineSet ¶
func RegisterRamReset ¶
func RegisterRamReset(gba *GBA)
func UpdateAffineParams ¶
Types ¶
type Alu ¶
type Alu struct {
Opcode, Rd, Rn, Rm, RnValue, Op2, Inst uint32
Immediate, Set bool
LogicalFlags, Test bool
Carry bool
}
func NewAluData ¶
type Background ¶
type Background struct {
Enabled bool
Invalid bool
W, H uint32
Pa, Pb, Pc, Pd uint32
Priority uint32
CharBaseBlock uint32
Mosaic bool
Palette256 bool
ScreenBaseBlock uint32
AffineWrap bool
Size uint32
XOffset, YOffset uint32
Affine bool
//PbCalc, PdCalc float64
OutX, OutY float64
// contains filtered or unexported fields
}
func (*Background) BgAffineReset ¶
func (bg *Background) BgAffineReset()
func (*Background) BgAffineUpdate ¶
func (bg *Background) BgAffineUpdate()
type Blend ¶
type Blend struct {
Mode uint32
// contains filtered or unexported fields
}
blends are [6]... because Bg0, Bg1, Bg2, Bg3, Obj, Bd
type BlendPalettes ¶
type BlendPalettes struct {
Bld *Blend
NoBlendPalette, APalette, BPalette uint32
// contains filtered or unexported fields
}
func NewBlendPalette ¶
func NewBlendPalette(i uint32, bld *Blend, gba *GBA) *BlendPalettes
type DMA ¶
type DMA struct {
Gba *GBA
Idx int
Src uint32
Dst uint32
InitSrc uint32
InitDst uint32
Control uint32
WordCount uint32
DstAdj uint32
SrcAdj uint32
Repeat bool
DRQ bool
Mode uint32
IRQ bool
Enabled bool
Value uint32
// contains filtered or unexported fields
}
func (*DMA) ReadControl ¶
func (*DMA) WriteControl ¶
func (*DMA) WriteCount ¶
type GBA ¶
type GBA struct {
Debugger Debugger
Cartridge cart.Cartridge
Cpu Cpu
Mem Memory
PPU PPU
Timers [4]Timer
Dma [4]DMA
Irq Irq
Apu *apu.Apu
Paused, Muted, Save, Halted, Drawn bool
OpenBusOpcode uint32
AccCycles uint32
Keypad Keypad
SoundCycles uint32
SoundCyclesMask uint32
Pixels []byte
Image *ebiten.Image
Frame uint64
// contains filtered or unexported fields
}
func (*GBA) ExitException ¶
func (*GBA) InputHandler ¶
func (gba *GBA) InputHandler(keys []ebiten.Key, buttons []ebiten.StandardGamepadButton)
func (*GBA) SetIdleAddr ¶
func (gba *GBA) SetIdleAddr()
func (*GBA) ToggleMute ¶
func (*GBA) TogglePause ¶
func (*GBA) UpdateTimers ¶
type Half ¶
type Memory ¶
type Memory struct {
GBA *GBA
BIOS [0x4000]uint8
WRAM1 [0x40000]uint8
WRAM2 [0x8000]uint8
PRAM [0x200]uint16
VRAM [0x18001]uint8
OAM [0x400]uint8
IO [0x400]uint8
BIOS_MODE uint32
Dispstat Dispstat
// contains filtered or unexported fields
}
func (*Memory) InitSaveLoop ¶
func (m *Memory) InitSaveLoop()
func (*Memory) Read16 ¶
Accessing SRAM Area by 16bit/32bit Reading retrieves 8bit value from specified address, multiplied by 0101h (LDRH) or by 01010101h (LDR). Writing changes the 8bit value at the specified address only, being set to LSB of (source_data ROR (address*8)).
func (*Memory) ReadIODirectByte ¶
func (*Memory) ReadOpenBus ¶
func (*Memory) ReadSoundIO ¶
type PPU ¶
type PPU struct {
Dispcnt Dispcnt
Objects [128]Object
Backgrounds [4]Background
Windows Windows
Blend Blend
Mosaic Mosaic
// contains filtered or unexported fields
}
func (*PPU) UpdateAffine ¶
func (*PPU) UpdateBackgrounds ¶
type Sdt ¶
type Sdt struct {
Opcode, Rd, Rn, RnValue, RdValue, Offset, Shift, ShiftType, Rm uint32
Set, I, Load, WriteBack, MemoryMgmt, Pre, Up, Byte, Pld bool
}
func NewSdtData ¶
type Timer ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.