|
#define | MSX |
|
#define | SYSTEM_60HZ 0x00 |
|
#define | SYSTEM_50HZ 0x01 |
|
#define | VBK_REG VDP_ATTR_SHIFT |
|
#define | J_UP 0b00100000 |
|
#define | J_DOWN 0b01000000 |
|
#define | J_LEFT 0b00010000 |
|
#define | J_RIGHT 0b10000000 |
|
#define | J_A 0b00000001 |
|
#define | J_B 0b00000100 |
|
#define | J_SELECT 0b00001000 |
|
#define | J_START 0b00000010 |
|
#define | M_TEXT_OUT 0x02U |
|
#define | M_TEXT_INOUT 0x03U |
|
#define | M_NO_SCROLL 0x04U |
|
#define | M_NO_INTERP 0x08U |
|
#define | S_BANK 0x01U |
|
#define | S_FLIPX 0x02U |
|
#define | S_FLIPY 0x04U |
|
#define | S_PALETTE 0x08U |
|
#define | S_PRIORITY 0x10U |
|
#define | S_PAL(n) (((n) & 0x01U) << 3) |
|
#define | __WRITE_VDP_REG_UNSAFE(REG, v) shadow_##REG=(v),VDP_CMD=(shadow_##REG),VDP_CMD=REG |
|
#define | __WRITE_VDP_REG(REG, v) shadow_##REG=(v);__asm__("di");VDP_CMD=(shadow_##REG);VDP_CMD=REG;__asm__("ei") |
|
#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 | SET_BORDER_COLOR(C) __WRITE_VDP_REG(VDP_R7, ((C) | 0xf0u)) |
|
#define | SHOW_BKG |
|
#define | HIDE_BKG |
|
#define | SHOW_WIN |
|
#define | HIDE_WIN |
|
#define | SHOW_SPRITES |
|
#define | HIDE_SPRITES |
|
#define | SPRITES_16x16 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_SPR_16X16) |
|
#define | SPRITES_8x8 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_SPR_16X16)) |
|
#define | DEVICE_SUPPORTS_COLOR (TRUE) |
|
#define | DIV_REG get_r_reg() |
|
#define | CURRENT_BANK _current_bank |
|
#define | BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME ) |
|
#define | BANKREF(VARNAME) |
|
#define | BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME; |
|
#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 |
|
#define | set_win_tiles set_tile_map |
|
#define | fill_bkg_rect fill_rect |
|
#define | fill_win_rect fill_rect |
|
#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 32 |
|
#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 |
|
uint8_t | get_system (void) |
|
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) |
|
uint8_t | get_r_reg (void) PRESERVES_REGS(b |
|
void | SWITCH_ROM (uint8_t bank) Z88DK_FASTCALL PRESERVES_REGS(b |
|
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 | enable_interrupts (void) PRESERVES_REGS(a |
|
void | disable_interrupts (void) PRESERVES_REGS(a |
|
void | set_default_palette (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, const palette_color_t *rgb_data) Z88DK_CALLEE |
|
void | set_native_tile_data (uint16_t start, uint16_t ntiles, const void *src) Z88DK_CALLEE |
|
void | set_bkg_4bpp_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_sprite_1bpp_data (uint16_t start, uint16_t ntiles, const void *src) Z88DK_CALLEE |
|
void | set_native_sprite_data (uint16_t start, uint16_t ntiles, const void *src) |
|
void | set_2bpp_palette (uint16_t palette) |
|
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_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_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_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_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 | fill_rect (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 |
|
HALTs the CPU and waits for the vertical blank interrupt.
This is often used in main loops to idle the CPU at low power until it's time to start the next frame. It's also useful for syncing animation with the screen re-draw.
Warning: If the VBL interrupt is disabled, this function will never return. If the screen is off this function returns immediately.
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
Sets the OAM Property Flags of sprite number nb to those defined in prop.
- Parameters
-
nb | Sprite number, range 0 - 39 |
prop | Property setting (see bitfield description) |
The bits in prop represent:
- Bit 7 - Vertical flip. Dictates which way up the sprite is drawn vertically.
0: normal
1: upside down
- Bit 6 - Horizontal flip. Dictates which way up the sprite is drawn horizontally.
0: normal
1: back to front
- Bit 5 - Priority flag. When this is set, the sprites appear behind the background and window layer.
0: infront
1: behind
- Bit 4 - Unimplemented
- Bit 3 - Unimplemented
- Bit 2 - Unimplemented
- Bit 1 - See bit 0.
- Bit 0 - Bits 0-1 indicate which color palette the sprite should use. Note: only palettes 4 to 7 will be available for NES sprites.
It's recommended to use GBDK constants (eg: S_FLIPY) to configure sprite properties as these are crossplatform.
#define S_FLIPY
Definition: gb.h:96
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: gb.h:1933
#define S_FLIPX
Definition: gb.h:92
#define set_sprite_palette(first_palette, nb_palettes, rgb_data)
Definition: msx.h:550
- See also
- S_PALETTE, S_FLIPX, S_FLIPY, S_PRIORITY
Sets the OAM Property Flags of sprite number nb to those defined in prop.
- Parameters
-
nb | Sprite number, range 0 - 39 |
prop | Property setting (see bitfield description) |
The bits in prop represent:
- Bit 7 - Priority flag. When this is set the sprites appear behind the background and window layer.
0: infront
1: behind
- Bit 6 - Vertical flip. Dictates which way up the sprite is drawn vertically.
0: normal
1:upside down
- Bit 5 - Horizontal flip. Dictates which way up the sprite is drawn horizontally.
0: normal
1:back to front
- Bit 4 - DMG/Non-CGB Mode Only. Assigns either one of the two b/w palettes to the sprite.
0: OBJ palette 0
1: OBJ palette 1
- Bit 3 - GBC only. Dictates from which bank of Sprite Tile Patterns the tile is taken.
0: Bank 0
1: Bank 1
- Bit 2 - See bit 0.
- Bit 1 - See bit 0.
- Bit 0 - GBC only. Bits 0-2 indicate which of the 7 OBJ colour palettes the sprite is assigned.
It's recommended to use GBDK constants (eg: S_FLIPY) to configure sprite properties as these are crossplatform.
- See also
- S_PALETTE, S_FLIPX, S_FLIPY, S_PRIORITY
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 MSX 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