store firmware in nvram (nw)

This commit is contained in:
smf- 2013-09-04 10:59:52 +00:00
parent b4590c6aeb
commit 00d110d825
2 changed files with 48 additions and 3 deletions

View File

@ -6,7 +6,8 @@
const device_type SCSI_CR589 = &device_creator<scsi_cr589_device>; const device_type SCSI_CR589 = &device_creator<scsi_cr589_device>;
scsi_cr589_device::scsi_cr589_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) 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(); scsicd_device::device_start();
download = 0; download = 0;
memcpy( &buffer[ identity_offset ], "MATSHITACD-ROM CR-589 GS0N", 28 );
save_item(NAME(download)); save_item(NAME(download));
save_item(NAME(buffer)); save_item(NAME(buffer));
save_item(NAME(bufferOffset)); 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 ) void scsi_cr589_device::ExecCommand( int *transferLength )
{ {
switch( command[ 0 ] ) switch( command[ 0 ] )

View File

@ -17,7 +17,8 @@
#include "atapihle.h" #include "atapihle.h"
#include "scsicd.h" #include "scsicd.h"
class scsi_cr589_device : public scsicd_device class scsi_cr589_device : public scsicd_device,
public device_nvram_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -31,6 +32,11 @@ protected:
// device-level overrides // device-level overrides
virtual void device_start(); 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: private:
int download; int download;
UINT8 buffer[ 65536 ]; UINT8 buffer[ 65536 ];