Skip to content

Commit 57aa5bb

Browse files
committed
nec/pc8001.cpp: .n80 quickload support
1 parent 603a7f2 commit 57aa5bb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/mame/nec/pc8001.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "speaker.h"
4747
#include "utf8.h"
4848

49+
4950
void pc8001_base_state::crtc_reverse_w(int state)
5051
{
5152
// rvv acts as a global flip for reverse attribute meaning
@@ -723,6 +724,31 @@ void pc8001mk2sr_state::machine_reset()
723724
//membank("bank2")->set_entry(2);
724725
}
725726

727+
/* Snapquik */
728+
729+
SNAPSHOT_LOAD_MEMBER(pc8001_state::snapshot_cb)
730+
{
731+
if (m_ram->size() < 0x10000)
732+
return std::make_pair(image_error::UNSUPPORTED, std::string("Configured RAM size must be 64K"));
733+
734+
if (image.length() > 0x8000)
735+
return std::make_pair(image_error::INVALIDLENGTH, std::string());
736+
737+
uint8_t *ram = m_ram->pointer();
738+
739+
std::vector<u8> snapshot(image.length());
740+
image.fread(&snapshot[0], image.length());
741+
742+
std::copy(std::begin(snapshot), std::end(snapshot), &ram[0x8000]);
743+
m_maincpu->set_state_int(Z80_SP, ram[0xff3e] | (ram[0xff3f] << 8));
744+
m_maincpu->set_pc(0xff3d);
745+
746+
//m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
747+
748+
return std::make_pair(std::error_condition(), std::string());
749+
}
750+
751+
726752
/* Machine Drivers */
727753

728754
void pc8001_state::pc8001(machine_config &config)
@@ -778,6 +804,9 @@ void pc8001_state::pc8001(machine_config &config)
778804

779805
RAM(config, RAM_TAG).set_default_size("16K").set_extra_options("32K,64K");
780806

807+
snapshot_image_device &snapshot(SNAPSHOT(config, "snapshot", "bin,n80", attotime::from_seconds(1)));
808+
snapshot.set_load_callback(FUNC(pc8001_state::snapshot_cb));
809+
781810
SOFTWARE_LIST(config, "disk_n_list").set_original("pc8001_flop");
782811

783812
/* sound hardware */

src/mame/nec/pc8001.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "bus/nec_fdd/pc80s31k.h"
1010
#include "cpu/z80/z80.h"
1111
#include "imagedev/cassette.h"
12+
#include "imagedev/snapquik.h"
1213
#include "machine/buffer.h"
1314
#include "machine/i8251.h"
1415
#include "machine/i8255.h"
@@ -119,6 +120,8 @@ class pc8001_state : public pc8001_base_state
119120
required_device<ram_device> m_ram;
120121
required_memory_region m_rom;
121122

123+
DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb);
124+
122125
private:
123126
uint8_t port40_r();
124127
void port40_w(uint8_t data);

0 commit comments

Comments
 (0)