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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Sinclair ZX8301 emulation
**********************************************************************
_____ _____
DTACKL 1 |* \_/ | 40 WEL
A17 2 | | 39 PCENL
A16 3 | | 38 VDA
RDWL 4 | | 37 ROWL
DSMCL 5 | | 36 TX0EL
VCC 6 | | 35 XTAL2
CLKCPU 7 | | 34 XTAL1
RASL 8 | | 33 ROM0EH
CAS0L 9 | | 32 BLUE
CAS1L 10 | ZX8301 | 31 GREEN
VSYNCH 11 | ULA | 30 RED
CSYNCL 12 | | 29 DB7
DA0 13 | | 28 DA7
DB0 14 | | 27 DA6
VDD 15 | | 26 DB6
DB1 16 | | 25 DB5
DA1 17 | | 24 DA5
DA2 18 | | 23 DB4
DB2 19 | | 22 DA4
DA3 20 |_____________| 21 DB3
**********************************************************************/
#ifndef MAME_VIDEO_ZX8301_H
#define MAME_VIDEO_ZX8301_H
#pragma once
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
#define MCFG_ZX8301_CPU(_tag) \
downcast<zx8301_device &>(*device).set_cpu_tag("^" _tag);
#define MCFG_ZX8301_VSYNC_CALLBACK(_write) \
devcb = &downcast<zx8301_device &>(*device).set_vsync_wr_callback(DEVCB_##_write);
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
// ======================> zx8301_device
class zx8301_device : public device_t,
public device_memory_interface,
public device_video_interface
{
public:
// construction/destruction
zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_vsync_wr_callback(Object &&cb) { return m_write_vsync.set_callback(std::forward<Object>(cb)); }
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
DECLARE_WRITE8_MEMBER( control_w );
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( data_w );
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void zx8301(address_map &map);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_config_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
// address space configurations
const address_space_config m_space_config;
inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t data);
void draw_line_mode4(bitmap_rgb32 &bitmap, int y, uint16_t da);
void draw_line_mode8(bitmap_rgb32 &bitmap, int y, uint16_t da);
private:
enum
{
TIMER_VSYNC,
TIMER_FLASH
};
required_device<cpu_device> m_cpu;
devcb_write_line m_write_vsync;
//address_space *m_data;
int m_dispoff; // display off
int m_mode8; // mode8 active
int m_base; // video ram base address
int m_flash; // flash
int m_vsync; // vertical sync
int m_vda; // valid data address
emu_timer *m_vsync_timer; // vertical sync timer
emu_timer *m_flash_timer; // flash timer
};
// device type definition
DECLARE_DEVICE_TYPE(ZX8301, zx8301_device)
#endif // MAME_VIDEO_ZX8301_H
|