1 // license:GPL-2.0+ 2 // copyright-holders:Juergen Buchmueller 3 #ifndef MAME_INCLUDES_LAZERCMD_H 4 #define MAME_INCLUDES_LAZERCMD_H 5 6 #pragma once 7 8 #include "cpu/s2650/s2650.h" 9 #include "machine/timer.h" 10 #include "sound/dac.h" 11 #include "emupal.h" 12 13 #define HORZ_RES 32 14 #define VERT_RES 24 15 #define HORZ_CHR 8 16 #define VERT_CHR 10 17 #define VERT_FNT 8 18 19 #define HORZ_BAR 0x40 20 #define VERT_BAR 0x80 21 22 #define MARKER_ACTIVE_L 0x03 23 #define MARKER_ACTIVE_R 0x04 24 #define MARKER_VERT_R 0x0a 25 #define MARKER_HORZ_L 0x0b 26 #define MARKER_VERT_L 0x0c 27 #define MARKER_HORZ_R 0x0d 28 29 #define MARKER_HORZ_ADJ -1 30 #define MARKER_VERT_ADJ -10 31 32 class lazercmd_state : public driver_device 33 { 34 public: lazercmd_state(const machine_config & mconfig,device_type type,const char * tag)35 lazercmd_state(const machine_config &mconfig, device_type type, const char *tag) : 36 driver_device(mconfig, type, tag), 37 m_maincpu(*this, "maincpu"), 38 m_dac0(*this, "dac0"), 39 m_dac1(*this, "dac1"), 40 m_dac2(*this, "dac2"), 41 m_dac3(*this, "dac3"), 42 m_videoram(*this, "videoram"), 43 m_gfxdecode(*this, "gfxdecode"), 44 m_palette(*this, "palette") 45 { } 46 47 void bbonk(machine_config &config); 48 void medlanes(machine_config &config); 49 void lazercmd(machine_config &config); 50 51 void init_lazercmd(); 52 53 private: 54 /* device */ 55 required_device<s2650_device> m_maincpu; 56 optional_device<dac_bit_interface> m_dac0; 57 optional_device<dac_bit_interface> m_dac1; 58 required_device<dac_bit_interface> m_dac2; 59 required_device<dac_bit_interface> m_dac3; 60 /* memory pointers */ 61 required_shared_ptr<uint8_t> m_videoram; 62 63 required_device<gfxdecode_device> m_gfxdecode; 64 required_device<palette_device> m_palette; 65 66 /* video-related */ 67 uint8_t m_marker_x; 68 uint8_t m_marker_y; 69 70 /* misc */ 71 int m_timer_count; 72 uint8_t m_sense_state; 73 uint8_t m_attract; 74 75 void lazercmd_ctrl_port_w(uint8_t data); 76 uint8_t lazercmd_ctrl_port_r(); 77 void lazercmd_data_port_w(uint8_t data); 78 uint8_t lazercmd_data_port_r(); 79 void lazercmd_hardware_w(offs_t offset, uint8_t data); 80 void medlanes_hardware_w(offs_t offset, uint8_t data); 81 void bbonk_hardware_w(offs_t offset, uint8_t data); 82 uint8_t lazercmd_hardware_r(offs_t offset); 83 virtual void machine_start() override; 84 virtual void machine_reset() override; 85 void lazercmd_palette(palette_device &palette) const; 86 uint32_t screen_update_lazercmd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 87 TIMER_DEVICE_CALLBACK_MEMBER(lazercmd_timer); 88 TIMER_DEVICE_CALLBACK_MEMBER(bbonk_timer); 89 int vert_scale(int data); 90 void plot_pattern( bitmap_ind16 &bitmap, int x, int y ); 91 void bbonk_map(address_map &map); 92 void lazercmd_map(address_map &map); 93 void lazercmd_portmap(address_map &map); 94 void medlanes_map(address_map &map); 95 }; 96 97 #endif // MAME_INCLUDES_LAZERCMD_H 98