diff options
Diffstat (limited to 'src/devices/machine/at28c16.cpp')
-rw-r--r-- | src/devices/machine/at28c16.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/devices/machine/at28c16.cpp b/src/devices/machine/at28c16.cpp index 48676f534a8..079649e0e95 100644 --- a/src/devices/machine/at28c16.cpp +++ b/src/devices/machine/at28c16.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "emu.h" -#include "machine/at28c16.h" +#include "at28c16.h" #define AT28C16_DATA_BYTES ( 0x800 ) #define AT28C16_ID_BYTES ( 0x20 ) @@ -107,18 +107,16 @@ void at28c16_device::nvram_default() // .nv file //------------------------------------------------- -bool at28c16_device::nvram_read( util::read_stream &file ) +bool at28c16_device::nvram_read(util::read_stream &file) { - std::vector<uint8_t> buffer( AT28C16_TOTAL_BYTES ); - size_t actual; + std::vector<uint8_t> buffer(AT28C16_TOTAL_BYTES); - if (file.read( &buffer[0], AT28C16_TOTAL_BYTES, actual ) || actual != AT28C16_TOTAL_BYTES) + auto const [err, actual] = util::read(file, &buffer[0], AT28C16_TOTAL_BYTES); + if (err || (actual != AT28C16_TOTAL_BYTES)) return false; - for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) - { - space(AS_PROGRAM).write_byte( offs, buffer[ offs ] ); - } + for (offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++) + space(AS_PROGRAM).write_byte(offs, buffer[offs]); return true; } @@ -130,15 +128,13 @@ bool at28c16_device::nvram_read( util::read_stream &file ) bool at28c16_device::nvram_write( util::write_stream &file ) { - std::vector<uint8_t> buffer ( AT28C16_TOTAL_BYTES ); - size_t actual; + std::vector<uint8_t> buffer(AT28C16_TOTAL_BYTES); - for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) - { - buffer[ offs ] = space(AS_PROGRAM).read_byte( offs ); - } + for (offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++) + buffer[offs] = space(AS_PROGRAM).read_byte(offs); - return !file.write( &buffer[0], AT28C16_TOTAL_BYTES, actual ) && actual == AT28C16_TOTAL_BYTES; + auto const [err, actual] = util::write(file, &buffer[0], AT28C16_TOTAL_BYTES); + return !err; } |