1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_GENERALPLUS_GPL16250_NAND_H
4 #define MAME_INCLUDES_GENERALPLUS_GPL16250_NAND_H
5 
6 #pragma once
7 
8 #include "includes/generalplus_gpl16250.h"
9 #include "machine/generalplus_gpl16250soc.h"
10 #include "machine/generalplus_gpl16250.h"
11 #include "bus/generic/slot.h"
12 #include "bus/generic/carts.h"
13 
14 #include "screen.h"
15 #include "speaker.h"
16 
17 
18 class generalplus_gpac800_game_state : public gcm394_game_state
19 {
20 public:
generalplus_gpac800_game_state(const machine_config & mconfig,device_type type,const char * tag)21 	generalplus_gpac800_game_state(const machine_config& mconfig, device_type type, const char* tag) :
22 		gcm394_game_state(mconfig, type, tag),
23 		m_nandregion(*this, "nandrom"),
24 		m_sdram_kwords(0x400000), // 0x400000 words (0x800000 bytes)
25 		m_initial_copy_words(0x2000)
26 	{
27 	}
28 
29 	void generalplus_gpac800(machine_config &config);
30 
31 	void nand_init210();
32 	void nand_init210_32mb();
33 	void nand_init840();
34 	void nand_wlsair60();
35 	void nand_vbaby();
36 	void nand_tsm();
37 	void nand_beambox();
38 	void nand_kiugames();
39 
40 protected:
41 	virtual void machine_start() override;
42 	virtual void machine_reset() override;
43 
44 	uint8_t read_nand(offs_t offset);
45 	std::vector<uint16_t> m_sdram;
46 	std::vector<uint16_t> m_sdram2;
47 
48 	virtual uint16_t cs0_r(offs_t offset) override;
49 	virtual void cs0_w(offs_t offset, uint16_t data) override;
50 	virtual uint16_t cs1_r(offs_t offset) override;
51 	virtual void cs1_w(offs_t offset, uint16_t data) override;
52 
53 private:
54 	optional_region_ptr<uint8_t> m_nandregion;
55 
56 	void nand_create_stripped_region();
57 
58 	std::vector<uint8_t> m_strippedrom;
59 	int m_strippedsize;
60 	int m_size;
61 	int m_nandblocksize;
62 	int m_nandblocksize_stripped;
63 
64 	int m_sdram_kwords;
65 	int m_initial_copy_words;
66 	int m_vectorbase;
67 };
68 
69 
70 class generalplus_gpac800_vbaby_game_state : public generalplus_gpac800_game_state
71 {
72 public:
generalplus_gpac800_vbaby_game_state(const machine_config & mconfig,device_type type,const char * tag)73 	generalplus_gpac800_vbaby_game_state(const machine_config& mconfig, device_type type, const char* tag) :
74 		generalplus_gpac800_game_state(mconfig, type, tag),
75 		m_cart(*this, "cartslot")
76 	{
77 	}
78 
79 	void generalplus_gpac800_vbaby(machine_config &config);
80 
81 protected:
82 	required_device<generic_slot_device> m_cart;
83 	DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load);
84 
85 private:
86 };
87 
88 
89 #endif // MAME_INCLUDES_GENERALPLUS_GPL16250_NAND_H
90 
91