1 // license:GPL-2.0+ 2 // copyright-holders:Juergen Buchmueller 3 /****************************************************************************** 4 * Microtan 65 5 * 6 * variables and function prototypes 7 * 8 * Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000 9 * 10 * Thanks go to Geoff Macdonald <mail@geoff.org.uk> 11 * for his site http://www.geoff.org.uk/microtan/index.htm 12 * and to Fabrice Frances <frances@ensica.fr> 13 * for his site http://oric.free.fr/microtan.html 14 * 15 ******************************************************************************/ 16 17 #ifndef MAME_INCLUDES_MICROTAN_H 18 #define MAME_INCLUDES_MICROTAN_H 19 20 #pragma once 21 22 #include "cpu/m6502/m6502.h" 23 #include "cpu/m6809/m6809.h" 24 #include "machine/input_merger.h" 25 #include "machine/timer.h" 26 #include "bus/tanbus/tanbus.h" 27 #include "imagedev/snapquik.h" 28 #include "tilemap.h" 29 30 class microtan_state : public driver_device 31 { 32 public: microtan_state(const machine_config & mconfig,device_type type,const char * tag)33 microtan_state(const machine_config &mconfig, device_type type, const char *tag) 34 : driver_device(mconfig, type, tag) 35 , m_maincpu(*this, "maincpu") 36 , m_irq_line(*this, "irq_line") 37 , m_config(*this, "CONFIG") 38 , m_io_keyboard(*this, "KBD%u", 0) 39 , m_io_keypad(*this, "KPAD%u", 0) 40 , m_keypad(*this, "KEYPAD") 41 , m_tanbus(*this, "tanbus") 42 , m_videoram(*this, "videoram") 43 , m_gfxdecode(*this, "gfxdecode") 44 , m_gfx1(*this, "gfx1") 45 , m_led(*this, "led1") 46 { } 47 48 void mt65(machine_config &config); 49 void micron(machine_config &config); 50 void spinveti(machine_config &config); 51 52 void init_gfx2(); 53 void init_microtan(); 54 55 TIMER_DEVICE_CALLBACK_MEMBER(kbd_scan); 56 uint8_t bffx_r(offs_t offset); 57 void bffx_w(offs_t offset, uint8_t data); 58 DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); 59 60 protected: 61 enum { IRQ_KBD, IRQ_TANBUS }; 62 63 virtual void machine_start() override; 64 virtual void machine_reset() override; 65 virtual void video_start() override; 66 67 required_device<cpu_device> m_maincpu; 68 required_device<input_merger_device> m_irq_line; 69 required_ioport m_config; 70 optional_ioport_array<9> m_io_keyboard; 71 optional_ioport_array<4> m_io_keypad; 72 optional_ioport m_keypad; 73 optional_device<tanbus_device> m_tanbus; 74 75 uint8_t m_keypad_column; 76 uint8_t m_keyboard_ascii; 77 emu_timer *m_pulse_nmi_timer; 78 uint8_t m_keyrows[10]; 79 int m_lastrow; 80 int m_mask; 81 int m_key; 82 int m_repeat; 83 int m_repeater; 84 85 virtual void store_key(int key); 86 87 private: 88 optional_shared_ptr<uint8_t> m_videoram; 89 optional_device<gfxdecode_device> m_gfxdecode; 90 optional_memory_region m_gfx1; 91 output_finder<> m_led; 92 93 uint8_t m_chunky_graphics; 94 std::unique_ptr<uint8_t[]> m_chunky_buffer; 95 tilemap_t *m_bg_tilemap; 96 97 uint8_t sound_r(); 98 void sound_w(uint8_t data); 99 void videoram_w(offs_t offset, uint8_t data); 100 TILE_GET_INFO_MEMBER(get_bg_tile_info); 101 void pgm_chargen_w(offs_t offset, uint8_t data); 102 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 103 TIMER_CALLBACK_MEMBER(pulse_nmi); 104 105 image_verify_result verify_snapshot(uint8_t *data, int size); 106 image_init_result parse_intel_hex(uint8_t *snapshot_buff, char *src); 107 image_init_result parse_zillion_hex(uint8_t *snapshot_buff, char *src); 108 void set_cpu_regs(const uint8_t *snapshot_buff, int base); 109 void snapshot_copy(uint8_t *snapshot_buff, int snapshot_size); 110 DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb); 111 DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); 112 113 void mt65_map(address_map &map); 114 void spinv_map(address_map &map); 115 }; 116 117 118 class mt6809_state : public microtan_state 119 { 120 public: 121 using microtan_state::microtan_state; 122 123 void mt6809(machine_config &config); 124 125 protected: 126 virtual void video_start() override; 127 128 virtual void store_key(int key) override; 129 130 private: 131 uint8_t keyboard_r(); 132 133 void mt6809_map(address_map &map); 134 }; 135 136 #endif // MAME_INCLUDES_MICROTAN_H 137