1 // license:BSD-3-Clause 2 // copyright-holders:zzemu-cn 3 /*************************************************************************** 4 NF500A (TRS80 Level II Basic) 5 09/01/2019 6 7 H-01B (TRS80 Level II Basic) 8 10/05/2019 9 ****************************************************************************/ 10 11 #ifndef MAME_INCLUDES_H01X_H 12 #define MAME_INCLUDES_H01X_H 13 14 #pragma once 15 16 #include "screen.h" 17 #include "speaker.h" 18 #include "emupal.h" 19 #include "cpu/z80/z80.h" 20 #include "machine/ram.h" 21 #include "sound/spkrdev.h" 22 #include "imagedev/cassette.h" 23 #include "formats/trs_cas.h" 24 25 class h01x_state : public driver_device 26 { 27 public: h01x_state(const machine_config & mconfig,device_type type,const char * tag)28 h01x_state(const machine_config &mconfig, device_type type, const char *tag) 29 : driver_device(mconfig, type, tag) 30 , m_maincpu(*this, "maincpu") 31 , m_ram(*this, RAM_TAG) 32 , m_vram(*this, "vram") 33 , m_rom(*this, "maincpu") 34 , m_hzrom(*this, "hzrom") 35 , m_exrom(*this, "exrom") 36 , m_p_videoram(*this, "videoram") 37 , m_speaker(*this, "speaker") 38 , m_cassette(*this, "cassette") 39 , m_io_keyboard(*this, "LINE%u", 0) 40 { } 41 42 void init_h01x(); 43 44 void h01x(machine_config &config); 45 void h01b(machine_config &config); 46 void nf500a(machine_config &config); 47 void h01jce(machine_config &config); 48 49 //private: 50 virtual void video_start() override; 51 52 void h01x_mem_map(address_map &map); 53 void h01x_io_map(address_map &map); 54 55 uint32_t screen_update_h01x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 56 57 uint8_t mem_0000_r(offs_t offset); 58 void mem_0000_w(uint8_t data); 59 uint8_t mem_4000_r(offs_t offset); 60 void mem_4000_w(offs_t offset, uint8_t data); 61 uint8_t mem_8000_r(offs_t offset); 62 void mem_8000_w(offs_t offset, uint8_t data); 63 uint8_t mem_c000_r(offs_t offset); 64 void mem_c000_w(offs_t offset, uint8_t data); 65 66 void port_60_w(uint8_t data); 67 void port_64_w(uint8_t data); 68 void port_70_w(uint8_t data); 69 uint8_t port_50_r(); 70 71 required_device<cpu_device> m_maincpu; 72 required_device<ram_device> m_ram; 73 required_device<ram_device> m_vram; 74 required_memory_region m_rom; 75 required_memory_region m_hzrom; 76 optional_memory_region m_exrom; 77 optional_shared_ptr<u8> m_p_videoram; 78 required_device<speaker_sound_device> m_speaker; 79 required_device<cassette_image_device> m_cassette; 80 required_ioport_array<11> m_io_keyboard; 81 82 protected: 83 virtual void machine_start() override; 84 virtual void machine_reset() override; 85 86 private: 87 uint8_t m_bank; 88 89 uint8_t *m_ram_ptr, *m_rom_ptr, *m_hzrom_ptr, *m_vram_ptr; 90 int m_ram_size; 91 92 TIMER_CALLBACK_MEMBER(cassette_data_callback); 93 bool m_cassette_data; 94 emu_timer *m_cassette_data_timer; 95 double m_old_cassette_val; 96 }; 97 98 #endif // MAME_INCLUDES_H01X_H 99