1 // license:GPL-2.0+ 2 // copyright-holders:Juergen Buchmueller 3 /***************************************************************************** 4 * 5 * includes/vtech2.h 6 * 7 ****************************************************************************/ 8 #ifndef MAME_INCLUDES_VTECH2_H 9 #define MAME_INCLUDES_VTECH2_H 10 11 #pragma once 12 13 #include "machine/bankdev.h" 14 #include "bus/generic/carts.h" 15 #include "bus/generic/slot.h" 16 #include "bus/vtech/ioexp/ioexp.h" 17 #include "imagedev/cassette.h" 18 #include "imagedev/flopdrv.h" 19 #include "sound/spkrdev.h" 20 #include "emupal.h" 21 22 #define TRKSIZE_FM 3172 /* size of a standard FM mode track */ 23 24 class vtech2_state : public driver_device 25 { 26 public: vtech2_state(const machine_config & mconfig,device_type type,const char * tag)27 vtech2_state(const machine_config &mconfig, device_type type, const char *tag) 28 : driver_device(mconfig, type, tag) 29 , m_maincpu(*this, "maincpu") 30 , m_speaker(*this, "speaker") 31 , m_cassette(*this, "cassette") 32 , m_cart(*this, "cartslot") 33 , m_laser_file(*this, "floppy%u", 0U) 34 , m_gfxdecode(*this, "gfxdecode") 35 , m_palette(*this, "palette") 36 , m_vram(*this, "videoram") 37 , m_io_keyboard(*this, {"ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROWD", "ROWC", "ROWB", "ROWA"}) 38 , m_banka(*this, "banka") 39 , m_bankb(*this, "bankb") 40 , m_bankc(*this, "bankc") 41 , m_bankd(*this, "bankd") 42 , m_ioexp(*this, "io") 43 { } 44 45 void laser350(machine_config &config); 46 void laser700(machine_config &config); 47 void laser500(machine_config &config); 48 49 void init_laser(); 50 51 DECLARE_INPUT_CHANGED_MEMBER(reset_button); 52 53 protected: 54 virtual void machine_reset() override; 55 virtual void machine_start() override; 56 57 private: 58 void laser_fdc_w(offs_t offset, uint8_t data); 59 void laser_bg_mode_w(uint8_t data); 60 void laser_two_color_w(uint8_t data); 61 uint8_t laser_fdc_r(offs_t offset); 62 void vtech2_palette(palette_device &palette) const; 63 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 64 void mmio_w(uint8_t data); 65 uint8_t mmio_r(offs_t offset); 66 uint8_t cart_r(offs_t offset); 67 DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load); 68 69 void laser_get_track(); 70 void laser_put_track(); 71 72 void io_map(address_map &map); 73 void mem_map(address_map &map); 74 void m_map350(address_map &map); 75 void m_map500(address_map &map); 76 void m_map700(address_map &map); 77 78 void init_waitstates(); 79 80 required_device<cpu_device> m_maincpu; 81 required_device<speaker_sound_device> m_speaker; 82 required_device<cassette_image_device> m_cassette; 83 required_device<generic_slot_device> m_cart; 84 optional_device_array<legacy_floppy_image_device, 2> m_laser_file; 85 required_device<gfxdecode_device> m_gfxdecode; 86 required_device<palette_device> m_palette; 87 optional_shared_ptr<u8> m_vram; 88 required_ioport_array<12> m_io_keyboard; 89 required_device<address_map_bank_device> m_banka; 90 required_device<address_map_bank_device> m_bankb; 91 required_device<address_map_bank_device> m_bankc; 92 required_device<address_map_bank_device> m_bankd; 93 required_device<vtech_ioexp_slot_device> m_ioexp; 94 95 char m_laser_frame_message[64+1]; 96 int m_laser_frame_time; 97 u8 m_laser_latch; 98 uint8_t m_laser_track_x2[2]; 99 uint8_t m_laser_fdc_status; 100 uint8_t m_laser_fdc_data[TRKSIZE_FM]; 101 int m_laser_data; 102 int m_laser_fdc_edge; 103 int m_laser_fdc_bits; 104 int m_laser_drive; 105 int m_laser_fdc_start; 106 int m_laser_fdc_write; 107 int m_laser_fdc_offs; 108 int m_laser_fdc_latch; 109 int m_level_old; 110 int m_cassette_bit; 111 int m_laser_bg_mode; 112 int m_laser_two_color; 113 u8 m_language; 114 u32 m_cart_size; 115 116 memory_region *m_cart_rom; 117 }; 118 119 #endif // MAME_INCLUDES_VTECH2_H 120