(MESS) super80 : cleanup, part 2

This commit is contained in:
Robbbert 2014-04-27 10:20:22 +00:00
parent 477c80e76e
commit 51ee7d463e
4 changed files with 41 additions and 58 deletions

View File

@ -76,10 +76,10 @@ The user has to adjust some bytes in memory in order to select a different baud
BDF8 BDF9 Baud BDF8 BDF9 Baud
--------------------- ---------------------
F8 4 300 F8 04 300
BA 3 400 BA 03 400
7C 2 600 7C 02 600
3E 1 1200 3E 01 1200
The enhanced Monitor roms (those not supplied by Dick Smith) have extra commands to change the rates The enhanced Monitor roms (those not supplied by Dick Smith) have extra commands to change the rates
without the tedium of manually modifying memory. without the tedium of manually modifying memory.
@ -100,7 +100,7 @@ a bit and reading the next, until a full byte has been constructed. Lastly, the
checked that it is at a high level. checked that it is at a high level.
This means that we cannot attempt to convert frequency to voltage ourselves, since the OS only This means that we cannot attempt to convert frequency to voltage ourselves, since the OS only
"looks" once a bit. The solution is to use a mame timer running at a high enough rate (200 kHz) "looks" once a bit. The solution is to use a mame timer running at a high enough rate (40 kHz)
to read the wave state. While the wave state stays constant, a counter is incremented. When the to read the wave state. While the wave state stays constant, a counter is incremented. When the
state changes, the output is set according to how far the counter has progressed. The counter is state changes, the output is set according to how far the counter has progressed. The counter is
then reset ready for the next wave state. The code for this is in the TIMER_CALLBACK. then reset ready for the next wave state. The code for this is in the TIMER_CALLBACK.
@ -761,6 +761,7 @@ static MACHINE_CONFIG_START( super80, super80_state )
MCFG_CASSETTE_ADD( "cassette", super80_cassette_interface ) MCFG_CASSETTE_ADD( "cassette", super80_cassette_interface )
MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read
MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(100)) // keyb scan MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(100)) // keyb scan
MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_h", super80_state, timer_h, attotime::from_hz(100)) // half-speed
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( super80d, super80 ) static MACHINE_CONFIG_DERIVED( super80d, super80 )
@ -967,10 +968,10 @@ ROM_START( super80v )
ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF ) ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF )
ROM_END ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
COMP( 1981, super80, 0, 0, super80, super80, super80_state, super80, "Dick Smith Electronics","Super-80 (V1.2)" , 0) COMP( 1981, super80, 0, 0, super80, super80, super80_state, super80, "Dick Smith Electronics", "Super-80 (V1.2)" , 0)
COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, super80, "Dick Smith Electronics","Super-80 (V2.2)" , 0) COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (V2.2)" , 0)
COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, super80, "Dick Smith Electronics","Super-80 (El Graphix 4)" , GAME_UNOFFICIAL) COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (El Graphix 4)" , GAME_UNOFFICIAL)
COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, super80, "Dick Smith Electronics","Super-80 (with colour)" , GAME_UNOFFICIAL) COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, super80, "Dick Smith Electronics", "Super-80 (with colour)" , GAME_UNOFFICIAL)
COMP( 1981, super80r, super80, 0, super80r, super80r, super80_state, super80v, "Dick Smith Electronics","Super-80 (with VDUEB)" , GAME_UNOFFICIAL) COMP( 1981, super80r, super80, 0, super80r, super80r, super80_state, super80, "Dick Smith Electronics", "Super-80 (with VDUEB)" , GAME_UNOFFICIAL)
COMP( 1981, super80v, super80, 0, super80v, super80v, super80_state, super80v, "Dick Smith Electronics","Super-80 (with enhanced VDUEB)" , GAME_UNOFFICIAL) COMP( 1981, super80v, super80, 0, super80v, super80v, super80_state, super80, "Dick Smith Electronics", "Super-80 (with enhanced VDUEB)" , GAME_UNOFFICIAL)

View File

