summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine')
-rw-r--r--src/devices/machine/ds6417.cpp12
-rw-r--r--src/devices/machine/ds6417.h4
-rw-r--r--src/devices/machine/hp_dc100_tape.cpp18
-rw-r--r--src/devices/machine/hp_dc100_tape.h6
-rw-r--r--src/devices/machine/i7220.cpp6
-rw-r--r--src/devices/machine/i7220.h2
-rw-r--r--src/devices/machine/pccard_sram.cpp32
-rw-r--r--src/devices/machine/pccard_sram.h8
-rw-r--r--src/devices/machine/smartmed.cpp24
-rw-r--r--src/devices/machine/smartmed.h6
10 files changed, 58 insertions, 60 deletions
diff --git a/src/devices/machine/ds6417.cpp b/src/devices/machine/ds6417.cpp
index 51ae6e7a201..75905ef80a9 100644
--- a/src/devices/machine/ds6417.cpp
+++ b/src/devices/machine/ds6417.cpp
@@ -37,19 +37,19 @@ void ds6417_device::device_reset()
m_command = 0;
}
-image_init_result ds6417_device::call_load()
+std::error_condition ds6417_device::call_load()
{
if(length() != 32768)
- return image_init_result::FAIL;
- return image_init_result::PASS;
+ return image_error::INVALIDLENGTH;
+ return std::error_condition();
}
-image_init_result ds6417_device::call_create(int format_type, util::option_resolution *format_options)
+std::error_condition ds6417_device::call_create(int format_type, util::option_resolution *format_options)
{
u8 buffer[32768] = {0};
if(fwrite(buffer, 32768) != 32768)
- return image_init_result::FAIL;
- return image_init_result::PASS;
+ return std::errc::io_error;
+ return std::error_condition();
}
uint8_t ds6417_device::calccrc(uint8_t bit, uint8_t crc) const
diff --git a/src/devices/machine/ds6417.h b/src/devices/machine/ds6417.h
index 94d5e109426..beccdbe3c60 100644
--- a/src/devices/machine/ds6417.h
+++ b/src/devices/machine/ds6417.h
@@ -21,8 +21,8 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "bin"; }
- virtual image_init_result call_load() override;
- virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::error_condition call_load() override;
+ virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
DECLARE_WRITE_LINE_MEMBER(data_w) { if(!m_read) m_data = state; }
DECLARE_WRITE_LINE_MEMBER(clock_w);
diff --git a/src/devices/machine/hp_dc100_tape.cpp b/src/devices/machine/hp_dc100_tape.cpp
index 2afd9d78beb..8e735834e6c 100644
--- a/src/devices/machine/hp_dc100_tape.cpp
+++ b/src/devices/machine/hp_dc100_tape.cpp
@@ -85,12 +85,12 @@ hp_dc100_tape_device::hp_dc100_tape_device(const machine_config &mconfig, const
{
}
-image_init_result hp_dc100_tape_device::call_load()
+std::error_condition hp_dc100_tape_device::call_load()
{
return internal_load(false);
}
-image_init_result hp_dc100_tape_device::call_create(int format_type, util::option_resolution *format_options)
+std::error_condition hp_dc100_tape_device::call_create(int format_type, util::option_resolution *format_options)
{
return internal_load(true);
}
@@ -596,7 +596,7 @@ void hp_dc100_tape_device::clear_state()
set_tape_present(is_loaded());
}
-image_init_result hp_dc100_tape_device::internal_load(bool is_create)
+std::error_condition hp_dc100_tape_device::internal_load(bool is_create)
{
LOG("load %d\n", is_create);
@@ -607,9 +607,8 @@ image_init_result hp_dc100_tape_device::internal_load(bool is_create)
auto io = util::random_read_write_fill(image_core_file(), 0);
if (!io) {
LOG("out of memory\n");
- seterror(std::errc::not_enough_memory, nullptr);
set_tape_present(false);
- return image_init_result::FAIL;
+ return std::errc::not_enough_memory;
}
m_image.clear_tape();
m_image.save_tape(*io);
@@ -617,15 +616,14 @@ image_init_result hp_dc100_tape_device::internal_load(bool is_create)
auto io = util::random_read_fill(image_core_file(), 0);
if (!io) {
LOG("out of memory\n");
- seterror(std::errc::not_enough_memory, nullptr);
set_tape_present(false);
- return image_init_result::FAIL;
+ return std::errc::not_enough_memory;
}
if (!m_image.load_tape(*io)) {
LOG("load failed\n");
- seterror(image_error::INVALIDIMAGE, "Wrong format");
+ //seterror(image_error::INVALIDIMAGE, "Wrong format");
set_tape_present(false);
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
}
}
LOG("load OK\n");
@@ -633,7 +631,7 @@ image_init_result hp_dc100_tape_device::internal_load(bool is_create)
m_image_dirty = false;
set_tape_present(true);
- return image_init_result::PASS;
+ return std::error_condition();
}
void hp_dc100_tape_device::set_tape_present(bool present)
diff --git a/src/devices/machine/hp_dc100_tape.h b/src/devices/machine/hp_dc100_tape.h
index fd8ff3b5425..1642149211a 100644
--- a/src/devices/machine/hp_dc100_tape.h
+++ b/src/devices/machine/hp_dc100_tape.h
@@ -24,8 +24,8 @@ public:
hp_dc100_tape_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device_image_interface overrides
- virtual image_init_result call_load() override;
- virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::error_condition call_load() override;
+ virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual std::string call_display() override;
virtual const char *file_extensions() const noexcept override;
@@ -157,7 +157,7 @@ private:
bool m_image_dirty;
void clear_state();
- image_init_result internal_load(bool is_create);
+ std::error_condition internal_load(bool is_create);
void set_tape_present(bool present);
double compute_set_point(tape_speed_t speed , bool fwd) const;
void start_tape();
diff --git a/src/devices/machine/i7220.cpp b/src/devices/machine/i7220.cpp
index 9d9c788759f..dcb8697f936 100644
--- a/src/devices/machine/i7220.cpp
+++ b/src/devices/machine/i7220.cpp
@@ -108,13 +108,13 @@ void i7220_device::device_reset()
memset(&m_regs, 0, sizeof(m_regs));
}
-image_init_result i7220_device::call_load()
+std::error_condition i7220_device::call_load()
{
if (length() != (m_data_size * I7110_MBM_SIZE))
{
- return image_init_result::FAIL;
+ return image_error::INVALIDLENGTH;
}
- return image_init_result::PASS;
+ return std::error_condition();
}
diff --git a/src/devices/machine/i7220.h b/src/devices/machine/i7220.h
index f961d64559e..eb0068927db 100644
--- a/src/devices/machine/i7220.h
+++ b/src/devices/machine/i7220.h
@@ -50,7 +50,7 @@ public:
void set_data_size(int data_size) { m_data_size = data_size; }
// image-level overrides
- virtual image_init_result call_load() override;
+ virtual std::error_condition call_load() override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/devices/machine/pccard_sram.cpp b/src/devices/machine/pccard_sram.cpp
index 1a4f652a814..432b64e84fd 100644
--- a/src/devices/machine/pccard_sram.cpp
+++ b/src/devices/machine/pccard_sram.cpp
@@ -173,22 +173,22 @@ pccard_mitsubishi_sram_device::pccard_mitsubishi_sram_device(const machine_confi
{
}
-image_init_result pccard_mitsubishi_sram_device::call_load()
+std::error_condition pccard_mitsubishi_sram_device::call_load()
{
card_inserted(false);
if (length() != m_sram.bytes())
- return image_init_result::FAIL;
+ return image_error::INVALIDLENGTH;
if (fread(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
card_inserted(true);
- return image_init_result::PASS;
+ return std::error_condition();
}
-image_init_result pccard_mitsubishi_sram_device::call_create(int format_type, util::option_resolution *format_options)
+std::error_condition pccard_mitsubishi_sram_device::call_create(int format_type, util::option_resolution *format_options)
{
card_inserted(false);
@@ -196,11 +196,11 @@ image_init_result pccard_mitsubishi_sram_device::call_create(int format_type, ut
std::fill_n(&m_sram[0], m_sram.length(), 0);
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
card_inserted(true);
- return image_init_result::PASS;
+ return std::error_condition();
}
void pccard_mitsubishi_sram_device::call_unload()
@@ -255,25 +255,25 @@ pccard_centennial_sram_device::pccard_centennial_sram_device(const machine_confi
{
}
-image_init_result pccard_centennial_sram_device::call_load()
+std::error_condition pccard_centennial_sram_device::call_load()
{
card_inserted(false);
if (length() != m_sram.bytes() + m_eeprom.bytes())
- return image_init_result::FAIL;
+ return image_error::INVALIDLENGTH;
if (fread(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
if (fread(&m_eeprom[0], m_eeprom.bytes()) != m_eeprom.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
card_inserted(true);
- return image_init_result::PASS;
+ return std::error_condition();
}
-image_init_result pccard_centennial_sram_device::call_create(int format_type, util::option_resolution *format_options)
+std::error_condition pccard_centennial_sram_device::call_create(int format_type, util::option_resolution *format_options)
{
card_inserted(false);
@@ -284,14 +284,14 @@ image_init_result pccard_centennial_sram_device::call_create(int format_type, ut
std::copy_n(m_eeprom_default->base(), m_eeprom.length(), &m_eeprom[0]);
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
if (fwrite(&m_eeprom[0], m_eeprom.bytes()) != m_eeprom.bytes())
- return image_init_result::FAIL;
+ return image_error::UNSPECIFIED;
card_inserted(true);
- return image_init_result::PASS;
+ return std::error_condition();
}
void pccard_centennial_sram_device::call_unload()
diff --git a/src/devices/machine/pccard_sram.h b/src/devices/machine/pccard_sram.h
index 2cc43e335c1..dc17aded95a 100644
--- a/src/devices/machine/pccard_sram.h
+++ b/src/devices/machine/pccard_sram.h
@@ -77,8 +77,8 @@ protected:
protected:
// device_image_interface overrides
- virtual image_init_result call_load() override;
- virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::error_condition call_load() override;
+ virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
private:
@@ -102,8 +102,8 @@ protected:
protected:
// device_image_interface overrides
- virtual image_init_result call_load() override;
- virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::error_condition call_load() override;
+ virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
private:
diff --git a/src/devices/machine/smartmed.cpp b/src/devices/machine/smartmed.cpp
index 1c54d36d174..27492fd8b31 100644
--- a/src/devices/machine/smartmed.cpp
+++ b/src/devices/machine/smartmed.cpp
@@ -121,19 +121,19 @@ void nand_device::device_start()
/*
Load a SmartMedia image
*/
-image_init_result smartmedia_image_device::smartmedia_format_1()
+std::error_condition smartmedia_image_device::smartmedia_format_1()
{
SM_disk_image_header custom_header;
const int bytes_read = fread(&custom_header, sizeof(custom_header));
if (bytes_read != sizeof(custom_header))
{
- return image_init_result::FAIL;
+ return std::errc::io_error;
}
if (custom_header.version > 1)
{
- return image_init_result::FAIL;
+ return image_error::INVALIDIMAGE;
}
m_page_data_size = get_UINT32BE(custom_header.page_data_size);
@@ -177,7 +177,7 @@ image_init_result smartmedia_image_device::smartmedia_format_1()
m_image_format = 1;
#endif
- return image_init_result::PASS;
+ return std::error_condition();
}
int smartmedia_image_device::detect_geometry( uint8_t id1, uint8_t id2)
@@ -216,24 +216,24 @@ int smartmedia_image_device::detect_geometry( uint8_t id1, uint8_t id2)
return result;
}
-image_init_result smartmedia_image_device::smartmedia_format_2()
+std::error_condition smartmedia_image_device::smartmedia_format_2()
{
disk_image_format_2_header custom_header;
const int bytes_read = fread(&custom_header, sizeof(custom_header));
if (bytes_read != sizeof(custom_header))
{
- return image_init_result::FAIL;
+ return std::errc::io_error;
}
if ((custom_header.data1[0] != 0xEC) && (custom_header.data1[0] != 0x98))
{
- return image_init_result::FAIL;
+ return image_error::INVALIDIMAGE;
}
if (!detect_geometry(custom_header.data1[0], custom_header.data1[1]))
{
- return image_init_result::FAIL;
+ return image_error::INVALIDIMAGE;
}
m_feeprom_data_alloc = std::make_unique<uint8_t[]>(m_page_total_size*m_num_pages);
@@ -269,17 +269,17 @@ image_init_result smartmedia_image_device::smartmedia_format_2()
m_image_format = 2;
#endif
- return image_init_result::PASS;
+ return std::error_condition();
}
-image_init_result smartmedia_image_device::call_load()
+std::error_condition smartmedia_image_device::call_load()
{
- image_init_result result;
+ std::error_condition result;
uint64_t position;
// try format 1
position = ftell();
result = smartmedia_format_1();
- if (result != image_init_result::PASS)
+ if (result)
{
// try format 2
fseek(position, SEEK_SET);
diff --git a/src/devices/machine/smartmed.h b/src/devices/machine/smartmed.h
index 77c7d53b209..c44c106c14b 100644
--- a/src/devices/machine/smartmed.h
+++ b/src/devices/machine/smartmed.h
@@ -207,14 +207,14 @@ public:
virtual const char *image_interface() const noexcept override { return "sm_memc"; }
virtual const char *file_extensions() const noexcept override { return "smc"; }
- virtual image_init_result call_load() override;
+ virtual std::error_condition call_load() override;
virtual void call_unload() override;
protected:
virtual const software_list_loader &get_software_list_loader() const override;
- image_init_result smartmedia_format_1();
- image_init_result smartmedia_format_2();
+ std::error_condition smartmedia_format_1();
+ std::error_condition smartmedia_format_2();
int detect_geometry(uint8_t id1, uint8_t id2);
};