mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
vtech2.cpp: Eliminate machine().device (nw)
This commit is contained in:
parent
ff21c59e8a
commit
be578fda6a
@ -69,7 +69,6 @@
|
||||
#include "includes/vtech2.h"
|
||||
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "sound/wave.h"
|
||||
|
||||
#include "screen.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "bus/generic/carts.h"
|
||||
#include "bus/generic/slot.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "sound/spkrdev.h"
|
||||
|
||||
#define TRKSIZE_FM 3172 /* size of a standard FM mode track */
|
||||
@ -25,9 +26,56 @@ public:
|
||||
m_speaker(*this, "speaker"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_laser_file(*this, {FLOPPY_0, FLOPPY_1}),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
|
||||
void init_laser();
|
||||
void laser350(machine_config &config);
|
||||
void laser700(machine_config &config);
|
||||
void laser500(machine_config &config);
|
||||
|
||||
private:
|
||||
DECLARE_WRITE8_MEMBER(laser_bank_select_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_fdc_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_bg_mode_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_two_color_w);
|
||||
DECLARE_READ8_MEMBER(laser_fdc_r);
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
DECLARE_PALETTE_INIT(vtech2);
|
||||
DECLARE_MACHINE_RESET(laser500);
|
||||
DECLARE_MACHINE_RESET(laser700);
|
||||
uint32_t screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(vtech2_interrupt);
|
||||
|
||||
int mra_bank(int bank, int offs);
|
||||
void mwa_bank(int bank, int offs, int data);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank1);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank2);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank3);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank4);
|
||||
DECLARE_READ8_MEMBER(mra_bank1);
|
||||
DECLARE_READ8_MEMBER(mra_bank2);
|
||||
DECLARE_READ8_MEMBER(mra_bank3);
|
||||
DECLARE_READ8_MEMBER(mra_bank4);
|
||||
|
||||
void laser_machine_init(int bank_mask, int video_mask);
|
||||
void laser_get_track();
|
||||
void laser_put_track();
|
||||
|
||||
void vtech2_io(address_map &map);
|
||||
void vtech2_mem(address_map &map);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
optional_device_array<legacy_floppy_image_device, 2> m_laser_file;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
uint8_t *m_videoram;
|
||||
int m_laser_latch;
|
||||
char m_laser_frame_message[64+1];
|
||||
@ -55,47 +103,8 @@ public:
|
||||
int m_row_d;
|
||||
int m_laser_bg_mode;
|
||||
int m_laser_two_color;
|
||||
DECLARE_WRITE8_MEMBER(laser_bank_select_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_fdc_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_bg_mode_w);
|
||||
DECLARE_WRITE8_MEMBER(laser_two_color_w);
|
||||
DECLARE_READ8_MEMBER(laser_fdc_r);
|
||||
void init_laser();
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
DECLARE_PALETTE_INIT(vtech2);
|
||||
DECLARE_MACHINE_RESET(laser500);
|
||||
DECLARE_MACHINE_RESET(laser700);
|
||||
uint32_t screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(vtech2_interrupt);
|
||||
|
||||
int mra_bank(int bank, int offs);
|
||||
void mwa_bank(int bank, int offs, int data);
|
||||
memory_region *m_cart_rom;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank1);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank2);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank3);
|
||||
DECLARE_WRITE8_MEMBER(mwa_bank4);
|
||||
DECLARE_READ8_MEMBER(mra_bank1);
|
||||
DECLARE_READ8_MEMBER(mra_bank2);
|
||||
DECLARE_READ8_MEMBER(mra_bank3);
|
||||
DECLARE_READ8_MEMBER(mra_bank4);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
void laser_machine_init(int bank_mask, int video_mask);
|
||||
void laser_get_track();
|
||||
void laser_put_track();
|
||||
device_t *laser_file();
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
void laser350(machine_config &config);
|
||||
void laser700(machine_config &config);
|
||||
void laser500(machine_config &config);
|
||||
void vtech2_io(address_map &map);
|
||||
void vtech2_mem(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
|
@ -308,24 +308,18 @@ void vtech2_state::mwa_bank(int bank, int offs, int data)
|
||||
}
|
||||
|
||||
|
||||
device_t *vtech2_state::laser_file()
|
||||
{
|
||||
return machine().device(m_laser_drive ? FLOPPY_1 : FLOPPY_0);
|
||||
}
|
||||
|
||||
void vtech2_state::laser_get_track()
|
||||
{
|
||||
sprintf(m_laser_frame_message, "#%d get track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2);
|
||||
m_laser_frame_time = 30;
|
||||
/* drive selected or and image file ok? */
|
||||
if( m_laser_drive >= 0 && laser_file() != nullptr )
|
||||
if( m_laser_drive >= 0 && m_laser_file[m_laser_drive].found() )
|
||||
{
|
||||
int size, offs;
|
||||
device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file());
|
||||
size = TRKSIZE_VZ;
|
||||
offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2;
|
||||
image->fseek(offs, SEEK_SET);
|
||||
size = image->fread(m_laser_fdc_data, size);
|
||||
device_image_interface &image = *m_laser_file[m_laser_drive];
|
||||
int size = TRKSIZE_VZ;
|
||||
int offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2;
|
||||
image.fseek(offs, SEEK_SET);
|
||||
size = image.fread(m_laser_fdc_data, size);
|
||||
logerror("get track @$%05x $%04x bytes\n", offs, size);
|
||||
}
|
||||
m_laser_fdc_offs = 0;
|
||||
@ -334,14 +328,13 @@ void vtech2_state::laser_get_track()
|
||||
|
||||
void vtech2_state::laser_put_track()
|
||||
{
|
||||
device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file());
|
||||
/* drive selected and image file ok? */
|
||||
if( m_laser_drive >= 0 && laser_file() != nullptr )
|
||||
if( m_laser_drive >= 0 && m_laser_file[m_laser_drive].found() )
|
||||
{
|
||||
int size, offs;
|
||||
offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2;
|
||||
image->fseek(offs + m_laser_fdc_start, SEEK_SET);
|
||||
size = image->fwrite(&m_laser_fdc_data[m_laser_fdc_start], m_laser_fdc_write);
|
||||
device_image_interface &image = *m_laser_file[m_laser_drive];
|
||||
int offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2;
|
||||
image.fseek(offs + m_laser_fdc_start, SEEK_SET);
|
||||
int size = image.fwrite(&m_laser_fdc_data[m_laser_fdc_start], m_laser_fdc_write);
|
||||
logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, m_laser_fdc_start, size, m_laser_fdc_write);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user