|
#define | SEGA |
|
#define | VBK_REG VDP_ATTR_SHIFT |
|
#define | J_UP 0b00000001 |
|
#define | J_DOWN 0b00000010 |
|
#define | J_LEFT 0b00000100 |
|
#define | J_RIGHT 0b00001000 |
|
#define | J_A 0b00010000 |
|
#define | J_B 0b00100000 |
|
#define | M_TEXT_OUT 0x02U |
|
#define | M_TEXT_INOUT 0x03U |
|
#define | M_NO_SCROLL 0x04U |
|
#define | M_NO_INTERP 0x08U |
|
#define | S_FLIPX 0x02U |
|
#define | S_FLIPY 0x04U |
|
#define | S_PALETTE 0x08U |
|
#define | S_PRIORITY 0x10U |
|
#define | S_PAL(n) 0 |
|
#define | __WRITE_VDP_REG(REG, v) shadow_##REG=(v);__critical{VDP_CMD=(shadow_##REG),VDP_CMD=REG;} |
|
#define | __READ_VDP_REG(REG) shadow_##REG |
|
#define | EMPTY_IFLAG 0x00U |
|
#define | VBL_IFLAG 0x01U |
|
#define | LCD_IFLAG 0x02U |
|
#define | TIM_IFLAG 0x04U |
|
#define | SIO_IFLAG 0x08U |
|
#define | JOY_IFLAG 0x10U |
|
#define | SCREENWIDTH DEVICE_SCREEN_PX_WIDTH |
|
#define | SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT |
|
#define | MINWNDPOSX 0x00U |
|
#define | MINWNDPOSY 0x00U |
|
#define | MAXWNDPOSX 0x00U |
|
#define | MAXWNDPOSY 0x00U |
|
#define | DISPLAY_ON __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_DISP_ON) |
|
#define | DISPLAY_OFF display_off(); |
|
#define | HIDE_LEFT_COLUMN __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) |= R0_LCB) |
|
#define | SHOW_LEFT_COLUMN __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) &= (~R0_LCB)) |
|
#define | SHOW_BKG |
|
#define | HIDE_BKG |
|
#define | SHOW_WIN |
|
#define | HIDE_WIN |
|
#define | SHOW_SPRITES |
|
#define | HIDE_SPRITES |
|
#define | SPRITES_8x16 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_SPR_8X16) |
|
#define | SPRITES_8x8 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_SPR_8X16)) |
|
#define | DEVICE_SUPPORTS_COLOR (TRUE) |
|
#define | _current_bank MAP_FRAME1 |
|
#define | CURRENT_BANK MAP_FRAME1 |
|
#define | BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME ) |
|
#define | BANKREF(VARNAME) |
|
#define | BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME; |
|
#define | SWITCH_ROM(b) MAP_FRAME1=(b) |
|
#define | SWITCH_ROM1 SWITCH_ROM |
|
#define | SWITCH_ROM2(b) MAP_FRAME2=(b) |
|
#define | SWITCH_RAM(b) RAM_CONTROL=((b)&1)?RAM_CONTROL|RAMCTL_BANK:RAM_CONTROL&(~RAMCTL_BANK) |
|
#define | ENABLE_RAM RAM_CONTROL|=RAMCTL_RAM |
|
#define | DISABLE_RAM RAM_CONTROL&=(~RAMCTL_RAM) |
|
#define | set_bkg_palette_entry set_palette_entry |
|
#define | set_sprite_palette_entry(palette, entry, rgb_data) set_palette_entry(1,entry,rgb_data) |
|
#define | set_bkg_palette set_palette |
|
#define | set_sprite_palette(first_palette, nb_palettes, rgb_data) set_palette(1,1,rgb_data) |
|
#define | COMPAT_PALETTE(C0, C1, C2, C3) (((uint16_t)(C3) << 12) | ((uint16_t)(C2) << 8) | ((uint16_t)(C1) << 4) | (uint16_t)(C0)) |
|
#define | set_bkg_tiles set_tile_map_compat |
|
#define | set_win_tiles set_tile_map_compat |
|
#define | fill_bkg_rect fill_rect_compat |
|
#define | fill_win_rect fill_rect_compat |
|
#define | DISABLE_VBL_TRANSFER _shadow_OAM_base = 0 |
|
#define | ENABLE_VBL_TRANSFER _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8) |
|
#define | MAX_HARDWARE_SPRITES 64 |
|
#define | HARDWARE_SPRITE_CAN_FLIP_X 0 |
|
#define | HARDWARE_SPRITE_CAN_FLIP_Y 0 |
|
#define | set_bkg_tile_xy set_tile_xy |
|
#define | set_win_tile_xy set_tile_xy |
|
#define | get_win_xy_addr get_bkg_xy_addr |
|
|
void | WRITE_VDP_CMD (uint16_t cmd) Z88DK_FASTCALL PRESERVES_REGS(b |
|
void | WRITE_VDP_DATA (uint16_t data) Z88DK_FASTCALL PRESERVES_REGS(b |
|
void | mode (uint8_t m) OLDCALL |
|
uint8_t | get_mode (void) OLDCALL |
|
void | set_interrupts (uint8_t flags) Z88DK_FASTCALL |
|
void | remove_VBL (int_handler h) Z88DK_FASTCALL PRESERVES_REGS(iyh |
|
void | remove_LCD (int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b |
|
void | remove_TIM (int_handler h) Z88DK_FASTCALL |
|
void | remove_SIO (int_handler h) Z88DK_FASTCALL |
|
void | remove_JOY (int_handler h) Z88DK_FASTCALL |
|
void | add_VBL (int_handler h) Z88DK_FASTCALL PRESERVES_REGS(d |
|
void | add_LCD (int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b |
|
void | add_TIM (int_handler h) Z88DK_FASTCALL |
|
void | add_SIO (int_handler h) Z88DK_FASTCALL |
|
void | add_JOY (int_handler h) Z88DK_FASTCALL |
|
uint8_t | cancel_pending_interrupts (void) |
|
void | move_bkg (uint8_t x, uint8_t y) |
|
void | scroll_bkg (int8_t x, int8_t y) |
|
void | vsync (void) PRESERVES_REGS(b |
|
void | wait_vbl_done (void) PRESERVES_REGS(b |
|
void | display_off (void) |
|
void | refresh_OAM (void) |
|
void | delay (uint16_t d) Z88DK_FASTCALL |
|
uint8_t | joypad (void) OLDCALL PRESERVES_REGS(b |
|
uint8_t | waitpad (uint8_t mask) Z88DK_FASTCALL PRESERVES_REGS(b |
|
void | waitpadup (void) PRESERVES_REGS(b |
|
uint8_t | joypad_init (uint8_t npads, joypads_t *joypads) Z88DK_CALLEE |
|
void | joypad_ex (joypads_t *joypads) Z88DK_FASTCALL PRESERVES_REGS(iyh |
|
void | set_default_palette (void) |
|
void | cgb_compatibility (void) |
|
void | cpu_fast (void) |
|
void | set_palette_entry (uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_palette (uint8_t first_palette, uint8_t nb_palettes, palette_color_t *rgb_data) Z88DK_CALLEE |
|
void | set_native_tile_data (uint16_t start, uint16_t ntiles, const void *src) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_bkg_4bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_sprite_4bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_2bpp_palette (uint16_t palette) |
|
void | set_tile_2bpp_data (uint16_t start, uint16_t ntiles, const void *src, uint16_t palette) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_bkg_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_sprite_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_bkg_2bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_sprite_2bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_1bpp_colors (uint8_t fgcolor, uint8_t bgcolor) |
|
void | set_tile_1bpp_data (uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_bkg_1bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_sprite_1bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_data (uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | vmemcpy (uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_tile_map (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_tile_map_compat (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
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) |
|
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) |
|
void | set_bkg_attributes (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) |
|
void | set_tile_submap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_tile_submap_compat (uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | set_bkg_submap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) |
|
void | set_win_submap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) |
|
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) |
|
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) |
|
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) |
|
void | fill_rect (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | fill_rect_compat (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
void | SET_SHADOW_OAM_ADDRESS (void *address) |
|
void | set_sprite_tile (uint8_t nb, uint8_t tile) |
|
uint8_t | get_sprite_tile (uint8_t nb) |
|
void | set_sprite_prop (uint8_t nb, uint8_t prop) |
|
uint8_t | get_sprite_prop (uint8_t nb) |
|
void | move_sprite (uint8_t nb, uint8_t x, uint8_t y) |
|
void | scroll_sprite (uint8_t nb, int8_t x, int8_t y) |
|
void | hide_sprite (uint8_t nb) |
|
void | set_vram_byte (uint8_t *addr, uint8_t v) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
uint8_t * | set_attributed_tile_xy (uint8_t x, uint8_t y, uint16_t t) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
uint8_t * | set_tile_xy (uint8_t x, uint8_t y, uint8_t t) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
uint8_t * | get_bkg_xy_addr (uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh |
|
SMS/GG specific functions.
Sets a rectangular area of the Background Tile Map using a sub-region from a source tile map. Useful for scrolling implementations of maps larger than 32 x 32 tiles.
- Parameters
-
x | X Start position in both the Source Tile Map and hardware Background Map tile coordinates. Range 0 - 255 |
y | Y Start position in both the Source Tile Map and hardware Background Map tile coordinates. Range 0 - 255 |
w | Width of area to set in tiles. Range 1 - 255 |
h | Height of area to set in tiles. Range 1 - 255 |
map | Pointer to source tile map data |
map_w | Width of source tile map in tiles. Range 1 - 255 |
Entries are copied from map to the Background Tile Map starting at x, y writing across for w tiles and down for h tiles, using map_w as the rowstride for the source tile map.
The x and y parameters are in Source Tile Map tile coordinates. The location tiles will be written to on the hardware Background Map is derived from those, but only uses the lower 5 bits of each axis, for range of 0-31 (they are bit-masked: x & 0x1F
and y & 0x1F
). As a result the two coordinate systems are aligned together.
In order to transfer tile map data in a way where the coordinate systems are not aligned, an offset from the Source Tile Map pointer can be passed in: (map_ptr + x + (y * map_width))
.
For example, if you want the tile id at 1,2
from the source map to show up at 0,0
on the hardware Background Map (instead of at 1,2
) then modify the pointer address that is passed in: map_ptr + 1 + (2 * map_width)
Use this instead of set_bkg_tiles when the source map is wider than 32 tiles or when writing a width that does not match the source map width.
One byte per source tile map entry.
Writes that exceed coordinate 31 on the x or y axis will wrap around to the Left and Top edges.
See set_bkg_tiles for setting CGB attribute maps with VBK_REG.
- See also
- SHOW_BKG
-
set_bkg_data, set_bkg_tiles, set_win_submap, set_tiles
Sets a rectangular area of the Window Tile Map using a sub-region from a source tile map.
- Parameters
-
x | X Start position in both the Source Tile Map and hardware Window Map tile coordinates. Range 0 - 255 |
y | Y Start position in both the Source Tile Map and hardware Window Map tile coordinates. Range 0 - 255 |
w | Width of area to set in tiles. Range 1 - 255 |
h | Height of area to set in tiles. Range 1 - 255 |
map | Pointer to source tile map data |
map_w | Width of source tile map in tiles. Range 1 - 255 |
Entries are copied from map to the Window Tile Map starting at x, y writing across for w tiles and down for h tiles, using map_w as the rowstride for the source tile map.
The x and y parameters are in Source Tile Map tile coordinates. The location tiles will be written to on the hardware Background Map is derived from those, but only uses the lower 5 bits of each axis, for range of 0-31 (they are bit-masked: x & 0x1F
and y & 0x1F
). As a result the two coordinate systems are aligned together.
In order to transfer tile map data in a way where the coordinate systems are not aligned, an offset from the Source Tile Map pointer can be passed in: (map_ptr + x + (y * map_width))
.
For example, if you want the tile id at 1,2
from the source map to show up at 0,0
on the hardware Background Map (instead of at 1,2
) then modify the pointer address that is passed in: map_ptr + 1 + (2 * map_width)
Use this instead of set_win_tiles when the source map is wider than 32 tiles or when writing a width that does not match the source map width.
One byte per source tile map entry.
Writes that exceed coordinate 31 on the x or y axis will wrap around to the Left and Top edges.
GBC only: VBK_REG determines whether Tile Numbers or Tile Attributes get set.
See set_bkg_tiles for details about CGB attribute maps with VBK_REG.
- See also
- SHOW_WIN, HIDE_WIN, set_win_tiles, set_bkg_submap, set_bkg_tiles, set_bkg_data, set_tiles
Flag for disabling of OAM copying routine
Values:
- 1: OAM copy routine is disabled (non-isr VDP operation may be in progress)
- 0: OAM copy routine is enabled
This flag is modified by all sms/gg GBDK API calls that write to the VDP. It is set to DISABLED when they start and ENABLED when they complete.
- Note
- It is recommended to avoid writing to the Video Display Processor (VDP) during an interrupt service routine (ISR) since it can corrupt the VDP pointer of an VDP operation already in progress.
If it is necessary, this flag can be used during an ISR to determine whether a VDP operation is already in progress. If the value is 1
then avoid writing to the VDP (tiles, map, scrolling, colors, etc).
volatile uint8_t _shadow_OAM_OFF
- See also
- docs_consoles_safe_display_controller_access