diff --git a/src/emu/machine/cr589.c b/src/emu/machine/cr589.c index 3c3d36014d1..292c8e06775 100644 --- a/src/emu/machine/cr589.c +++ b/src/emu/machine/cr589.c @@ -6,7 +6,8 @@ const device_type SCSI_CR589 = &device_creator; scsi_cr589_device::scsi_cr589_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : scsicd_device(mconfig, SCSI_CR589, "SCSI CR589", tag, owner, clock, "scsi_cr589", __FILE__) + : scsicd_device(mconfig, SCSI_CR589, "SCSI CR589", tag, owner, clock, "scsi_cr589", __FILE__), + device_nvram_interface(mconfig, *this) { } @@ -18,13 +19,51 @@ void scsi_cr589_device::device_start() scsicd_device::device_start(); download = 0; - memcpy( &buffer[ identity_offset ], "MATSHITACD-ROM CR-589 GS0N", 28 ); save_item(NAME(download)); save_item(NAME(buffer)); save_item(NAME(bufferOffset)); } + + +//------------------------------------------------- +// nvram_default - called to initialize NVRAM to +// its default state +//------------------------------------------------- + +void scsi_cr589_device::nvram_default() +{ + memset( buffer, 0, sizeof(buffer)); + memcpy( &buffer[ identity_offset ], "MATSHITACD-ROM CR-589 GS0N", 28 ); +} + + + +//------------------------------------------------- +// nvram_read - called to read NVRAM from the +// .nv file +//------------------------------------------------- + +void scsi_cr589_device::nvram_read(emu_file &file) +{ + file.read(buffer, sizeof(buffer)); +} + + + +//------------------------------------------------- +// nvram_write - called to write NVRAM to the +// .nv file +//------------------------------------------------- + +void scsi_cr589_device::nvram_write(emu_file &file) +{ + file.write(buffer, sizeof(buffer)); +} + + + void scsi_cr589_device::ExecCommand( int *transferLength ) { switch( command[ 0 ] ) diff --git a/src/emu/machine/cr589.h b/src/emu/machine/cr589.h index 66e40bc7166..ef8d9c8edf5 100644 --- a/src/emu/machine/cr589.h +++ b/src/emu/machine/cr589.h @@ -17,7 +17,8 @@ #include "atapihle.h" #include "scsicd.h" -class scsi_cr589_device : public scsicd_device +class scsi_cr589_device : public scsicd_device, + public device_nvram_interface { public: // construction/destruction @@ -31,6 +32,11 @@ protected: // device-level overrides virtual void device_start(); + // device_nvram_interface overrides + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); + private: int download; UINT8 buffer[ 65536 ];