Documentation
¶
Index ¶
- Constants
- Variables
- func AddJOY(h IntHandler)
- func AddLCD(h IntHandler)
- func AddSIO(h IntHandler)
- func AddTIM(h IntHandler)
- func AddVBL(h IntHandler)
- func CGBCompatibility()
- func CPUFast()
- func CPUSlow()
- func DISABLE_RAM_MBC1()
- func DISABLE_RAM_MBC5()
- func DISPLAY_OFF()
- func DISPLAY_ON()
- func Delay(duration UINT16)
- func DisableInterrupts()
- func DisplayOff()
- func ENABLE_RAM_MBC1()
- func ENABLE_RAM_MBC5()
- func EnableInterrupts()
- func GetBkgData(firstTile, nbTiles UINT8, data []UINT8)
- func GetBkgTiles(x, y, w, h UINT8, tiles []UINT8)
- func GetSpriteData(firstTile, nbTiles UINT8, data []UINT8)
- func GetSpriteProp(nb UINT8)
- func GetSpriteTile(nb UINT8)
- func GetWinData(firstTile, nbTiles UINT8, data []UINT8)
- func GetWinTiles(x, y, w, h UINT8, tiles []UINT8)
- func Gotoxy(x, y UINT8)
- func HIDE_BKG()
- func HIDE_SPRITES()
- func HIDE_WIN()
- func MoveBkg(x, y UINT8)
- func MoveSprite(nb, x, y UINT8)
- func MoveWin(x, y UINT8)
- func NowaitIntHandler()
- func RemoveJOY(h IntHandler)
- func RemoveLCD(h IntHandler)
- func RemoveSIO(h IntHandler)
- func RemoveTIM(h IntHandler)
- func RemoveVBL(h IntHandler)
- func Reset()
- func SHOW_BKG()
- func SHOW_SPRITES()
- func SHOW_WIN()
- func SPRITES_8x8()
- func SPRITES_8x16()
- func SWITCH_4_32_MODE_MBC1()
- func SWITCH_16_8_MODE_MBC1()
- func SWITCH_RAM_MBC1(b BYTE)
- func SWITCH_RAM_MBC5(b BYTE)
- func SWITCH_ROM_MBC1(b BYTE)
- func SWITCH_ROM_MBC5(b BYTE)
- func ScrollBkg(x, y INT8)
- func ScrollSprite(nb, x, y UINT8)
- func ScrollWin(x, y INT8)
- func SetBkgData(firstTile, nbTiles UINT8, data []UINT8)
- func SetBkgPalette(firstPalette, nbPalettes UINT8, rgbData []UINT16)
- func SetBkgPaletteEntry(palette, entry UINT8, rgbData UINT16)
- func SetBkgTiles(x, y, w, h UINT8, tiles []UINT8)
- func SetInterrupts(flags UINT8)
- func SetMode(m UINT8)
- func SetSpriteData(firstTile, nbTiles UINT8, data []UINT8)
- func SetSpritePalette(firstPalette, nbPalettes UINT8, rgbData []UINT16)
- func SetSpritePaletteEntry(palette, entry UINT8, rgbData UINT16)
- func SetSpriteProp(nb, prop UINT8)
- func SetSpriteTile(nb, tile UINT8)
- func SetWinData(firstTile, nbTiles UINT8, data []UINT8)
- func SetWinTiles(x, y, w, h UINT8, tiles []UINT8)
- func Setchar(r rune)
- func WaitIntHandler()
- func WaitVBLDone()
- func Waitpadup()
- type BOOLEAN
- type BYTE
- type DWORD
- type INT8
- type IntHandler
- type UINT8
- type UINT16
- type UINT32
- type WORD
Constants ¶
const ( SCREENWIDTH = 0xA0 SCREENHEIGHT = 0x90 MINWNDPOSX = 0x07 MINWNDPOSY = 0x00 MAXWNDPOSX = 0xA6 MAXWNDPOSY = 0x8F )
const ( VBL_IFLAG = 0x01 LCD_IFLAG = 0x02 TIM_IFLAG = 0x04 SIO_IFLAG = 0x08 JOY_IFLAG = 0x10 )
const ( J_START = 0x80 J_SELECT = 0x40 J_B = 0x20 J_A = 0x10 J_DOWN = 0x08 J_UP = 0x04 J_LEFT = 0x02 J_RIGHT = 0x01 )
const ( M_DRAWING = 0x01 M_TEXT_OUT = 0x02 M_TEXT_INOUT = 0x03 M_NO_SCROLL = 0x04 M_NO_INTERP = 0x08 S_PALETTE = 0x10 S_FLIPX = 0x20 S_FLIPY = 0x40 S_PRIORITY = 0x80 )
Variables ¶
var ( P1_REG = 0xff00 /* Joystick: 1.1.P15.P14.P13.P12.P11.P10 */ SB_REG = 0xff01 /* Serial IO data buffer */ SC_REG = 0xff02 /* Serial IO control register */ DIV_REG = 0xff04 /* Divider register */ TIMA_REG = 0xff05 /* Timer counter */ TMA_REG = 0xff06 /* Timer modulo */ TAC_REG = 0xff07 /* Timer control */ IF_REG = 0xff0f /* Interrupt flags: 0.0.0.JOY.SIO.TIM.LCD.VBL */ NR10_REG = 0xff10 /* Sound register */ NR11_REG = 0xff11 /* Sound register */ NR12_REG = 0xff12 /* Sound register */ NR13_REG = 0xff13 /* Sound register */ NR14_REG = 0xff14 /* Sound register */ NR21_REG = 0xff16 /* Sound register */ NR22_REG = 0xff17 /* Sound register */ NR23_REG = 0xff18 /* Sound register */ NR24_REG = 0xff19 /* Sound register */ NR30_REG = 0xff1a /* Sound register */ NR31_REG = 0xff1b /* Sound register */ NR32_REG = 0xff1c /* Sound register */ NR33_REG = 0xff1d /* Sound register */ NR34_REG = 0xff1e /* Sound register */ NR41_REG = 0xff20 /* Sound register */ NR42_REG = 0xff21 /* Sound register */ NR43_REG = 0xff22 /* Sound register */ NR44_REG = 0xff23 /* Sound register */ NR50_REG = 0xff24 /* Sound register */ NR51_REG = 0xff25 /* Sound register */ NR52_REG = 0xff26 /* Sound register */ LCDC_REG = 0xff40 /* LCD control */ STAT_REG = 0xff41 /* LCD status */ SCY_REG = 0xff42 /* Scroll Y */ SCX_REG = 0xff43 /* Scroll X */ LY_REG = 0xff44 /* LCDC Y-coordinate */ LYC_REG = 0xff45 /* LY compare */ DMA_REG = 0xff46 /* DMA transfer */ BGP_REG = 0xff47 /* BG palette data */ OBP0_REG = 0xff48 /* OBJ palette 0 data */ OBP1_REG = 0xff49 /* OBJ palette 1 data */ WY_REG = 0xff4a /* Window Y coordinate */ WX_REG = 0xff4b /* Window X coordinate */ KEY1_REG = 0xff4d /* CPU speed */ VBK_REG = 0xff4f /* VRAM bank */ HDMA1_REG = 0xff51 /* DMA control 1 */ HDMA2_REG = 0xff52 /* DMA control 2 */ HDMA3_REG = 0xff53 /* DMA control 3 */ HDMA4_REG = 0xff54 /* DMA control 4 */ HDMA5_REG = 0xff55 /* DMA control 5 */ RP_REG = 0xff56 /* IR port */ BCPS_REG = 0xff68 /* BG color palette specification */ BCPD_REG = 0xff69 /* BG color palette data */ OCPS_REG = 0xff6a /* OBJ color palette specification */ OCPD_REG = 0xff6b /* OBJ color palette data */ SVBK_REG = 0xff70 /* WRAM bank */ IE_REG = 0xffff /* Interrupt enable */ )
Functions ¶
func CGBCompatibility ¶
func CGBCompatibility()
CGBCompatibility Set defaults compatible with normal GameBoy.
func CPUFast ¶
func CPUFast()
CPUFast Set CPU speed to fast operation. Make sure interrupts are disabled before call.
func CPUSlow ¶
func CPUSlow()
CPUSlow Set CPU speed to slow operation. Make sure interrupts are disabled before call.
func DISABLE_RAM_MBC1 ¶
func DISABLE_RAM_MBC1()
func DISABLE_RAM_MBC5 ¶
func DISABLE_RAM_MBC5()
func DISPLAY_OFF ¶
func DISPLAY_OFF()
func DISPLAY_ON ¶
func DISPLAY_ON()
func Delay ¶
func Delay(duration UINT16)
Delay NONBANKED
Delays the given number of milliseconds. Uses no timers or interrupts, and can be called with interrupts disabled (why nobody knows :)
func DisableInterrupts ¶
func DisableInterrupts()
DisableInterrupts NONBANKED
This function may be called as many times as you like; however the first call to enable_interrupts will re-enable them. @see enable_interrupts
func DisplayOff ¶
func DisplayOff()
DisplayOff NONBANKED
Turns the display off. Waits until the VBL interrupt before turning the display off.
@see DISPLAY_ON
func ENABLE_RAM_MBC1 ¶
func ENABLE_RAM_MBC1()
func ENABLE_RAM_MBC5 ¶
func ENABLE_RAM_MBC5()
func EnableInterrupts ¶
func EnableInterrupts()
EnableInterrupts NONBANKED
Enables unmasked interrupts @see disable_interrupts
func GetBkgData ¶
func GetBkgTiles ¶
func GetSpriteData ¶
func GetSpriteProp ¶
func GetSpriteProp(nb UINT8)
func GetSpriteTile ¶
func GetSpriteTile(nb UINT8)
func GetWinData ¶
func GetWinTiles ¶
func HIDE_SPRITES ¶
func HIDE_SPRITES()
func MoveSprite ¶
func MoveSprite(nb, x, y UINT8)
func NowaitIntHandler ¶
func NowaitIntHandler()
NowaitIntHandler NONBANKED
Interrupt handler chain terminator that don't wait for .STAT
You must add this handler the last in every interrupt handler chain if you want to change the default interrupt handler behaviour that waits for LCD controller mode to become 1 or 0 before return from the interrupt.
func RemoveJOY ¶
func RemoveJOY(h IntHandler)
RemoveJOY NONBANKED
The remove functions will remove any interrupt handler. A handler of NULL will cause bad things to happen.
func RemoveLCD ¶
func RemoveLCD(h IntHandler)
RemoveLCD NONBANKED
The remove functions will remove any interrupt handler. A handler of NULL will cause bad things to happen.
func RemoveSIO ¶
func RemoveSIO(h IntHandler)
RemoveSIO NONBANKED
The remove functions will remove any interrupt handler. A handler of NULL will cause bad things to happen.
func RemoveTIM ¶
func RemoveTIM(h IntHandler)
RemoveTIM NONBANKED
The remove functions will remove any interrupt handler. A handler of NULL will cause bad things to happen.
func RemoveVBL ¶
func RemoveVBL(h IntHandler)
RemoveVBL NONBANKED
The remove functions will remove any interrupt handler. A handler of NULL will cause bad things to happen.
func Reset ¶
func Reset()
Reset NONBANKED
Performs a warm reset by reloading the CPU value then jumping to the start of crt0 (0x0150)
func SHOW_SPRITES ¶
func SHOW_SPRITES()
func SPRITES_8x8 ¶
func SPRITES_8x8()
func SPRITES_8x16 ¶
func SPRITES_8x16()
func SWITCH_4_32_MODE_MBC1 ¶
func SWITCH_4_32_MODE_MBC1()
func SWITCH_16_8_MODE_MBC1 ¶
func SWITCH_16_8_MODE_MBC1()
func SWITCH_RAM_MBC1 ¶
func SWITCH_RAM_MBC1(b BYTE)
func SWITCH_RAM_MBC5 ¶
func SWITCH_RAM_MBC5(b BYTE)
func SWITCH_ROM_MBC1 ¶
func SWITCH_ROM_MBC1(b BYTE)
func SWITCH_ROM_MBC5 ¶
func SWITCH_ROM_MBC5(b BYTE)
func ScrollSprite ¶
func ScrollSprite(nb, x, y UINT8)
func SetBkgData ¶
func SetBkgPalette ¶
SetBkgPalette Set bkg palette(s).
func SetBkgPaletteEntry ¶
SetBkgPaletteEntry Set a bkg palette entry.
func SetBkgTiles ¶
func SetInterrupts ¶
func SetInterrupts(flags UINT8)
SetInterrupts NONBANKED
Clears any pending interrupts and sets the interrupt mask register IO to flags.
@see VBL_IFLAG
@param flags A logical OR of *_IFLAGS
func SetMode ¶
func SetMode(m UINT8)
SetMode NONBANKED
gbdk: void mode(UINT8 m) NONBANKED;
Set the current mode - one of M_* defined above
func SetSpriteData ¶
func SetSpritePalette ¶
SetSpritePalette Set sprite palette(s).
func SetSpritePaletteEntry ¶
SetSpritePaletteEntry Set a sprite palette entry.
func SetSpriteProp ¶
func SetSpriteProp(nb, prop UINT8)
func SetSpriteTile ¶
func SetSpriteTile(nb, tile UINT8)
func SetWinData ¶
func SetWinTiles ¶
func WaitIntHandler ¶
func WaitIntHandler()
WaitIntHandler NONBANKED
Interrupt handler chain terminator that waits for .STAT and returns in the BEGINNING of mode0 or mode1 ONLY
func WaitVBLDone ¶
func WaitVBLDone()
WaitVBLDone NONBANKED
Waits for the vertical blank interrupt (VBL) to finish. This can be used to sync animation with the screen re-draw. If VBL interrupt is disabled, this function will never return. If the screen is off this function returns immediately.
Types ¶
type UINT8 ¶
type UINT8 uint8
func Joypad ¶
func Joypad() UINT8
Joypad Reads and returns the current state of the joypad. Follows Nintendo's guidelines for reading the pad. Return value is an OR of J_*
@see J_START