1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// license:BSD-3-Clause
// copyright-holders:David Haywood
/******************************************************************************
VT video emulation
The VT video is based on the ppu2c0x but with enhanced capabilities such
as 16 colour sprites.
******************************************************************************/
#ifndef MAME_VIDEO_PPU_VT03_H
#define MAME_VIDEO_PPU_VT03_H
#pragma once
#include "video/ppu2c0x.h"
#define MCFG_PPU_VT03_ADD(_tag) \
MCFG_PPU2C0X_ADD(_tag, PPU_VT03)
#define MCFG_PPU_VT03_READ_BG_CB(_devcb) \
devcb = &downcast<ppu_vt03_device &>(*device).set_read_bg_callback(DEVCB_##_devcb);
#define MCFG_PPU_VT03_READ_SP_CB(_devcb) \
devcb = &downcast<ppu_vt03_device &>(*device).set_read_sp_callback(DEVCB_##_devcb);
#define MCFG_PPU_VT03_MODIFY MCFG_DEVICE_MODIFY
#define MCFG_PPU_VT03_SET_PAL_MODE(pmode) \
downcast<ppu_vt03_device &>(*device).set_palette_mode(pmode);
#define MCFG_PPU_VT03_SET_DESCRAMBLE(dsc) \
downcast<ppu_vt03_device &>(*device).set_201x_descramble(dsc);
enum vtxx_pal_mode {
PAL_MODE_VT0x,
PAL_MODE_NEW_RGB,
PAL_MODE_NEW_VG,
PAL_MODE_NEW_RGB12,
};
class ppu_vt03_device : public ppu2c0x_device {
public:
ppu_vt03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_read_bg_callback(Object &&cb) { return m_read_bg.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_read_sp_callback(Object &&cb) { return m_read_sp.set_callback(std::forward<Object>(cb)); }
void set_palette_mode(vtxx_pal_mode pmode) { m_pal_mode = pmode; }
void set_201x_descramble(const uint8_t descramble[6]) { for (int i = 0; i < 6; i++) m_2012_2017_descramble[i] = descramble[i]; }
virtual DECLARE_READ8_MEMBER(read) override;
virtual DECLARE_WRITE8_MEMBER(write) override;
virtual DECLARE_READ8_MEMBER(palette_read) override;
virtual DECLARE_WRITE8_MEMBER(palette_write) override;
virtual void init_palette( palette_device &palette, int first_entry ) override;
virtual void read_tile_plane_data(int address, int color) override;
virtual void shift_tile_plane_data(uint8_t &pix) override;
virtual void draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table) override;
virtual void read_sprite_plane_data(int address) override;
virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx) override;
virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) override;
virtual void read_extra_sprite_bits(int sprite_index) override;
virtual void device_start() override;
virtual void device_reset() override;
void set_201x_reg(int reg, uint8_t data);
uint8_t get_201x_reg(int reg);
uint8_t get_va34();
uint8_t get_m_read_bg4_bg3();
uint8_t get_speva2_speva0();
private:
devcb_read8 m_read_bg;
devcb_read8 m_read_sp;
std::unique_ptr<uint8_t[]> m_newpal;
int m_read_bg4_bg3;
int m_va34;
uint8_t m_extplanebuf[2];
uint8_t m_extra_sprite_bits;
palette_device *m_palette;
uint8_t m_201x_regs[0x20];
uint8_t m_2012_2017_descramble[0x6];
vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x;
void set_2010_reg(uint8_t data);
void set_new_pen(int i);
};
DECLARE_DEVICE_TYPE(PPU_VT03, ppu_vt03_device)
#endif // MAME_VIDEO_PPU_VT03_H
|