28 #define SYSTEM_BITS_NTSC 0x00
29 #define SYSTEM_BITS_PAL 0x40
30 #define SYSTEM_BITS_DENDY 0x80
33 #define SYSTEM_60HZ 0x00
34 #define SYSTEM_50HZ 0x01
36 #define RGB(r,g,b) RGB_TO_NES(((r) | ((g) << 2) | ((b) << 4)))
37 #define RGB8(r,g,b) RGB_TO_NES((((r) >> 6) | (((g) >> 6) << 2) | (((b) >> 6) << 4)))
38 #define RGBHTML(RGB24bit) RGB_TO_NES((((RGB24bit) >> 22) | ((((RGB24bit) & 0xFFFF) >> 14) << 2) | ((((RGB24bit) & 0xFF) >> 6) << 4)))
46 #define RGB_DARKRED 0x06
47 #define RGB_GREEN 0x2A
48 #define RGB_DARKGREEN 0x1A
50 #define RGB_DARKBLUE 0x02
51 #define RGB_YELLOW 0x28
52 #define RGB_DARKYELLOW 0x18
56 #define RGB_PURPLE 0x14
57 #define RGB_BLACK 0x0F
58 #define RGB_DARKGRAY 0x00
59 #define RGB_LIGHTGRAY 0x10
60 #define RGB_WHITE 0x30
91 #define J_SELECT 0x20U
98 #define M_DRAWING 0x01U
99 #define M_TEXT_OUT 0x02U
100 #define M_TEXT_INOUT 0x03U
106 #define M_NO_SCROLL 0x04U
110 #define M_NO_INTERP 0x08U
116 #define S_PALETTE 0x10U
120 #define S_FLIPX 0x40U
124 #define S_FLIPY 0x80U
129 #define S_PRIORITY 0x20U
136 #define DMG_BLACK 0x03
137 #define DMG_DARK_GRAY 0x02
138 #define DMG_LITE_GRAY 0x01
139 #define DMG_WHITE 0x00
159 #define DMG_PALETTE(C0, C1, C2, C3) ((uint8_t)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03)))
164 #define SCREENWIDTH DEVICE_SCREEN_PX_WIDTH
167 #define SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT
253 #define MAX_LCD_ISR_CALLS 4
298 #define CURRENT_BANK _current_bank
310 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
325 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
327 .local b___func_ ## VARNAME \
328 ___bank_ ## VARNAME = b___func_ ## VARNAME \
329 .globl ___bank_ ## VARNAME \
342 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
347 #define SWITCH_ROM_DUMMY(b)
352 #define SWITCH_ROM_UNROM(b) _switch_prg0(b)
359 #define SWITCH_ROM SWITCH_ROM_UNROM
365 #define SWITCH_RAM(b) 0
418 uint8_t joy0, joy1, joy2, joy3;
509 #define DISPLAY_OFF \
515 #define HIDE_LEFT_COLUMN \
516 shadow_PPUMASK &= ~(PPUMASK_SHOW_BG_LC | PPUMASK_SHOW_SPR_LC); \
521 #define SHOW_LEFT_COLUMN \
522 shadow_PPUMASK |= (PPUMASK_SHOW_BG_LC | PPUMASK_SHOW_SPR_LC);
527 #define SET_BORDER_COLOR(C)
533 shadow_PPUMASK |= PPUMASK_SHOW_BG;
539 shadow_PPUMASK &= ~PPUMASK_SHOW_BG;
544 #define SHOW_SPRITES \
545 shadow_PPUMASK |= PPUMASK_SHOW_SPR;
550 #define HIDE_SPRITES \
551 shadow_PPUMASK &= ~PPUMASK_SHOW_SPR;
556 #define SPRITES_8x16 \
557 shadow_PPUCTRL |= PPUCTRL_SPR_8X16;
562 #define SPRITES_8x8 \
563 shadow_PPUCTRL &= ~PPUCTRL_SPR_8X16;
580 #define COMPAT_PALETTE(C0,C1,C2,C3) ((uint8_t)(((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)))
604 #define set_bkg_2bpp_data set_bkg_data
638 #define set_tile_map set_bkg_tiles
813 #define set_tile_submap set_bkg_submap
866 #define set_tile_xy set_bkg_tile_xy
893 #define set_attribute_xy set_bkg_attribute_xy
948 #define set_sprite_2bpp_data set_sprite_data
985 #define DISABLE_OAM_DMA \
990 #define DISABLE_VBL_TRANSFER DISABLE_OAM_DMA
992 #define ENABLE_OAM_DMA \
993 _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
997 #define ENABLE_VBL_TRANSFER ENABLE_OAM_DMA
1001 #define MAX_HARDWARE_SPRITES 64
1005 #define HARDWARE_SPRITE_CAN_FLIP_X 1
1009 #define HARDWARE_SPRITE_CAN_FLIP_Y 1
1159 if (first_tile < 256) {
1161 if(first_tile + nb_tiles > 256)
1206 if (first_tile < 256) {
1208 if(first_tile + nb_tiles > 256)
1240 #define fill_rect fill_bkg_rect
char c
Definition: string.h:20
#define NONBANKED
Definition: types.h:40
uint16_t palette_color_t
Definition: cgb.h:85
uint8_t d
Definition: gb.h:414
uint8_t h
Definition: gb.h:414
__SHADOW_REG bkg_scroll_x
Definition: hardware.h:56
__SHADOW_REG bkg_scroll_y
Definition: hardware.h:57
uint8_t waitpad(uint8_t mask) NO_OVERLAY_LOCALS
void flush_shadow_attributes(void) NO_OVERLAY_LOCALS
void set_bkg_attributes_nes16x16(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *attributes) NO_OVERLAY_LOCALS
void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) NO_OVERLAY_LOCALS
volatile uint8_t _current_bank
Definition: gb.h:522
#define SYSTEM_BITS_NTSC
Definition: nes.h:28
void scroll_bkg(int8_t x, int8_t y)
Definition: nes.h:931
void delay(uint16_t d) NO_OVERLAY_LOCALS
void enable_interrupts(void)
Definition: nes.h:450
uint16_t _current_1bpp_colors
void set_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: nes.h:1158
void disable_interrupts(void)
Definition: nes.h:466
void vmemset(void *s, uint8_t c, size_t n) NO_OVERLAY_LOCALS
void set_sprite_tile(uint8_t nb, uint8_t tile) NO_OVERLAY_LOCALS
Definition: gb.h:1874
uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t) NO_OVERLAY_LOCALS
void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *attributes, uint8_t map_w)
Definition: nes.h:751
volatile struct OAM_item_t shadow_OAM[]
void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) NO_OVERLAY_LOCALS
void move_sprite(uint8_t nb, uint8_t x, uint8_t y) NO_OVERLAY_LOCALS
Definition: gb.h:1960
uint8_t get_system(void)
Definition: nes.h:272
void display_on(void) NO_OVERLAY_LOCALS
void add_VBL(int_handler h) NO_OVERLAY_LOCALS
void set_vram_byte(uint8_t *addr, uint8_t v) NO_OVERLAY_LOCALS
void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) NO_OVERLAY_LOCALS
void scroll_sprite(uint8_t nb, int8_t x, int8_t y) NO_OVERLAY_LOCALS
Definition: gb.h:1976
uint8_t get_sprite_tile(uint8_t nb) NO_OVERLAY_LOCALS
Definition: gb.h:1885
void remove_VBL(int_handler h) NO_OVERLAY_LOCALS
void move_bkg(uint8_t x, uint8_t y)
Definition: nes.h:917
uint8_t _shadow_OAM_base
Definition: gb.h:1824
void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
void wait_vbl_done(void) NO_OVERLAY_LOCALS
void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
Definition: gb.h:2155
void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: nes.h:1205
void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) NO_OVERLAY_LOCALS
void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) NO_OVERLAY_LOCALS
void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
Definition: gb.h:2172
void refresh_OAM(void) NO_OVERLAY_LOCALS
void vsync(void) NO_OVERLAY_LOCALS
volatile uint16_t sys_time
void set_bkg_attribute_xy_nes16x16(uint8_t x, uint8_t y, uint8_t a) NO_OVERLAY_LOCALS
void set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) NO_OVERLAY_LOCALS
void set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
Definition: nes.h:889
uint8_t _switch_prg0(uint8_t bank) NO_OVERLAY_LOCALS
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: nes.h:1013
uint8_t get_sprite_prop(uint8_t nb) NO_OVERLAY_LOCALS
Definition: gb.h:1943
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: nes.h:777
void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *attributes)
Definition: nes.h:688
struct OAM_item_t OAM_item_t
uint8_t joypad(void) NO_OVERLAY_LOCALS
void hide_sprite(uint8_t nb) NO_OVERLAY_LOCALS
Definition: gb.h:1988
void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
void(* int_handler)(void) NONBANKED
Definition: nes.h:171
void set_sprite_prop(uint8_t nb, uint8_t prop) NO_OVERLAY_LOCALS
Definition: gb.h:1933
void display_off(void) NO_OVERLAY_LOCALS
Definition: msx.h:248
#define SYSTEM_60HZ
Definition: nes.h:33
uint8_t palette_color_t
Definition: nes.h:62
void set_2bpp_palette(uint16_t palette)
Definition: nes.h:584
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) NO_OVERLAY_LOCALS
void set_bkg_palette_entry(uint8_t palette, uint8_t entry, palette_color_t rgb_data) NO_OVERLAY_LOCALS
void set_bkg_submap_attributes_nes16x16(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) NO_OVERLAY_LOCALS
void set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) NO_OVERLAY_LOCALS
uint8_t _submap_tile_offset
void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) NO_OVERLAY_LOCALS
uint8_t get_mode(void) NO_OVERLAY_LOCALS
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: nes.h:837
void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) NO_OVERLAY_LOCALS
Definition: msx.h:619
void remove_LCD(int_handler h) NO_OVERLAY_LOCALS
void set_sprite_palette_entry(uint8_t palette, uint8_t entry, palette_color_t rgb_data) NO_OVERLAY_LOCALS
void init_bkg(uint8_t c) NO_OVERLAY_LOCALS
void add_LCD(int_handler h) NO_OVERLAY_LOCALS
#define SYSTEM_50HZ
Definition: nes.h:34
uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) NO_OVERLAY_LOCALS
void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) NO_OVERLAY_LOCALS
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: nes.h:590
void mode(uint8_t m) NO_OVERLAY_LOCALS
void waitpadup(void) NO_OVERLAY_LOCALS
void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len) NO_OVERLAY_LOCALS
void joypad_ex(joypads_t *joypads) NO_OVERLAY_LOCALS
unsigned char uint8_t
Definition: stdint.h:51
unsigned short int uint16_t
Definition: stdint.h:52
signed char int8_t
Definition: stdint.h:43
uint8_t x
Definition: gb.h:1812
uint8_t prop
Definition: gb.h:1814
uint8_t tile
Definition: gb.h:1813
uint8_t y
Definition: gb.h:1812