Skip to content

Commit

Permalink
-debug/debugcmd.cpp: Don't leak an open FILE when an argument is inva…
Browse files Browse the repository at this point in the history
…lid and also fixed a spelling error.

 * The saver/loadr commands should consider region endianness for portability.

-cpu/gigatron: Capitalisation of hex values was inconsistent, change it to lowercase as that tends to be the MAME standard.

-machine/exorterm.cpp: Fixed inputs magically changing on reset when they shouldn't (there are still others that should be fixed).

-mpu4vid.cpp: Corrected some errors in game descriptions.

-Fixed a couple of editing errors.
  • Loading branch information
cuavas committed Aug 5, 2020
1 parent a27476c commit 309a2ee
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 47 deletions.
2 changes: 1 addition & 1 deletion scripts/target/mame/nl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ files{
MAME_DIR .. "src/mame/audio/nl_tailg.cpp",
MAME_DIR .. "src/mame/audio/nl_tailg.h",
MAME_DIR .. "src/mame/audio/nl_warrior.cpp",
MAME_DIR .. "src/mame/audio/nl_Warrior.h",
MAME_DIR .. "src/mame/audio/nl_warrior.h",

MAME_DIR .. "src/mame/drivers/galaxian.cpp",
MAME_DIR .. "src/mame/includes/galaxian.h",
Expand Down
1 change: 0 additions & 1 deletion src/devices/bus/rs232/exorterm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void exorterm155_terminal_device::device_reset()
m_exorterm155->rs232_conn_cts_w(0);

// To the computer
output_rxd(1);
output_dcd(0);
output_dsr(0);
if (!m_flow_control->read())
Expand Down
10 changes: 5 additions & 5 deletions src/devices/cpu/gigatron/gigatron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void gigatron_cpu_device::reset_cpu()
m_pc = 0;
m_npc = (m_pc + 1) & m_romMask;
m_ppc = 0;
m_inReg = 0xFF;
m_inReg = 0xff;
m_outx = 0;
m_out = 0;
}
Expand Down Expand Up @@ -228,13 +228,13 @@ void gigatron_cpu_device::aluOp(uint8_t op, uint8_t mode, uint8_t bus, uint8_t d
case 7:
uint16_t rising = ~(m_out & b);
m_out = b;
m_out_cb(0, m_out, 0xFF);
m_out_cb(0, m_out, 0xff);

// rising edge of out[6] registers outx from ac
if (rising & 0x40)
{
m_outx = m_ac;
m_outx_cb(0, m_outx, 0xFF);
m_outx_cb(0, m_outx, 0xff);
}
break;
}
Expand Down Expand Up @@ -333,8 +333,8 @@ void gigatron_cpu_device::execute_set_input(int irqline, int state)

gigatron_cpu_device::gigatron_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, GTRON, tag, owner, clock)
, m_ramMask(0x7FFF)
, m_romMask(0xFFFF)
, m_ramMask(0x7fff)
, m_romMask(0xffff)
, m_program_config("program", ENDIANNESS_BIG, 16, 14, -1)
, m_data_config("data", ENDIANNESS_BIG, 8, 15, 0)
, m_outx_cb(*this)
Expand Down
15 changes: 6 additions & 9 deletions src/devices/machine/exorterm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,8 @@ void exorterm155_device::device_start()
save_item(NAME(m_kbd_start_holdoff));

// Keyboard

if (!m_kbd_scan_timer)
m_kbd_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_scan_row), this));
if (!m_kbd_repeat_timer)
m_kbd_repeat_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_repeat), this));
m_kbd_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_scan_row), this));
m_kbd_repeat_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_repeat), this));
kbd_reset_state();
kbd_repeat_stop();

Expand All @@ -775,6 +772,9 @@ void exorterm155_device::device_start()
save_item(NAME(m_kbd_repeat_row));
save_item(NAME(m_kbd_repeat_column));
save_item(NAME(m_kbd_last_modifiers));

m_dsr = 1;
m_ring = 0;
}

void exorterm155_device::device_reset()
Expand All @@ -793,9 +793,6 @@ void exorterm155_device::device_reset()
m_special_char_disp = 0;
m_sys_timer_count = 0;

m_dsr = 1;
m_ring = 0;

m_beeper->set_state(0);

// Keyboard
Expand All @@ -819,7 +816,7 @@ ROM_START( exorterm155 )
ROM_LOAD("51aw1018b24.bin", 0xd800, 0x0800, CRC(18a0ed66) SHA1(5fa6e4b3c27969c1d7e27c79fc2993e4cc9262cf))

ROM_REGION(0x0800, "chargen", 0)
ROM_LOAD("chargen.rom", 0x0000, 0x0800, CRC(0087cbad) SHA1(a6d3dd0512db4c459944c60d728536755a570964))
ROM_LOAD("chargen.rom", 0x0000, 0x0800, CRC(0087cbad) SHA1(a6d3dd0512db4c459944c60d728536755a570964) BAD_DUMP) // constructed from an apparently similar published Motorola character set

ROM_END

