diff options
Diffstat (limited to 'src/devices/machine/spg2xx.h')
-rw-r--r-- | src/devices/machine/spg2xx.h | 126 |
1 files changed, 26 insertions, 100 deletions
diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h index 859620d9f66..806e8395c4d 100644 --- a/src/devices/machine/spg2xx.h +++ b/src/devices/machine/spg2xx.h @@ -37,6 +37,8 @@ #include "cpu/unsp/unsp.h" #include "spg2xx_audio.h" #include "spg2xx_io.h" +#include "spg2xx_sysdma.h" +#include "spg2xx_video.h" #include "screen.h" class spg2xx_device : public device_t, public device_mixer_interface @@ -65,14 +67,16 @@ public: auto chip_select() { return m_chip_sel.bind(); } - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank); - required_device<spg2xx_audio_device> m_spg_audio; required_device<spg2xx_io_device> m_spg_io; + required_device<spg2xx_sysdma_device> m_spg_sysdma; + required_device<spg2xx_video_device> m_spg_video; + + void extint_w(int channel, bool state) { m_spg_io->extint_w(channel, state); } + void uart_rx(uint8_t data) { m_spg_io->uart_rx(data); } - void extint_w(int channel, bool state) { m_spg_io->extint_w(channel, state); }; - void uart_rx(uint8_t data) { m_spg_io->uart_rx(data); }; + DECLARE_WRITE_LINE_MEMBER(vblank) { m_spg_video->vblank(state); } + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return m_spg_video->screen_update(screen, bitmap, cliprect); } protected: spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint32_t sprite_limit) @@ -81,30 +85,7 @@ protected: m_sprite_limit = sprite_limit; } - enum - { - PAGE_ENABLE_MASK = 0x0008, - PAGE_WALLPAPER_MASK = 0x0004, - - SPRITE_ENABLE_MASK = 0x0001, - SPRITE_COORD_TL_MASK = 0x0002, - - PAGE_DEPTH_FLAG_MASK = 0x3000, - PAGE_DEPTH_FLAG_SHIFT = 12, - PAGE_TILE_HEIGHT_MASK = 0x00c0, - PAGE_TILE_HEIGHT_SHIFT = 6, - PAGE_TILE_WIDTH_MASK = 0x0030, - PAGE_TILE_WIDTH_SHIFT = 4, - TILE_X_FLIP = 0x0004, - TILE_Y_FLIP = 0x0008 - }; - - DECLARE_READ16_MEMBER(video_r); - DECLARE_WRITE16_MEMBER(video_w); - - DECLARE_READ16_MEMBER(dma_r); - DECLARE_WRITE16_MEMBER(dma_w); - + DECLARE_WRITE_LINE_MEMBER(videoirq_w); DECLARE_WRITE_LINE_MEMBER(audioirq_w); DECLARE_WRITE_LINE_MEMBER(timerirq_w); DECLARE_WRITE_LINE_MEMBER(uartirq_w); @@ -114,68 +95,18 @@ protected: DECLARE_READ16_MEMBER(space_r); - inline void check_video_irq(); - void spg2xx_map(address_map &map); - static const device_timer_id TIMER_SCREENPOS = 2; - - virtual void device_start() override; virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - void do_cpu_dma(uint32_t len); - - void do_sprite_dma(uint32_t len); - - enum blend_enable_t : bool - { - BlendOff = false, - BlendOn = true - }; - enum rowscroll_enable_t : bool - { - RowScrollOff = false, - RowScrollOn = true - }; - - enum flipx_t : bool - { - FlipXOff = false, - FlipXOn = true - }; - - void apply_saturation(const rectangle &cliprect); - void apply_fade(const rectangle &cliprect); - - template<blend_enable_t Blend, rowscroll_enable_t RowScroll, flipx_t FlipX> - void blit(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile); - void blit_page(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t bitmap_addr, uint16_t *regs); - void blit_sprite(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t base_addr); - void blit_sprites(const rectangle &cliprect, uint32_t scanline, int depth); - - uint8_t mix_channel(uint8_t a, uint8_t b); - - uint32_t m_screenbuf[320 * 240]; - uint8_t m_rgb5_to_rgb8[32]; - uint32_t m_rgb555_to_rgb888[0x8000]; - - bool m_hide_page0; - bool m_hide_page1; - bool m_hide_sprites; - bool m_debug_sprites; - bool m_debug_blit; - bool m_debug_palette; - uint8_t m_sprite_index_to_debug; - - uint16_t m_dma_regs[0x4]; - - uint16_t m_video_regs[0x100]; - uint32_t m_sprite_limit; - int m_rowscrolloffset; // auto racing in 'zone60' minigames needs this to be 15, the JAKKS games (Star Wars Revenge of the sith - Gunship Battle, Wheel of Fortune, Namco Ms. Pac-Man 5-in-1 Pole Position) need it to be 0, where does it come from? + // TODO: these are fixed values, put them in relevant devices? + uint16_t m_sprite_limit; + uint16_t m_rowscrolloffset; // auto racing in 'zone60' minigames needs this to be 15, the JAKKS games (Star Wars Revenge of the sith - Gunship Battle, Wheel of Fortune, Namco Ms. Pac-Man 5-in-1 Pole Position) need it to be 0, where does it come from? uint16_t m_pal_flag; + DECLARE_READ16_MEMBER(get_sprlimit) { return m_sprite_limit; } + DECLARE_READ16_MEMBER(get_rowscrolloffset) { return m_rowscrolloffset; } + DECLARE_READ16_MEMBER(get_pal_ntsc) { return m_pal_flag; } devcb_write16 m_porta_out; devcb_write16 m_portb_out; @@ -197,27 +128,22 @@ protected: required_device<unsp_device> m_cpu; required_device<screen_device> m_screen; - required_shared_ptr<uint16_t> m_scrollram; - required_shared_ptr<uint16_t> m_paletteram; - required_shared_ptr<uint16_t> m_spriteram; void configure_spg_io(spg2xx_io_device* io); - DECLARE_READ16_MEMBER(porta_r) { return m_porta_in(); }; - DECLARE_READ16_MEMBER(portb_r) { return m_portb_in(); }; - DECLARE_READ16_MEMBER(portc_r) { return m_portc_in(); }; - DECLARE_WRITE16_MEMBER(porta_w) { m_porta_out(offset, data, mem_mask); }; - DECLARE_WRITE16_MEMBER(portb_w) { m_portb_out(offset, data, mem_mask); }; - DECLARE_WRITE16_MEMBER(portc_w) { m_portc_out(offset, data, mem_mask); }; - template <size_t Line> DECLARE_READ16_MEMBER(adc_r) { return m_adc_in[Line](); }; + DECLARE_READ16_MEMBER(porta_r) { return m_porta_in(); } + DECLARE_READ16_MEMBER(portb_r) { return m_portb_in(); } + DECLARE_READ16_MEMBER(portc_r) { return m_portc_in(); } + DECLARE_WRITE16_MEMBER(porta_w) { m_porta_out(offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER(portb_w) { m_portb_out(offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER(portc_w) { m_portc_out(offset, data, mem_mask); } + template <size_t Line> DECLARE_READ16_MEMBER(adc_r) { return m_adc_in[Line](); } - DECLARE_WRITE8_MEMBER(eepromx_w) { m_eeprom_w(offset, data, mem_mask); }; + DECLARE_WRITE8_MEMBER(eepromx_w) { m_eeprom_w(offset, data, mem_mask); } DECLARE_READ8_MEMBER(eepromx_r) { return m_eeprom_r(); }; - DECLARE_WRITE8_MEMBER(tx_w) { m_uart_tx(offset, data, mem_mask); }; - DECLARE_WRITE8_MEMBER(cs_w) { m_chip_sel(offset, data, mem_mask); }; - DECLARE_READ16_MEMBER(get_pal_r) { return m_pal_flag; }; - + DECLARE_WRITE8_MEMBER(tx_w) { m_uart_tx(offset, data, mem_mask); } + DECLARE_WRITE8_MEMBER(cs_w) { m_chip_sel(offset, data, mem_mask); } }; class spg24x_device : public spg2xx_device |