27 #if defined(__TARGET_msxdos)
33 #define SYSTEM_60HZ 0x00
34 #define SYSTEM_50HZ 0x01
36 #define VBK_REG VDP_ATTR_SHIFT
51 #define J_UP 0b00100000
52 #define J_DOWN 0b01000000
53 #define J_LEFT 0b00010000
54 #define J_RIGHT 0b10000000
55 #define J_A 0b00000001
56 #define J_B 0b00000100
57 #define J_SELECT 0b00001000
58 #define J_START 0b00000010
64 #define M_TEXT_OUT 0x02U
65 #define M_TEXT_INOUT 0x03U
71 #define M_NO_SCROLL 0x04U
75 #define M_NO_INTERP 0x08U
88 #define S_PALETTE 0x08U
91 #define S_PRIORITY 0x10U
95 #define S_PAL(n) (((n) & 0x01U) << 3)
98 #define __WRITE_VDP_REG_UNSAFE(REG, v) shadow_##REG=(v),VDP_CMD=(shadow_##REG),VDP_CMD=REG
99 #define __WRITE_VDP_REG(REG, v) shadow_##REG=(v);__asm__("di");VDP_CMD=(shadow_##REG);VDP_CMD=REG;__asm__("ei")
100 #define __READ_VDP_REG(REG) shadow_##REG
129 #define EMPTY_IFLAG 0x00U
135 #define VBL_IFLAG 0x01U
139 #define LCD_IFLAG 0x02U
142 #define TIM_IFLAG 0x04U
145 #define SIO_IFLAG 0x08U
148 #define JOY_IFLAG 0x10U
155 #define SCREENWIDTH DEVICE_SCREEN_PX_WIDTH
158 #define SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT
161 #define MINWNDPOSX 0x00U
164 #define MINWNDPOSY 0x00U
167 #define MAXWNDPOSX 0x00U
170 #define MAXWNDPOSY 0x00U
256 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_DISP_ON)
261 #define DISPLAY_OFF \
271 #define HIDE_LEFT_COLUMN \
272 __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) |= R0_LCB)
277 #define SHOW_LEFT_COLUMN \
278 __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) &= (~R0_LCB))
282 #define SET_BORDER_COLOR(C) __WRITE_VDP_REG(VDP_R7, ((C) | 0xf0u))
316 #define SPRITES_16x16 \
317 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_SPR_16X16)
321 #define SPRITES_8x8 \
322 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_SPR_16X16))
327 #define DEVICE_SUPPORTS_COLOR (TRUE)
344 #define DIV_REG get_r_reg()
349 #define CURRENT_BANK _current_bank
361 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
376 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
378 .local b___func_ ## VARNAME \
379 ___bank_ ## VARNAME = b___func_ ## VARNAME \
380 .globl ___bank_ ## VARNAME \
393 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
401 #define SWITCH_ROM1 SWITCH_ROM
407 #define SWITCH_ROM2(b) MAP_FRAME2=(b)
413 #define SWITCH_RAM(b) RAM_CONTROL=((b)&1)?RAM_CONTROL|RAMCTL_BANK:RAM_CONTROL&(~RAMCTL_BANK)
418 #define ENABLE_RAM RAM_CONTROL|=RAMCTL_RAM
423 #define DISABLE_RAM RAM_CONTROL&=(~RAMCTL_RAM)
457 uint8_t joy0, joy1, joy2, joy3;
511 #if defined(__TARGET_msxdos)
513 #define RGB(r,g,b) ((r) | ((g) << 2) | ((b) << 4))
514 #define RGB8(r,g,b) (((r) >> 6) | (((g) >> 6) << 2) | (((b) >> 6) << 4))
515 #define RGBHTML(RGB24bit) (((RGB24bit) >> 22) | ((((RGB24bit) & 0xFFFF) >> 14) << 2) | ((((RGB24bit) & 0xFF) >> 6) << 4))
519 #define RGB_RED RGB( 3, 0, 0)
520 #define RGB_DARKRED RGB( 2, 0, 0)
521 #define RGB_GREEN RGB( 0, 3, 0)
522 #define RGB_DARKGREEN RGB( 0, 2, 0)
523 #define RGB_BLUE RGB( 0, 0, 3)
524 #define RGB_DARKBLUE RGB( 0, 0, 2)
525 #define RGB_YELLOW RGB( 3, 3, 0)
526 #define RGB_DARKYELLOW RGB( 2, 2, 0)
527 #define RGB_CYAN RGB( 0, 3, 3)
528 #define RGB_AQUA RGB( 3, 1, 2)
529 #define RGB_PINK RGB( 3, 0, 3)
530 #define RGB_PURPLE RGB( 2, 0, 2)
531 #define RGB_BLACK RGB( 0, 0, 0)
532 #define RGB_DARKGRAY RGB( 1, 1, 1)
533 #define RGB_LIGHTGRAY RGB( 2, 2, 2)
534 #define RGB_WHITE RGB( 3, 3, 3)
539 #error Unrecognized port
546 #define set_bkg_palette_entry set_palette_entry
547 #define set_sprite_palette_entry(palette,entry,rgb_data) set_palette_entry(1,entry,rgb_data)
549 #define set_bkg_palette set_palette
550 #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data)
561 #define COMPAT_PALETTE(C0,C1,C2,C3) (((uint16_t)(C3) << 12) | ((uint16_t)(C2) << 8) | ((uint16_t)(C1) << 4) | (uint16_t)(C0))
602 #define set_bkg_tiles set_tile_map
603 #define set_win_tiles set_tile_map
639 #define fill_bkg_rect fill_rect
640 #define fill_win_rect fill_rect
691 #define DISABLE_VBL_TRANSFER \
696 #define ENABLE_VBL_TRANSFER \
697 _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
701 #define MAX_HARDWARE_SPRITES 32
705 #define HARDWARE_SPRITE_CAN_FLIP_X 0
709 #define HARDWARE_SPRITE_CAN_FLIP_Y 0
786 itm->
y+=
y, itm->
x+=
x;
823 #define set_bkg_tile_xy set_tile_xy
824 #define set_win_tile_xy set_tile_xy
830 #define get_win_xy_addr get_bkg_xy_addr
#define OLDCALL
Definition: types.h:21
#define NONBANKED
Definition: types.h:40
#define PRESERVES_REGS(...)
Definition: types.h:32
#define Z88DK_CALLEE
Definition: types.h:46
#define Z88DK_FASTCALL
Definition: types.h:47
uint16_t palette_color_t
Definition: cgb.h:85
#define VDP_RSCY
Definition: hardware.h:113
#define VDP_R1
Definition: hardware.h:53
#define VDP_RSCX
Definition: hardware.h:108
#define R1_DISP_ON
Definition: hardware.h:58
void set_sprite_tile(uint8_t nb, uint8_t tile)
Definition: msx.h:733
volatile uint8_t _current_bank
Definition: gb.h:522
void d
Definition: msx.h:102
void c
Definition: msx.h:102
void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: msx.h:619
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_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: msx.h:632
void joypad_ex(joypads_t *joypads) Z88DK_FASTCALL PRESERVES_REGS(iyh
void scroll_bkg(int8_t x, int8_t y)
Definition: msx.h:222
void set_sprite_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: msx.h:570
void delay(uint16_t d) Z88DK_FASTCALL
uint16_t _current_2bpp_palette
uint16_t _current_1bpp_colors
void set_default_palette(void)
void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh
void add_SIO(int_handler h) Z88DK_FASTCALL
void vmemcpy(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
void remove_JOY(int_handler h) Z88DK_FASTCALL
volatile struct OAM_item_t shadow_OAM[]
volatile uint8_t _shadow_OAM_OFF
void mode(uint8_t m) OLDCALL
void set_native_sprite_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: msx.h:557
uint8_t get_system(void)
Definition: msx.h:122
uint8_t * set_attributed_tile_xy(uint8_t x, uint8_t y, uint16_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
void add_JOY(int_handler h) Z88DK_FASTCALL
void WRITE_VDP_CMD(uint16_t cmd) Z88DK_FASTCALL PRESERVES_REGS(b
void b
Definition: msx.h:490
void set_bkg_1bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: msx.h:585
void add_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
volatile uint8_t _shadow_OAM_base
Definition: gb.h:1824
uint8_t * set_tile_xy(uint8_t x, uint8_t y, uint8_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
void set_sprite_1bpp_data(uint16_t start, uint16_t ntiles, const void *src) Z88DK_CALLEE
Definition: sms.h:653
uint8_t joypad(void) OLDCALL PRESERVES_REGS(b
void move_bkg(uint8_t x, uint8_t y)
Definition: msx.h:217
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh
uint8_t get_sprite_prop(uint8_t nb)
Definition: msx.h:752
void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
Definition: msx.h:784
void add_TIM(int_handler h) Z88DK_FASTCALL
uint8_t get_mode(void) OLDCALL
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: msx.h:611
void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh
volatile uint16_t sys_time
uint8_t waitpad(uint8_t mask) Z88DK_FASTCALL PRESERVES_REGS(b
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: msx.h:713
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: msx.h:606
void set_bkg_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: msx.h:567
void wait_vbl_done(void) PRESERVES_REGS(b
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 cpu_fast(void)
Definition: msx.h:543
uint8_t get_r_reg(void) PRESERVES_REGS(b
struct OAM_item_t OAM_item_t
void set_data(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
void(* int_handler)(void) NONBANKED
Definition: msx.h:175
#define __READ_VDP_REG(REG)
Definition: msx.h:100
void remove_TIM(int_handler h) Z88DK_FASTCALL
void remove_SIO(int_handler h) Z88DK_FASTCALL
void remove_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(iyh
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: msx.h:748
void set_2bpp_palette(uint16_t palette)
Definition: msx.h:563
void WRITE_VDP_DATA(uint16_t data) Z88DK_FASTCALL PRESERVES_REGS(b
#define __WRITE_VDP_REG(REG, v)
Definition: msx.h:99
void remove_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
void enable_interrupts(void) PRESERVES_REGS(a
void iyh
Definition: msx.h:102
void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
Definition: msx.h:768
uint8_t _submap_tile_offset
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 h
Definition: msx.h:238
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_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: msx.h:622
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: msx.h:627
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) Z88DK_CALLEE
void waitpadup(void) PRESERVES_REGS(b
void SWITCH_ROM(uint8_t bank) Z88DK_FASTCALL PRESERVES_REGS(b
void hide_sprite(uint8_t nb)
Definition: msx.h:794
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: msx.h:581
uint8_t cancel_pending_interrupts(void)
Definition: msx.h:213
void disable_interrupts(void) PRESERVES_REGS(a
void add_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(d
void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) Z88DK_CALLEE
void e
Definition: msx.h:102
void set_interrupts(uint8_t flags) Z88DK_FASTCALL
void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: msx.h:553
void iyl
Definition: msx.h:102
void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE
void vsync(void) PRESERVES_REGS(b
uint8_t get_sprite_tile(uint8_t nb)
Definition: msx.h:744
void l
Definition: msx.h:238
void set_vram_byte(uint8_t *addr, uint8_t v) Z88DK_CALLEE PRESERVES_REGS(iyh
void display_off(void)
Definition: msx.h:248
short int int16_t
Definition: stdint.h:44
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