mirror of
https://github.com/holub/mame
synced 2025-04-26 10:13:37 +03:00
cleanup of cgenie (nw)
This commit is contained in:
parent
be424b223e
commit
71f50fd916
@ -43,18 +43,18 @@ static ADDRESS_MAP_START (cgenie_mem, AS_PROGRAM, 8, cgenie_state )
|
||||
// AM_RANGE(0x4000, 0xbfff) AM_RAM // set up in MACHINE_START
|
||||
// AM_RANGE(0xc000, 0xdfff) AM_ROM // installed in cgenie_init_machine
|
||||
// AM_RANGE(0xe000, 0xefff) AM_ROM // installed in cgenie_init_machine
|
||||
AM_RANGE(0xf000, 0xf3ff) AM_READWRITE_LEGACY(cgenie_colorram_r, cgenie_colorram_w ) AM_SHARE("colorram")
|
||||
AM_RANGE(0xf400, 0xf7ff) AM_READWRITE_LEGACY(cgenie_fontram_r, cgenie_fontram_w) AM_SHARE("fontram")
|
||||
AM_RANGE(0xf800, 0xf8ff) AM_READ_LEGACY(cgenie_keyboard_r )
|
||||
AM_RANGE(0xf000, 0xf3ff) AM_READWRITE(cgenie_colorram_r, cgenie_colorram_w ) AM_SHARE("colorram")
|
||||
AM_RANGE(0xf400, 0xf7ff) AM_READWRITE(cgenie_fontram_r, cgenie_fontram_w) AM_SHARE("fontram")
|
||||
AM_RANGE(0xf800, 0xf8ff) AM_READ(cgenie_keyboard_r )
|
||||
AM_RANGE(0xf900, 0xffdf) AM_NOP
|
||||
AM_RANGE(0xffe0, 0xffe3) AM_READWRITE_LEGACY(cgenie_irq_status_r, cgenie_motor_w )
|
||||
AM_RANGE(0xffe0, 0xffe3) AM_READWRITE(cgenie_irq_status_r, cgenie_motor_w )
|
||||
AM_RANGE(0xffe4, 0xffeb) AM_NOP
|
||||
AM_RANGE(0xffec, 0xffec) AM_READWRITE_LEGACY(cgenie_status_r, cgenie_command_w )
|
||||
AM_RANGE(0xffec, 0xffec) AM_READWRITE(cgenie_status_r, cgenie_command_w )
|
||||
AM_RANGE(0xffe4, 0xffeb) AM_NOP
|
||||
AM_RANGE(0xffec, 0xffec) AM_WRITE_LEGACY(cgenie_command_w )
|
||||
AM_RANGE(0xffed, 0xffed) AM_READWRITE_LEGACY(cgenie_track_r, cgenie_track_w )
|
||||
AM_RANGE(0xffee, 0xffee) AM_READWRITE_LEGACY(cgenie_sector_r, cgenie_sector_w )
|
||||
AM_RANGE(0xffef, 0xffef) AM_READWRITE_LEGACY(cgenie_data_r, cgenie_data_w )
|
||||
AM_RANGE(0xffec, 0xffec) AM_WRITE(cgenie_command_w )
|
||||
AM_RANGE(0xffed, 0xffed) AM_READWRITE(cgenie_track_r, cgenie_track_w )
|
||||
AM_RANGE(0xffee, 0xffee) AM_READWRITE(cgenie_sector_r, cgenie_sector_w )
|
||||
AM_RANGE(0xffef, 0xffef) AM_READWRITE(cgenie_data_r, cgenie_data_w )
|
||||
AM_RANGE(0xfff0, 0xffff) AM_NOP
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -62,9 +62,9 @@ static ADDRESS_MAP_START (cgenie_io, AS_IO, 8, cgenie_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0xf8, 0xf8) AM_READWRITE(cgenie_sh_control_port_r, cgenie_sh_control_port_w )
|
||||
AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE_LEGACY("ay8910", ay8910_r, ay8910_data_w )
|
||||
AM_RANGE(0xfa, 0xfa) AM_READWRITE_LEGACY(cgenie_index_r, cgenie_index_w )
|
||||
AM_RANGE(0xfb, 0xfb) AM_READWRITE_LEGACY(cgenie_register_r, cgenie_register_w )
|
||||
AM_RANGE(0xff, 0xff) AM_READWRITE_LEGACY(cgenie_port_ff_r, cgenie_port_ff_w )
|
||||
AM_RANGE(0xfa, 0xfa) AM_READWRITE(cgenie_index_r, cgenie_index_w )
|
||||
AM_RANGE(0xfb, 0xfb) AM_READWRITE(cgenie_register_r, cgenie_register_w )
|
||||
AM_RANGE(0xff, 0xff) AM_READWRITE(cgenie_port_ff_r, cgenie_port_ff_w )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static INPUT_PORTS_START( cgenie )
|
||||
@ -479,10 +479,10 @@ static const ay8910_interface cgenie_ay8910_interface =
|
||||
{
|
||||
AY8910_LEGACY_OUTPUT,
|
||||
AY8910_DEFAULT_LOADS,
|
||||
DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, cgenie_psg_port_a_r),
|
||||
DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, cgenie_psg_port_b_r),
|
||||
DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, cgenie_psg_port_a_w),
|
||||
DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, cgenie_psg_port_b_w)
|
||||
DEVCB_DRIVER_MEMBER(cgenie_state, cgenie_psg_port_a_r),
|
||||
DEVCB_DRIVER_MEMBER(cgenie_state, cgenie_psg_port_b_r),
|
||||
DEVCB_DRIVER_MEMBER(cgenie_state, cgenie_psg_port_a_w),
|
||||
DEVCB_DRIVER_MEMBER(cgenie_state, cgenie_psg_port_b_w)
|
||||
};
|
||||
|
||||
|
||||
|
@ -89,6 +89,45 @@ public:
|
||||
void cgenie_refresh_tv_set(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
int cgenie_port_xx_r( int offset );
|
||||
int cgenie_videoram_r( int offset );
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_psg_port_a_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_psg_port_b_r );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_psg_port_a_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_psg_port_b_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_colorram_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_fontram_r );
|
||||
|
||||
DECLARE_WRITE8_MEMBER( cgenie_colorram_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_fontram_w );
|
||||
|
||||
DECLARE_WRITE8_MEMBER( cgenie_port_ff_w );
|
||||
DECLARE_READ8_MEMBER( cgenie_port_ff_r );
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_status_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_track_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_sector_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_data_r );
|
||||
|
||||
DECLARE_WRITE8_MEMBER( cgenie_command_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_track_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_sector_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_data_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_irq_status_r );
|
||||
|
||||
DECLARE_WRITE8_MEMBER( cgenie_motor_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_keyboard_r );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_videoram_w );
|
||||
|
||||
|
||||
DECLARE_READ8_MEMBER( cgenie_index_r );
|
||||
DECLARE_READ8_MEMBER( cgenie_register_r );
|
||||
|
||||
DECLARE_WRITE8_MEMBER( cgenie_index_w );
|
||||
DECLARE_WRITE8_MEMBER( cgenie_register_w );
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -97,51 +136,4 @@ public:
|
||||
|
||||
extern const wd17xx_interface cgenie_wd17xx_interface;
|
||||
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_psg_port_a_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_psg_port_b_r );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_psg_port_a_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_psg_port_b_w );
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_colorram_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_fontram_r );
|
||||
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_colorram_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_fontram_w );
|
||||
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_port_ff_w );
|
||||
DECLARE_READ8_HANDLER ( cgenie_port_ff_r );
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_status_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_track_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_sector_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_data_r );
|
||||
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_command_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_track_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_sector_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_data_w );
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_irq_status_r );
|
||||
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_motor_w );
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_keyboard_r );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_videoram_w );
|
||||
|
||||
|
||||
/*----------- defined in video/cgenie.c -----------*/
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_READ8_HANDLER ( cgenie_index_r );
|
||||
DECLARE_READ8_HANDLER ( cgenie_register_r );
|
||||
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_index_w );
|
||||
DECLARE_WRITE8_HANDLER ( cgenie_register_w );
|
||||
|
||||
#endif /* CGENIE_H_ */
|
||||
|
@ -147,7 +147,7 @@ void cgenie_state::machine_start()
|
||||
|
||||
/* set up RAM */
|
||||
space.install_read_bank(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, "bank1");
|
||||
space.install_legacy_write_handler(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, FUNC(cgenie_videoram_w));
|
||||
space.install_write_handler(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, write8_delegate(FUNC(cgenie_state::cgenie_videoram_w),this));
|
||||
m_videoram = machine().device<ram_device>(RAM_TAG)->pointer();
|
||||
membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
|
||||
machine().scheduler().timer_pulse(attotime::from_hz(11025), timer_expired_delegate(FUNC(cgenie_state::handle_cassette_input),this));
|
||||
@ -170,12 +170,11 @@ void cgenie_state::machine_start()
|
||||
#define FF_BGD2 0x80 /* background color select 2 */
|
||||
#define FF_BGD (FF_BGD0 | FF_BGD1 | FF_BGD2)
|
||||
|
||||
WRITE8_HANDLER( cgenie_port_ff_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
int port_ff_changed = state->m_port_ff ^ data;
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_port_ff_w )
|
||||
{
|
||||
int port_ff_changed = m_port_ff ^ data;
|
||||
|
||||
state->m_cassette->output(data & 0x01 ? -1.0 : 1.0 );
|
||||
m_cassette->output(data & 0x01 ? -1.0 : 1.0 );
|
||||
|
||||
/* background bits changed ? */
|
||||
if( port_ff_changed & FF_BGD )
|
||||
@ -190,7 +189,7 @@ WRITE8_HANDLER( cgenie_port_ff_w )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( state->m_tv_mode == 0 )
|
||||
if( m_tv_mode == 0 )
|
||||
{
|
||||
switch( data & (FF_BGD1 + FF_BGD2) )
|
||||
{
|
||||
@ -223,32 +222,31 @@ WRITE8_HANDLER( cgenie_port_ff_w )
|
||||
b = 15;
|
||||
}
|
||||
}
|
||||
palette_set_color_rgb(space.machine(), 0, r, g, b);
|
||||
palette_set_color_rgb(machine(), 0, r, g, b);
|
||||
}
|
||||
|
||||
/* character mode changed ? */
|
||||
if( port_ff_changed & FF_CHR )
|
||||
{
|
||||
state->m_font_offset[2] = (data & FF_CHR0) ? 0x00 : 0x80;
|
||||
state->m_font_offset[3] = (data & FF_CHR1) ? 0x00 : 0x80;
|
||||
m_font_offset[2] = (data & FF_CHR0) ? 0x00 : 0x80;
|
||||
m_font_offset[3] = (data & FF_CHR1) ? 0x00 : 0x80;
|
||||
}
|
||||
|
||||
/* graphics mode changed ? */
|
||||
if( port_ff_changed & FF_FGR )
|
||||
{
|
||||
state->cgenie_mode_select(data & FF_FGR);
|
||||
cgenie_mode_select(data & FF_FGR);
|
||||
}
|
||||
|
||||
state->m_port_ff = data;
|
||||
m_port_ff = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cgenie_port_ff_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
UINT8 data = state->m_port_ff & ~0x01;
|
||||
READ8_MEMBER( cgenie_state::cgenie_port_ff_r )
|
||||
{
|
||||
UINT8 data = m_port_ff & ~0x01;
|
||||
|
||||
data |= state->m_cass_bit;
|
||||
data |= m_cass_bit;
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -265,148 +263,143 @@ int cgenie_state::cgenie_port_xx_r( int offset )
|
||||
*************************************/
|
||||
|
||||
|
||||
READ8_HANDLER( cgenie_psg_port_a_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
return state->m_psg_a_inp;
|
||||
READ8_MEMBER( cgenie_state::cgenie_psg_port_a_r )
|
||||
{
|
||||
return m_psg_a_inp;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_psg_port_b_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
if( state->m_psg_a_out < 0xd0 )
|
||||
READ8_MEMBER( cgenie_state::cgenie_psg_port_b_r )
|
||||
{
|
||||
if( m_psg_a_out < 0xd0 )
|
||||
{
|
||||
/* comparator value */
|
||||
state->m_psg_b_inp = 0x00;
|
||||
m_psg_b_inp = 0x00;
|
||||
|
||||
if( state->ioport("JOY0")->read() > state->m_psg_a_out )
|
||||
state->m_psg_b_inp |= 0x80;
|
||||
if( ioport("JOY0")->read() > m_psg_a_out )
|
||||
m_psg_b_inp |= 0x80;
|
||||
|
||||
if( state->ioport("JOY1")->read() > state->m_psg_a_out )
|
||||
state->m_psg_b_inp |= 0x40;
|
||||
if( ioport("JOY1")->read() > m_psg_a_out )
|
||||
m_psg_b_inp |= 0x40;
|
||||
|
||||
if( state->ioport("JOY2")->read() > state->m_psg_a_out )
|
||||
state->m_psg_b_inp |= 0x20;
|
||||
if( ioport("JOY2")->read() > m_psg_a_out )
|
||||
m_psg_b_inp |= 0x20;
|
||||
|
||||
if( state->ioport("JOY3")->read() > state->m_psg_a_out )
|
||||
state->m_psg_b_inp |= 0x10;
|
||||
if( ioport("JOY3")->read() > m_psg_a_out )
|
||||
m_psg_b_inp |= 0x10;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read keypad matrix */
|
||||
state->m_psg_b_inp = 0xFF;
|
||||
m_psg_b_inp = 0xFF;
|
||||
|
||||
if( !(state->m_psg_a_out & 0x01) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP0")->read();
|
||||
if( !(m_psg_a_out & 0x01) )
|
||||
m_psg_b_inp &= ~ioport("KP0")->read();
|
||||
|
||||
if( !(state->m_psg_a_out & 0x02) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP1")->read();
|
||||
if( !(m_psg_a_out & 0x02) )
|
||||
m_psg_b_inp &= ~ioport("KP1")->read();
|
||||
|
||||
if( !(state->m_psg_a_out & 0x04) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP2")->read();
|
||||
if( !(m_psg_a_out & 0x04) )
|
||||
m_psg_b_inp &= ~ioport("KP2")->read();
|
||||
|
||||
if( !(state->m_psg_a_out & 0x08) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP3")->read();
|
||||
if( !(m_psg_a_out & 0x08) )
|
||||
m_psg_b_inp &= ~ioport("KP3")->read();
|
||||
|
||||
if( !(state->m_psg_a_out & 0x10) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP4")->read();
|
||||
if( !(m_psg_a_out & 0x10) )
|
||||
m_psg_b_inp &= ~ioport("KP4")->read();
|
||||
|
||||
if( !(state->m_psg_a_out & 0x20) )
|
||||
state->m_psg_b_inp &= ~state->ioport("KP5")->read();
|
||||
if( !(m_psg_a_out & 0x20) )
|
||||
m_psg_b_inp &= ~ioport("KP5")->read();
|
||||
}
|
||||
return state->m_psg_b_inp;
|
||||
return m_psg_b_inp;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_psg_port_a_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
state->m_psg_a_out = data;
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_psg_port_a_w )
|
||||
{
|
||||
m_psg_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_psg_port_b_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_psg_port_b_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
state->m_psg_b_out = data;
|
||||
m_psg_b_out = data;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_status_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_status_r )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, return 0 */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return 0;
|
||||
return wd17xx_status_r(fdc, space, offset);
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_track_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_track_r )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, return 0xff */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return 0xff;
|
||||
return wd17xx_track_r(fdc, space, offset);
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_sector_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_sector_r )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, return 0xff */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return 0xff;
|
||||
return wd17xx_sector_r(fdc, space, offset);
|
||||
}
|
||||
|
||||
READ8_HANDLER(cgenie_data_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_data_r )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, return 0xff */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return 0xff;
|
||||
return wd17xx_data_r(fdc, space, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_command_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_command_w )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, return immediately */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return;
|
||||
wd17xx_command_w(fdc, space, offset, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_track_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_track_w )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, ignore the write */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return;
|
||||
wd17xx_track_w(fdc, space, offset, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_sector_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_sector_w )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, ignore the write */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return;
|
||||
wd17xx_sector_w(fdc, space, offset, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_data_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_data_w )
|
||||
{
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
/* If the floppy isn't emulated, ignore the write */
|
||||
if( (space.machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
if( (machine().root_device().ioport("DSW0")->read() & 0x80) == 0 )
|
||||
return;
|
||||
wd17xx_data_w(fdc, space, offset, data);
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_irq_status_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
int result = state->m_irq_status;
|
||||
READ8_MEMBER( cgenie_state::cgenie_irq_status_r )
|
||||
{
|
||||
int result = m_irq_status;
|
||||
|
||||
state->m_irq_status &= ~(IRQ_TIMER | IRQ_FDC);
|
||||
m_irq_status &= ~(IRQ_TIMER | IRQ_FDC);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -447,10 +440,9 @@ const wd17xx_interface cgenie_wd17xx_interface =
|
||||
{FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
|
||||
};
|
||||
|
||||
WRITE8_HANDLER( cgenie_motor_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
device_t *fdc = space.machine().device("wd179x");
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_motor_w )
|
||||
{
|
||||
device_t *fdc = machine().device("wd179x");
|
||||
UINT8 drive = 255;
|
||||
|
||||
logerror("cgenie motor_w $%02X\n", data);
|
||||
@ -468,45 +460,45 @@ WRITE8_HANDLER( cgenie_motor_w )
|
||||
return;
|
||||
|
||||
/* mask head select bit */
|
||||
state->m_head = (data >> 4) & 1;
|
||||
m_head = (data >> 4) & 1;
|
||||
|
||||
/* currently selected drive */
|
||||
state->m_motor_drive = drive;
|
||||
m_motor_drive = drive;
|
||||
|
||||
wd17xx_set_drive(fdc,drive);
|
||||
wd17xx_set_side(fdc,state->m_head);
|
||||
wd17xx_set_side(fdc,m_head);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
* Keyboard *
|
||||
*************************************/
|
||||
READ8_HANDLER( cgenie_keyboard_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_keyboard_r )
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if( offset & 0x01 )
|
||||
result |= space.machine().root_device().ioport("ROW0")->read();
|
||||
result |= machine().root_device().ioport("ROW0")->read();
|
||||
|
||||
if( offset & 0x02 )
|
||||
result |= space.machine().root_device().ioport("ROW1")->read();
|
||||
result |= machine().root_device().ioport("ROW1")->read();
|
||||
|
||||
if( offset & 0x04 )
|
||||
result |= space.machine().root_device().ioport("ROW2")->read();
|
||||
result |= machine().root_device().ioport("ROW2")->read();
|
||||
|
||||
if( offset & 0x08 )
|
||||
result |= space.machine().root_device().ioport("ROW3")->read();
|
||||
result |= machine().root_device().ioport("ROW3")->read();
|
||||
|
||||
if( offset & 0x10 )
|
||||
result |= space.machine().root_device().ioport("ROW4")->read();
|
||||
result |= machine().root_device().ioport("ROW4")->read();
|
||||
|
||||
if( offset & 0x20 )
|
||||
result |= space.machine().root_device().ioport("ROW5")->read();
|
||||
result |= machine().root_device().ioport("ROW5")->read();
|
||||
|
||||
if( offset & 0x40 )
|
||||
result |= space.machine().root_device().ioport("ROW6")->read();
|
||||
result |= machine().root_device().ioport("ROW6")->read();
|
||||
|
||||
if( offset & 0x80 )
|
||||
result |= space.machine().root_device().ioport("ROW7")->read();
|
||||
result |= machine().root_device().ioport("ROW7")->read();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -521,56 +513,51 @@ int cgenie_state::cgenie_videoram_r( int offset )
|
||||
return videoram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_videoram_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
UINT8 *videoram = state->m_videoram;
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_videoram_w )
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
/* write to video RAM */
|
||||
if( data == videoram[offset] )
|
||||
return; /* no change */
|
||||
videoram[offset] = data;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_colorram_r )
|
||||
READ8_MEMBER( cgenie_state::cgenie_colorram_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
return state->m_colorram[offset] | 0xf0;
|
||||
return m_colorram[offset] | 0xf0;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_colorram_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_colorram_w )
|
||||
{
|
||||
/* only bits 0 to 3 */
|
||||
data &= 15;
|
||||
/* nothing changed ? */
|
||||
if( data == state->m_colorram[offset] )
|
||||
if( data == m_colorram[offset] )
|
||||
return;
|
||||
|
||||
/* set new value */
|
||||
state->m_colorram[offset] = data;
|
||||
m_colorram[offset] = data;
|
||||
/* make offset relative to video frame buffer offset */
|
||||
offset = (offset + (state->cgenie_get_register(12) << 8) + state->cgenie_get_register(13)) & 0x3ff;
|
||||
offset = (offset + (cgenie_get_register(12) << 8) + cgenie_get_register(13)) & 0x3ff;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cgenie_fontram_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
return state->m_fontram[offset];
|
||||
READ8_MEMBER( cgenie_state::cgenie_fontram_r )
|
||||
{
|
||||
return m_fontram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cgenie_fontram_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_fontram_w )
|
||||
{
|
||||
UINT8 *dp;
|
||||
|
||||
if( data == state->m_fontram[offset] )
|
||||
if( data == m_fontram[offset] )
|
||||
return; /* no change */
|
||||
|
||||
/* store data */
|
||||
state->m_fontram[offset] = data;
|
||||
m_fontram[offset] = data;
|
||||
|
||||
/* convert eight pixels */
|
||||
dp = const_cast<UINT8 *>(space.machine().gfx[0]->get_data(256 + offset/8) + (offset % 8) * space.machine().gfx[0]->width());
|
||||
dp = const_cast<UINT8 *>(machine().gfx[0]->get_data(256 + offset/8) + (offset % 8) * machine().gfx[0]->width());
|
||||
dp[0] = (data & 0x80) ? 1 : 0;
|
||||
dp[1] = (data & 0x40) ? 1 : 0;
|
||||
dp[2] = (data & 0x20) ? 1 : 0;
|
||||
|
@ -56,101 +56,100 @@ void cgenie_state::cgenie_offset_xy()
|
||||
/***************************************************************************
|
||||
Write to an indexed register of the 6845 CRTC
|
||||
***************************************************************************/
|
||||
WRITE8_HANDLER ( cgenie_register_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_register_w )
|
||||
{
|
||||
//int addr;
|
||||
|
||||
switch (state->m_crt.idx)
|
||||
switch (m_crt.idx)
|
||||
{
|
||||
case 0:
|
||||
if( state->m_crt.horizontal_total == data )
|
||||
if( m_crt.horizontal_total == data )
|
||||
break;
|
||||
state->m_crt.horizontal_total = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.horizontal_total = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 1:
|
||||
if( state->m_crt.horizontal_displayed == data )
|
||||
if( m_crt.horizontal_displayed == data )
|
||||
break;
|
||||
state->m_crt.horizontal_displayed = data;
|
||||
m_crt.horizontal_displayed = data;
|
||||
break;
|
||||
case 2:
|
||||
if( state->m_crt.horizontal_sync_pos == data )
|
||||
if( m_crt.horizontal_sync_pos == data )
|
||||
break;
|
||||
state->m_crt.horizontal_sync_pos = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.horizontal_sync_pos = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 3:
|
||||
state->m_crt.horizontal_length = data;
|
||||
m_crt.horizontal_length = data;
|
||||
break;
|
||||
case 4:
|
||||
if( state->m_crt.vertical_total == data )
|
||||
if( m_crt.vertical_total == data )
|
||||
break;
|
||||
state->m_crt.vertical_total = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.vertical_total = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 5:
|
||||
if( state->m_crt.vertical_adjust == data )
|
||||
if( m_crt.vertical_adjust == data )
|
||||
break;
|
||||
state->m_crt.vertical_adjust = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.vertical_adjust = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 6:
|
||||
if( state->m_crt.vertical_displayed == data )
|
||||
if( m_crt.vertical_displayed == data )
|
||||
break;
|
||||
state->m_crt.vertical_displayed = data;
|
||||
m_crt.vertical_displayed = data;
|
||||
break;
|
||||
case 7:
|
||||
if( state->m_crt.vertical_sync_pos == data )
|
||||
if( m_crt.vertical_sync_pos == data )
|
||||
break;
|
||||
state->m_crt.vertical_sync_pos = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.vertical_sync_pos = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 8:
|
||||
state->m_crt.crt_mode = data;
|
||||
m_crt.crt_mode = data;
|
||||
break;
|
||||
case 9:
|
||||
data &= 15;
|
||||
if( state->m_crt.scan_lines == data )
|
||||
if( m_crt.scan_lines == data )
|
||||
break;
|
||||
state->m_crt.scan_lines = data;
|
||||
state->cgenie_offset_xy();
|
||||
m_crt.scan_lines = data;
|
||||
cgenie_offset_xy();
|
||||
break;
|
||||
case 10:
|
||||
if( state->m_crt.cursor_top == data )
|
||||
if( m_crt.cursor_top == data )
|
||||
break;
|
||||
state->m_crt.cursor_top = data;
|
||||
//addr = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
|
||||
m_crt.cursor_top = data;
|
||||
//addr = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
|
||||
break;
|
||||
case 11:
|
||||
if( state->m_crt.cursor_bottom == data )
|
||||
if( m_crt.cursor_bottom == data )
|
||||
break;
|
||||
state->m_crt.cursor_bottom = data;
|
||||
//addr = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
|
||||
m_crt.cursor_bottom = data;
|
||||
//addr = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
|
||||
break;
|
||||
case 12:
|
||||
data &= 63;
|
||||
if( state->m_crt.screen_address_hi == data )
|
||||
if( m_crt.screen_address_hi == data )
|
||||
break;
|
||||
state->m_crt.screen_address_hi = data;
|
||||
m_crt.screen_address_hi = data;
|
||||
break;
|
||||
case 13:
|
||||
if( state->m_crt.screen_address_lo == data )
|
||||
if( m_crt.screen_address_lo == data )
|
||||
break;
|
||||
state->m_crt.screen_address_lo = data;
|
||||
m_crt.screen_address_lo = data;
|
||||
break;
|
||||
case 14:
|
||||
data &= 63;
|
||||
if( state->m_crt.cursor_address_hi == data )
|
||||
if( m_crt.cursor_address_hi == data )
|
||||
break;
|
||||
state->m_crt.cursor_address_hi = data;
|
||||
//addr = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
|
||||
m_crt.cursor_address_hi = data;
|
||||
//addr = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
|
||||
break;
|
||||
case 15:
|
||||
if( state->m_crt.cursor_address_lo == data )
|
||||
if( m_crt.cursor_address_lo == data )
|
||||
break;
|
||||
state->m_crt.cursor_address_lo = data;
|
||||
//addr = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo;
|
||||
m_crt.cursor_address_lo = data;
|
||||
//addr = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -158,19 +157,17 @@ WRITE8_HANDLER ( cgenie_register_w )
|
||||
/***************************************************************************
|
||||
Write to the index register of the 6845 CRTC
|
||||
***************************************************************************/
|
||||
WRITE8_HANDLER ( cgenie_index_w )
|
||||
WRITE8_MEMBER( cgenie_state::cgenie_index_w )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
state->m_crt.idx = data & 15;
|
||||
m_crt.idx = data & 15;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Read from an indexed register of the 6845 CRTC
|
||||
***************************************************************************/
|
||||
READ8_HANDLER ( cgenie_register_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
return state->cgenie_get_register(state->m_crt.idx);
|
||||
READ8_MEMBER( cgenie_state::cgenie_register_r )
|
||||
{
|
||||
return cgenie_get_register(m_crt.idx);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -219,10 +216,9 @@ int cgenie_state::cgenie_get_register(int indx)
|
||||
/***************************************************************************
|
||||
Read the index register of the 6845 CRTC
|
||||
***************************************************************************/
|
||||
READ8_HANDLER ( cgenie_index_r )
|
||||
{
|
||||
cgenie_state *state = space.machine().driver_data<cgenie_state>();
|
||||
return state->m_crt.idx;
|
||||
READ8_MEMBER( cgenie_state::cgenie_index_r )
|
||||
{
|
||||
return m_crt.idx;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user