diff options
author | 2020-05-03 04:01:57 +1000 | |
---|---|---|
committer | 2020-05-03 04:01:57 +1000 | |
commit | 769764de1b0b0f7647feae902ea2864a947cd9fe (patch) | |
tree | 31d40993ea8c88987e2070c7e5070e66bb27dffb | |
parent | f0928453f6d7749054f818581881f0036dda2065 (diff) |
(nw) super80: cleanup (step 1)
-rw-r--r-- | src/mame/drivers/super80.cpp | 335 | ||||
-rw-r--r-- | src/mame/includes/super80.h | 185 | ||||
-rw-r--r-- | src/mame/machine/super80.cpp | 95 | ||||
-rw-r--r-- | src/mame/video/super80.cpp | 205 |
4 files changed, 386 insertions, 434 deletions
diff --git a/src/mame/drivers/super80.cpp b/src/mame/drivers/super80.cpp index c5d638bfbeb..1f3db3b0983 100644 --- a/src/mame/drivers/super80.cpp +++ b/src/mame/drivers/super80.cpp @@ -7,7 +7,7 @@ Super80.c written by Robbbert, 2005-2010. 2010-12-19: Added V3.7 bios freshly dumped today. 2014-04-28: Added disk system and did cleanups -See the MESS sysinfo and wiki for usage +See the MAME sysinfo and wiki for usage documentation. Below for the most technical bits: = Architecture (super80): @@ -71,8 +71,7 @@ documentation. Below for the most technical bits: = Cassette information: -The standard cassette system uses sequences of 1200 Hz and 2400 Hz to represent a 0 or a 1 respectivly. -This is identical to the Exidy Sorcerer and the Microbee. Data rates available are 300, 400, 600, and 1200 baud. +The standard cassette system uses Kansas City format. Data rates available are 300, 400, 600, and 1200 baud. The user has to adjust some bytes in memory in order to select a different baud rate. BDF8 BDF9 Baud @@ -109,13 +108,13 @@ then reset ready for the next wave state. The code for this is in the TIMER_CALL A kit was produced by ETI magazine, which plugged into the line from your cassette player earphone socket. The computer line was plugged into this box instead of the cassette player. The box was fitted with a speaker and a volume control. You could listen to the tones, to assist with head -alignment, and with debugging. In MESS, a config switch has been provided so that you can turn +alignment, and with debugging. In MAME, a config switch has been provided so that you can turn this sound on or off as needed. = About the 1 MHz / 2 MHz switching: The original hardware runs with a 2 MHz clock, but operates in an unusual way. There is no video -processor chip, just a huge bunch of TTL chips. The system spends half the time running the CPU, +processor chip, just a huge bunch of TTL. The system spends half the time running the CPU, and half the time displaying the picture. The timing will activate the BUSREQ line, and the CPU will finish its current instruction, activate the BUSACK line, and go to sleep. The video circuits will read the video RAM and show the picture. At the end, the BUSREQ line is released, and processing can @@ -131,14 +130,11 @@ a loud hum. When loading, the synchronisation to the start bit could be missed, Therefore the screen can be turned off via an output bit. This disables the BUSREQ control, which in turn prevents screen refresh, and gives the processor a full uninterrupted 2 MHz speed. -MAME does not emulate BUSREQ or BUSACK. Further, a real system would display a blank screen by not -updating the video. In MAME, the display continues to show. It just doesn't update. - To obtain accurate timing, the video update routine will toggle the HALT line on alternate frames. Although physically incorrect, it is the only way to accurately emulate the speed change function. The video update routine emulates the blank screen by filling it with spaces. -For the benefit of those who like to experiment, config switches have been provided in MESS to +For the benefit of those who like to experiment, config switches have been provided in MAME to allow you to leave the screen on at all times, and to always run at 2 MHz if desired. These options cannot exist in real hardware. @@ -154,15 +150,15 @@ speedwise and accuracy-wise. The modified rom had the autorun option built in. Autorun was never available for cassettes. -In MESS, the same file format is used - I can transfer files between MESS and the 386 seamlessly. -MESS has one difference - the program simply appears in memory without the processor being aware +In MAME, the same file format is used - I can transfer files between MAME and the 386 seamlessly. +MAME has one difference - the program simply appears in memory without the processor being aware of it. To accomplish autorun therefore requires that the processor pc register be set to the start address of the program. BASIC programs may need some preprocessing before they can be started. This is not necessary on a Super-80 or a Microbee, but is needed on any system running Microsoft BASIC, such as the Exidy Sorcerer or the VZ-200. -In MESS, quickload is available for all Super80 variants (otherwise you would not have any games -to play). MESS features a config switch so the user can turn autorun on or off as desired. +In MAME, quickload is available for all Super80 variants (otherwise you would not have any games +to play). MAME features a config switch so the user can turn autorun on or off as desired. = Start of Day circuit: @@ -242,33 +238,42 @@ ToDo: /**************************** MEMORY AND I/O MAPPINGS *****************************************************************/ -/* A read_byte or write_byte to unmapped memory crashes MESS, and UNMAP doesnt fix it. - This makes the H and E monitor commands show FF */ -READ8_MEMBER( super80_state::super80_read_ff ) { return 0xff; } - void super80_state::super80_map(address_map &map) { - map(0x0000, 0x3fff).bankrw("boot").region("maincpu", 0x0000); - map(0x4000, 0xbfff).ram().region("maincpu", 0x4000); - map(0xc000, 0xefff).rom(); - map(0xf000, 0xffff).r(FUNC(super80_state::super80_read_ff)).nopw(); + map(0x0000, 0xbfff).lrw8(NAME([this](u16 offset) { return m_ram[offset]; }), + NAME([this](u16 offset, u8 data) { m_ram[offset] = data; })); + map(0x0000, 0x0fff).lr8 (NAME([this](u16 offset) { if(m_boot_in_progress) offset |= 0xc000; return m_ram[offset]; })); + map(0xc000, 0xefff).lr8 (NAME([this](u16 offset) { m_boot_in_progress = false; return m_ram[offset+0xc000]; })); + map(0xf000, 0xffff).lr8 (NAME([this](u16 offset) { return m_ram[offset+0xf000]; })); + map(0xc000, 0xffff).nopw(); } void super80_state::super80m_map(address_map &map) { - map(0x0000, 0x3fff).bankrw("boot").region("maincpu", 0x0000); - map(0x4000, 0xbfff).ram().region("maincpu", 0x4000); - map(0xc000, 0xefff).rom(); - map(0xf000, 0xffff).ram().region("maincpu", 0xf000); + super80_map(map); + map(0xf000, 0xffff).lrw8(NAME([this](u16 offset) { return m_ram[offset+0xf000]; }), + NAME([this](u16 offset, u8 data) { m_ram[offset+0xf000] = data; })); +} + +void super80v_state::super80v_map(address_map &map) +{ + map(0x0000, 0x0fff).lrw8(NAME([this](u16 offset) { if(m_boot_in_progress) return m_rom[offset]; else return m_ram[offset]; }), + NAME([this](u16 offset, u8 data) { m_ram[offset] = data; })); + map(0x1000, 0xbfff).ram(); + map(0xc000, 0xefff).lr8 (NAME([this](u16 offset) { m_boot_in_progress = false; return m_rom[offset]; })); + map(0xf000, 0xf7ff).lrw8(NAME([this](u16 offset) { return super80v_state::low_r(offset); }), + NAME([this](u16 offset, u8 data) { super80v_state::low_w(offset, data); })); + map(0xf800, 0xffff).lrw8(NAME([this](u16 offset) { return super80v_state::high_r(offset); }), + NAME([this](u16 offset, u8 data) { super80v_state::high_w(offset, data); })); } -void super80_state::super80v_map(address_map &map) +void super80r_state::super80r_map(address_map &map) { - map(0x0000, 0x3fff).bankrw("boot"); - map(0x4000, 0xbfff).ram(); - map(0xc000, 0xefff).rom(); - map(0xf000, 0xf7ff).rw(FUNC(super80_state::super80v_low_r), FUNC(super80_state::super80v_low_w)); - map(0xf800, 0xffff).rw(FUNC(super80_state::super80v_high_r), FUNC(super80_state::super80v_high_w)); + super80v_map(map); + map(0xf000, 0xf7ff).lrw8(NAME([this](u16 offset) { return super80r_state::low_r(offset); }), + NAME([this](u16 offset, u8 data) { super80r_state::low_w(offset, data); })); + map(0xf800, 0xffff).lrw8(NAME([this](u16 offset) { return super80r_state::high_r(offset); }), + NAME([this](u16 offset, u8 data) { super80r_state::high_w(offset, data); })); } void super80_state::super80_io(address_map &map) @@ -276,10 +281,10 @@ void super80_state::super80_io(address_map &map) map.global_mask(0xff); map.unmap_value_high(); map(0xdc, 0xdc).r("cent_status_in", FUNC(input_buffer_device::read)); - map(0xdc, 0xdc).w(FUNC(super80_state::super80_dc_w)); - map(0xe0, 0xe0).mirror(0x14).w(FUNC(super80_state::super80_f0_w)); - map(0xe1, 0xe1).mirror(0x14).w(FUNC(super80_state::super80_f1_w)); - map(0xe2, 0xe2).mirror(0x14).r(FUNC(super80_state::super80_f2_r)); + map(0xdc, 0xdc).lw8(NAME([this](u8 data) { super80_state::portdc_w(data); })); + map(0xe0, 0xe0).mirror(0x14).lw8(NAME([this](u8 data) { super80_state::portf0_w(data); })); + map(0xe1, 0xe1).mirror(0x14).lw8(NAME([this](u8 data) { super80_state::portf1_w(data); })); + map(0xe2, 0xe2).mirror(0x14).lr8(NAME([this]() { return super80_state::portf2_r(); })); map(0xf8, 0xfb).mirror(0x04).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); } @@ -288,42 +293,28 @@ void super80_state::super80e_io(address_map &map) map.global_mask(0xff); map.unmap_value_high(); map(0xbc, 0xbc).r("cent_status_in", FUNC(input_buffer_device::read)); - map(0xbc, 0xbc).w(FUNC(super80_state::super80_dc_w)); - map(0xe0, 0xe0).mirror(0x14).w(FUNC(super80_state::super80_f0_w)); - map(0xe1, 0xe1).mirror(0x14).w(FUNC(super80_state::super80_f1_w)); - map(0xe2, 0xe2).mirror(0x14).r(FUNC(super80_state::super80_f2_r)); + map(0xbc, 0xbc).lw8(NAME([this](u8 data) { super80_state::portdc_w(data); })); + map(0xe0, 0xe0).mirror(0x14).lw8(NAME([this](u8 data) { super80_state::portf0_w(data); })); + map(0xe1, 0xe1).mirror(0x14).lw8(NAME([this](u8 data) { super80_state::portf1_w(data); })); + map(0xe2, 0xe2).mirror(0x14).lr8(NAME([this]() { return super80_state::portf2_r(); })); map(0xf8, 0xfb).mirror(0x04).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); } -void super80_state::super80r_io(address_map &map) + +void super80v_state::super80v_io(address_map &map) { map.global_mask(0xff); map.unmap_value_high(); - map(0x10, 0x10).w(FUNC(super80_state::super80v_10_w)); - map(0x11, 0x11).r(m_crtc, FUNC(mc6845_device::register_r)); - map(0x11, 0x11).w(FUNC(super80_state::super80v_11_w)); + map(0x10, 0x10).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); + map(0x11, 0x11).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); map(0x30, 0x30).rw(m_dma, FUNC(z80dma_device::read), FUNC(z80dma_device::write)); map(0x38, 0x3b).rw(m_fdc, FUNC(wd2793_device::read), FUNC(wd2793_device::write)); - map(0x3e, 0x3e).r(FUNC(super80_state::port3e_r)); - map(0x3f, 0x3f).w(FUNC(super80_state::port3f_w)); - map(0xdc, 0xdc).r("cent_status_in", FUNC(input_buffer_device::read)); - map(0xdc, 0xdc).w(FUNC(super80_state::super80_dc_w)); - map(0xe0, 0xe0).mirror(0x14).w(FUNC(super80_state::super80r_f0_w)); - map(0xe2, 0xe2).mirror(0x14).r(FUNC(super80_state::super80_f2_r)); - map(0xf8, 0xfb).mirror(0x04).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); -} - -void super80_state::super80v_io(address_map &map) -{ - map.global_mask(0xff); - map.unmap_value_high(); - map(0x10, 0x10).w(FUNC(super80_state::super80v_10_w)); - map(0x11, 0x11).r(m_crtc, FUNC(mc6845_device::register_r)); - map(0x11, 0x11).w(FUNC(super80_state::super80v_11_w)); + map(0x3e, 0x3e).r(FUNC(super80v_state::port3e_r)); + map(0x3f, 0x3f).w(FUNC(super80v_state::port3f_w)); map(0xdc, 0xdc).r("cent_status_in", FUNC(input_buffer_device::read)); - map(0xdc, 0xdc).w(FUNC(super80_state::super80_dc_w)); - map(0xe0, 0xe0).mirror(0x14).w(FUNC(super80_state::super80_f0_w)); - map(0xe2, 0xe2).mirror(0x14).r(FUNC(super80_state::super80_f2_r)); + map(0xdc, 0xdc).lw8(NAME([this](u8 data) { super80v_state::portdc_w(data); })); + map(0xe0, 0xe0).mirror(0x14).lw8(NAME([this](u8 data) { super80v_state::portf0_w(data); })); + map(0xe2, 0xe2).mirror(0x14).lr8(NAME([this]() { return super80v_state::portf2_r(); })); map(0xf8, 0xfb).mirror(0x04).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); } @@ -606,7 +597,7 @@ static const gfx_layout super80e_charlayout = static const gfx_layout super80v_charlayout = { 8,16, /* 8 x 16 characters */ - 256, /* 256 characters */ + 128, /* 128 characters */ 1, /* 1 bits per pixel */ { 0 }, /* no bitplanes */ /* x offsets */ @@ -633,9 +624,8 @@ static GFXDECODE_START( gfx_super80m ) GFXDECODE_ENTRY( "chargen", 0x1000, super80d_charlayout, 2, 6 ) GFXDECODE_END -/* This will show the 128 characters in the ROM + whatever happens to be in the PCG */ static GFXDECODE_START( gfx_super80v ) - GFXDECODE_ENTRY( "maincpu", 0xf000, super80v_charlayout, 2, 6 ) + GFXDECODE_ENTRY( "chargen", 0x0000, super80v_charlayout, 2, 6 ) GFXDECODE_END @@ -653,7 +643,7 @@ static const z80_daisy_config super80_daisy_chain[] = // Z80DMA //------------------------------------------------- -WRITE_LINE_MEMBER( super80_state::busreq_w ) +WRITE_LINE_MEMBER( super80v_state::busreq_w ) { // since our Z80 has no support for BUSACK, we assume it is granted immediately m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); @@ -661,35 +651,30 @@ WRITE_LINE_MEMBER( super80_state::busreq_w ) m_dma->bai_w(state); // tell dma that bus has been granted } -READ8_MEMBER(super80_state::memory_read_byte) +READ8_MEMBER(super80v_state::memory_read_byte) { address_space& prog_space = m_maincpu->space(AS_PROGRAM); return prog_space.read_byte(offset); } -WRITE8_MEMBER(super80_state::memory_write_byte) +WRITE8_MEMBER(super80v_state::memory_write_byte) { address_space& prog_space = m_maincpu->space(AS_PROGRAM); prog_space.write_byte(offset, data); } -READ8_MEMBER(super80_state::io_read_byte) +READ8_MEMBER(super80v_state::io_read_byte) { address_space& prog_space = m_maincpu->space(AS_IO); return prog_space.read_byte(offset); } -WRITE8_MEMBER(super80_state::io_write_byte) +WRITE8_MEMBER(super80v_state::io_write_byte) { address_space& prog_space = m_maincpu->space(AS_IO); prog_space.write_byte(offset, data); } -void super80_state::machine_start() -{ - m_cass_led.resolve(); -} - static void super80_floppies(device_slot_interface &device) { device.option_add("s80flop", FLOPPY_525_QD); @@ -713,12 +698,10 @@ void super80_state::super80(machine_config &config) m_maincpu->set_addrmap(AS_IO, &super80_state::super80_io); m_maincpu->set_daisy_config(super80_daisy_chain); - MCFG_MACHINE_RESET_OVERRIDE(super80_state, super80) - Z80PIO(config, m_pio, MASTER_CLOCK/6); m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - m_pio->out_pa_callback().set(FUNC(super80_state::pio_port_a_w)); - m_pio->in_pb_callback().set(FUNC(super80_state::pio_port_b_r)); + m_pio->out_pa_callback().set([this](u8 data){ super80_state::pio_port_a_w(data); }); + m_pio->in_pb_callback().set([this](){ return super80_state::pio_port_b_r(); }); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(48.8); @@ -730,7 +713,6 @@ void super80_state::super80(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_super80); config.set_default_layout(layout_super80); - MCFG_VIDEO_START_OVERRIDE(super80_state,super80) /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -797,43 +779,41 @@ void super80_state::super80m(machine_config &config) m_gfxdecode->set_info(gfx_super80m); m_screen->set_screen_update(FUNC(super80_state::screen_update_super80m)); - m_screen->screen_vblank().set(FUNC(super80_state::screen_vblank_super80m)); + m_screen->screen_vblank().set([this](bool state) { super80_state::screen_vblank_super80m(state); }); // software list config.device_remove("cass_list"); SOFTWARE_LIST(config, "cass_list").set_original("super80_cass").set_filter("M"); } -void super80_state::super80v(machine_config &config) +void super80v_state::super80v(machine_config &config) { /* basic machine hardware */ Z80(config, m_maincpu, MASTER_CLOCK/6); /* 2 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &super80_state::super80v_map); - m_maincpu->set_addrmap(AS_IO, &super80_state::super80v_io); + m_maincpu->set_addrmap(AS_PROGRAM, &super80v_state::super80v_map); + m_maincpu->set_addrmap(AS_IO, &super80v_state::super80v_io); m_maincpu->set_daisy_config(super80_daisy_chain); - MCFG_MACHINE_RESET_OVERRIDE(super80_state, super80r) - Z80PIO(config, m_pio, MASTER_CLOCK/6); m_pio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - m_pio->out_pa_callback().set(FUNC(super80_state::pio_port_a_w)); - m_pio->in_pb_callback().set(FUNC(super80_state::pio_port_b_r)); + m_pio->out_pa_callback().set([this](u8 data){ super80v_state::pio_port_a_w(data); }); + m_pio->in_pb_callback().set([this](){ return super80v_state::pio_port_b_r(); }); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(50); m_screen->set_size(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT); m_screen->set_visarea(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1); - m_screen->set_screen_update(FUNC(super80_state::screen_update_super80v)); - m_screen->screen_vblank().set(FUNC(super80_state::screen_vblank_super80m)); + m_screen->set_screen_update(FUNC(super80v_state::screen_update_super80v)); + m_screen->screen_vblank().set([this](bool state) { super80v_state::screen_vblank_super80m(state); }); - PALETTE(config, m_palette, FUNC(super80_state::super80m_palette), 32); + PALETTE(config, m_palette, FUNC(super80v_state::super80m_palette), 32); GFXDECODE(config, m_gfxdecode, m_palette, gfx_super80v); MC6845(config, m_crtc, MASTER_CLOCK / SUPER80V_DOTS); m_crtc->set_screen("screen"); m_crtc->set_show_border_area(false); m_crtc->set_char_width(SUPER80V_DOTS); - m_crtc->set_update_row_callback(FUNC(super80_state::crtc_update_row)); + m_crtc->set_update_row_callback(FUNC(super80v_state::crtc_update_row)); config.set_default_layout(layout_super80); @@ -855,7 +835,7 @@ void super80_state::super80v(machine_config &config) INPUT_BUFFER(config, "cent_status_in", 0); /* quickload */ - QUICKLOAD(config, "quickload", "bin", attotime::from_seconds(3)).set_load_callback(FUNC(super80_state::quickload_cb)); + QUICKLOAD(config, "quickload", "bin", attotime::from_seconds(3)).set_load_callback(FUNC(super80v_state::quickload_cb)); /* cassette */ CASSETTE(config, m_cassette); @@ -863,31 +843,33 @@ void super80_state::super80v(machine_config &config) m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05); m_cassette->set_interface("super80_cass"); - TIMER(config, "kansas_r").configure_periodic(FUNC(super80_state::kansas_r), attotime::from_hz(40000)); // cass read - TIMER(config, "timer_k").configure_periodic(FUNC(super80_state::timer_k), attotime::from_hz(300)); // keyb scan - - // software list - SOFTWARE_LIST(config, "cass_list").set_original("super80_cass").set_filter("V"); -} - -void super80_state::super80r(machine_config &config) -{ - super80v(config); - m_maincpu->set_addrmap(AS_IO, &super80_state::super80r_io); + TIMER(config, "kansas_r").configure_periodic(FUNC(super80v_state::kansas_r), attotime::from_hz(40000)); // cass read + TIMER(config, "timer_k").configure_periodic(FUNC(super80v_state::timer_k), attotime::from_hz(300)); // keyb scan Z80DMA(config, m_dma, MASTER_CLOCK/6); - m_dma->out_busreq_callback().set(FUNC(super80_state::busreq_w)); + m_dma->out_busreq_callback().set(FUNC(super80v_state::busreq_w)); m_dma->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); //ba0 - not connected - m_dma->in_mreq_callback().set(FUNC(super80_state::memory_read_byte)); - m_dma->out_mreq_callback().set(FUNC(super80_state::memory_write_byte)); - m_dma->in_iorq_callback().set(FUNC(super80_state::io_read_byte)); - m_dma->out_iorq_callback().set(FUNC(super80_state::io_write_byte)); + m_dma->in_mreq_callback().set(FUNC(super80v_state::memory_read_byte)); + m_dma->out_mreq_callback().set(FUNC(super80v_state::memory_write_byte)); + m_dma->in_iorq_callback().set(FUNC(super80v_state::io_read_byte)); + m_dma->out_iorq_callback().set(FUNC(super80v_state::io_write_byte)); WD2793(config, m_fdc, 2_MHz_XTAL); m_fdc->drq_wr_callback().set(m_dma, FUNC(z80dma_device::rdy_w)); FLOPPY_CONNECTOR(config, "fdc:0", super80_floppies, "s80flop", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", super80_floppies, "s80flop", floppy_image_device::default_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "fdc:2", super80_floppies, "s80flop", floppy_image_device::default_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "fdc:3", super80_floppies, "s80flop", floppy_image_device::default_floppy_formats).enable_sound(true); + + // software list + SOFTWARE_LIST(config, "cass_list").set_original("super80_cass").set_filter("V"); +} + +void super80r_state::super80r(machine_config &config) +{ + super80v(config); + m_maincpu->set_addrmap(AS_PROGRAM, &super80r_state::super80r_map); // software list config.device_remove("cass_list"); @@ -897,88 +879,85 @@ void super80_state::super80r(machine_config &config) /**************************** ROMS *****************************************************************/ ROM_START( super80 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("super80.u26", 0xc000, 0x1000, CRC(6a6a9664) SHA1(2c4fcd943aa9bf7419d58fbc0e28ffb89ef22e0b) ) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) /* This makes the screen show the FF character when O F1 F0 entered */ + ROM_REGION(0x3000, "maincpu", 0) + ROM_LOAD("super80.u26", 0x0000, 0x1000, CRC(6a6a9664) SHA1(2c4fcd943aa9bf7419d58fbc0e28ffb89ef22e0b) ) + ROM_LOAD("super80.u33", 0x1000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0x2000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) ROM_REGION(0x0400, "chargen", 0) // 2513 prom ROM_LOAD("super80.u27", 0x0000, 0x0400, CRC(d1e4b3c6) SHA1(3667b97c6136da4761937958f281609690af4081) ) ROM_END ROM_START( super80d ) - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x3000, "maincpu", 0) ROM_SYSTEM_BIOS(0, "super80d", "V2.2") - ROMX_LOAD("super80d.u26", 0xc000, 0x1000, CRC(cebd2613) SHA1(87b94cc101a5948ce590211c68272e27f4cbe95a), ROM_BIOS(0)) + ROMX_LOAD("super80d.u26", 0x0000, 0x1000, CRC(cebd2613) SHA1(87b94cc101a5948ce590211c68272e27f4cbe95a), ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "super80f", "MDS (original)") - ROMX_LOAD("super80f.u26", 0xc000, 0x1000, CRC(d39775f0) SHA1(b47298ee028924612e9728bb2debd0f47399add7), ROM_BIOS(1)) + ROMX_LOAD("super80f.u26", 0x0000, 0x1000, CRC(d39775f0) SHA1(b47298ee028924612e9728bb2debd0f47399add7), ROM_BIOS(1)) ROM_SYSTEM_BIOS(2, "super80g", "MDS (upgraded)") - ROMX_LOAD("super80g.u26", 0xc000, 0x1000, CRC(7386f507) SHA1(69d7627033d62bd4e886ccc136e89f1524d38f47), ROM_BIOS(2)) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) + ROMX_LOAD("super80g.u26", 0x0000, 0x1000, CRC(7386f507) SHA1(69d7627033d62bd4e886ccc136e89f1524d38f47), ROM_BIOS(2)) + ROM_LOAD("super80.u33", 0x1000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0x2000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) ROM_REGION(0x0800, "chargen", 0) // 2716 eprom ROM_LOAD("super80d.u27", 0x0000, 0x0800, CRC(cb4c81e2) SHA1(8096f21c914fa76df5d23f74b1f7f83bd8645783) ) ROM_END ROM_START( super80e ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("super80e.u26", 0xc000, 0x1000, CRC(bdc668f8) SHA1(3ae30b3cab599fca77d5e461f3ec1acf404caf07) ) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) + ROM_REGION(0x3000, "maincpu", 0) + ROM_LOAD("super80e.u26", 0x0000, 0x1000, CRC(bdc668f8) SHA1(3ae30b3cab599fca77d5e461f3ec1acf404caf07) ) + ROM_LOAD("super80.u33", 0x1000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0x2000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) ROM_REGION(0x1000, "chargen", 0) // 2732 eprom ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) ROM_END ROM_START( super80m ) - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x3000, "maincpu", 0) ROM_SYSTEM_BIOS(0, "8r0", "8R0") - ROMX_LOAD("s80-8r0.u26", 0xc000, 0x1000, CRC(48d410d8) SHA1(750d984abc013a3344628300288f6d1ba140a95f), ROM_BIOS(0) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(0) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(0) ) + ROMX_LOAD("s80-8r0.u26", 0x0000, 0x1000, CRC(48d410d8) SHA1(750d984abc013a3344628300288f6d1ba140a95f), ROM_BIOS(0) ) + ROMX_LOAD("s80-8r0.u33", 0x1000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(0) ) + ROMX_LOAD("s80-8r0.u42", 0x2000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(0) ) #if 0 /* Temporary patch to fix crash when lprinting a tab */ - ROM_FILL(0xcc44,1,0x46) - ROM_FILL(0xcc45,1,0xc5) - ROM_FILL(0xcc46,1,0x06) - ROM_FILL(0xcc47,1,0x20) - ROM_FILL(0xcc48,1,0xcd) - ROM_FILL(0xcc49,1,0xc7) - ROM_FILL(0xcc4a,1,0xcb) - ROM_FILL(0xcc4b,1,0xc1) - ROM_FILL(0xcc4c,1,0x10) - ROM_FILL(0xcc4d,1,0xf7) - ROM_FILL(0xcc4e,1,0x00) - ROM_FILL(0xcc4f,1,0x00) + ROM_FILL(0x0c44,1,0x46) + ROM_FILL(0x0c45,1,0xc5) + ROM_FILL(0x0c46,1,0x06) + ROM_FILL(0x0c47,1,0x20) + ROM_FILL(0x0c48,1,0xcd) + ROM_FILL(0x0c49,1,0xc7) + ROM_FILL(0x0c4a,1,0xcb) + ROM_FILL(0x0c4b,1,0xc1) + ROM_FILL(0x0c4c,1,0x10) + ROM_FILL(0x0c4d,1,0xf7) + ROM_FILL(0x0c4e,1,0x00) + ROM_FILL(0x0c4f,1,0x00) #endif ROM_SYSTEM_BIOS(1, "v37", "V3.7") - ROMX_LOAD("s80-v37.u26", 0xc000, 0x1000, CRC(46043035) SHA1(1765105df4e4af83d56cafb88e158ed462d4709e), ROM_BIOS(1) ) - ROMX_LOAD("s80-v37.u33", 0xd000, 0x1000, CRC(afb52b15) SHA1(0a2c25834074ce44bf12ac8532b4add492bcf950), ROM_BIOS(1) ) - ROMX_LOAD("s80-v37.u42", 0xe000, 0x1000, CRC(7344b27a) SHA1(f43fc47ddb5c12bffffa63488301cd5eb386cc9a), ROM_BIOS(1) ) + ROMX_LOAD("s80-v37.u26", 0x0000, 0x1000, CRC(46043035) SHA1(1765105df4e4af83d56cafb88e158ed462d4709e), ROM_BIOS(1) ) + ROMX_LOAD("s80-v37.u33", 0x1000, 0x1000, CRC(afb52b15) SHA1(0a2c25834074ce44bf12ac8532b4add492bcf950), ROM_BIOS(1) ) + ROMX_LOAD("s80-v37.u42", 0x2000, 0x1000, CRC(7344b27a) SHA1(f43fc47ddb5c12bffffa63488301cd5eb386cc9a), ROM_BIOS(1) ) ROM_SYSTEM_BIOS(2, "8r2", "8R2") - ROMX_LOAD("s80-8r2.u26", 0xc000, 0x1000, CRC(1e166c8c) SHA1(15647614be9300cdd2956da913e83234c36b36a9), ROM_BIOS(2) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(2) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(2) ) + ROMX_LOAD("s80-8r2.u26", 0x0000, 0x1000, CRC(1e166c8c) SHA1(15647614be9300cdd2956da913e83234c36b36a9), ROM_BIOS(2) ) + ROMX_LOAD("s80-8r0.u33", 0x1000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(2) ) + ROMX_LOAD("s80-8r0.u42", 0x2000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(2) ) ROM_SYSTEM_BIOS(3, "8r3", "8R3") - ROMX_LOAD("s80-8r3.u26", 0xc000, 0x1000, CRC(ee7dd90b) SHA1(c53f8eef82e8f943642f6ddfc2cb1bfdc32d25ca), ROM_BIOS(3) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(3) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(3) ) + ROMX_LOAD("s80-8r3.u26", 0x0000, 0x1000, CRC(ee7dd90b) SHA1(c53f8eef82e8f943642f6ddfc2cb1bfdc32d25ca), ROM_BIOS(3) ) + ROMX_LOAD("s80-8r0.u33", 0x1000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(3) ) + ROMX_LOAD("s80-8r0.u42", 0x2000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(3) ) ROM_SYSTEM_BIOS(4, "8r4", "8R4") - ROMX_LOAD("s80-8r4.u26", 0xc000, 0x1000, CRC(637d001d) SHA1(f26b5ecc33fd44b05b1f199d79e0f072ec8d0e23), ROM_BIOS(4) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(4) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(4) ) + ROMX_LOAD("s80-8r4.u26", 0x0000, 0x1000, CRC(637d001d) SHA1(f26b5ecc33fd44b05b1f199d79e0f072ec8d0e23), ROM_BIOS(4) ) + ROMX_LOAD("s80-8r0.u33", 0x1000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(4) ) + ROMX_LOAD("s80-8r0.u42", 0x2000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(4) ) ROM_SYSTEM_BIOS(5, "8r5", "8R5") - ROMX_LOAD("s80-8r5.u26", 0xc000, 0x1000, CRC(294f217c) SHA1(f352d54e84e94bf299726dc3af4eb7b2d06d317c), ROM_BIOS(5) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(5) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(5) ) + ROMX_LOAD("s80-8r5.u26", 0x0000, 0x1000, CRC(294f217c) SHA1(f352d54e84e94bf299726dc3af4eb7b2d06d317c), ROM_BIOS(5) ) + ROMX_LOAD("s80-8r0.u33", 0x1000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(5) ) + ROMX_LOAD("s80-8r0.u42", 0x2000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(5) ) ROM_REGION(0x1800, "chargen", 0) ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) @@ -986,35 +965,33 @@ ROM_START( super80m ) ROM_END ROM_START( super80r ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x3000, "maincpu", 0 ) ROM_SYSTEM_BIOS(0, "super80r", "MCE (original)") - ROMX_LOAD("super80r.u26", 0xc000, 0x1000, CRC(01bb6406) SHA1(8e275ecf5141b93f86e45ff8a735b965ea3e8d44), ROM_BIOS(0)) + ROMX_LOAD("super80r.u26", 0x0000, 0x1000, CRC(01bb6406) SHA1(8e275ecf5141b93f86e45ff8a735b965ea3e8d44), ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "super80s", "MCE (upgraded)") - ROMX_LOAD("super80s.u26", 0xc000, 0x1000, CRC(3e29d307) SHA1(b3f4667633e0a4eb8577e39b5bd22e1f0bfbc0a9), ROM_BIOS(1)) + ROMX_LOAD("super80s.u26", 0x0000, 0x1000, CRC(3e29d307) SHA1(b3f4667633e0a4eb8577e39b5bd22e1f0bfbc0a9), ROM_BIOS(1)) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) + ROM_LOAD("super80.u33", 0x1000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0x2000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) - ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF ) + ROM_REGION(0x0800, "chargen", 0) // 2716 eprom + ROM_LOAD("s80hmce.ic24", 0x0000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) ROM_END ROM_START( super80v ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("s80-v37v.u26", 0xc000, 0x1000, CRC(01e0c0dd) SHA1(ef66af9c44c651c65a21d5bda939ffa100078c08) ) - ROM_LOAD("s80-v37v.u33", 0xd000, 0x1000, CRC(812ad777) SHA1(04f355bea3470a7d9ea23bb2811f6af7d81dc400) ) - ROM_LOAD("s80-v37v.u42", 0xe000, 0x1000, CRC(e02e736e) SHA1(57b0264c805da99234ab5e8e028fca456851a4f9) ) - ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) - - ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) - ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF ) + ROM_REGION( 0x3000, "maincpu", 0 ) + ROM_LOAD("s80-v37v.u26", 0x0000, 0x1000, CRC(01e0c0dd) SHA1(ef66af9c44c651c65a21d5bda939ffa100078c08) ) + ROM_LOAD("s80-v37v.u33", 0x1000, 0x1000, CRC(812ad777) SHA1(04f355bea3470a7d9ea23bb2811f6af7d81dc400) ) + ROM_LOAD("s80-v37v.u42", 0x2000, 0x1000, CRC(e02e736e) SHA1(57b0264c805da99234ab5e8e028fca456851a4f9) ) + + ROM_REGION(0x0800, "chargen", 0) // 2716 eprom + ROM_LOAD("s80hmce.ic24", 0x0000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1981, super80, 0, 0, super80, super80, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (V1.2)" , 0) -COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (V2.2)" , 0) -COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (El Graphix 4)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (with colour)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80r, super80, 0, super80r, super80r, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (with VDUEB)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80v, super80, 0, super80v, super80v, super80_state, init_super80, "Dick Smith Electronics", "Super-80 (with enhanced VDUEB)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80, 0, 0, super80, super80, super80_state, empty_init, "Dick Smith Electronics", "Super-80 (V1.2)" , 0) +COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, empty_init, "Dick Smith Electronics", "Super-80 (V2.2)" , 0) +COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, empty_init, "Dick Smith Electronics", "Super-80 (El Graphix 4)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, empty_init, "Dick Smith Electronics", "Super-80 (with colour)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80r, super80, 0, super80r, super80r, super80r_state, empty_init, "Dick Smith Electronics", "Super-80 (with VDUEB)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80v, super80, 0, super80v, super80v, super80v_state, empty_init, "Dick Smith Electronics", "Super-80 (with enhanced VDUEB)" , MACHINE_UNOFFICIAL) diff --git a/src/mame/includes/super80.h b/src/mame/includes/super80.h index a58ce727a8e..949cae73378 100644 --- a/src/mame/includes/super80.h +++ b/src/mame/includes/super80.h @@ -37,10 +37,8 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_maincpu(*this, "maincpu") - , m_p_ram(*this, "maincpu") + , m_rom(*this, "maincpu") , m_p_chargen(*this, "chargen") - , m_p_colorram(*this, "colorram") - , m_p_videoram(*this, "videoram") , m_pio(*this, "z80pio") , m_cassette(*this, "cassette") , m_samples(*this, "samples") @@ -50,95 +48,42 @@ public: , m_io_dsw(*this, "DSW") , m_io_config(*this, "CONFIG") , m_io_keyboard(*this, "KEY.%u", 0) - , m_crtc(*this, "crtc") - , m_dma(*this, "dma") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") , m_cass_led(*this, "cass_led") { } void super80m(machine_config &config); void super80(machine_config &config); - void super80r(machine_config &config); void super80e(machine_config &config); void super80d(machine_config &config); - void super80v(machine_config &config); - - void init_super80(); -private: +protected: void machine_start() override; - - DECLARE_READ8_MEMBER(super80v_low_r); - DECLARE_READ8_MEMBER(super80v_high_r); - DECLARE_WRITE8_MEMBER(super80v_low_w); - DECLARE_WRITE8_MEMBER(super80v_high_w); - DECLARE_WRITE8_MEMBER(super80v_10_w); - DECLARE_WRITE8_MEMBER(super80v_11_w); - DECLARE_READ8_MEMBER(port3e_r); - DECLARE_WRITE8_MEMBER(port3f_w); - DECLARE_WRITE8_MEMBER(super80_f1_w); - DECLARE_READ8_MEMBER(super80_f2_r); - DECLARE_WRITE8_MEMBER(super80_dc_w); - DECLARE_WRITE8_MEMBER(super80_f0_w); - DECLARE_WRITE8_MEMBER(super80r_f0_w); - DECLARE_READ8_MEMBER(super80_read_ff); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE8_MEMBER(pio_port_a_w); - uint8_t pio_port_b_r(); - DECLARE_MACHINE_RESET(super80); - DECLARE_MACHINE_RESET(super80r); - DECLARE_VIDEO_START(super80); + void machine_common(); + void cassette_motor(bool data); + void screen_vblank_super80m(bool state); + void portf0_w(u8 data); + void portdc_w(u8 data); + void pio_port_a_w(u8 data); + u8 pio_port_b_r(); + u8 portf2_r(); + u8 m_portf0; + u8 m_s_options; + u8 m_palette_index; + u8 m_keylatch; + u8 m_cass_data[4]; + u8 m_key_pressed; + bool m_boot_in_progress; + std::unique_ptr<u8[]> m_ram; void super80m_palette(palette_device &palette) const; - DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); - MC6845_UPDATE_ROW(crtc_update_row); - uint32_t screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_super80m); - TIMER_CALLBACK_MEMBER(super80_reset); - TIMER_DEVICE_CALLBACK_MEMBER(timer_h); TIMER_DEVICE_CALLBACK_MEMBER(timer_k); TIMER_DEVICE_CALLBACK_MEMBER(kansas_r); - - void super80_io(address_map &map); - void super80_map(address_map &map); - void super80e_io(address_map &map); - void super80m_map(address_map &map); - void super80r_io(address_map &map); - void super80v_io(address_map &map); - void super80v_map(address_map &map); - - uint8_t m_s_options; - uint8_t m_portf0; - uint8_t m_mc6845_cursor[16]; - uint8_t m_palette_index; - uint8_t m_keylatch; - uint8_t m_cass_data[4]; - uint8_t m_int_sw; - uint8_t m_last_data; - uint8_t m_key_pressed; - uint16_t m_vidpg; - uint8_t m_current_charset; - uint8_t m_mc6845_reg[32]; - uint8_t m_mc6845_ind; - void mc6845_cursor_configure(); - void super80_cassette_motor(bool data); + DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); required_device<palette_device> m_palette; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<z80_device> m_maincpu; - required_region_ptr<u8> m_p_ram; - optional_region_ptr<u8> m_p_chargen; - optional_region_ptr<u8> m_p_colorram; - optional_region_ptr<u8> m_p_videoram; + required_region_ptr<u8> m_rom; + required_region_ptr<u8> m_p_chargen; required_device<z80pio_device> m_pio; required_device<cassette_image_device> m_cassette; required_device<samples_device> m_samples; @@ -148,12 +93,90 @@ private: required_ioport m_io_dsw; required_ioport m_io_config; required_ioport_array<8> m_io_keyboard; - optional_device<mc6845_device> m_crtc; - optional_device<z80dma_device> m_dma; - optional_device<wd2793_device> m_fdc; - optional_device<floppy_connector> m_floppy0; - optional_device<floppy_connector> m_floppy1; output_finder<> m_cass_led; + +private: + + void machine_reset() override; + void portf1_w(u8 data); + TIMER_DEVICE_CALLBACK_MEMBER(timer_h); + uint32_t screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void super80_io(address_map &map); + void super80_map(address_map &map); + void super80e_io(address_map &map); + void super80m_map(address_map &map); + + u8 m_int_sw; + u8 m_last_data; + u16 m_vidpg; + bool m_current_charset; +}; + + +class super80v_state : public super80_state +{ +public: + super80v_state(const machine_config &mconfig, device_type type, const char *tag) + : super80_state(mconfig, type, tag) + , m_crtc(*this, "crtc") + , m_dma(*this, "dma") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_floppy2(*this, "fdc:2") + , m_floppy3(*this, "fdc:3") + { } + + void super80v(machine_config &config); + +protected: + void super80v_map(address_map &map); + void super80v_io(address_map &map); + void port3f_w(u8 data); + u8 port3e_r(); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + MC6845_UPDATE_ROW(crtc_update_row); + uint32_t screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + required_device<mc6845_device> m_crtc; + required_device<z80dma_device> m_dma; + required_device<wd2793_device> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; + required_device<floppy_connector> m_floppy2; + required_device<floppy_connector> m_floppy3; + +private: + void machine_reset() override; + void low_w(u16 offset, u8 data); + void high_w(u16 offset, u8 data); + u8 low_r(u16 offset); + u8 high_r(u16 offset); }; +class super80r_state : public super80v_state +{ +public: + using super80v_state::super80v_state; + + void super80r(machine_config &config); + +private: + + void machine_reset() override; + void low_w(u16 offset, u8 data); + void high_w(u16 offset, u8 data); + void super80r_map(address_map &map); + u8 low_r(u16 offset); + u8 high_r(u16 offset); +}; + + #endif // MAME_INCLUDES_SUPER80_H diff --git a/src/mame/machine/super80.cpp b/src/mame/machine/super80.cpp index bbf5a4040d6..c20551531a8 100644 --- a/src/mame/machine/super80.cpp +++ b/src/mame/machine/super80.cpp @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Robbbert -/* Super80.c written by Robbbert, 2005-2009. See driver source for documentation. */ +/* Super80.cpp written by Robbbert, 2005-2009. See driver source for documentation. */ #include "emu.h" #include "includes/super80.h" @@ -9,7 +9,7 @@ /**************************** PIO ******************************************************************************/ -WRITE8_MEMBER( super80_state::pio_port_a_w ) +void super80_state::pio_port_a_w(u8 data) { m_keylatch = data; m_pio->port_b_write(pio_port_b_r()); // refresh kbd int @@ -20,10 +20,8 @@ uint8_t super80_state::pio_port_b_r() uint8_t data = 0xff; for (int i = 0; i < 8; i++) - { if (!BIT(m_keylatch, i)) data &= m_io_keyboard[i]->read(); - } m_key_pressed = 3; @@ -32,7 +30,7 @@ uint8_t super80_state::pio_port_b_r() /**************************** CASSETTE ROUTINES *****************************************************************/ -void super80_state::super80_cassette_motor( bool motor_state ) +void super80_state::cassette_motor( bool motor_state ) { // relay sound if (BIT(m_last_data, 1) != motor_state) @@ -89,16 +87,11 @@ TIMER_DEVICE_CALLBACK_MEMBER( super80_state::kansas_r ) } } -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER(super80_state::super80_reset) -{ - membank("boot")->set_entry(0); -} TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_h ) { uint8_t go_fast = 0; - if ( (!BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 1)) ) /* bit 2 of port F0 is low, OR user turned on config switch */ + if ( (!BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 1)) ) // bit 2 of port F0 is low, OR user turned on config switch go_fast++; // must be 1 at boot so banking works correctly /* code to slow down computer to 1 MHz by halting cpu on every second frame */ @@ -137,13 +130,13 @@ TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_h ) /**************************** I/O PORTS *****************************************************************/ -READ8_MEMBER( super80_state::port3e_r ) +u8 super80v_state::port3e_r() { return 0xF8 | (m_fdc->intrq_r() << 0) | (m_fdc->drq_r() << 1) | 4; } // UFDC board can support 4 drives; we support 2 -WRITE8_MEMBER( super80_state::port3f_w ) +void super80v_state::port3f_w(u8 data) { // m_fdc->58(BIT(data, 0)); 5/8 pin not emulated in wd_fdc m_fdc->enmf_w(BIT(data,1)); @@ -151,8 +144,8 @@ WRITE8_MEMBER( super80_state::port3f_w ) floppy_image_device *floppy = nullptr; if (BIT(data, 2)) floppy = m_floppy0->get_device(); if (BIT(data, 3)) floppy = m_floppy1->get_device(); - //if (BIT(data, 4)) floppy = m_floppy2->get_device(); - //if (BIT(data, 5)) floppy = m_floppy3->get_device(); + if (BIT(data, 4)) floppy = m_floppy2->get_device(); + if (BIT(data, 5)) floppy = m_floppy3->get_device(); m_fdc->set_floppy(floppy); @@ -165,71 +158,75 @@ WRITE8_MEMBER( super80_state::port3f_w ) m_fdc->dden_w(BIT(data, 7)); } -READ8_MEMBER( super80_state::super80_f2_r ) +u8 super80_state::portf2_r() { - uint8_t data = m_io_dsw->read() & 0xf0; // dip switches on pcb + u8 data = m_io_dsw->read() & 0xf0; // dip switches on pcb data |= m_cass_data[2]; // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state data |= 0x08; // bit 3 - not used return data; } -WRITE8_MEMBER( super80_state::super80_dc_w ) +void super80_state::portdc_w(u8 data) { - /* hardware strobe driven from port select, bit 7..0 = data */ + // hardware strobe driven from port select, bit 7..0 = data m_cent_data_out->write(data); m_centronics->write_strobe(0); m_centronics->write_strobe(1); } -WRITE8_MEMBER( super80_state::super80_f0_w ) +void super80_state::portf0_w(u8 data) { - uint8_t bits = data ^ m_last_data; + u8 bits = data ^ m_last_data; m_portf0 = data; - m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ - m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ + m_speaker->level_w(BIT(data, 3)); // bit 3 - speaker + if (BIT(bits, 1)) cassette_motor(BIT(data, 1)); // bit 1 - cassette motor + m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); // bit 0 - cass out m_last_data = data; } -WRITE8_MEMBER( super80_state::super80r_f0_w ) + +/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ + +void super80_state::machine_start() { - uint8_t bits = data ^ m_last_data; - m_portf0 = data | 0x14; - m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ - m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ + // zerofill + m_ram = make_unique_clear<u8[]>(0x10000); + m_vidpg = 0xfe00; + m_cass_led.resolve(); - m_last_data = data; + // register for savestates + save_pointer(NAME(m_ram), 0x10000); +// save_item(NAME(m_ram_address)); +// save_item(NAME(m_matrix)); +// save_item(NAME(m_digit_data)); } -/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ - -MACHINE_RESET_MEMBER( super80_state, super80 ) +void super80_state::machine_common() { + m_boot_in_progress = true; m_portf0 = 0; // must be 0 like real machine, or banking breaks on 32-col systems m_keylatch = 0xff; m_key_pressed = 0; m_palette_index = 0; - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); - membank("boot")->set_entry(1); } -MACHINE_RESET_MEMBER( super80_state, super80r ) +void super80_state::machine_reset() { - m_portf0 = 0x14; - m_keylatch = 0xff; - m_key_pressed = 0; - m_palette_index = 0; - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); - membank("boot")->set_entry(1); + std::copy_n(&m_rom[0], 0x3000, &m_ram[0xc000]); // make 0 F1 C0 work + std::fill_n(&m_ram[0xf000], 0x1000, 0xff); // make O F1 FF work + machine_common(); +} + +void super80r_state::machine_reset() +{ + machine_common(); } -void super80_state::init_super80() +void super80v_state::machine_reset() { - uint8_t *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); + machine_common(); } @@ -241,13 +238,13 @@ QUICKLOAD_LOAD_MEMBER(super80_state::quickload_cb) { uint16_t exec_addr, start_addr, end_addr; - /* load the binary into memory */ + // load the binary into memory if (z80bin_load_file(&image, m_maincpu->space(AS_PROGRAM), file_type, &exec_addr, &start_addr, &end_addr) != image_init_result::PASS) return image_init_result::FAIL; - /* is this file executable? */ + // is this file executable? if (exec_addr != 0xffff) - /* check to see if autorun is on */ + // check to see if autorun is on if (BIT(m_io_config->read(), 0)) m_maincpu->set_pc(exec_addr); diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp index c7ea76e3100..1763f36a2f6 100644 --- a/src/mame/video/super80.cpp +++ b/src/mame/video/super80.cpp @@ -2,9 +2,6 @@ // copyright-holders:Robbbert /* Super80.c written by Robbbert, 2005-2010. See the driver source for documentation. */ -/* Notes on using MAME MC6845 Device (MMD). - 1. Speed of MMD is about 20% slower than pre-MMD coding - 2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here. */ #include "emu.h" @@ -54,12 +51,12 @@ void super80_state::super80m_palette(palette_device &palette) const -WRITE_LINE_MEMBER(super80_state::screen_vblank_super80m) +void super80_state::screen_vblank_super80m(bool state) { // rising edge if (state) { - /* if we chose another palette or colour mode, enable it */ + // if we chose another palette or colour mode, enable it m_palette_index = (m_io_config->read() & 0x60) ? 0 : 16; } } @@ -69,15 +66,15 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 m_cass_led = BIT(m_portf0, 5); const uint8_t options = m_io_config->read(); - bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); // bit 2 of port F0 is high, OR user turned on config switch uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) - fg = 15; /* b&w */ + fg = 15; // b&w else - fg = 5; /* green */ + fg = 5; // green } uint16_t sy = 0; @@ -93,17 +90,17 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 uint8_t chr = 32; if (screen_on) { - chr = m_p_ram[ma | x] & 0x7f; + chr = m_ram[ma | x] & 0x7f; if ((chr >= 0x61) && (chr <= 0x7a)) chr &= 0x1f; else chr &= 0x3f; } - /* get pattern of pixels for that character scanline */ + // get pattern of pixels for that character scanline const uint8_t gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; - /* Display a scanline of a character */ + // Display a scanline of a character *p++ = BIT(gfx, 7) ? fg : 0; *p++ = BIT(gfx, 6) ? fg : 0; *p++ = BIT(gfx, 5) ? fg : 0; @@ -124,15 +121,15 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind m_cass_led = BIT(m_portf0, 5); const uint8_t options = m_io_config->read(); - bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); // bit 2 of port F0 is high, OR user turned on config switch uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) - fg = 15; /* b&w */ + fg = 15; // b&w else - fg = 5; /* green */ + fg = 5; // green } uint16_t sy = 0; @@ -147,12 +144,12 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind { uint8_t chr = 32; if (screen_on) - chr = m_p_ram[ma | x]; + chr = m_ram[ma | x]; - /* get pattern of pixels for that character scanline */ + // get pattern of pixels for that character scanline const uint8_t gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); - /* Display a scanline of a character */ + // Display a scanline of a character *p++ = BIT(gfx, 7) ? fg : 0; *p++ = BIT(gfx, 6) ? fg : 0; *p++ = BIT(gfx, 5) ? fg : 0; @@ -173,15 +170,15 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind m_cass_led = BIT(m_portf0, 5); const uint8_t options = m_io_config->read(); - bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); // bit 2 of port F0 is high, OR user turned on config switch uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) - fg = 15; /* b&w */ + fg = 15; // b&w else - fg = 5; /* green */ + fg = 5; // green } uint16_t sy = 0; @@ -196,12 +193,12 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind { uint8_t chr = 32; if (screen_on) - chr = m_p_ram[ma | x]; + chr = m_ram[ma | x]; - /* get pattern of pixels for that character scanline */ + // get pattern of pixels for that character scanline const uint8_t gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; - /* Display a scanline of a character */ + // Display a scanline of a character *p++ = BIT(gfx, 7) ? fg : 0; *p++ = BIT(gfx, 6) ? fg : 0; *p++ = BIT(gfx, 5) ? fg : 0; @@ -223,18 +220,18 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind const uint8_t options = m_io_config->read(); - /* get selected character generator */ - const uint8_t cgen = m_current_charset ^ ((options & 0x10) >> 4); /* bit 0 of port F1 and cgen config switch */ + // get selected character generator + const bool cgen = m_current_charset ^ BIT(options, 4); // bit 0 of port F1 and cgen config switch - const bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + const bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); // bit 2 of port F0 is high, OR user turned on config switch uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) - fg = 15; /* b&w */ + fg = 15; // b&w else - fg = 5; /* green */ + fg = 5; // green } uint16_t sy = 0; @@ -249,24 +246,24 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind { uint8_t chr = 32; if (screen_on) - chr = m_p_ram[ma | x]; + chr = m_ram[ma | x]; uint8_t bg = 0; if (!(options & 0x40)) { - const uint8_t col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */ + const uint8_t col = m_ram[0xfe00 | ma | x]; // byte of colour to display fg = m_palette_index + (col & 0x0f); bg = m_palette_index + (col >> 4); } - /* get pattern of pixels for that character scanline */ + // get pattern of pixels for that character scanline uint8_t gfx; if (cgen) gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; else gfx = m_p_chargen[0x1000 | ((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); - /* Display a scanline of a character */ + // Display a scanline of a character *p++ = BIT(gfx, 7) ? fg : bg; *p++ = BIT(gfx, 6) ? fg : bg; *p++ = BIT(gfx, 5) ? fg : bg; @@ -282,17 +279,13 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind return 0; } -VIDEO_START_MEMBER(super80_state,super80) -{ - m_vidpg = 0xfe00; -} /**************************** I/O PORTS *****************************************************************/ -WRITE8_MEMBER( super80_state::super80_f1_w ) +void super80_state::portf1_w(u8 data) { m_vidpg = (data & 0xfe) << 8; - m_current_charset = data & 1; + m_current_charset = BIT(data, 0); } /*--------------------------------------------------------------- @@ -301,91 +294,69 @@ WRITE8_MEMBER( super80_state::super80_f1_w ) ---------------------------------------------------------------*/ -static const uint8_t mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; +// we place the colour ram at m_ram[0x9000], and the videoram at m_ram[0x8000]. +u8 super80r_state::low_r(u16 offset) +{ + return m_ram[offset+0x8000]; +} + +void super80r_state::low_w(u16 offset, u8 data) +{ + m_ram[offset+0x8000] = data; // video +} + +u8 super80r_state::high_r(u16 offset) +{ + return m_ram[offset+0x8800]; // video +} -READ8_MEMBER( super80_state::super80v_low_r ) +void super80r_state::high_w(u16 offset, u8 data) +{ + m_ram[offset+0x8800] = data; // video + m_ram[offset+0xf800] = data; // pcg +} + +u8 super80v_state::low_r(u16 offset) { if (BIT(m_portf0, 2)) - return m_p_videoram[offset]; + return m_ram[offset+0x8000]; // video else - return m_p_colorram[offset]; + return m_ram[offset+0x9000]; // colour } -WRITE8_MEMBER( super80_state::super80v_low_w ) +void super80v_state::low_w(u16 offset, u8 data) { if (BIT(m_portf0, 2)) - m_p_videoram[offset] = data; + m_ram[offset+0x8000] = data; // video else - m_p_colorram[offset] = data; + m_ram[offset+0x9000] = data; // colour } -READ8_MEMBER( super80_state::super80v_high_r ) +u8 super80v_state::high_r(u16 offset) { if (!BIT(m_portf0, 2)) - return m_p_colorram[0x800 | offset]; + return m_ram[offset+0x9800]; // colour else if (BIT(m_portf0, 4)) - return m_p_ram[0xf800 | offset]; + return m_ram[offset+0x8800]; // video else - return m_p_ram[0xf000 | offset]; + return m_p_chargen[offset]; // char rom } -WRITE8_MEMBER( super80_state::super80v_high_w ) +void super80v_state::high_w(u16 offset, u8 data) { if (!BIT(m_portf0, 2)) - m_p_colorram[0x800 | offset] = data; + m_ram[offset+0x9800] = data; // colour else { - m_p_videoram[0x800 | offset] = data; + m_ram[offset+0x8800] = data; // video if (BIT(m_portf0, 4)) - m_p_ram[0xf800 | offset] = data; + m_ram[offset+0xf800] = data; // pcg } } -/* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ -void super80_state::mc6845_cursor_configure() -{ - /* curs_type holds the general cursor shape to be created - 0 = no cursor - 1 = partial cursor (only shows on a block of scan lines) - 2 = full cursor - 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ - - for (uint8_t i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one - - uint8_t r9 = m_mc6845_reg[9]; // number of scan lines - 1 - uint8_t r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits - uint8_t r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below - - /* decide the curs_type by examining the registers */ - uint8_t curs_type = 0; - if (r10 < r11) - curs_type=1; // start less than end, show start to end - else if (r10 == r11) - curs_type=2; // if equal, show full cursor - else - curs_type=3; // if start greater than end, it's a two-part cursor - - if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor - if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor - if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware - - /* create the new cursor */ - if (curs_type > 1) - for (uint8_t i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) - m_mc6845_cursor[i] = 0xff; // turn on full cursor - - if (curs_type == 1) - for (uint8_t i = r10; i < r11; i++) - m_mc6845_cursor[i] = 0xff; // for each line that should show, turn on that scan line - - if (curs_type == 3) - for (uint8_t i = r11; i < r10; i++) - m_mc6845_cursor[i] = 0; // now take a bite out of the middle -} - -uint32_t super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t super80v_state::screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { m_s_options = m_io_config->read(); m_cass_led = BIT(m_portf0, 5); @@ -393,7 +364,7 @@ uint32_t super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb return 0; } -MC6845_UPDATE_ROW( super80_state::crtc_update_row ) +MC6845_UPDATE_ROW( super80v_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); uint32_t *p = &bitmap.pix32(y); @@ -401,38 +372,36 @@ MC6845_UPDATE_ROW( super80_state::crtc_update_row ) for (uint16_t x = 0; x < x_count; x++) // for each character { uint8_t inv = 0; - // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ + if (x == cursor_x) inv=0xff; const uint16_t mem = (ma + x) & 0xfff; - uint8_t chr = m_p_videoram[mem]; + uint8_t chr = m_ram[mem+0x8000]; /* get colour or b&w */ - uint8_t fg = 5; /* green */ + uint8_t fg = 5; // green if ((m_s_options & 0x60) == 0x60) - fg = 15; /* b&w */ + fg = 15; // b&w uint8_t bg = 0; if (~m_s_options & 0x40) { - const uint8_t col = m_p_colorram[mem]; /* byte of colour to display */ + const uint8_t col = m_ram[mem+0x9000]; // byte of colour to display fg = m_palette_index + (col & 0x0f); bg = m_palette_index + (col >> 4); } - /* if inverse mode, replace any pcgram chrs with inverse chrs */ - if (!BIT(m_portf0, 4) && (chr & 0x80)) // is it a high chr in inverse mode + // if inverse mode, replace any pcgram chrs with inverse chrs + if (!BIT(m_portf0, 4) && BIT(chr, 7)) // is it a high chr in inverse mode { inv ^= 0xff; // invert the chr chr &= 0x7f; // and drop bit 7 } - /* process cursor */ - if (x == cursor_x) - inv ^= m_mc6845_cursor[ra]; + // get pattern of pixels for that character scanline + const uint8_t gfx = BIT(chr, 7) + ? m_ram[0xf000 | ((chr << 4) | ra)] ^ inv + : m_p_chargen[((chr << 4) | ra)] ^ inv; - /* get pattern of pixels for that character scanline */ - const uint8_t gfx = m_p_ram[0xf000 | ((chr << 4) | ra)] ^ inv; - - /* Display a scanline of a character */ + // Display a scanline of a character *p++ = palette[BIT(gfx, 7) ? fg : bg]; *p++ = palette[BIT(gfx, 6) ? fg : bg]; *p++ = palette[BIT(gfx, 5) ? fg : bg]; @@ -443,18 +412,4 @@ MC6845_UPDATE_ROW( super80_state::crtc_update_row ) } } -/**************************** I/O PORTS *****************************************************************/ -WRITE8_MEMBER( super80_state::super80v_10_w ) -{ - data &= 0x1f; - m_mc6845_ind = data; - m_crtc->address_w(data); -} - -WRITE8_MEMBER( super80_state::super80v_11_w ) -{ - m_mc6845_reg[m_mc6845_ind] = data & mc6845_mask[m_mc6845_ind]; /* save data in register */ - m_crtc->register_w(data); - if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ -} |