1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /***************************************************************************
4 
5     Atari "Stella on Steroids" hardware
6 
7 ***************************************************************************/
8 #ifndef MAME_INCLUDES_BEATHEAD_H
9 #define MAME_INCLUDES_BEATHEAD_H
10 
11 #pragma once
12 
13 #include "machine/timer.h"
14 #include "cpu/asap/asap.h"
15 #include "audio/atarijsa.h"
16 #include "emupal.h"
17 #include "screen.h"
18 
19 class beathead_state : public driver_device
20 {
21 public:
beathead_state(const machine_config & mconfig,device_type type,const char * tag)22 	beathead_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_maincpu(*this, "maincpu"),
25 		m_palette(*this, "palette"),
26 		m_screen(*this, "screen"),
27 		m_jsa(*this, "jsa"),
28 		m_scan_timer(*this, "scan_timer"),
29 		m_videoram(*this, "videoram"),
30 		m_vram_bulk_latch(*this, "vram_bulk_latch"),
31 		m_palette_select(*this, "palette_select"),
32 		m_ram_base(*this, "ram_base"),
33 		m_rom_base(*this, "rom_base")
34 	{ }
35 
36 	void beathead(machine_config &config);
37 
38 protected:
39 	// in drivers/beathead.cpp
40 	void update_interrupts();
41 	void interrupt_control_w(offs_t offset, uint32_t data);
42 	uint32_t interrupt_control_r();
43 	void sound_reset_w(offs_t offset, uint32_t data);
44 	void coin_count_w(offs_t offset, uint32_t data);
45 
46 	// in video/beathead.cpp
47 	void vram_transparent_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
48 	void vram_bulk_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
49 	void vram_latch_w(offs_t offset, uint32_t data);
50 	void vram_copy_w(offs_t offset, uint32_t data);
51 	void finescroll_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
52 	uint32_t hsync_ram_r(offs_t offset);
53 	void hsync_ram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
54 	TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
55 
56 	virtual void machine_reset() override;
57 	virtual void video_start() override;
58 	void main_map(address_map &map);
59 
60 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61 
62 private:
63 	required_device<cpu_device> m_maincpu;
64 	required_device<palette_device> m_palette;
65 	required_device<screen_device> m_screen;
66 
67 	required_device<atari_jsa_iii_device> m_jsa;
68 	required_device<timer_device> m_scan_timer;
69 
70 	required_shared_ptr<uint32_t> m_videoram;
71 
72 	required_shared_ptr<uint32_t> m_vram_bulk_latch;
73 	required_shared_ptr<uint32_t> m_palette_select;
74 
75 	uint32_t          m_finescroll;
76 	offs_t          m_vram_latch_offset;
77 
78 	offs_t          m_hsyncram_offset;
79 	offs_t          m_hsyncram_start;
80 	uint8_t           m_hsyncram[0x800];
81 
82 	required_shared_ptr<uint32_t> m_ram_base;
83 	required_shared_ptr<uint32_t> m_rom_base;
84 
85 	attotime        m_hblank_offset;
86 
87 	uint8_t           m_irq_line_state;
88 	uint8_t           m_irq_enable[3];
89 	uint8_t           m_irq_state[3];
90 };
91 
92 #endif // MAME_INCLUDES_BEATHEAD_H
93