@ -14,7 +14,7 @@
#include "machine/wd_fdc.h" #include "machine/wd_fdc.h"
/* Bits in shared variable: /* Bits in m_portf0 variable:
d5 cassette LED d5 cassette LED
d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom)
d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) d2 super80v video or colour bankswitch (1=video ram, 0=colour ram)
@ -75,7 +75,6 @@ public:
DECLARE_WRITE8_MEMBER(pio_port_a_w); DECLARE_WRITE8_MEMBER(pio_port_a_w);
DECLARE_READ8_MEMBER(pio_port_b_r); DECLARE_READ8_MEMBER(pio_port_b_r);
DECLARE_DRIVER_INIT(super80); DECLARE_DRIVER_INIT(super80);
DECLARE_DRIVER_INIT(super80v);
DECLARE_VIDEO_START(super80); DECLARE_VIDEO_START(super80);
DECLARE_VIDEO_START(super80v); DECLARE_VIDEO_START(super80v);
DECLARE_PALETTE_INIT(super80m); DECLARE_PALETTE_INIT(super80m);
@ -86,13 +85,12 @@ public:
UINT32 screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_super80m(screen_device &screen, bool state); void screen_eof_super80m(screen_device &screen, bool state);
TIMER_CALLBACK_MEMBER(super80_timer);
TIMER_CALLBACK_MEMBER(super80_reset); TIMER_CALLBACK_MEMBER(super80_reset);
TIMER_CALLBACK_MEMBER(super80_halfspeed); TIMER_DEVICE_CALLBACK_MEMBER(timer_h);
TIMER_DEVICE_CALLBACK_MEMBER(timer_p);
TIMER_DEVICE_CALLBACK_MEMBER(timer_k); TIMER_DEVICE_CALLBACK_MEMBER(timer_k);
TIMER_DEVICE_CALLBACK_MEMBER(timer_p);
UINT8 m_s_options; UINT8 m_s_options;
UINT8 m_shared; UINT8 m_portf0;
UINT8 *m_p_videoram; UINT8 *m_p_videoram;
UINT8 *m_p_colorram; UINT8 *m_p_colorram;
UINT8 *m_p_pcgram; UINT8 *m_p_pcgram;
@ -119,7 +117,6 @@ private:
void mc6845_cursor_configure(); void mc6845_cursor_configure();
void palette_set_colors_rgb(const UINT8 *colors); void palette_set_colors_rgb(const UINT8 *colors);
void super80_cassette_motor(UINT8 data); void super80_cassette_motor(UINT8 data);
void driver_init_common();
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<z80pio_device> m_pio; required_device<z80pio_device> m_pio;
required_device<cassette_image_device> m_cassette; required_device<cassette_image_device> m_cassette;

View File

@ -111,10 +111,10 @@ TIMER_CALLBACK_MEMBER(super80_state::super80_reset)
membank("boot")->set_entry(0); membank("boot")->set_entry(0);
} }
TIMER_CALLBACK_MEMBER(super80_state::super80_halfspeed) TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_h )
{ {
UINT8 go_fast = 0; UINT8 go_fast = 0;
if ( (!BIT(m_shared, 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++; go_fast++;
/* code to slow down computer to 1 MHz by halting cpu on every second frame */ /* code to slow down computer to 1 MHz by halting cpu on every second frame */
@ -201,7 +201,7 @@ WRITE8_MEMBER( super80_state::super80_dc_w )
WRITE8_MEMBER( super80_state::super80_f0_w ) WRITE8_MEMBER( super80_state::super80_f0_w )
{ {
UINT8 bits = data ^ m_last_data; UINT8 bits = data ^ m_last_data;
m_shared = data; m_portf0 = data;
m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */
if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ 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_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */
@ -212,7 +212,7 @@ WRITE8_MEMBER( super80_state::super80_f0_w )
WRITE8_MEMBER( super80_state::super80r_f0_w ) WRITE8_MEMBER( super80_state::super80r_f0_w )
{ {
UINT8 bits = data ^ m_last_data; UINT8 bits = data ^ m_last_data;
m_shared = data | 0x14; m_portf0 = data | 0x14;
m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */
if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ 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_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */
@ -224,29 +224,19 @@ WRITE8_MEMBER( super80_state::super80r_f0_w )
void super80_state::machine_reset() void super80_state::machine_reset()
{ {
m_shared = 0xff; m_portf0 = 0xff;
m_keylatch = 0xff; m_keylatch = 0xff;
m_key_pressed = 0; m_key_pressed = 0;
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this));
membank("boot")->set_entry(1); membank("boot")->set_entry(1);
} }
void super80_state::driver_init_common() DRIVER_INIT_MEMBER( super80_state,super80 )
{ {
UINT8 *RAM = memregion("maincpu")->base(); UINT8 *RAM = memregion("maincpu")->base();
membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000);
} }
DRIVER_INIT_MEMBER(super80_state,super80)
{
machine().scheduler().timer_pulse(attotime::from_hz(100), timer_expired_delegate(FUNC(super80_state::super80_halfspeed),this)); /* timer for 1MHz slowdown */
driver_init_common();
}
DRIVER_INIT_MEMBER(super80_state,super80v)
{
driver_init_common();
}
/*------------------------------------------------- /*-------------------------------------------------
QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) QUICKLOAD_LOAD_MEMBER( super80_state, super80 )
@ -255,7 +245,6 @@ DRIVER_INIT_MEMBER(super80_state,super80v)
QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) QUICKLOAD_LOAD_MEMBER( super80_state, super80 )
{ {
UINT16 exec_addr, start_addr, end_addr; UINT16 exec_addr, start_addr, end_addr;
int autorun;
/* load the binary into memory */ /* load the binary into memory */
if (z80bin_load_file(&image, file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL) if (z80bin_load_file(&image, file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL)
@ -263,13 +252,9 @@ QUICKLOAD_LOAD_MEMBER( super80_state, super80 )
/* is this file executable? */ /* is this file executable? */
if (exec_addr != 0xffff) if (exec_addr != 0xffff)
{ /* check to see if autorun is on */
/* check to see if autorun is on (I hate how this works) */ if BIT(m_io_config->read_safe(0xFF), 0)
autorun = ioport("CONFIG")->read_safe(0xFF) & 1;
if (autorun)
m_maincpu->set_pc(exec_addr); m_maincpu->set_pc(exec_addr);
}
return IMAGE_INIT_PASS; return IMAGE_INIT_PASS;
} }

View File

@ -93,9 +93,9 @@ UINT32 super80_state::screen_update_super80(screen_device &screen, bitmap_ind16
UINT8 y,ra,chr=32,gfx,screen_on=0; UINT8 y,ra,chr=32,gfx,screen_on=0;
UINT16 sy=0,ma=m_vidpg,x; UINT16 sy=0,ma=m_vidpg,x;
output_set_value("cass_led",BIT(m_shared, 5)); output_set_value("cass_led",BIT(m_portf0, 5));
if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */
screen_on++; screen_on++;
for (y = 0; y < 16; y++) for (y = 0; y < 16; y++)
@ -133,9 +133,9 @@ UINT32 super80_state::screen_update_super80d(screen_device &screen, bitmap_ind16
UINT8 y,ra,chr=32,gfx,screen_on=0; UINT8 y,ra,chr=32,gfx,screen_on=0;
UINT16 sy=0,ma=m_vidpg,x; UINT16 sy=0,ma=m_vidpg,x;
output_set_value("cass_led",BIT(m_shared, 5)); output_set_value("cass_led",BIT(m_portf0, 5));
if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */
screen_on++; screen_on++;
for (y = 0; y < 16; y++) for (y = 0; y < 16; y++)
@ -173,9 +173,9 @@ UINT32 super80_state::screen_update_super80e(screen_device &screen, bitmap_ind16
UINT8 y,ra,chr=32,gfx,screen_on=0; UINT8 y,ra,chr=32,gfx,screen_on=0;
UINT16 sy=0,ma=m_vidpg,x; UINT16 sy=0,ma=m_vidpg,x;
output_set_value("cass_led",BIT(m_shared, 5)); output_set_value("cass_led",BIT(m_portf0, 5));
if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */
screen_on++; screen_on++;
for (y = 0; y < 16; y++) for (y = 0; y < 16; y++)
@ -217,9 +217,9 @@ UINT32 super80_state::screen_update_super80m(screen_device &screen, bitmap_ind16
/* get selected character generator */ /* get selected character generator */
UINT8 cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */ UINT8 cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */
output_set_value("cass_led",BIT(m_shared, 5)); output_set_value("cass_led",BIT(m_portf0, 5));
if ((BIT(m_shared, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */
screen_on++; screen_on++;
if (screen_on) if (screen_on)
@ -295,7 +295,7 @@ static const UINT8 mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x
READ8_MEMBER( super80_state::super80v_low_r ) READ8_MEMBER( super80_state::super80v_low_r )
{ {
if (m_shared & 4) if BIT(m_portf0, 2)
return m_p_videoram[offset]; return m_p_videoram[offset];
else else
return m_p_colorram[offset]; return m_p_colorram[offset];
@ -303,7 +303,7 @@ READ8_MEMBER( super80_state::super80v_low_r )
WRITE8_MEMBER( super80_state::super80v_low_w ) WRITE8_MEMBER( super80_state::super80v_low_w )
{ {
if (m_shared & 4) if BIT(m_portf0, 2)
m_p_videoram[offset] = data; m_p_videoram[offset] = data;
else else
m_p_colorram[offset] = data; m_p_colorram[offset] = data;
@ -311,10 +311,10 @@ WRITE8_MEMBER( super80_state::super80v_low_w )
READ8_MEMBER( super80_state::super80v_high_r ) READ8_MEMBER( super80_state::super80v_high_r )
{ {
if (~m_shared & 4) if (!BIT(m_portf0, 2))
return m_p_colorram[0x800 | offset]; return m_p_colorram[0x800 | offset];
else else
if (m_shared & 0x10) if BIT(m_portf0, 4)
return m_p_pcgram[0x800 | offset]; return m_p_pcgram[0x800 | offset];
else else
return m_p_pcgram[offset]; return m_p_pcgram[offset];
@ -322,13 +322,13 @@ READ8_MEMBER( super80_state::super80v_high_r )
WRITE8_MEMBER( super80_state::super80v_high_w ) WRITE8_MEMBER( super80_state::super80v_high_w )
{ {
if (~m_shared & 4) if (!BIT(m_portf0, 2))
m_p_colorram[0x800 | offset] = data; m_p_colorram[0x800 | offset] = data;
else else
{ {
m_p_videoram[0x800 | offset] = data; m_p_videoram[0x800 | offset] = data;
if (m_shared & 0x10) if BIT(m_portf0, 4)
m_p_pcgram[0x800 | offset] = data; m_p_pcgram[0x800 | offset] = data;
} }
} }
@ -381,7 +381,7 @@ UINT32 super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32
m_speed = m_mc6845_reg[10]&0x20, m_flash = m_mc6845_reg[10]&0x40; // cursor modes m_speed = m_mc6845_reg[10]&0x20, m_flash = m_mc6845_reg[10]&0x40; // cursor modes
m_cursor = (m_mc6845_reg[14]<<8) | m_mc6845_reg[15]; // get cursor position m_cursor = (m_mc6845_reg[14]<<8) | m_mc6845_reg[15]; // get cursor position
m_s_options=m_io_config->read(); m_s_options=m_io_config->read();
output_set_value("cass_led",BIT(m_shared, 5)); output_set_value("cass_led",BIT(m_portf0, 5));
m_crtc->screen_update(screen, bitmap, cliprect); m_crtc->screen_update(screen, bitmap, cliprect);
return 0; return 0;
} }
@ -413,7 +413,7 @@ MC6845_UPDATE_ROW( super80v_update_row )
} }
/* if inverse mode, replace any pcgram chrs with inverse chrs */ /* if inverse mode, replace any pcgram chrs with inverse chrs */
if ((~state->m_shared & 0x10) && (chr & 0x80)) // is it a high chr in inverse mode if ((!BIT(state->m_portf0, 4)) && (chr & 0x80)) // is it a high chr in inverse mode
{ {
inv ^= 0xff; // invert the chr inv ^= 0xff; // invert the chr
chr &= 0x7f; // and drop bit 7 chr &= 0x7f; // and drop bit 7