diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-06-03 13:46:26 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-06-03 13:50:15 -0400 |
commit | 579d0e264697e53529655285a353a634d9744529 (patch) | |
tree | 39559b96951f31c64d4a5c4c9ce733dffb3c468f | |
parent | d1f8985365ae3ed4461355b03c8e5f76d136ec98 (diff) |
qx10.cpp: Code cleanup; use object finders instead of machine().device and memregion (nw)
-rw-r--r-- | src/mame/drivers/qx10.cpp | 108 |
1 files changed, 50 insertions, 58 deletions
diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index 1ff6b19d6a2..b463ed551d6 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -73,10 +73,12 @@ public: m_dma_1(*this, "8237dma_1"), m_dma_2(*this, "8237dma_2"), m_fdc(*this, "upd765"), + m_floppy(*this, "upd765:%u", 0U), m_hgdc(*this, "upd7220"), m_rtc(*this, "rtc"), m_kbd(*this, "kbd"), m_vram_bank(0), + m_char_rom(*this, "chargen"), m_maincpu(*this, "maincpu"), m_screen(*this, "screen"), m_ram(*this, RAM_TAG), @@ -84,22 +86,9 @@ public: { } - required_device<pit8253_device> m_pit_1; - required_device<pit8253_device> m_pit_2; - required_device<pic8259_device> m_pic_m; - required_device<pic8259_device> m_pic_s; - required_device<upd7201_device> m_scc; - required_device<i8255_device> m_ppi; - required_device<am9517a_device> m_dma_1; - required_device<am9517a_device> m_dma_2; - required_device<upd765a_device> m_fdc; - required_device<upd7220_device> m_hgdc; - required_device<mc146818_device> m_rtc; - required_device<rs232_port_device> m_kbd; - uint8_t m_vram_bank; - //required_shared_ptr<uint8_t> m_video_ram; - std::unique_ptr<uint16_t[]> m_video_ram; + void qx10(machine_config &config); +private: uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); virtual void machine_start() override; @@ -134,12 +123,43 @@ public: DECLARE_QUICKLOAD_LOAD_MEMBER(qx10); - uint8_t *m_char_rom; + DECLARE_PALETTE_INIT(qx10); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); + + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + + void qx10_io(address_map &map); + void qx10_mem(address_map &map); + void upd7220_map(address_map &map); + + required_device<pit8253_device> m_pit_1; + required_device<pit8253_device> m_pit_2; + required_device<pic8259_device> m_pic_m; + required_device<pic8259_device> m_pic_s; + required_device<upd7201_device> m_scc; + required_device<i8255_device> m_ppi; + required_device<am9517a_device> m_dma_1; + required_device<am9517a_device> m_dma_2; + required_device<upd765a_device> m_fdc; + required_device_array<floppy_connector, 2> m_floppy; + required_device<upd7220_device> m_hgdc; + required_device<mc146818_device> m_rtc; + required_device<rs232_port_device> m_kbd; + uint8_t m_vram_bank; + //required_shared_ptr<uint8_t> m_video_ram; + std::unique_ptr<uint16_t[]> m_video_ram; + required_region_ptr<uint8_t> m_char_rom; + + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + required_device<ram_device> m_ram; + required_device<palette_device> m_palette; /* FDD */ int m_fdcint; int m_fdcmotor; - int m_fdcready; + //int m_fdcready; /* memory */ int m_membank; @@ -148,23 +168,6 @@ public: uint8_t m_cmosram[0x800]; uint8_t m_color_mode; - - struct{ - uint8_t rx; - }m_rs232c; - - DECLARE_PALETTE_INIT(qx10); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; - required_device<ram_device> m_ram; - required_device<palette_device> m_palette; - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); - void qx10(machine_config &config); - void qx10_io(address_map &map); - void qx10_mem(address_map &map); - void upd7220_map(address_map &map); }; UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) @@ -199,24 +202,17 @@ UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - uint8_t color; - uint8_t tile_data; - uint8_t pen; - for( x = 0; x < pitch; x++ ) + for (int x = 0; x < pitch; x++) { - tile = m_video_ram[((addr+x)*2) >> 1] & 0xff; - attr = m_video_ram[((addr+x)*2) >> 1] >> 8; + int tile = m_video_ram[((addr+x)*2) >> 1] & 0xff; + int attr = m_video_ram[((addr+x)*2) >> 1] >> 8; - color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */ + uint8_t color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */ - for( yi = 0; yi < lr; yi++) + for (int yi = 0; yi < lr; yi++) { - tile_data = (m_char_rom[tile*16+yi]); + uint8_t tile_data = (m_char_rom[tile*16+yi]); if(attr & 8) tile_data^=0xff; @@ -227,16 +223,15 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) if(attr & 0x80 && m_screen->frame_number() & 0x10) //TODO: check for blinking interval tile_data=0; - for( xi = 0; xi < 8; xi++) + for (int xi = 0; xi < 8; xi++) { - int res_x,res_y; - - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; + uint8_t pen; if(yi >= 16) pen = 0; else @@ -399,7 +394,7 @@ WRITE8_MEMBER( qx10_state::fdd_motor_w ) { m_fdcmotor = 1; - machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(false); + m_floppy[0]->get_device()->mon_w(false); // motor off controlled by clock } @@ -407,8 +402,8 @@ READ8_MEMBER( qx10_state::qx10_30_r ) { floppy_image_device *floppy1,*floppy2; - floppy1 = machine().device<floppy_connector>("upd765:0")->get_device(); - floppy2 = machine().device<floppy_connector>("upd765:1")->get_device(); + floppy1 = m_floppy[0]->get_device(); + floppy2 = m_floppy[1]->get_device(); return m_fdcint | /*m_fdcmotor*/ 0 << 1 | @@ -685,9 +680,6 @@ void qx10_state::video_start() { // allocate memory m_video_ram = make_unique_clear<uint16_t[]>(0x30000); - - // find memory regions - m_char_rom = memregion("chargen")->base(); } PALETTE_INIT_MEMBER(qx10_state, qx10) |