Expand Down
2 changes: 1 addition & 1 deletion src/devices/machine/v3021.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
// copyright-holders:Angelo Salese,cam900
/***************************************************************************
v3021.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/devices/machine/v3021.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
// copyright-holders:Angelo Salese,cam900
/***************************************************************************
v3021.h
Expand Down
1 change: 0 additions & 1 deletion src/devices/sound/k053260.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ static constexpr int CLOCKS_PER_SAMPLE = 64;

// device type definition
DEFINE_DEVICE_TYPE(K053260, k053260_device, "k053260", "K053260 KDSC")
;


// Pan multipliers. Set according to integer angles in degrees, amusingly.
Expand Down
48 changes: 23 additions & 25 deletions src/emu/debug/debugcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,6 @@ void debugger_commands::execute_saveregion(int ref, const std::vector<std::strin
{
u64 offset, length;
memory_region *region;
FILE *f;

/* validate parameters */
if (!validate_number_parameter(params[1], offset))
Expand All @@ -1987,21 +1986,21 @@ void debugger_commands::execute_saveregion(int ref, const std::vector<std::strin
if (!validate_memory_region_parameter(params[3], region))
return;

/* open the file */
f = fopen(params[0].c_str(), "wb");
if (!f) {
m_console.printf("Error opening file '%s'\n", params[0].c_str());
if (offset >= region->bytes())
{
m_console.printf("Invalid offset\n");
return;
}
if ((length <= 0) || ((length + offset) >= region->bytes()))
length = region->bytes() - offset;

if(offset >= region->bytes()) {
m_console.printf("Invalide offset\n");
/* open the file */
FILE *f = fopen(params[0].c_str(), "wb");
if (!f)
{
m_console.printf("Error opening file '%s'\n", params[0].c_str());
return;
}
// get full length
if(length <= 0 || length + offset >= region->bytes()) {
length = region->bytes() - offset;
}
fwrite(region->base() + offset, 1, length, f);

fclose(f);
Expand Down Expand Up @@ -2118,14 +2117,13 @@ void debugger_commands::execute_load(int ref, const std::vector<std::string> &pa


/*-------------------------------------------------
execute_saveregion - execute the save command on region memory
execute_loadregion - execute the load command on region memory
-------------------------------------------------*/

void debugger_commands::execute_loadregion(int ref, const std::vector<std::string> &params)
{
u64 offset, length;
memory_region *region;
FILE *f;

/* validate parameters */
if (!validate_number_parameter(params[1], offset))
Expand All @@ -2135,9 +2133,18 @@ void debugger_commands::execute_loadregion(int ref, const std::vector<std::strin
if (!validate_memory_region_parameter(params[3], region))
return;

if (offset >= region->bytes())
{
m_console.printf("Invalid offset\n");
return;
}
if ((length <= 0) || ((length + offset) >= region->bytes()))
length = region->bytes() - offset;

/* open the file */
f = fopen(params[0].c_str(), "rb");
if (!f) {
FILE *f = fopen(params[0].c_str(), "rb");
if (!f)
{
m_console.printf("Error opening file '%s'\n", params[0].c_str());
return;
}
Expand All @@ -2146,18 +2153,9 @@ void debugger_commands::execute_loadregion(int ref, const std::vector<std::strin
u64 size = ftell(f);
rewind(f);

if(offset >= region->bytes()) {
m_console.printf("Invalide offset\n");
return;
}
// get full length
if(length <= 0 || length + offset >= region->bytes()) {
length = region->bytes() - offset;
}
// check file size
if(length >= size) {
if (length >= size)
length = size;
}

fread(region->base() + offset, 1, length, f);

Expand Down
3 changes: 2 additions & 1 deletion src/mame/drivers/exorciser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ class exorciser_state : public driver_device
DECLARE_INPUT_CHANGED_MEMBER(maincpu_clock_change);
DECLARE_WRITE_LINE_MEMBER(abort_key_w);

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

private:
void dbg_map(address_map &map);
void mem_map(address_map &map);

Expand Down
4 changes: 2 additions & 2 deletions src/mame/drivers/mpu4vid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8293,7 +8293,7 @@ GAME( 199?, v4sixxc, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwb
GAME( 199?, v4sixxg, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, Cash+Token) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxh, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, Cash+Token, Datapak) (set 1) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxi, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, Cash+Token, Datapak) (set 2) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxj, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, Cash+Token, % Key) (MPU4 Video) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxj, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, Cash+Token, % Key) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxk, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Fixed, All - Cash) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxl, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, All - Cash) (MPU4 Video)",GAME_FLAGS )
GAME( 199?, v4sixxm, v4sixx, bwbvid, bwbvid, mpu4vid_state, init_bwbhack, ROT0, "BWB","6-X (BWB) (Release 3, 20p Switchable to 10p, All - Cash, Datapak) (MPU4 Video)",GAME_FLAGS )
Expand Down Expand Up @@ -8378,7 +8378,7 @@ GAME( 1996, v4renob, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_pri
GAME( 1996, v4renos, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release A, 20p Switchable 20p/10p/5p, Cash+Token) (set 1) (MPU4 Video)",GAME_FLAGS )
GAME( 1996, v4renou, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release A, 20p Switchable 20p/10p/5p, Cash+Token) (set 2) (MPU4 Video)",GAME_FLAGS )
GAME( 1996, v4renor, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release A, 20p Switchable 20p/10p/5p, Cash+Token) (Showcase) (set 1) (MPU4 Video)",GAME_FLAGS )
GAME( 1996, v4renot, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release A, 20p Switchable 20p/10p/5p, Cash+Token) (Showcase) (set 2)(MPU4 Video)",GAME_FLAGS )
GAME( 1996, v4renot, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release A, 20p Switchable 20p/10p/5p, Cash+Token) (Showcase) (set 2) (MPU4 Video)",GAME_FLAGS )
// older 68k version
GAME( 1996, v4reno8, v4reno, bwbvid5, bwbvid, mpu4vid_state, init_prizeinv, ROT0, "BWB","Reno Reels (Release 8, 20p Fixed, Cash+Token) (MPU4 Video)",GAME_FLAGS )
// 68k ROMs below have no matching base roms
Expand Down

0 comments on commit 309a2ee

Please sign in to comment.