From 353aa038e55e2f2c10ba981043a15242f0ee8e83 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 23 Jul 2020 15:23:56 +1000 Subject: [PATCH] galaxy: cleanup --- src/mame/drivers/galaxy.cpp | 101 +++++++++++++++--------------------- src/mame/includes/galaxy.h | 38 +++++++------- src/mame/machine/galaxy.cpp | 72 ++++++------------------- src/mame/video/galaxy.cpp | 68 ++++++++++++------------ 4 files changed, 110 insertions(+), 169 deletions(-) diff --git a/src/mame/drivers/galaxy.cpp b/src/mame/drivers/galaxy.cpp index 8d4b39b8500..dfcde1713cb 100644 --- a/src/mame/drivers/galaxy.cpp +++ b/src/mame/drivers/galaxy.cpp @@ -21,6 +21,10 @@ Galaksija driver by Krzysztof Strzecha and Miodrag Milanovic 03/01/2001 Snapshot loading added. 01/01/2001 Preliminary driver. +ToDo: +- pacmanp not showing its hi-res graphics - get black screen +- is the hack in the video still needed? commenting it out made no difference. + ***************************************************************************/ #include "emu.h" @@ -28,13 +32,8 @@ Galaksija driver by Krzysztof Strzecha and Miodrag Milanovic #include "cpu/z80/z80.h" #include "formats/gtp_cas.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/ram.h" #include "sound/ay8910.h" #include "emupal.h" -#include "screen.h" -#include "softlist.h" #include "speaker.h" @@ -49,19 +48,21 @@ void galaxy_state::galaxyp_io(address_map &map) void galaxy_state::galaxy_mem(address_map &map) { - map(0x0000, 0x0fff).rom(); - map(0x2000, 0x2037).mirror(0x07c0).r(FUNC(galaxy_state::galaxy_keyboard_r)); - map(0x2038, 0x203f).mirror(0x07c0).w(FUNC(galaxy_state::galaxy_latch_w)); + map(0x0000, 0x1fff).rom(); + map(0x2000, 0x2037).mirror(0x07c0).r(FUNC(galaxy_state::keyboard_r)); + map(0x2038, 0x203f).mirror(0x07c0).w(FUNC(galaxy_state::latch_w)); + // see init_galaxy for ram placement } void galaxy_state::galaxyp_mem(address_map &map) { map(0x0000, 0x0fff).rom(); // ROM A map(0x1000, 0x1fff).rom(); // ROM B - map(0x2000, 0x2037).mirror(0x07c0).r(FUNC(galaxy_state::galaxy_keyboard_r)); - map(0x2038, 0x203f).mirror(0x07c0).w(FUNC(galaxy_state::galaxy_latch_w)); - map(0xe000, 0xefff).rom(); // ROM C - map(0xf000, 0xffff).rom(); // ROM D + map(0x2000, 0x2037).mirror(0x07c0).r(FUNC(galaxy_state::keyboard_r)); + map(0x2038, 0x203f).mirror(0x07c0).w(FUNC(galaxy_state::latch_w)); + map(0x2800, 0xdfff).ram(); + map(0xe000, 0xefff).rom().region("maincpu",0x2000); // ROM C + map(0xf000, 0xffff).rom().region("maincpu",0x3000); // ROM D } /* 2008-05 FP: @@ -70,7 +71,7 @@ Small note about natural keyboard support. Currently: - "Break" is mapped to 'F1' - "Repeat" is mapped to 'F2' */ -static INPUT_PORTS_START (galaxy_common) +static INPUT_PORTS_START (galaxy) PORT_START("LINE0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') @@ -140,24 +141,12 @@ static INPUT_PORTS_START (galaxy_common) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END -static INPUT_PORTS_START( galaxy ) - PORT_INCLUDE( galaxy_common ) - PORT_START("ROM2") - PORT_CONFNAME(0x01, 0x01, "ROM 2") - PORT_CONFSETTING(0x01, "Installed") - PORT_CONFSETTING(0x00, "Not installed") + PORT_START("LINE7") INPUT_PORTS_END -static INPUT_PORTS_START( galaxyp ) - PORT_INCLUDE( galaxy_common ) -INPUT_PORTS_END - -#define XTAL 6144000 - /* F4 Character Displayer */ -static const gfx_layout galaxy_charlayout = +static const gfx_layout charlayout = { 8, 16, /* 8 x 16 characters */ 128, /* 128 characters */ @@ -171,19 +160,17 @@ static const gfx_layout galaxy_charlayout = }; static GFXDECODE_START( gfx_galaxy ) - GFXDECODE_ENTRY( "gfx1", 0x0000, galaxy_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "chargen", 0x0000, charlayout, 0, 1 ) GFXDECODE_END void galaxy_state::galaxy(machine_config &config) { /* basic machine hardware */ - Z80(config, m_maincpu, XTAL / 2); + Z80(config, m_maincpu, 6'144'000 / 2); m_maincpu->set_addrmap(AS_PROGRAM, &galaxy_state::galaxy_mem); - m_maincpu->set_vblank_int("screen", FUNC(galaxy_state::galaxy_interrupt)); - m_maincpu->set_irq_acknowledge_callback(FUNC(galaxy_state::galaxy_irq_callback)); - - MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxy ) + m_maincpu->set_vblank_int("screen", FUNC(galaxy_state::irq0_line_hold)); + m_maincpu->set_irq_acknowledge_callback(FUNC(galaxy_state::irq_callback)); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -191,7 +178,7 @@ void galaxy_state::galaxy(machine_config &config) m_screen->set_palette("palette"); m_screen->set_size(384, 212); m_screen->set_visarea(0, 384-1, 0, 208-1); - m_screen->set_screen_update(FUNC(galaxy_state::screen_update_galaxy)); + m_screen->set_screen_update(FUNC(galaxy_state::screen_update)); GFXDECODE(config, "gfxdecode", "palette", gfx_galaxy); PALETTE(config, "palette", palette_device::MONOCHROME); @@ -216,13 +203,11 @@ void galaxy_state::galaxy(machine_config &config) void galaxy_state::galaxyp(machine_config &config) { /* basic machine hardware */ - Z80(config, m_maincpu, XTAL / 2); + Z80(config, m_maincpu, 6'144'000 / 2); m_maincpu->set_addrmap(AS_PROGRAM, &galaxy_state::galaxyp_mem); m_maincpu->set_addrmap(AS_IO, &galaxy_state::galaxyp_io); - m_maincpu->set_vblank_int("screen", FUNC(galaxy_state::galaxy_interrupt)); - m_maincpu->set_irq_acknowledge_callback(FUNC(galaxy_state::galaxy_irq_callback)); - - MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxyp ) + m_maincpu->set_vblank_int("screen", FUNC(galaxy_state::irq0_line_hold)); + m_maincpu->set_irq_acknowledge_callback(FUNC(galaxy_state::irq_callback)); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -230,17 +215,18 @@ void galaxy_state::galaxyp(machine_config &config) m_screen->set_palette("palette"); m_screen->set_size(384, 208); m_screen->set_visarea(0, 384-1, 0, 208-1); - m_screen->set_screen_update(FUNC(galaxy_state::screen_update_galaxy)); + m_screen->set_screen_update(FUNC(galaxy_state::screen_update)); + GFXDECODE(config, "gfxdecode", "palette", gfx_galaxy); PALETTE(config, "palette", palette_device::MONOCHROME); - /* snapshot */ SNAPSHOT(config, "snapshot", "gal").set_load_callback(FUNC(galaxy_state::snapshot_cb)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - AY8910(config, "ay8910", XTAL/4); // FIXME: really no output routes for this AY? + ay8910_device &ay(AY8910(config, "ay8910", 6'144'000 / 4)); + ay.add_route(ALL_OUTPUTS, "mono", 0.50); CASSETTE(config, m_cassette); m_cassette->set_formats(gtp_cassette_formats); @@ -249,28 +235,27 @@ void galaxy_state::galaxyp(machine_config &config) m_cassette->set_interface("galaxy_cass"); SOFTWARE_LIST(config, "cass_list").set_original("galaxy"); - - /* internal ram */ - RAM(config, RAM_TAG).set_default_size("38K"); } ROM_START (galaxy) - ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739)) - ROM_LOAD_OPTIONAL ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "galrom1.dd8", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739) ) + ROM_LOAD( "galrom2.dd9", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "galchr.dd3", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88) ) ROM_END ROM_START (galaxyp) - ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739)) - ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) - ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) + ROM_REGION( 0x4000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(dfc92163654a756b70f5a446daf49d7534f4c739) ) + ROM_LOAD( "galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1) ) + ROM_LOAD( "galplus.bin", 0x2000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "galchr.dd3", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88) ) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1983, galaxy, 0, 0, galaxy, galaxy, galaxy_state, init_galaxy, "Voja Antonic / Elektronika inzenjering", "Galaksija", 0) -COMP( 1985, galaxyp, galaxy, 0, galaxyp, galaxyp, galaxy_state, init_galaxyp, "Nenad Dunjic", "Galaksija plus", 0) +COMP( 1983, galaxy, 0, 0, galaxy, galaxy, galaxy_state, init_galaxy, "Voja Antonic / Elektronika inzenjering", "Galaksija", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, galaxyp, galaxy, 0, galaxyp, galaxy, galaxy_state, init_galaxyp, "Nenad Dunjic", "Galaksija plus", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/galaxy.h b/src/mame/includes/galaxy.h index 1e2c529f71d..59885dc1753 100644 --- a/src/mame/includes/galaxy.h +++ b/src/mame/includes/galaxy.h @@ -24,9 +24,9 @@ public: , m_screen(*this, "screen") , m_cassette(*this, "cassette") , m_ram(*this, RAM_TAG) - , m_region_gfx1(*this, "gfx1") - { - } + , m_p_chargen(*this, "chargen") + , m_io_keyboard(*this, "LINE%u", 0U) + { } void galaxy(machine_config &config); void galaxyp(machine_config &config); @@ -35,29 +35,20 @@ public: void init_galaxyp(); private: - uint8_t galaxy_keyboard_r(offs_t offset); - void galaxy_latch_w(uint8_t data); - virtual void video_start() override; - DECLARE_MACHINE_RESET(galaxy); - DECLARE_MACHINE_RESET(galaxyp); - uint32_t screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(galaxy_interrupt); + uint8_t keyboard_r(offs_t offset); + void latch_w(uint8_t data); + void machine_start() override; + void machine_reset() override; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(gal_video); - IRQ_CALLBACK_MEMBER(galaxy_irq_callback); - void galaxy_set_timer(); - void galaxy_setup_snapshot (const uint8_t * data, uint32_t size); + IRQ_CALLBACK_MEMBER(irq_callback); + void set_timer(); + void setup_snapshot (const uint8_t * data, uint32_t size); DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb); void galaxy_mem(address_map &map); void galaxyp_io(address_map &map); void galaxyp_mem(address_map &map); - required_device m_maincpu; - required_device m_screen; - required_device m_cassette; - required_device m_ram; - required_memory_region m_region_gfx1; - ioport_port *m_io_ports[8]; - int m_interrupts_enabled; uint8_t m_latch_value; uint32_t m_gal_cnt; @@ -66,6 +57,13 @@ private: uint32_t m_start_addr; emu_timer *m_gal_video_timer; bitmap_ind16 m_bitmap; + + required_device m_maincpu; + required_device m_screen; + required_device m_cassette; + optional_device m_ram; + required_region_ptr m_p_chargen; + required_ioport_array<8> m_io_keyboard; }; #endif // MAME_INCLUDES_GALAXY_H diff --git a/src/mame/machine/galaxy.cpp b/src/mame/machine/galaxy.cpp index cc003d99ce3..e8badb08f6e 100644 --- a/src/mame/machine/galaxy.cpp +++ b/src/mame/machine/galaxy.cpp @@ -17,7 +17,7 @@ I/O devices ***************************************************************************/ -uint8_t galaxy_state::galaxy_keyboard_r(offs_t offset) +uint8_t galaxy_state::keyboard_r(offs_t offset) { if (offset == 0) { @@ -25,12 +25,10 @@ uint8_t galaxy_state::galaxy_keyboard_r(offs_t offset) return (level > 0) ? 0xfe : 0xff; } else - { - return m_io_ports[(offset>>3) & 0x07]->read() & (0x01<<(offset & 0x07)) ? 0xfe : 0xff; - } + return m_io_keyboard[(offset>>3) & 0x07]->read() & (0x01<<(offset & 0x07)) ? 0xfe : 0xff; } -void galaxy_state::galaxy_latch_w(uint8_t data) +void galaxy_state::latch_w(uint8_t data) { double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; m_latch_value = data; @@ -43,14 +41,9 @@ void galaxy_state::galaxy_latch_w(uint8_t data) Interrupts ***************************************************************************/ -INTERRUPT_GEN_MEMBER(galaxy_state::galaxy_interrupt) +IRQ_CALLBACK_MEMBER(galaxy_state::irq_callback) { - device.execute().set_input_line(0, HOLD_LINE); -} - -IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback) -{ - galaxy_set_timer(); + set_timer(); m_interrupts_enabled = true; return 0xff; } @@ -62,7 +55,7 @@ IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback) #define GALAXY_SNAPSHOT_V1_SIZE 8268 #define GALAXY_SNAPSHOT_V2_SIZE 8244 -void galaxy_state::galaxy_setup_snapshot(const uint8_t * data, uint32_t size) +void galaxy_state::setup_snapshot(const uint8_t * data, uint32_t size) { switch (size) { @@ -138,7 +131,7 @@ SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb) image.fread( snapshot_data, snapshot_size); - galaxy_setup_snapshot(snapshot_data, snapshot_size); + setup_snapshot(snapshot_data, snapshot_size); return image_init_result::PASS; } @@ -150,62 +143,29 @@ SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb) void galaxy_state::init_galaxy() { - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - address_space &space = m_maincpu->space(AS_PROGRAM); space.install_readwrite_bank( 0x2800, 0x2800 + m_ram->size() - 1, "bank1"); membank("bank1")->set_base(m_ram->pointer()); if (m_ram->size() < (6 + 48) * 1024) - { space.nop_readwrite( 0x2800 + m_ram->size(), 0xffff); - } +} - for ( int i = 0; i < 8; i++ ) - { - m_io_ports[i] = ioport( keynames[i] ); - } +void galaxy_state::init_galaxyp() +{ + uint8_t *ROM = memregion("maincpu")->base(); + ROM[0x0037] = 0x29; + ROM[0x03f9] = 0xcd; + ROM[0x03fa] = 0x00; + ROM[0x03fb] = 0xe0; } /*************************************************************************** Machine Initialization ***************************************************************************/ -MACHINE_RESET_MEMBER(galaxy_state,galaxy) +void galaxy_state::machine_reset() { - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* ROM 2 enable/disable */ - if (ioport("ROM2")->read()) { - space.install_read_bank(0x1000, 0x1fff, "bank10"); - } else { - space.nop_read(0x1000, 0x1fff); - } - space.nop_write(0x1000, 0x1fff); - - if (ioport("ROM2")->read()) - membank("bank10")->set_base(memregion("maincpu")->base() + 0x1000); - m_interrupts_enabled = true; } -void galaxy_state::init_galaxyp() -{ - init_galaxy(); -} - -MACHINE_RESET_MEMBER(galaxy_state,galaxyp) -{ - uint8_t *ROM = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - - ROM[0x0037] = 0x29; - ROM[0x03f9] = 0xcd; - ROM[0x03fa] = 0x00; - ROM[0x03fb] = 0xe0; - - space.install_read_bank(0xe000, 0xefff, "bank11"); - space.nop_write(0xe000, 0xefff); - membank("bank11")->set_base(memregion("maincpu")->base() + 0xe000); - m_interrupts_enabled = true; -} diff --git a/src/mame/video/galaxy.cpp b/src/mame/video/galaxy.cpp index 3b03991d3bb..a74a5631566 100644 --- a/src/mame/video/galaxy.cpp +++ b/src/mame/video/galaxy.cpp @@ -12,9 +12,7 @@ #include "emu.h" #include "includes/galaxy.h" - #include "cpu/z80/z80.h" -#include "screen.h" TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) @@ -23,19 +21,17 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) int y, x; if (m_interrupts_enabled == true) { - uint8_t *gfx = m_region_gfx1->base(); - uint8_t dat = (m_latch_value & 0x3c) >> 2; + uint8_t dat = BIT(m_latch_value, 2, 4); if ((m_gal_cnt >= 48 * 2) && (m_gal_cnt < 48 * 210)) // display on screen just m_first 208 lines { - uint8_t mode = (m_latch_value >> 1) & 1; // bit 2 latch represents mode - uint16_t addr = (m_maincpu->state_int(Z80_I) << 8) | m_maincpu->state_int(Z80_R) | ((m_latch_value & 0x80) ^ 0x80); - if (mode == 0) + uint16_t addr = (m_maincpu->state_int(Z80_I) << 8) | m_maincpu->state_int(Z80_R) | (~m_latch_value & 0x80); + if (!BIT(m_latch_value, 1)) // bit 2 latch represents mode { // Text mode if (m_first == 0 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) { // Due to a fact that on real processor latch value is set at - // the end of last cycle we need to skip dusplay of double + // the end of last cycle we need to skip display of double // m_first char in each row m_code = 0x00; m_first = 1; @@ -44,27 +40,27 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) { m_code = space.read_byte(addr) & 0xbf; m_code += (m_code & 0x80) >> 1; - m_code = gfx[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; + m_code = m_p_chargen[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; m_first = 0; } y = m_gal_cnt / 48 - 2; x = (m_gal_cnt % 48) * 8; - m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; + m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix16(y, x ) = BIT(m_code, 7); } else { // Graphics mode if (m_first < 4 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) { // Due to a fact that on real processor latch value is set at - // the end of last cycle we need to skip dusplay of 4 times + // the end of last cycle we need to skip display of 4 times // m_first char in each row m_code = 0x00; m_first++; @@ -79,40 +75,35 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) /* hack - until calc of R is fixed in Z80 */ if (x == 11 * 8 && y == 0) - { m_start_addr = addr; - } + if ((x / 8 >= 11) && (x / 8 < 44)) - { m_code = space.read_byte(m_start_addr + y * 32 + (m_gal_cnt % 48) - 11) ^ 0xff; - } else - { m_code = 0x00; - } /* end of hack */ - m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; + m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix16(y, x ) = BIT(m_code, 7); } } m_gal_cnt++; } } -void galaxy_state::galaxy_set_timer() +void galaxy_state::set_timer() { m_gal_cnt = 0; m_gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8)); } -void galaxy_state::video_start() +void galaxy_state::machine_start() { m_gal_cnt = 0; @@ -120,9 +111,16 @@ void galaxy_state::video_start() m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); m_screen->register_screen_bitmap(m_bitmap); + + save_item(NAME(m_interrupts_enabled)); + save_item(NAME(m_latch_value)); + save_item(NAME(m_gal_cnt)); + save_item(NAME(m_code)); + save_item(NAME(m_first)); + save_item(NAME(m_start_addr)); } -uint32_t galaxy_state::screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t galaxy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); if (m_interrupts_enabled == false)