Skip to content

Commit

Permalink
4dpi, amstrad, apple2, bebox, besta, dkong, m24: initialized some var…
Browse files Browse the repository at this point in the history
…iables which were causing incorrect behaviours in drvnoclear debug builds
  • Loading branch information
Osso13 committed Feb 26, 2021
1 parent 0818171 commit 1a0b950
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 124 deletions.
2 changes: 2 additions & 0 deletions src/mame/drivers/4dpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class pi4d2x_state : public driver_device
, m_gfx(*this, "gfx")
, m_softlist(*this, "softlist")
, m_leds(*this, "led%u", 0U)
, m_vme_isr(0)
{
}

Expand Down Expand Up @@ -248,6 +249,7 @@ class pi4d3x_state : public driver_device
, m_serial(*this, "serial%u", 1U)
, m_dsp(*this, "dsp")
{
std::fill(std::begin(m_lio_isr), std::end(m_lio_isr), 0 );
}

void pi4d30(machine_config &config);
Expand Down
6 changes: 0 additions & 6 deletions src/mame/drivers/amstrad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,6 @@ void amstrad_state::amstrad_base(machine_config &config)
m_crtc->out_vsync_callback().set(FUNC(amstrad_state::amstrad_vsync_changed));
m_crtc->out_cur_callback().set("exp", FUNC(cpc_expansion_slot_device::cursor_w));

MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad)

/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8912(config, m_ay, 16_MHz_XTAL / 16);
Expand Down Expand Up @@ -1087,8 +1085,6 @@ void amstrad_state::cpcplus(machine_config &config)
m_crtc->out_hsync_callback().set(FUNC(amstrad_state::amstrad_plus_hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(amstrad_state::amstrad_plus_vsync_changed));

MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad)

/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8912(config, m_ay, 40_MHz_XTAL / 40);
Expand Down Expand Up @@ -1166,8 +1162,6 @@ void amstrad_state::gx4000(machine_config &config)
m_crtc->out_hsync_callback().set(FUNC(amstrad_state::amstrad_plus_hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(amstrad_state::amstrad_plus_vsync_changed));

MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad)

/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8912(config, m_ay, 40_MHz_XTAL / 40);
Expand Down
2 changes: 2 additions & 0 deletions src/mame/drivers/apple2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ void apple2_state::machine_start()
m_cassette->output(-1.0f);
m_upperbank->set_bank(0);
m_inh_bank = 0;
m_strobe = 0;
m_transchar = 0;

// precalculate joystick time constants
m_x_calibration = attotime::from_nsec(10800).as_double();
Expand Down
17 changes: 16 additions & 1 deletion src/mame/drivers/besta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "machine/terminal.h"


