summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/wswan.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/wswan.h')
-rw-r--r--src/mame/video/wswan.h118
1 files changed, 63 insertions, 55 deletions
diff --git a/src/mame/video/wswan.h b/src/mame/video/wswan.h
index 0ca4b6d3c1d..f532ae5d3ab 100644
--- a/src/mame/video/wswan.h
+++ b/src/mame/video/wswan.h
@@ -30,12 +30,14 @@ public:
template <typename... T> void set_dmasnd_callback(T &&... args) { m_snd_dma_cb.set(std::forward<T>(args)...); }
void set_vdp_type(int type) { m_vdp_type = type; }
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint8_t vram_r(offs_t offset);
- void vram_w(offs_t offset, uint8_t data);
- uint8_t reg_r(offs_t offset);
- void reg_w(offs_t offset, uint8_t data);
+ u16 vram_r(offs_t offset, u16 mem_mask);
+ void vram_w(offs_t offset, u16 data, u16 mem_mask);
+ u16 reg_r(offs_t offset, u16 mem_mesk);
+ void reg_w(offs_t offset, u16 data, u16 mem_mask);
+
+ auto icons_cb() { return m_icons_cb.bind(); }
enum
{
@@ -61,71 +63,77 @@ protected:
void refresh_scanline();
void scanline_interrupt();
void common_save();
+ u16 swap_bytes(u16 word);
bitmap_ind16 m_bitmap;
- uint8_t m_layer_bg_enable; /* Background layer on/off */
- uint8_t m_layer_fg_enable; /* Foreground layer on/off */
- uint8_t m_sprites_enable; /* Sprites on/off */
- uint8_t m_window_sprites_enable; /* Sprite window on/off */
- uint8_t m_window_fg_mode; /* 0:inside/outside, 1:??, 2:inside, 3:outside */
- uint8_t m_bg_control;
- uint8_t m_current_line; /* Current scanline : 0-158 (159?) */
- uint8_t m_line_compare; /* Line to trigger line interrupt on */
- uint32_t m_sprite_table_address; /* Address of the sprite table */
- uint8_t m_sprite_table_buffer[512];
- uint8_t m_sprite_first; /* First sprite to draw */
- uint8_t m_sprite_count; /* Number of sprites to draw */
- uint8_t m_sprite_first_latch;
- uint8_t m_sprite_count_latch;
- uint16_t m_layer_bg_address; /* Address of the background screen map */
- uint16_t m_layer_fg_address; /* Address of the foreground screen map */
- uint8_t m_window_fg_left; /* Left coordinate of foreground window */
- uint8_t m_window_fg_top; /* Top coordinate of foreground window */
- uint8_t m_window_fg_right; /* Right coordinate of foreground window */
- uint8_t m_window_fg_bottom; /* Bottom coordinate of foreground window */
- uint8_t m_window_sprites_left; /* Left coordinate of sprites window */
- uint8_t m_window_sprites_top; /* Top coordinate of sprites window */
- uint8_t m_window_sprites_right; /* Right coordinate of sprites window */
- uint8_t m_window_sprites_bottom; /* Bottom coordinate of sprites window */
- uint8_t m_layer_bg_scroll_x; /* Background layer X scroll */
- uint8_t m_layer_bg_scroll_y; /* Background layer Y scroll */
- uint8_t m_layer_fg_scroll_x; /* Foreground layer X scroll */
- uint8_t m_layer_fg_scroll_y; /* Foreground layer Y scroll */
- uint8_t m_lcd_control; /* LCD on/off */
- uint8_t m_icons; /* FIXME: What do we do with these? Maybe artwork? */
- uint8_t m_color_mode; /* monochrome/color mode */
- uint8_t m_colors_16; /* 4/16 colors mode */
- uint8_t m_tile_packed; /* layered/packed tile mode switch */
- uint8_t m_timer_hblank_enable; /* Horizontal blank interrupt on/off */
- uint8_t m_timer_hblank_mode; /* Horizontal blank timer mode */
- uint16_t m_timer_hblank_reload; /* Horizontal blank timer reload value */
- uint16_t m_timer_hblank_count; /* Horizontal blank timer counter value */
- uint8_t m_timer_vblank_enable; /* Vertical blank interrupt on/off */
- uint8_t m_timer_vblank_mode; /* Vertical blank timer mode */
- uint16_t m_timer_vblank_reload; /* Vertical blank timer reload value */
- uint16_t m_timer_vblank_count; /* Vertical blank timer counter value */
+ u8 m_layer_bg_enable; // Background layer on/off
+ u8 m_layer_fg_enable; // Foreground layer on/off
+ u8 m_sprites_enable; // Sprites on/off
+ u8 m_window_sprites_enable; // Sprite window on/off
+ u8 m_window_fg_mode; // 0:inside/outside, 1:??, 2:inside, 3:outside
+ u8 m_bg_control;
+ u8 m_current_line; // Current scanline : 0-158 (159?)
+ u8 m_line_compare; // Line to trigger line interrupt on
+ u32 m_sprite_table_address; // Address of the sprite table
+ u16 m_sprite_table_buffer[256];
+ u8 m_sprite_first; // First sprite to draw
+ u8 m_sprite_count; // Number of sprites to draw
+ u8 m_sprite_first_latch;
+ u8 m_sprite_count_latch;
+ u16 m_layer_bg_address; // Address of the background screen map
+ u16 m_layer_fg_address; // Address of the foreground screen map
+ u8 m_window_fg_left; // Left coordinate of foreground window
+ u8 m_window_fg_top; // Top coordinate of foreground window
+ u8 m_window_fg_right; // Right coordinate of foreground window
+ u8 m_window_fg_bottom; // Bottom coordinate of foreground window
+ u8 m_window_sprites_left; // Left coordinate of sprites window
+ u8 m_window_sprites_top; // Top coordinate of sprites window
+ u8 m_window_sprites_right; // Right coordinate of sprites window
+ u8 m_window_sprites_bottom; // Bottom coordinate of sprites window
+ u8 m_layer_bg_scroll_x; // Background layer X scroll
+ u8 m_layer_bg_scroll_y; // Background layer Y scroll
+ u8 m_layer_fg_scroll_x; // Foreground layer X scroll
+ u8 m_layer_fg_scroll_y; // Foreground layer Y scroll
+ u8 m_lcd_control; // LCD on/off
+ u8 m_color_mode; // monochrome/color mode
+ u8 m_colors_16; // 4/16 colors mode
+ u8 m_tile_packed; // layered/packed tile mode switch
+ u8 m_timer_hblank_enable; // Horizontal blank interrupt on/off
+ u8 m_timer_hblank_mode; // Horizontal blank timer mode
+ u16 m_timer_hblank_reload; // Horizontal blank timer reload value
+ u16 m_timer_hblank_count; // Horizontal blank timer counter value
+ u8 m_timer_vblank_enable; // Vertical blank interrupt on/off
+ u8 m_timer_vblank_mode; // Vertical blank timer mode
+ u16 m_timer_vblank_reload; // Vertical blank timer reload value
+ u16 m_timer_vblank_count; // Vertical blank timer counter value
int m_main_palette[8];
emu_timer *m_timer;
- std::vector<uint8_t> m_vram;
- uint8_t *m_palette_vram;
- uint8_t m_palette_port[0x20];
+ std::vector<u16> m_vram;
+ u16 *m_palette_vram;
+ u16 m_palette_port[0x10];
int m_pal[16][16];
- uint8_t m_regs[256];
+ u16 m_regs[128];
irq_cb_delegate m_set_irq_cb;
dmasnd_cb_delegate m_snd_dma_cb;
int m_vdp_type;
+ devcb_write8 m_icons_cb;
+
// timer IDs
- static const device_timer_id TIMER_SCANLINE = 0;
+ static constexpr device_timer_id TIMER_SCANLINE = 0;
// interrupt flags
// these are the same as the wswan.h ones
- static const uint8_t WSWAN_VIDEO_IFLAG_LCMP = 0x10;
- static const uint8_t WSWAN_VIDEO_IFLAG_VBLTMR = 0x20;
- static const uint8_t WSWAN_VIDEO_IFLAG_VBL = 0x40;
- static const uint8_t WSWAN_VIDEO_IFLAG_HBLTMR = 0x80;
+ static constexpr u8 WSWAN_VIDEO_IFLAG_LCMP = 0x10;
+ static constexpr u8 WSWAN_VIDEO_IFLAG_VBLTMR = 0x20;
+ static constexpr u8 WSWAN_VIDEO_IFLAG_VBL = 0x40;
+ static constexpr u8 WSWAN_VIDEO_IFLAG_HBLTMR = 0x80;
+
+ static constexpr size_t WS_VRAM_SIZE = 0x4000 >> 1;
+ static constexpr size_t WSC_VRAM_SIZE = 0x10000 >> 1;
+ static constexpr size_t WSC_VRAM_PALETTE = 0xfe00 >> 1;
};
DECLARE_DEVICE_TYPE(WSWAN_VIDEO, wswan_video_device)