gb.h
Go to the documentation of this file.
#ifndef _GB_H
#define _GB_H
#include <types.h>
#include <stdint.h>
#include <gbdk/version.h>
#include <gb/hardware.h>
// Here NINTENDO means Game Boy & related clones
#define NINTENDO
#ifdef SEGA
#undef SEGA
#endif
#ifdef NINTENDO_NES
#undef NINTENDO_NES
#endif
#ifdef MSX
#undef MSX
#endif
#define SYSTEM_60HZ 0x00
#define SYSTEM_50HZ 0x01
#if defined(__TARGET_ap)
#define ANALOGUEPOCKET
#elif defined(__TARGET_gb)
#define GAMEBOY
#elif defined(__TARGET_duck)
#define MEGADUCK
#endif
#define J_UP 0x04U
#define J_DOWN 0x08U
#define J_LEFT 0x02U
#define J_RIGHT 0x01U
#define J_A 0x10U
#define J_B 0x20U
#define J_SELECT 0x40U
#define J_START 0x80U
#define M_DRAWING 0x01U
#define M_TEXT_OUT 0x02U
#define M_TEXT_INOUT 0x03U
#define M_NO_SCROLL 0x04U
#define M_NO_INTERP 0x08U
#define S_BANK 0x08U
#define S_PALETTE 0x10U
#define S_FLIPX 0x20U
#define S_FLIPY 0x40U
#define S_PRIORITY 0x80U
#define S_PAL(n) n
/* Interrupt flags */
#define EMPTY_IFLAG 0x00U
#define VBL_IFLAG 0x01U
#define LCD_IFLAG 0x02U
#define TIM_IFLAG 0x04U
#define SIO_IFLAG 0x08U
#define JOY_IFLAG 0x10U
/* DMG Palettes */
#define DMG_BLACK 0x03
#define DMG_DARK_GRAY 0x02
#define DMG_LITE_GRAY 0x01
#define DMG_WHITE 0x00
#define DMG_PALETTE(C0, C1, C2, C3) ((uint8_t)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03)))
/* Limits */
#define SCREENWIDTH DEVICE_SCREEN_PX_WIDTH
#define SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT
#define MINWNDPOSX DEVICE_WINDOW_PX_OFFSET_X
#define MINWNDPOSY DEVICE_WINDOW_PX_OFFSET_Y
#define MAXWNDPOSX (DEVICE_WINDOW_PX_OFFSET_X + DEVICE_SCREEN_PX_WIDTH - 1)
#define MAXWNDPOSY (DEVICE_WINDOW_PX_OFFSET_Y + DEVICE_SCREEN_PX_HEIGHT - 1)
typedef void (*int_handler)(void) NONBANKED;
void remove_VBL(int_handler h);
void remove_LCD(int_handler h);
void remove_TIM(int_handler h);
void remove_SIO(int_handler h);
void remove_JOY(int_handler h);
void add_VBL(int_handler h);
void add_LCD(int_handler h);
void add_TIM(int_handler h);
void add_low_priority_TIM(int_handler h);
void add_SIO(int_handler h);
void add_JOY(int_handler h);
void nowait_int_handler(void);
void wait_int_handler(void);
inline uint8_t cancel_pending_interrupts(void) {
return IF_REG = 0;
}
void mode(uint8_t m);
uint8_t get_mode(void) PRESERVES_REGS(b, c, d, e, h, l);
inline uint8_t get_system(void) {
return SYSTEM_60HZ;
}
extern uint8_t _cpu;
#define DMG_TYPE 0x01
#define MGB_TYPE 0xFF
#define CGB_TYPE 0x11
extern uint8_t _is_GBA;
#define GBA_NOT_DETECTED 0x00
#define GBA_DETECTED 0x01
#define DEVICE_SUPPORTS_COLOR (_cpu == CGB_TYPE)
extern volatile uint16_t sys_time;
__REG _vbl_done;
#define VBL_DONE _vbl_done
void send_byte(void);
void receive_byte(void);
extern volatile uint8_t _io_status;
extern volatile uint8_t _io_in;
extern volatile uint8_t _io_out;
/* Status codes */
#define IO_IDLE 0x00U
#define IO_SENDING 0x01U
#define IO_RECEIVING 0x02U
#define IO_ERROR 0x04U
__REG _current_bank;
#define CURRENT_BANK _current_bank
#ifndef BANK
#define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
#endif
#define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
__asm \
.local b___func_ ## VARNAME \
___bank_ ## VARNAME = b___func_ ## VARNAME \
.globl ___bank_ ## VARNAME \
__endasm; \
}
#define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
#define SWITCH_ROM(b) (_current_bank = (b), rROMB0 = (b))
#if defined(__TARGET_duck)
#define SWITCH_RAM(b) (0)
#define ENABLE_RAM
#define DISABLE_RAM
#else
#define SWITCH_RAM(b) (rRAMB = (b))
#define ENABLE_RAM (rRAMG = 0x0A)
#define DISABLE_RAM (rRAMG = 0x00)
#endif
#define SWITCH_ROM_MEGADUCK(b) SWITCH_ROM(b)
#define SWITCH_ROM_MBC1(b) SWITCH_ROM(b)
#define SWITCH_RAM_MBC1(b) SWITCH_RAM(b)
#define ENABLE_RAM_MBC1 ENABLE_RAM
#define DISABLE_RAM_MBC1 DISABLE_RAM
#define SWITCH_16_8_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x00)
#define SWITCH_4_32_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x01)
#define SWITCH_ROM_MBC5(b) (_current_bank = (b), rROMB1 = 0, rROMB0 = (b))
#define SWITCH_ROM_MBC5_8M(b) (rROMB1 = ((uint16_t)(b) >> 8), rROMB0 = (b))
#define SWITCH_RAM_MBC5(b) SWITCH_RAM(b)
#define ENABLE_RAM_MBC5 ENABLE_RAM
#define DISABLE_RAM_MBC5 DISABLE_RAM
void delay(uint16_t d) PRESERVES_REGS(h, l);
uint8_t joypad(void) PRESERVES_REGS(b, c, h, l);
uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b, c, h, l);
void waitpadup(void) PRESERVES_REGS(a, b, c, d, e, h, l);
typedef struct {
uint8_t npads;
union {
struct {
uint8_t joy0, joy1, joy2, joy3;
};
uint8_t joypads[4];
};
} joypads_t;
uint8_t joypad_init(uint8_t npads, joypads_t * joypads) OLDCALL;
void joypad_ex(joypads_t * joypads) PRESERVES_REGS(b, c);
inline void enable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
__asm__("ei");
}
inline void disable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
__asm__("di");
}
void set_interrupts(uint8_t flags) PRESERVES_REGS(b, c, d, e, h, l);
void reset(void);
void vsync(void) PRESERVES_REGS(b, c, d, e, h, l);
void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l);
void display_off(void) PRESERVES_REGS(b, c, d, e, h, l);
void refresh_OAM(void) PRESERVES_REGS(b, c, d, e, h, l);
void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b, c);
#define DISPLAY_ON \
LCDC_REG|=LCDCF_ON
#define DISPLAY_OFF \
display_off();
#define HIDE_LEFT_COLUMN
#define SHOW_LEFT_COLUMN
#define SET_BORDER_COLOR(C)
#define SHOW_BKG \
LCDC_REG|=LCDCF_BGON
#define HIDE_BKG \
LCDC_REG&=~LCDCF_BGON
#define SHOW_WIN \
LCDC_REG|=LCDCF_WINON
#define HIDE_WIN \
LCDC_REG&=~LCDCF_WINON
#define SHOW_SPRITES \
LCDC_REG|=LCDCF_OBJON
#define HIDE_SPRITES \
LCDC_REG&=~LCDCF_OBJON
#define SPRITES_8x16 \
LCDC_REG|=LCDCF_OBJ16
#define SPRITES_8x8 \
LCDC_REG&=~LCDCF_OBJ16
void set_vram_byte(uint8_t * addr, uint8_t v) PRESERVES_REGS(b, c);
uint8_t get_vram_byte(uint8_t * addr) PRESERVES_REGS(b, c, h, l);
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) PRESERVES_REGS(h, l);
#define COMPAT_PALETTE(C0,C1,C2,C3) ((uint8_t)(((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)))
inline void set_2bpp_palette(uint16_t palette) {
palette;
}
extern uint16_t _current_1bpp_colors;
void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) OLDCALL;
inline void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor) {
set_1bpp_colors_ex(fgcolor, bgcolor, 0);
}
void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
#define set_bkg_2bpp_data set_bkg_data
void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
#define set_tile_map set_bkg_tiles
extern uint8_t _map_tile_offset;
inline void set_bkg_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile) {
_map_tile_offset = base_tile;
set_bkg_tiles(x, y, w, h, tiles);
_map_tile_offset = 0;
}
inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
{
VBK_REG = VBK_ATTRIBUTES;
set_bkg_tiles(x, y, w, h, tiles);
VBK_REG = VBK_TILES;
}
void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL;
#define set_tile_submap set_bkg_submap
extern uint8_t _submap_tile_offset;
inline void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) {
_submap_tile_offset = base_tile;
set_bkg_submap(x, y, w, h, map, map_w);
_submap_tile_offset = 0;
}
inline void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
{
VBK_REG = VBK_ATTRIBUTES;
set_bkg_submap(x, y, w, h, map, map_w);
VBK_REG = VBK_TILES;
}
void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t);
#define set_tile_xy set_bkg_tile_xy
inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
{
uint8_t* addr;
VBK_REG = VBK_ATTRIBUTES;
addr = set_bkg_tile_xy(x, y, a);
VBK_REG = VBK_TILES;
return addr;
}
#define set_attribute_xy set_bkg_attribute_xy
uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
inline void move_bkg(uint8_t x, uint8_t y) {
SCX_REG=x, SCY_REG=y;
}
inline void scroll_bkg(int8_t x, int8_t y) {
SCX_REG+=x, SCY_REG+=y;
}
uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) PRESERVES_REGS(h, l);
void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void set_win_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void set_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
inline void set_win_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile) {
_map_tile_offset = base_tile;
set_win_tiles(x, y, w, h, tiles);
_map_tile_offset = 0;
}
void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL;
inline void set_win_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) {
_submap_tile_offset = base_tile;
set_win_submap(x, y, w, h, map, map_w);
_submap_tile_offset = 0;
}
void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t);
uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
inline void move_win(uint8_t x, uint8_t y) {
WX_REG=x, WY_REG=y;
}
inline void scroll_win(int8_t x, int8_t y) {
WX_REG+=x, WY_REG+=y;
}
void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
#define set_sprite_2bpp_data set_sprite_data
void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
typedef struct OAM_item_t {
uint8_t y, x; //< X, Y Coordinates of the sprite on screen
uint8_t tile; //< Sprite tile number
uint8_t prop; //< OAM Property Flags
} OAM_item_t;
extern volatile struct OAM_item_t shadow_OAM[];
__REG _shadow_OAM_base;
#define DISABLE_OAM_DMA \
_shadow_OAM_base = 0
#define DISABLE_VBL_TRANSFER DISABLE_OAM_DMA
#define ENABLE_OAM_DMA \
_shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
#define ENABLE_VBL_TRANSFER ENABLE_OAM_DMA
#define MAX_HARDWARE_SPRITES 40
#define HARDWARE_SPRITE_CAN_FLIP_X 1
#define HARDWARE_SPRITE_CAN_FLIP_Y 1
inline void SET_SHADOW_OAM_ADDRESS(void * address) {
_shadow_OAM_base = (uint8_t)((uint16_t)address >> 8);
}
inline void set_sprite_tile(uint8_t nb, uint8_t tile) {
shadow_OAM[nb].tile=tile;
}
inline uint8_t get_sprite_tile(uint8_t nb) {
return shadow_OAM[nb].tile;
}
inline void set_sprite_prop(uint8_t nb, uint8_t prop) {
shadow_OAM[nb].prop=prop;
}
inline uint8_t get_sprite_prop(uint8_t nb) {
return shadow_OAM[nb].prop;
}
inline void move_sprite(uint8_t nb, uint8_t x, uint8_t y) {
OAM_item_t * itm = &shadow_OAM[nb];
itm->y=y, itm->x=x;
}
inline void scroll_sprite(uint8_t nb, int8_t x, int8_t y) {
OAM_item_t * itm = &shadow_OAM[nb];
itm->y+=y, itm->x+=x;
}
inline void hide_sprite(uint8_t nb) {
shadow_OAM[nb].y = 0;
}
void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len);
void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len);
void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len);
void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL;
void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL PRESERVES_REGS(b, c);
void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL;
inline void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
if (first_tile < 256) {
set_bkg_data(first_tile, nb_tiles, data);
} else {
set_sprite_data(first_tile - 256, nb_tiles, data);
}
}
inline void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
set_bkg_data(first_tile, nb_tiles, data);
}
inline void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
set_sprite_data(first_tile, nb_tiles, data);
}
void init_win(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
void init_bkg(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
void vmemset (void *s, uint8_t c, size_t n) OLDCALL PRESERVES_REGS(b, c);
void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
#define fill_rect fill_bkg_rect
void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
#endif /* _GB_H */
NONBANKED
#define NONBANKED
Definition: types.h:40
OLDCALL
#define OLDCALL
Definition: types.h:21
PRESERVES_REGS
#define PRESERVES_REGS(...)
Definition: types.h:32
hardware.h
IF_REG
__REG IF_REG
Definition: hardware.h:104
SCX_REG
__REG SCX_REG
Definition: hardware.h:307
SCY_REG
__REG SCY_REG
Definition: hardware.h:305
VBK_ATTRIBUTES
#define VBK_ATTRIBUTES
Definition: hardware.h:338
VBK_REG
__REG VBK_REG
Definition: hardware.h:332
VBK_TILES
#define VBK_TILES
Definition: hardware.h:336
WX_REG
__REG WX_REG
Definition: hardware.h:323
WY_REG
__REG WY_REG
Definition: hardware.h:321
__REG
#define __REG
Definition: hardware.h:14
OAM_item_t
struct OAM_item_t OAM_item_t
SET_SHADOW_OAM_ADDRESS
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: gb.h:1866
SYSTEM_60HZ
#define SYSTEM_60HZ
Definition: gb.h:27
_cpu
uint8_t _cpu
_current_1bpp_colors
uint16_t _current_1bpp_colors
_current_bank
__REG _current_bank
Definition: gb.h:534
_io_in
volatile uint8_t _io_in
_io_out
volatile uint8_t _io_out
_io_status
volatile uint8_t _io_status
_is_GBA
uint8_t _is_GBA
_map_tile_offset
uint8_t _map_tile_offset
_shadow_OAM_base
__REG _shadow_OAM_base
Definition: gb.h:1836
_submap_tile_offset
uint8_t _submap_tile_offset
_vbl_done
__REG _vbl_done
Definition: gb.h:476
add_JOY
void add_JOY(int_handler h)
add_LCD
void add_LCD(int_handler h)
add_SIO
void add_SIO(int_handler h)
add_TIM
void add_TIM(int_handler h)
add_VBL
void add_VBL(int_handler h)
add_low_priority_TIM
void add_low_priority_TIM(int_handler h)
b
void b
Definition: gb.h:748
c
uint8_t c
Definition: gb.h:419
cancel_pending_interrupts
uint8_t cancel_pending_interrupts(void)
Definition: gb.h:403
d
uint8_t d
Definition: gb.h:419
delay
void delay(uint16_t d) PRESERVES_REGS(h
disable_interrupts
void disable_interrupts(void) PRESERVES_REGS(a
display_off
void display_off(void) PRESERVES_REGS(b
e
uint8_t e
Definition: gb.h:419
enable_interrupts
void enable_interrupts(void) PRESERVES_REGS(a
fill_bkg_rect
void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b
fill_win_rect
void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b
get_bkg_data
void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
get_bkg_tile_xy
uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
get_bkg_tiles
void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b
get_bkg_xy_addr
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) PRESERVES_REGS(h
get_data
void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len)
get_mode
uint8_t get_mode(void) PRESERVES_REGS(b
get_sprite_data
void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
get_sprite_prop
uint8_t get_sprite_prop(uint8_t nb)
Definition: gb.h:1955
get_sprite_tile
uint8_t get_sprite_tile(uint8_t nb)
Definition: gb.h:1897
get_system
uint8_t get_system(void)
Definition: gb.h:426
get_tiles
void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL
get_vram_byte
uint8_t get_vram_byte(uint8_t *addr) PRESERVES_REGS(b
get_win_data
void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
get_win_tile_xy
uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
get_win_tiles
void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b
get_win_xy_addr
uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) PRESERVES_REGS(h
h
uint8_t h
Definition: gb.h:419
hide_sprite
void hide_sprite(uint8_t nb)
Definition: gb.h:2000
hiramcpy
void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b
init_bkg
void init_bkg(uint8_t c) OLDCALL PRESERVES_REGS(b
init_win
void init_win(uint8_t c) OLDCALL PRESERVES_REGS(b
int_handler
void(* int_handler)(void) NONBANKED
Definition: gb.h:184
joypad
uint8_t joypad(void) PRESERVES_REGS(b
joypad_ex
void joypad_ex(joypads_t *joypads) PRESERVES_REGS(b
joypad_init
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) OLDCALL
l
uint8_t l
Definition: gb.h:419
mode
void mode(uint8_t m)
move_bkg
void move_bkg(uint8_t x, uint8_t y)
Definition: gb.h:1460
move_sprite
void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
Definition: gb.h:1972
move_win
void move_win(uint8_t x, uint8_t y)
Definition: gb.h:1738
nowait_int_handler
void nowait_int_handler(void)
receive_byte
void receive_byte(void)
refresh_OAM
void refresh_OAM(void) PRESERVES_REGS(b
remove_JOY
void remove_JOY(int_handler h)
remove_LCD
void remove_LCD(int_handler h)
remove_SIO
void remove_SIO(int_handler h)
remove_TIM
void remove_TIM(int_handler h)
remove_VBL
void remove_VBL(int_handler h)
reset
void reset(void)
Definition: nes.h:534
scroll_bkg
void scroll_bkg(int8_t x, int8_t y)
Definition: gb.h:1474
scroll_sprite
void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
Definition: gb.h:1988
scroll_win
void scroll_win(int8_t x, int8_t y)
Definition: gb.h:1752
send_byte
void send_byte(void)
set_1bpp_colors
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: gb.h:1038
set_1bpp_colors_ex
void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) OLDCALL
set_2bpp_palette
void set_2bpp_palette(uint16_t palette)
Definition: gb.h:1004
set_bkg_1bpp_data
void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_bkg_attribute_xy
uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
Definition: gb.h:1420
set_bkg_attributes
void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
Definition: gb.h:1236
set_bkg_based_submap
void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile)
Definition: gb.h:1314
set_bkg_based_tiles
void set_bkg_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile)
Definition: gb.h:1181
set_bkg_data
void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_bkg_native_data
void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2167
set_bkg_submap
void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL
Definition: msx.h:627
set_bkg_submap_attributes
void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: gb.h:1368
set_bkg_tile_xy
uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t)
set_bkg_tiles
void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b
set_data
void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len)
set_interrupts
void set_interrupts(uint8_t flags) PRESERVES_REGS(b
set_native_tile_data
void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2144
set_sprite_1bpp_data
void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_sprite_data
void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_sprite_native_data
void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2184
set_sprite_prop
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: gb.h:1945
set_sprite_tile
void set_sprite_tile(uint8_t nb, uint8_t tile)
Definition: gb.h:1886
set_tile_data
void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL PRESERVES_REGS(b
set_tiles
void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL
set_vram_byte
void set_vram_byte(uint8_t *addr, uint8_t v) PRESERVES_REGS(b
set_win_1bpp_data
void set_win_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_win_based_submap
void set_win_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile)
Definition: gb.h:1669
set_win_based_tiles
void set_win_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile)
Definition: gb.h:1594
set_win_data
void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_win_submap
void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL
Definition: msx.h:630
set_win_tile_xy
uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t)
set_win_tiles
void set_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b
shadow_OAM
volatile struct OAM_item_t shadow_OAM[]
sys_time
volatile uint16_t sys_time
vmemcpy
void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len)
vmemset
void vmemset(void *s, uint8_t c, size_t n) OLDCALL PRESERVES_REGS(b
vsync
void vsync(void) PRESERVES_REGS(b
wait_int_handler
void wait_int_handler(void)
wait_vbl_done
void wait_vbl_done(void) PRESERVES_REGS(b
waitpad
uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b
waitpadup
void waitpadup(void) PRESERVES_REGS(a
stdint.h
int8_t
signed char int8_t
Definition: stdint.h:43
uint16_t
unsigned short int uint16_t
Definition: stdint.h:52
uint8_t
unsigned char uint8_t
Definition: stdint.h:51
OAM_item_t
Definition: gb.h:1823
OAM_item_t::prop
uint8_t prop
Definition: gb.h:1826
OAM_item_t::tile
uint8_t tile
Definition: gb.h:1825
OAM_item_t::x
uint8_t x
Definition: gb.h:1824
OAM_item_t::y
uint8_t y
Definition: gb.h:1824
joypads_t
Definition: gb.h:755
joypads_t::joy0
uint8_t joy0
Definition: gb.h:759
joypads_t::npads
uint8_t npads
Definition: gb.h:756
version.h