namespace {

class besta_state : public driver_device
{
public:
Expand All @@ -29,11 +31,14 @@ class besta_state : public driver_device
void besta(machine_config &config);

protected:
virtual void machine_start() override;
virtual void machine_reset() override;

private:
void besta_mem(address_map &map);
uint8_t mpcc_reg_r(offs_t offset);
void mpcc_reg_w(offs_t offset, uint8_t data);
void kbd_put(u8 data);
virtual void machine_reset() override;

uint8_t m_term_data;
uint8_t m_mpcc_regs[32];
Expand Down Expand Up @@ -103,6 +108,13 @@ void besta_state::besta_mem(address_map &map)
static INPUT_PORTS_START( besta )
INPUT_PORTS_END

void besta_state::machine_start()
{
m_term_data = 0;

save_item(NAME(m_term_data));
save_item(NAME(m_mpcc_regs));
}

void besta_state::machine_reset()
{
Expand Down Expand Up @@ -143,6 +155,9 @@ ROM_START( besta88 )
ROMX_LOAD( "cp31os9.27c512", 0x0000, 0x10000, CRC(607a0a55) SHA1(c257a88672ab39d2f3fad681d22e062182b0236d), ROM_BIOS(2))
ROM_END

} // Anonymous namespace


/* Driver */

// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
Expand Down
9 changes: 8 additions & 1 deletion src/mame/drivers/m24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@

#include "softlist.h"


namespace {

class m24_state : public driver_device
{
public:
Expand All @@ -58,7 +61,8 @@ class m24_state : public driver_device
m_kbc(*this, "kbc"),
m_keyboard(*this, "keyboard"),
m_z8000_apb(*this, "z8000_apb"),
m_dsw0(*this, "DSW0")
m_dsw0(*this, "DSW0"),
m_nmi_enable(false)
{ }

void olivetti(machine_config &config);
Expand Down Expand Up @@ -658,6 +662,9 @@ ROM_START( m240 )
ROM_LOAD("pdbd.tms2516.kbdmcu_replacement_board.10u", 0x000, 0x800, BAD_DUMP CRC(b8c4c18a) SHA1(25b4c24e19ff91924c53557c66513ab242d926c6))
ROM_END

} // Anonymous namespace


COMP( 1984, m21, ibm5150, 0, olivetti, m24, m24_state, empty_init, "Olivetti", "M21", MACHINE_NOT_WORKING )
COMP( 1983, m24, ibm5150, 0, olivetti, m24, m24_state, empty_init, "Olivetti", "M24", MACHINE_NOT_WORKING )
COMP( 1987, m240, ibm5150, 0, olivetti, m24, m24_state, empty_init, "Olivetti", "M240", MACHINE_NOT_WORKING )
193 changes: 100 additions & 93 deletions src/mame/includes/amstrad.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,88 +50,12 @@
#include "screen.h"


/****************************
* Gate Array data (CPC) -
****************************/
struct gate_array_t
{
std::unique_ptr<bitmap_ind16> bitmap; /* The bitmap we work on */
uint8_t pen_selected; /* Pen selection */
uint8_t mrer; /* Mode and ROM Enable Register */
uint8_t upper_bank;
uint8_t romdis; // ROMDIS signal from the expansion port

/* input signals from CRTC */
int vsync;
int hsync;
int de;
int ma;
int ra;

/* used for timing */
int hsync_after_vsync_counter;
int hsync_counter; /* The gate array counts CRTC HSYNC pulses using an internal 6-bit counter. */

/* used for drawing the screen */
attotime last_draw_time;
int y;
uint16_t *draw_p; /* Position in the bitmap where we are currently drawing */
uint16_t colour;
uint16_t address;
uint8_t *mode_lookup;
uint8_t data;
uint8_t ticks;
uint8_t ticks_increment;
uint16_t line_ticks;
uint8_t colour_ticks;
uint8_t max_colour_ticks;
};

/****************************
* ASIC data (CPC plus)
****************************/
struct asic_t
{
uint8_t *ram; /* pointer to RAM used for the CPC+ ASIC memory-mapped registers */
uint8_t enabled; /* Are CPC plus features enabled/unlocked */
uint8_t pri; /* Programmable raster interrupt */
uint8_t seqptr; /* Current position in the ASIC unlocking sequence */
uint8_t rmr2; /* ROM mapping register 2 */
uint16_t split_ma_base; /* Used to handle split screen support */
uint16_t split_ma_started; /* Used to handle split screen support */
uint16_t vpos; /* Current logical scanline */
uint16_t h_start; /* Position where DE became active */
uint16_t h_end; /* Position where DE became inactive */
uint8_t addr_6845; /* We need these to store a shadow copy of R1 of the mc6845 */
uint8_t horiz_disp;
uint8_t hscroll;
uint8_t de_start; /* flag to check if DE is been enabled this frame yet */
bool hsync_first_tick; /* flag to check in first CRTC tick, used for knowing when to cover left side of screen to cover horizontal softscroll mess */
uint8_t hsync_tick_count;

/* DMA */
uint8_t dma_status;
uint8_t dma_clear; /* Set if DMA interrupts are to be cleared automatically */
uint8_t dma_prescaler[3]; /* DMA channel prescaler */
uint16_t dma_repeat[3]; /* Location of the DMA channel's last repeat */
uint16_t dma_addr[3]; /* DMA channel address */
uint16_t dma_loopcount[3]; /* Count loops taken on this channel */
uint16_t dma_pause[3]; /* DMA pause count */
};


class amstrad_state : public driver_device
{
public:
enum
{
TIMER_PC2_LOW,
TIMER_VIDEO_UPDATE,
TIMER_SET_RESOLUTION
};

amstrad_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_exp(*this, "exp"),
m_maincpu(*this, "maincpu"),
m_ay(*this, "ay"),
m_fdc(*this, "upd765"),
Expand All @@ -142,7 +66,6 @@ class amstrad_state : public driver_device
m_cassette(*this, "cassette"),
m_cart(*this, "cartslot"),
m_ram(*this, RAM_TAG),
m_exp(*this, "exp"),
m_rtc(*this, "rtc"),
m_region_maincpu(*this, "maincpu"),
m_region_user1(*this, "user1"),
Expand All @@ -158,6 +81,32 @@ class amstrad_state : public driver_device
m_palette(*this, "palette")
{ }

void cpcplus_cartslot(machine_config &config);
void amstrad_base(machine_config &config);
void cpc664(machine_config &config);
void cpcplus(machine_config &config);
void gx4000(machine_config &config);
void cpc6128(machine_config &config);
void aleste(machine_config &config);
void kccomp(machine_config &config);
void cpc464(machine_config &config);

DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed);

optional_device<cpc_expansion_slot_device> m_exp; // not on a GX4000; accessed by a static function in machine/amstrad.cpp

protected:
enum
{
TIMER_PC2_LOW,
TIMER_VIDEO_UPDATE,
TIMER_SET_RESOLUTION
};

virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

private:
required_device<z80_device> m_maincpu;
required_device<ay8910_device> m_ay;
optional_device<upd765_family_device> m_fdc; // not on a GX4000
Expand All @@ -168,13 +117,83 @@ class amstrad_state : public driver_device
optional_device<cassette_image_device> m_cassette; // not on a GX4000, (or technically, the 6128+)
optional_device<generic_slot_device> m_cart; // only on 664+, 6128+ and GX4000
required_device<ram_device> m_ram;
optional_device<cpc_expansion_slot_device> m_exp; // not on a GX4000
optional_device<mc146818_device> m_rtc; // Aleste 520EX only

int m_system_type;
uint8_t m_aleste_mode;
int m_plus_irq_cause;

/****************************
* Gate Array data (CPC) -
****************************/
struct gate_array_t
{
std::unique_ptr<bitmap_ind16> bitmap; /* The bitmap we work on */
uint8_t pen_selected; /* Pen selection */
uint8_t mrer; /* Mode and ROM Enable Register */
uint8_t upper_bank;
uint8_t romdis; // ROMDIS signal from the expansion port

/* input signals from CRTC */
int vsync;
int hsync;
int de;
int ma;
int ra;

/* used for timing */
int hsync_after_vsync_counter;
int hsync_counter; /* The gate array counts CRTC HSYNC pulses using an internal 6-bit counter. */

/* used for drawing the screen */
attotime last_draw_time;
int y;
uint16_t *draw_p; /* Position in the bitmap where we are currently drawing */
uint16_t colour;
uint16_t address;
uint8_t *mode_lookup;
uint8_t data;
uint8_t ticks;
uint8_t ticks_increment;
uint16_t line_ticks;
uint8_t colour_ticks;
uint8_t max_colour_ticks;
};

gate_array_t m_gate_array;

/****************************
* ASIC data (CPC plus)
****************************/
struct asic_t
{
uint8_t *ram; /* pointer to RAM used for the CPC+ ASIC memory-mapped registers */
uint8_t enabled; /* Are CPC plus features enabled/unlocked */
uint8_t pri; /* Programmable raster interrupt */
uint8_t seqptr; /* Current position in the ASIC unlocking sequence */
uint8_t rmr2; /* ROM mapping register 2 */
uint16_t split_ma_base; /* Used to handle split screen support */
uint16_t split_ma_started; /* Used to handle split screen support */
uint16_t vpos; /* Current logical scanline */
uint16_t h_start; /* Position where DE became active */
uint16_t h_end; /* Position where DE became inactive */
uint8_t addr_6845; /* We need these to store a shadow copy of R1 of the mc6845 */
uint8_t horiz_disp;
uint8_t hscroll;
uint8_t de_start; /* flag to check if DE is been enabled this frame yet */
bool hsync_first_tick; /* flag to check in first CRTC tick, used for knowing when to cover left side of screen to cover horizontal softscroll mess */
uint8_t hsync_tick_count;

/* DMA */
uint8_t dma_status;
uint8_t dma_clear; /* Set if DMA interrupts are to be cleared automatically */
uint8_t dma_prescaler[3]; /* DMA channel prescaler */
uint16_t dma_repeat[3]; /* Location of the DMA channel's last repeat */
uint16_t dma_addr[3]; /* DMA channel address */
uint16_t dma_loopcount[3]; /* Count loops taken on this channel */
uint16_t dma_pause[3]; /* DMA pause count */
};

asic_t m_asic;
int m_GateArray_RamConfiguration;
unsigned char *m_AmstradCPC_RamBanks[4];
Expand Down Expand Up @@ -205,7 +224,6 @@ class amstrad_state : public driver_device
void amstrad_plus_seqcheck(int data);
DECLARE_MACHINE_START(amstrad);
DECLARE_MACHINE_RESET(amstrad);
DECLARE_VIDEO_START(amstrad);
void amstrad_cpc_palette(palette_device &palette) const;
void amstrad_cpc_green_palette(palette_device &palette) const;
DECLARE_MACHINE_START(plus);
Expand All @@ -221,7 +239,6 @@ class amstrad_state : public driver_device
void aleste_palette(palette_device &palette) const;
uint32_t screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_amstrad);
DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed);
TIMER_CALLBACK_MEMBER(amstrad_pc2_low);
TIMER_CALLBACK_MEMBER(amstrad_video_update_timer);
TIMER_CALLBACK_MEMBER(cb_set_resolution);
Expand Down Expand Up @@ -251,18 +268,9 @@ class amstrad_state : public driver_device

DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);

void cpcplus_cartslot(machine_config &config);
void amstrad_base(machine_config &config);
void cpc664(machine_config &config);
void cpcplus(machine_config &config);
void gx4000(machine_config &config);
void cpc6128(machine_config &config);
void aleste(machine_config &config);
void kccomp(machine_config &config);
void cpc464(machine_config &config);
void amstrad_io(address_map &map);
void amstrad_mem(address_map &map);
protected:

required_memory_region m_region_maincpu;
optional_memory_region m_region_user1;
required_memory_bank_array<16> m_banks;
Expand Down Expand Up @@ -300,14 +308,13 @@ class amstrad_state : public driver_device
void amstrad_common_init();
void enumerate_roms();
static uint8_t kccomp_get_colour_element(int colour_value);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

int m_centronics_busy;
uint8_t m_last_write;
};


/*----------- defined in machine/amstrad.c -----------*/
/*----------- defined in machine/amstrad.cpp -----------*/


void cpc_exp_cards(device_slot_interface &device);
Expand Down
Loading

0 comments on commit 1a0b950

Please sign in to comment.