From acb16536bf4ecbcda40bd658a49325fe81355f65 Mon Sep 17 00:00:00 2001 From: "K.Ohta" Date: Thu, 25 Oct 2018 00:58:58 +0900 Subject: [PATCH] [VM][General][WIP] Start to merge upstream 2018-10-14.Open branch upstream_20181014 . --- source/history.txt | 8 +- source/revision.txt | 2 +- source/src/common.cpp | 16 +- source/src/config.cpp | 30 ++-- source/src/fifo.cpp | 10 +- source/src/fileio.cpp | 242 ++++++++++++++++++++++++++----- source/src/fileio.h | 50 +++++-- source/src/qt/emuutils/CMakeLists.txt | 2 +- source/src/vm/babbage2nd/display.cpp | 8 +- source/src/vm/bmjr/memory.cpp | 38 ++--- source/src/vm/bubcom80/bubblecasette.cpp | 60 ++++---- source/src/vm/bubcom80/cmt.cpp | 12 +- source/src/vm/bubcom80/display.cpp | 2 +- source/src/vm/bubcom80/membus.cpp | 6 +- source/src/vm/bubcom80/rtc.cpp | 2 +- source/src/vm/colecovision/keyboard.cpp | 2 +- source/src/vm/colecovision/memory.cpp | 4 +- source/src/vm/common_vm/CMakeLists.txt | 2 +- source/src/vm/datarec.cpp | 10 +- source/src/vm/ex80/cmt.cpp | 10 +- source/src/vm/ex80/display.cpp | 4 +- source/src/vm/ex80/keyboard.cpp | 2 +- source/src/vm/ex80/memory.cpp | 2 +- source/src/vm/familybasic/apu.cpp | 2 +- source/src/vm/familybasic/apu.h | 204 +++++++++++++------------- source/src/vm/familybasic/memory.cpp | 2 +- source/src/vm/fm16beta/cmos.cpp | 4 +- source/src/vm/fm16beta/keyboard.cpp | 6 +- source/src/vm/fm16pi/sub.cpp | 10 +- source/src/vm/fm7/dummydevice.cpp | 6 +- source/src/vm/fm7/fm8_mainio.cpp | 2 +- source/src/vm/fm7/jcommcard.cpp | 16 +- source/src/vm/fm7/sound.cpp | 20 +-- source/src/vm/fmgen/fmgen.cpp | 6 +- source/src/vm/fmr30/cmos.cpp | 4 +- source/src/vm/fmr30/memory.cpp | 32 ++-- source/src/vm/fmr30/rtc.cpp | 14 +- source/src/vm/fmr30/scsi.cpp | 8 +- source/src/vm/fmr30/serial.cpp | 2 +- source/src/vm/fmr30/system.cpp | 6 +- source/src/vm/fmr30/timer.cpp | 4 +- source/src/vm/fmr50/cmos.cpp | 6 +- source/src/vm/fmr50/keyboard.cpp | 10 +- source/src/vm/fmr50/scsi.cpp | 4 +- source/src/vm/fmr50/timer.cpp | 10 +- source/src/vm/fp1100/main.cpp | 16 +- source/src/vm/fp1100/rampack.cpp | 4 +- source/src/vm/fp1100/sub.cpp | 56 ++++++- source/src/vm/fp1100/sub.h | 101 +------------ source/src/vm/fp200/io.h | 192 ++++++++++++------------ source/src/vm/hc20/memory.cpp | 2 +- source/src/vm/hc40/io.cpp | 70 ++++----- source/src/vm/hc40/memory.cpp | 4 +- source/src/vm/hc80/io.cpp | 116 +++++++-------- source/src/vm/hc80/memory.cpp | 4 +- source/src/vm/i386.cpp | 228 +++++++++++++++++++++-------- source/src/vm/i8259.cpp | 2 +- source/src/vm/jr100/memory.cpp | 8 +- source/src/vm/jx/display.cpp | 22 +-- source/src/vm/jx/floppy.cpp | 4 +- source/src/vm/jx/keyboard.cpp | 8 +- source/src/vm/m5/cmt.cpp | 14 +- source/src/vm/m6502.cpp | 2 +- source/src/vm/mc6809_base.cpp | 2 +- source/src/vm/msx/joystick.cpp | 2 +- source/src/vm/msx/keyboard.cpp | 4 +- source/src/vm/msx/memory.cpp | 30 ++-- source/src/vm/msx/memory_ex.cpp | 42 +++--- source/src/vm/msx/rtcif.cpp | 2 +- source/src/vm/multi8/cmt.cpp | 12 +- source/src/vm/multi8/display.cpp | 22 +-- source/src/vm/multi8/floppy.cpp | 2 +- source/src/vm/multi8/kanji.cpp | 2 +- source/src/vm/multi8/keyboard.cpp | 20 +-- source/src/vm/multi8/memory.cpp | 10 +- source/src/vm/mycomz80a/display.cpp | 12 +- source/src/vm/mycomz80a/keyboard.cpp | 6 +- source/src/vm/mycomz80a/memory.cpp | 6 +- source/src/vm/mz1p17.cpp | 2 +- source/src/vm/mz2500/cmt.cpp | 30 ++-- source/src/vm/mz2500/floppy.cpp | 2 +- source/src/vm/mz2500/interrupt.cpp | 2 +- source/src/vm/mz2500/joystick.cpp | 2 +- source/src/vm/mz2500/keyboard.cpp | 2 +- source/src/vm/mz2500/memory.cpp | 24 +-- source/src/vm/mz2500/memory80b.cpp | 32 ++-- source/src/vm/mz2500/mouse.cpp | 2 +- source/src/vm/mz2500/mz1e30.cpp | 6 +- source/src/vm/mz2500/mz1m01.cpp | 4 +- source/src/vm/mz2500/mz1r12.cpp | 8 +- source/src/vm/mz2500/mz1r13.cpp | 4 +- source/src/vm/mz2500/mz1r37.cpp | 4 +- source/src/vm/mz2500/serial.cpp | 2 +- source/src/vm/mz2800/joystick.cpp | 2 +- source/src/vm/mz2800/keyboard.cpp | 2 +- source/src/vm/mz2800/memory.cpp | 18 +-- source/src/vm/mz2800/mouse.cpp | 2 +- source/src/vm/mz2800/reset.cpp | 2 +- source/src/vm/mz2800/sasi.cpp | 32 ++-- source/src/vm/mz2800/serial.cpp | 2 +- source/src/vm/mz3500/keyboard.cpp | 20 +-- source/src/vm/mz3500/main.cpp | 48 +++--- source/src/vm/mz3500/sub.cpp | 12 +- source/src/vm/mz5500/keyboard.cpp | 22 +-- source/src/vm/mz5500/memory.cpp | 12 +- source/src/vm/mz5500/sysport.cpp | 4 +- source/src/vm/mz700/cmos.cpp | 6 +- source/src/vm/mz700/emm.cpp | 4 +- source/src/vm/mz700/floppy.cpp | 8 +- source/src/vm/mz700/kanji.cpp | 6 +- source/src/vm/mz700/keyboard.cpp | 2 +- source/src/vm/mz700/mz700.cpp | 2 +- source/src/vm/mz700/ramfile.cpp | 4 +- source/src/vm/mz80k/keyboard.cpp | 4 +- source/src/vm/mz80k/memory.cpp | 32 ++-- source/src/vm/mz80k/printer.cpp | 2 +- source/src/vm/pasopia/display.cpp | 6 +- source/src/vm/pasopia/floppy.cpp | 4 +- source/src/vm/pasopia/kanjipac2.cpp | 2 +- source/src/vm/pasopia/keyboard.cpp | 2 +- source/src/vm/pasopia/memory.cpp | 12 +- source/src/vm/pasopia/pac2.cpp | 2 +- source/src/vm/pasopia/rampac2.cpp | 8 +- source/src/vm/pasopia7/display.cpp | 14 +- source/src/vm/pasopia7/floppy.cpp | 2 +- source/src/vm/pasopia7/iobus.cpp | 2 +- source/src/vm/pasopia7/iotrap.cpp | 4 +- source/src/vm/pasopia7/kanjipac2.cpp | 2 +- source/src/vm/pasopia7/keyboard.cpp | 2 +- source/src/vm/pasopia7/memory.cpp | 20 +-- source/src/vm/pasopia7/pac2.cpp | 2 +- source/src/vm/pasopia7/rampac2.cpp | 8 +- source/src/vm/pc100/ioctrl.cpp | 18 +-- source/src/vm/pc100/kanji.cpp | 4 +- source/src/vm/pc2001/io.cpp | 12 +- source/src/vm/pc2001/pc2001.cpp | 2 +- source/src/vm/pc6001/floppy.cpp | 2 +- source/src/vm/pc6001/memory.cpp | 54 +++---- source/src/vm/pc6001/psub.cpp | 46 +++--- source/src/vm/pc6001/sub.cpp | 28 ++-- source/src/vm/pc6001/timer.cpp | 22 +-- source/src/vm/pc6031.cpp | 2 +- source/src/vm/pc8201/cmt.cpp | 16 +- source/src/vm/pc8201/keyboard.cpp | 6 +- source/src/vm/pc8201/lcd.cpp | 2 +- source/src/vm/pc8201/memory.cpp | 6 +- source/src/vm/pc9801/cmt.cpp | 10 +- source/src/vm/pc9801/floppy.cpp | 10 +- source/src/vm/pc9801/fmsound.cpp | 2 +- source/src/vm/pc9801/joystick.cpp | 2 +- source/src/vm/pc9801/keyboard.cpp | 6 +- source/src/vm/pc9801/mouse.cpp | 16 +- source/src/vm/pc9801/sasi.cpp | 6 +- source/src/vm/pc98ha/calendar.cpp | 2 +- source/src/vm/pc98ha/floppy.cpp | 4 +- source/src/vm/pc98ha/keyboard.cpp | 6 +- source/src/vm/pc98ha/memory.cpp | 32 ++-- source/src/vm/pc98ha/note.cpp | 4 +- source/src/vm/pcengine/pce.h | 111 +++++++------- source/src/vm/phc20/memory.cpp | 8 +- source/src/vm/phc25/keyboard.cpp | 4 +- source/src/vm/phc25/memory.cpp | 4 +- source/src/vm/phc25/system.cpp | 2 +- source/src/vm/pv1000/joystick.cpp | 4 +- source/src/vm/pv1000/psg.cpp | 2 +- source/src/vm/pv1000/vdp.cpp | 2 +- source/src/vm/pv2000/cmt.cpp | 12 +- source/src/vm/pv2000/keyboard.cpp | 6 +- source/src/vm/pv2000/printer.cpp | 8 +- source/src/vm/pyuta/memory.cpp | 10 +- source/src/vm/qc10/display.cpp | 12 +- source/src/vm/qc10/memory.cpp | 22 +-- source/src/vm/qc10/mfont.cpp | 2 +- source/src/vm/rx78/cmt.cpp | 10 +- source/src/vm/rx78/keyboard.cpp | 4 +- source/src/vm/rx78/memory.cpp | 12 +- source/src/vm/rx78/printer.cpp | 6 +- source/src/vm/sc3000/keyboard.cpp | 4 +- source/src/vm/sc3000/memory.cpp | 8 +- source/src/vm/scsi_dev.cpp | 2 +- source/src/vm/scv/io.cpp | 6 +- source/src/vm/scv/memory.cpp | 2 +- source/src/vm/scv/sound.h | 19 +-- source/src/vm/scv/vdp.cpp | 8 +- source/src/vm/smb80te/memory.cpp | 12 +- source/src/vm/smc777/memory.cpp | 2 +- source/src/vm/sn76489an.cpp | 2 +- source/src/vm/tk80bs/cmt.cpp | 18 +-- source/src/vm/tk80bs/display.cpp | 4 +- source/src/vm/tk80bs/keyboard.cpp | 12 +- source/src/vm/tk80bs/membus.cpp | 4 +- source/src/vm/tk80bs/memory.cpp | 4 +- source/src/vm/tms3631.cpp | 2 +- source/src/vm/tms9995.cpp | 44 +++--- source/src/vm/upd71071.cpp | 28 ++-- source/src/vm/x07/io.cpp | 72 ++++----- source/src/vm/x1/display.cpp | 2 +- source/src/vm/x1/iobus.cpp | 18 +-- source/src/vm/yalky/io.cpp | 20 +-- source/src/vm/yis/display.cpp | 2 +- source/src/vm/yis/keyboard.cpp | 6 +- source/src/vm/yis/mapper.cpp | 8 +- source/src/vm/ym2151.cpp | 2 +- source/src/vm/ym2203.cpp | 2 +- source/src/vm/z80dma.cpp | 2 +- source/src/vm/z80tvgame/memory.cpp | 4 +- 206 files changed, 1776 insertions(+), 1499 deletions(-) diff --git a/source/history.txt b/source/history.txt index 0620cbf57..a357cf684 100644 --- a/source/history.txt +++ b/source/history.txt @@ -1,8 +1,14 @@ +10/14/2018 + +[COMMON/FILEIO] improve functions to load/save state file for big-endian + +[VM/*] improve process_state for big-endian + + 10/13/2018 [EMU/DEBUGGER] increase breakpoint number from 8 to 16 -[VM/SCSI_DEV] fix to clear req signal after ack signal is raised [VM/VM_TEMPLATE] fix issue that virtual machine is not correctly released diff --git a/source/revision.txt b/source/revision.txt index 1c5c28bde..f4a7074ed 100644 --- a/source/revision.txt +++ b/source/revision.txt @@ -1,3 +1,3 @@ -Upstream 2018-10-13
+Upstream 2018-10-14
Qt Port and FM7 series 2018-10-25
diff --git a/source/src/common.cpp b/source/src/common.cpp index 288c123c8..156fe8b1c 100644 --- a/source/src/common.cpp +++ b/source/src/common.cpp @@ -1474,14 +1474,14 @@ bool DLL_PREFIX cur_time_t::process_state(void *f, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateInt32(year); - state_fio->StateInt32(month); - state_fio->StateInt32(day); - state_fio->StateInt32(day_of_week); - state_fio->StateInt32(hour); - state_fio->StateInt32(minute); - state_fio->StateInt32(second); - state_fio->StateBool(initialized); + state_fio->StateValue(year); + state_fio->StateValue(month); + state_fio->StateValue(day); + state_fio->StateValue(day_of_week); + state_fio->StateValue(hour); + state_fio->StateValue(minute); + state_fio->StateValue(second); + state_fio->StateValue(initialized); return true; } diff --git a/source/src/config.cpp b/source/src/config.cpp index bc260b23c..0e02d9196 100644 --- a/source/src/config.cpp +++ b/source/src/config.cpp @@ -872,46 +872,46 @@ bool process_config_state(void *f, bool loading) return false; } #ifdef USE_BOOT_MODE - state_fio->StateInt32(config.boot_mode); + state_fio->StateValue(config.boot_mode); #endif #ifdef USE_CPU_TYPE - state_fio->StateInt32(config.cpu_type); + state_fio->StateValue(config.cpu_type); #endif #ifdef USE_DIPSWITCH - state_fio->StateUint32(config.dipswitch); + state_fio->StateValue(config.dipswitch); #endif #ifdef USE_DEVICE_TYPE - state_fio->StateInt32(config.device_type); + state_fio->StateValue(config.device_type); #endif #ifdef USE_DRIVE_TYPE - state_fio->StateInt32(config.drive_type); + state_fio->StateValue(config.drive_type); #endif #ifdef USE_KEYBOARD_TYPE - state_fio->StateInt32(config.keyboard_type); + state_fio->StateValue(config.keyboard_type); #endif #ifdef USE_MOUSE_TYPE - state_fio->StateInt32(config.mouse_type); + state_fio->StateValue(config.mouse_type); #endif #ifdef USE_JOYSTICK_TYPE - state_fio->StateInt32(config.joystick_type); + state_fio->StateValue(config.joystick_type); #endif #ifdef USE_SOUND_TYPE - state_fio->StateInt32(config.sound_type); + state_fio->StateValue(config.sound_type); #endif #ifdef USE_MONITOR_TYPE - state_fio->StateInt32(config.monitor_type); + state_fio->StateValue(config.monitor_type); #endif #ifdef USE_PRINTER_TYPE - state_fio->StateInt32(config.printer_type); + state_fio->StateValue(config.printer_type); #endif #ifdef USE_FLOPPY_DISK for(int drv = 0; drv < USE_FLOPPY_DISK; drv++) { - state_fio->StateBool(config.correct_disk_timing[drv]); - state_fio->StateBool(config.ignore_disk_crc[drv]); + state_fio->StateValue(config.correct_disk_timing[drv]); + state_fio->StateValue(config.ignore_disk_crc[drv]); } #endif - state_fio->StateInt32(config.sound_frequency); - state_fio->StateInt32(config.sound_latency); + state_fio->StateValue(config.sound_frequency); + state_fio->StateValue(config.sound_latency); return true; } diff --git a/source/src/fifo.cpp b/source/src/fifo.cpp index 06c95d247..d0c7aad4b 100644 --- a/source/src/fifo.cpp +++ b/source/src/fifo.cpp @@ -100,11 +100,11 @@ bool FIFO::process_state(void *f, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateInt32(size); - state_fio->StateBuffer(buf, size * sizeof(int), 1); - state_fio->StateInt32(cnt); - state_fio->StateInt32(rpt); - state_fio->StateInt32(wpt); + state_fio->StateValue(size); + state_fio->StateArray(buf, size * sizeof(int), 1); + state_fio->StateValue(cnt); + state_fio->StateValue(rpt); + state_fio->StateValue(wpt); return true; } diff --git a/source/src/fileio.cpp b/source/src/fileio.cpp index 37d37a9fb..e45d6515d 100644 --- a/source/src/fileio.cpp +++ b/source/src/fileio.cpp @@ -573,6 +573,26 @@ void FILEIO::FputDouble_LE(double val) FputUint8(tmp.b.h7); } +_TCHAR FILEIO::FgetTCHAR_LE() +{ + switch(sizeof(_TCHAR)) { + case 2: return (_TCHAR)FgetUint16_LE(); + case 4: return (_TCHAR)FgetUint32_LE(); + case 8: return (_TCHAR)FgetUint64_LE(); + } + return (_TCHAR)FgetUint8(); +} + +void FILEIO::FputTCHAR_LE(_TCHAR val) +{ + switch(sizeof(_TCHAR)) { + case 2: FputUint16_LE((uint16_t)val); return; + case 4: FputUint32_LE((uint32_t)val); return; + case 8: FputUint32_LE((uint64_t)val); return; + } + FputUint8((uint8_t )val); +} + uint16_t FILEIO::FgetUint16_BE() { pair16_t tmp; @@ -749,6 +769,26 @@ void FILEIO::FputDouble_BE(double val) FputUint8(tmp.b.l); } +_TCHAR FILEIO::FgetTCHAR_BE() +{ + switch(sizeof(_TCHAR)) { + case 2: return (_TCHAR)FgetUint16_BE(); + case 4: return (_TCHAR)FgetUint32_BE(); + case 8: return (_TCHAR)FgetUint64_BE(); + } + return (_TCHAR)FgetUint8(); +} + +void FILEIO::FputTCHAR_BE(_TCHAR val) +{ + switch(sizeof(_TCHAR)) { + case 2: FputUint16_BE((uint16_t)val); return; + case 4: FputUint32_BE((uint32_t)val); return; + case 8: FputUint32_BE((uint64_t)val); return; + } + FputUint8((uint8_t )val); +} + int FILEIO::Fgetc() { #ifdef USE_ZLIB @@ -915,29 +955,6 @@ long FILEIO::Ftell() return 0; } -bool FILEIO::Fcompare(const void* buffer, size_t size) -{ - return Fcompare(buffer, size, 1); -} - -bool FILEIO::Fcompare(const void* buffer, size_t size, size_t count) -{ - bool result = true; - void *tmp = malloc(size); - - for(size_t i = 0; i < count; i++) { - if(Fread(tmp, size, 1) != 1) { - result = false; - break; - } - if(memcmp(buffer, tmp, size) != 0) { - result = false; - break; - } - } - free(tmp); - return result; -} bool FILEIO::Fflush() { @@ -972,17 +989,21 @@ bool FILEIO::StateCheckInt32(int32_t val) } } -bool FILEIO::StateCheckBuffer(const void *buffer, size_t size, size_t count) +bool FILEIO::StateCheckBuffer(const _TCHAR *buffer, size_t size, size_t count) { - if(open_mode == FILEIO_READ_BINARY) { - return Fcompare(buffer, size, count); - } else { - Fwrite(buffer, size, count); - return true; + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + if(open_mode == FILEIO_READ_BINARY) { + if(buffer[i] != FgetTCHAR_LE()) { + return false; + } + } else { + FputTCHAR_LE(buffer[i]); + } } + return true; } -void FILEIO::StateBool(bool &val) +void FILEIO::StateValue(bool &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetBool(); @@ -991,7 +1012,7 @@ void FILEIO::StateBool(bool &val) } } -void FILEIO::StateUint8(uint8_t &val) +void FILEIO::StateValue(uint8_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetUint8(); @@ -1000,7 +1021,7 @@ void FILEIO::StateUint8(uint8_t &val) } } -void FILEIO::StateUint16(uint16_t &val) +void FILEIO::StateValue(uint16_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetUint16_LE(); @@ -1009,7 +1030,7 @@ void FILEIO::StateUint16(uint16_t &val) } } -void FILEIO::StateUint32(uint32_t &val) +void FILEIO::StateValue(uint32_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetUint32_LE(); @@ -1018,7 +1039,7 @@ void FILEIO::StateUint32(uint32_t &val) } } -void FILEIO::StateUint64(uint64_t &val) +void FILEIO::StateValue(uint64_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetUint64_LE(); @@ -1027,7 +1048,7 @@ void FILEIO::StateUint64(uint64_t &val) } } -void FILEIO::StateInt8(int8_t &val) +void FILEIO::StateValue(int8_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetInt8(); @@ -1036,7 +1057,7 @@ void FILEIO::StateInt8(int8_t &val) } } -void FILEIO::StateInt16(int16_t &val) +void FILEIO::StateValue(int16_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetInt16_LE(); @@ -1045,7 +1066,7 @@ void FILEIO::StateInt16(int16_t &val) } } -void FILEIO::StateInt32(int32_t &val) +void FILEIO::StateValue(int32_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetInt32_LE(); @@ -1054,7 +1075,7 @@ void FILEIO::StateInt32(int32_t &val) } } -void FILEIO::StateInt64(int64_t &val) +void FILEIO::StateValue(int64_t &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetInt64_LE(); @@ -1063,7 +1084,34 @@ void FILEIO::StateInt64(int64_t &val) } } -void FILEIO::StateFloat(float &val) +void FILEIO::StateValue(pair16_t &val) +{ + if(open_mode == FILEIO_READ_BINARY) { + val.w = FgetUint16_LE(); + } else { + FputUint16_LE(val.w); + } +} + +void FILEIO::StateValue(pair32_t &val) +{ + if(open_mode == FILEIO_READ_BINARY) { + val.d = FgetUint32_LE(); + } else { + FputUint32_LE(val.d); + } +} + +void FILEIO::StateValue(pair64_t &val) +{ + if(open_mode == FILEIO_READ_BINARY) { + val.q = FgetUint64_LE(); + } else { + FputUint64_LE(val.q); + } +} + +void FILEIO::StateValue(float &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetFloat_LE(); @@ -1072,7 +1120,7 @@ void FILEIO::StateFloat(float &val) } } -void FILEIO::StateDouble(double &val) +void FILEIO::StateValue(double &val) { if(open_mode == FILEIO_READ_BINARY) { val = FgetDouble_LE(); @@ -1081,6 +1129,120 @@ void FILEIO::StateDouble(double &val) } } +void FILEIO::StateValue(_TCHAR &val) +{ + if(open_mode == FILEIO_READ_BINARY) { + val = FgetTCHAR_LE(); + } else { + FputTCHAR_LE(val); + } +} + +void FILEIO::StateArray(bool *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(uint8_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(uint16_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(uint32_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(uint64_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(int8_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(int16_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(int32_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(int64_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(pair16_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(pair32_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(pair64_t *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(float *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(double *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + +void FILEIO::StateArray(_TCHAR *buffer, size_t size, size_t count) +{ + for(unsigned int i = 0; i < size / sizeof(buffer[0]) * count; i++) { + StateValue(buffer[i]); + } +} + void FILEIO::StateBuffer(void *buffer, size_t size, size_t count) { if(open_mode == FILEIO_READ_BINARY) { diff --git a/source/src/fileio.h b/source/src/fileio.h index ab080de31..25e4ca9ca 100644 --- a/source/src/fileio.h +++ b/source/src/fileio.h @@ -111,6 +111,8 @@ public: void FputFloat_LE(float val); double FgetDouble_LE(); void FputDouble_LE(double val); + _TCHAR FgetTCHAR_LE(); + void FputTCHAR_LE(_TCHAR val); uint16_t FgetUint16_BE(); void FputUint16_BE(uint16_t val); @@ -128,6 +130,8 @@ public: void FputFloat_BE(float val); double FgetDouble_BE(); void FputDouble_BE(double val); + _TCHAR FgetTCHAR_BE(); + void FputTCHAR_BE(_TCHAR val); int Fgetc(); int Fputc(int c); @@ -146,19 +150,41 @@ public: bool StateCheckUint32(uint32_t val); bool StateCheckInt32(int32_t val); - bool StateCheckBuffer(const void *buffer, size_t size, size_t count); + bool StateCheckBuffer(const _TCHAR *buffer, size_t size, size_t count); - void StateBool(bool &val); - void StateUint8(uint8_t &val); - void StateUint16(uint16_t &val); - void StateUint32(uint32_t &val); - void StateUint64(uint64_t &val); - void StateInt8(int8_t &val); - void StateInt16(int16_t &val); - void StateInt32(int32_t &val); - void StateInt64(int64_t &val); - void StateFloat(float &val); - void StateDouble(double &val); + void StateValue(bool &val); + void StateValue(uint8_t &val); + void StateValue(uint16_t &val); + void StateValue(uint32_t &val); + void StateValue(uint64_t &val); + void StateValue(int8_t &val); + void StateValue(int16_t &val); + void StateValue(int32_t &val); + void StateValue(int64_t &val); + void StateValue(pair16_t &val); + void StateValue(pair32_t &val); + void StateValue(pair64_t &val); + void StateValue(float &val); + void StateValue(double &val); + void StateValue(_TCHAR &val); + + void StateArray(bool *buffer, size_t size, size_t count); + void StateArray(uint8_t *buffer, size_t size, size_t count); + void StateArray(uint16_t *buffer, size_t size, size_t count); + void StateArray(uint32_t *buffer, size_t size, size_t count); + void StateArray(uint64_t *buffer, size_t size, size_t count); + void StateArray(int8_t *buffer, size_t size, size_t count); + void StateArray(int16_t *buffer, size_t size, size_t count); + void StateArray(int32_t *buffer, size_t size, size_t count); + void StateArray(int64_t *buffer, size_t size, size_t count); + void StateArray(pair16_t *buffer, size_t size, size_t count); + void StateArray(pair32_t *buffer, size_t size, size_t count); + void StateArray(pair64_t *buffer, size_t size, size_t count); + void StateArray(float *buffer, size_t size, size_t count); + void StateArray(double *buffer, size_t size, size_t count); + void StateArray(_TCHAR *buffer, size_t size, size_t count); + + // obsolete function void StateBuffer(void *buffer, size_t size, size_t count); }; diff --git a/source/src/qt/emuutils/CMakeLists.txt b/source/src/qt/emuutils/CMakeLists.txt index 0e560d485..595823fc0 100644 --- a/source/src/qt/emuutils/CMakeLists.txt +++ b/source/src/qt/emuutils/CMakeLists.txt @@ -13,7 +13,7 @@ set(s_qt_emuutils_srcs QT5_WRAP_CPP(s_qt_emuutils_headers_MOC ${s_qt_emuutils_headers}) -SET(THIS_LIB_VERSION 2.13.1) +SET(THIS_LIB_VERSION 2.14.0) add_definitions(-D__LIBEMU_UTIL_VERSION=\"libCSPemu_utils.${THIS_LIB_VERSION}\") diff --git a/source/src/vm/babbage2nd/display.cpp b/source/src/vm/babbage2nd/display.cpp index 655ef1193..cece7251a 100644 --- a/source/src/vm/babbage2nd/display.cpp +++ b/source/src/vm/babbage2nd/display.cpp @@ -170,10 +170,10 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(seg, sizeof(seg), 1); - state_fio->StateUint8(ls373); - state_fio->StateUint8(pio_7seg); - state_fio->StateUint8(pio_8bit); + state_fio->StateArray(&seg[0][0], sizeof(seg), 1); + state_fio->StateValue(ls373); + state_fio->StateValue(pio_7seg); + state_fio->StateValue(pio_8bit); return true; } } diff --git a/source/src/vm/bmjr/memory.cpp b/source/src/vm/bmjr/memory.cpp index 02643b3b3..e0ebf35fb 100644 --- a/source/src/vm/bmjr/memory.cpp +++ b/source/src/vm/bmjr/memory.cpp @@ -414,25 +414,25 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(memory_bank); - state_fio->StateBuffer(color_table, sizeof(color_table), 1); - state_fio->StateUint8(char_color); - state_fio->StateUint8(back_color); - state_fio->StateUint8(mp1710_enb); - state_fio->StateUint8(screen_mode); - state_fio->StateBool(screen_reversed); - state_fio->StateBool(drec_bit); - state_fio->StateBool(drec_in); - state_fio->StateUint32(drec_clock); - state_fio->StateUint8(key_column); - state_fio->StateUint8(key_data); - state_fio->StateBool(nmi_enb); - state_fio->StateBool(break_pressed); - state_fio->StateUint8(sound_sample); - state_fio->StateDouble(sound_accum); - state_fio->StateUint32(sound_clock); - state_fio->StateUint32(sound_mix_clock); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(memory_bank); + state_fio->StateArray(color_table, sizeof(color_table), 1); + state_fio->StateValue(char_color); + state_fio->StateValue(back_color); + state_fio->StateValue(mp1710_enb); + state_fio->StateValue(screen_mode); + state_fio->StateValue(screen_reversed); + state_fio->StateValue(drec_bit); + state_fio->StateValue(drec_in); + state_fio->StateValue(drec_clock); + state_fio->StateValue(key_column); + state_fio->StateValue(key_data); + state_fio->StateValue(nmi_enb); + state_fio->StateValue(break_pressed); + state_fio->StateValue(sound_sample); + state_fio->StateValue(sound_accum); + state_fio->StateValue(sound_clock); + state_fio->StateValue(sound_mix_clock); // post process if(loading) { diff --git a/source/src/vm/bubcom80/bubblecasette.cpp b/source/src/vm/bubcom80/bubblecasette.cpp index 7b07e3d7d..51a749c66 100644 --- a/source/src/vm/bubcom80/bubblecasette.cpp +++ b/source/src/vm/bubcom80/bubblecasette.cpp @@ -715,44 +715,44 @@ bool BUBBLECASETTE::process_state(FILEIO* state_fio, bool loading) return false; } // Attributes - state_fio->StateUint32(file_length); - state_fio->StateBool(bubble_inserted); - state_fio->StateInt32(bubble_type); - state_fio->StateInt32(media_num); - state_fio->StateUint32(media_offset); - state_fio->StateUint32(media_offset_new); - state_fio->StateUint32(media_size); + state_fio->StateValue(file_length); + state_fio->StateValue(bubble_inserted); + state_fio->StateValue(bubble_type); + state_fio->StateValue(media_num); + state_fio->StateValue(media_offset); + state_fio->StateValue(media_offset_new); + state_fio->StateValue(media_size); // Data reg - state_fio->StateUint8(data_reg); + state_fio->StateValue(data_reg); // Command reg - state_fio->StateUint8(cmd_reg); + state_fio->StateValue(cmd_reg); // Status reg - state_fio->StateBool(stat_busy); - state_fio->StateBool(stat_tdra); - state_fio->StateBool(stat_rda); - state_fio->StateBool(cmd_error); - state_fio->StateBool(stat_error); - state_fio->StateBool(not_ready); + state_fio->StateValue(stat_busy); + state_fio->StateValue(stat_tdra); + state_fio->StateValue(stat_rda); + state_fio->StateValue(cmd_error); + state_fio->StateValue(stat_error); + state_fio->StateValue(not_ready); // Error reg - state_fio->StateBool(eject_error); - state_fio->StateBool(povr_error); - state_fio->StateBool(crc_error); - state_fio->StateBool(transfer_error); - state_fio->StateBool(bad_loop_over_error); - state_fio->StateBool(no_marker_error); - state_fio->StateBool(undefined_cmd_error); + state_fio->StateValue(eject_error); + state_fio->StateValue(povr_error); + state_fio->StateValue(crc_error); + state_fio->StateValue(transfer_error); + state_fio->StateValue(bad_loop_over_error); + state_fio->StateValue(no_marker_error); + state_fio->StateValue(undefined_cmd_error); // Page address - state_fio->StateUint32(page_address.d); + state_fio->StateValue(page_address.d); //Page Count - state_fio->StateUint32(page_count.d); + state_fio->StateValue(page_count.d); // Misc flags - state_fio->StateBool(is_b77); - state_fio->StateBool(read_access); - state_fio->StateBool(write_access); - state_fio->StateBool(write_protect); - state_fio->StateUint8(offset_reg); + state_fio->StateValue(is_b77); + state_fio->StateValue(read_access); + state_fio->StateValue(write_access); + state_fio->StateValue(write_protect); + state_fio->StateValue(offset_reg); - state_fio->StateBuffer(image_path, _MAX_PATH * sizeof(_TCHAR), 1); + state_fio->StateArray(image_path, _MAX_PATH * sizeof(_TCHAR), 1); // post process if(loading) { diff --git a/source/src/vm/bubcom80/cmt.cpp b/source/src/vm/bubcom80/cmt.cpp index da4c2d984..e5843c56d 100644 --- a/source/src/vm/bubcom80/cmt.cpp +++ b/source/src/vm/bubcom80/cmt.cpp @@ -108,10 +108,10 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(remote); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(remote); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -142,8 +142,8 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); return true; } } diff --git a/source/src/vm/bubcom80/display.cpp b/source/src/vm/bubcom80/display.cpp index a8a3873ce..380e33c34 100644 --- a/source/src/vm/bubcom80/display.cpp +++ b/source/src/vm/bubcom80/display.cpp @@ -811,7 +811,7 @@ void dmac_t::run(int c) } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool DISPLAY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/bubcom80/membus.cpp b/source/src/vm/bubcom80/membus.cpp index ad39f1e5b..90e4b580a 100644 --- a/source/src/vm/bubcom80/membus.cpp +++ b/source/src/vm/bubcom80/membus.cpp @@ -91,9 +91,9 @@ bool MEMBUS::process_state(FILEIO* state_fio, bool loading) if(!MEMORY::process_state(state_fio, loading)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint32(basic_addr.d); - state_fio->StateBool(ram_selected); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(basic_addr.d); + state_fio->StateValue(ram_selected); // post process if(loading) { diff --git a/source/src/vm/bubcom80/rtc.cpp b/source/src/vm/bubcom80/rtc.cpp index b65b1f174..8c6d98f60 100644 --- a/source/src/vm/bubcom80/rtc.cpp +++ b/source/src/vm/bubcom80/rtc.cpp @@ -161,7 +161,7 @@ bool RTC::process_state(FILEIO* state_fio, bool loading) if(!tmp_time.process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint8(ctrl); + state_fio->StateValue(ctrl); return true; } } diff --git a/source/src/vm/colecovision/keyboard.cpp b/source/src/vm/colecovision/keyboard.cpp index b9b1ea2cf..e60841dcf 100644 --- a/source/src/vm/colecovision/keyboard.cpp +++ b/source/src/vm/colecovision/keyboard.cpp @@ -139,7 +139,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(tenkey); + state_fio->StateValue(tenkey); return true; } } diff --git a/source/src/vm/colecovision/memory.cpp b/source/src/vm/colecovision/memory.cpp index d4a6458ad..e40d00c94 100644 --- a/source/src/vm/colecovision/memory.cpp +++ b/source/src/vm/colecovision/memory.cpp @@ -100,8 +100,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBool(inserted); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(inserted); // post process if(loading) { diff --git a/source/src/vm/common_vm/CMakeLists.txt b/source/src/vm/common_vm/CMakeLists.txt index 79d5a67db..e372cebbb 100644 --- a/source/src/vm/common_vm/CMakeLists.txt +++ b/source/src/vm/common_vm/CMakeLists.txt @@ -1,6 +1,6 @@ message("* vm/common_vm") -SET(THIS_LIB_VERSION 2.3.3) +SET(THIS_LIB_VERSION 2.4.0) #include(cotire) set(s_vm_common_vm_srcs diff --git a/source/src/vm/datarec.cpp b/source/src/vm/datarec.cpp index ff22e4722..9412f564d 100644 --- a/source/src/vm/datarec.cpp +++ b/source/src/vm/datarec.cpp @@ -1871,11 +1871,11 @@ bool DATAREC::process_state(FILEIO* state_fio, bool loading) if(loading) { close_file(); } - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(remote); - state_fio->StateBool(trigger); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(remote); + state_fio->StateValue(trigger); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { length_tmp = state_fio->FgetInt32_LE(); if(rec) { diff --git a/source/src/vm/ex80/cmt.cpp b/source/src/vm/ex80/cmt.cpp index 694fb1b79..f1cc94c48 100644 --- a/source/src/vm/ex80/cmt.cpp +++ b/source/src/vm/ex80/cmt.cpp @@ -104,9 +104,9 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -137,8 +137,8 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); return true; } } diff --git a/source/src/vm/ex80/display.cpp b/source/src/vm/ex80/display.cpp index 1483e4742..a5552dc7b 100644 --- a/source/src/vm/ex80/display.cpp +++ b/source/src/vm/ex80/display.cpp @@ -333,8 +333,8 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(odd_even); - state_fio->StateBool(dma); + state_fio->StateValue(odd_even); + state_fio->StateValue(dma); return true; } } diff --git a/source/src/vm/ex80/keyboard.cpp b/source/src/vm/ex80/keyboard.cpp index ac69173a3..2146b5b57 100644 --- a/source/src/vm/ex80/keyboard.cpp +++ b/source/src/vm/ex80/keyboard.cpp @@ -71,7 +71,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(column); + state_fio->StateValue(column); return true; } } diff --git a/source/src/vm/ex80/memory.cpp b/source/src/vm/ex80/memory.cpp index ce2131626..28f93ba3f 100644 --- a/source/src/vm/ex80/memory.cpp +++ b/source/src/vm/ex80/memory.cpp @@ -110,7 +110,7 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); return true; } } diff --git a/source/src/vm/familybasic/apu.cpp b/source/src/vm/familybasic/apu.cpp index 4943d17c1..9711e1270 100644 --- a/source/src/vm/familybasic/apu.cpp +++ b/source/src/vm/familybasic/apu.cpp @@ -315,7 +315,7 @@ void APU::enqueue(queue_t *d) q_head = (q_head + 1) & APUQUEUE_MASK; } -APU::queue_t* APU::dequeue() +queue_t* APU::dequeue() { int loc = q_tail; q_tail = (q_tail + 1) & APUQUEUE_MASK; diff --git a/source/src/vm/familybasic/apu.h b/source/src/vm/familybasic/apu.h index 6b7fd94f0..8404dfa05 100644 --- a/source/src/vm/familybasic/apu.h +++ b/source/src/vm/familybasic/apu.h @@ -21,113 +21,113 @@ namespace FAMILYBASIC { #define APUQUEUE_SIZE 4096 #define APUQUEUE_MASK (APUQUEUE_SIZE - 1) +// rectangle +typedef struct { + uint8_t regs[4]; + bool enabled; + int32_t phaseacc; + int32_t freq; + int32_t output_vol; + bool fixed_envelope; + bool holdnote; + uint8_t volume; + int32_t sweep_phase; + int32_t sweep_delay; + bool sweep_on; + uint8_t sweep_shifts; + uint8_t sweep_length; + bool sweep_inc; + int32_t freq_limit; + bool sweep_complement; + int32_t env_phase; + int32_t env_delay; + uint8_t env_vol; + int vbl_length; + uint8_t adder; + int duty_flip; + bool enabled_cur; + bool holdnote_cur; + int vbl_length_cur; +} rectangle_t; + +// triangle +typedef struct { + uint8_t regs[3]; + bool enabled; + int32_t freq; + int32_t phaseacc; + int32_t output_vol; + uint8_t adder; + bool holdnote; + bool counter_started; + int write_latency; + int vbl_length; + int linear_length; + bool enabled_cur; + bool holdnote_cur; + bool counter_started_cur; + int vbl_length_cur; +} triangle_t; + +// noise +typedef struct { + uint8_t regs[3]; + bool enabled; + int32_t freq; + int32_t phaseacc; + int32_t output_vol; + int32_t env_phase; + int32_t env_delay; + uint8_t env_vol; + bool fixed_envelope; + bool holdnote; + uint8_t volume; + int vbl_length; + uint8_t xor_tap; + bool enabled_cur; + bool holdnote_cur; + int vbl_length_cur; + + int shift_reg; + int noise_bit; +} noise_t; + +// dmc +typedef struct { + uint8_t regs[4]; + bool enabled; + int32_t freq; + int32_t phaseacc; + int32_t output_vol; + uint32_t address; + uint32_t cached_addr; + int dma_length; + int cached_dmalength; + uint8_t cur_byte; + bool looping; + bool irq_gen; + bool irq_occurred; + int32_t freq_cur; + int32_t phaseacc_cur; + int dma_length_cur; + int cached_dmalength_cur; + bool enabled_cur; + bool looping_cur; + bool irq_gen_cur; + bool irq_occurred_cur; +} dmc_t; + +// queue +typedef struct { + uint32_t timestamp, addr; + uint32_t data; +} queue_t; + class APU : public DEVICE { private: DEVICE *d_cpu, *d_mem; - // rectangle - typedef struct { - uint8_t regs[4]; - bool enabled; - int32_t phaseacc; - int32_t freq; - int32_t output_vol; - bool fixed_envelope; - bool holdnote; - uint8_t volume; - int32_t sweep_phase; - int32_t sweep_delay; - bool sweep_on; - uint8_t sweep_shifts; - uint8_t sweep_length; - bool sweep_inc; - int32_t freq_limit; - bool sweep_complement; - int32_t env_phase; - int32_t env_delay; - uint8_t env_vol; - int vbl_length; - uint8_t adder; - int duty_flip; - bool enabled_cur; - bool holdnote_cur; - int vbl_length_cur; - } rectangle_t; - - // triangle - typedef struct { - uint8_t regs[3]; - bool enabled; - int32_t freq; - int32_t phaseacc; - int32_t output_vol; - uint8_t adder; - bool holdnote; - bool counter_started; - int write_latency; - int vbl_length; - int linear_length; - bool enabled_cur; - bool holdnote_cur; - bool counter_started_cur; - int vbl_length_cur; - } triangle_t; - - // noise - typedef struct { - uint8_t regs[3]; - bool enabled; - int32_t freq; - int32_t phaseacc; - int32_t output_vol; - int32_t env_phase; - int32_t env_delay; - uint8_t env_vol; - bool fixed_envelope; - bool holdnote; - uint8_t volume; - int vbl_length; - uint8_t xor_tap; - bool enabled_cur; - bool holdnote_cur; - int vbl_length_cur; - - int shift_reg; - int noise_bit; - } noise_t; - - // dmc - typedef struct { - uint8_t regs[4]; - bool enabled; - int32_t freq; - int32_t phaseacc; - int32_t output_vol; - uint32_t address; - uint32_t cached_addr; - int dma_length; - int cached_dmalength; - uint8_t cur_byte; - bool looping; - bool irq_gen; - bool irq_occurred; - int32_t freq_cur; - int32_t phaseacc_cur; - int dma_length_cur; - int cached_dmalength_cur; - bool enabled_cur; - bool looping_cur; - bool irq_gen_cur; - bool irq_occurred_cur; - } dmc_t; - - // queue - typedef struct { - uint32_t timestamp, addr; - uint32_t data; - } queue_t; - rectangle_t rectangle[2]; triangle_t triangle; noise_t noise; diff --git a/source/src/vm/familybasic/memory.cpp b/source/src/vm/familybasic/memory.cpp index 169e9c41b..ce02028fd 100644 --- a/source/src/vm/familybasic/memory.cpp +++ b/source/src/vm/familybasic/memory.cpp @@ -876,7 +876,7 @@ void MEMORY::vrc7_hsync(int v) } } -#define STATE_VERSION 2 +#define STATE_VERSION 3 bool MEMORY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/fm16beta/cmos.cpp b/source/src/vm/fm16beta/cmos.cpp index e9caa6c40..60e8c8c41 100644 --- a/source/src/vm/fm16beta/cmos.cpp +++ b/source/src/vm/fm16beta/cmos.cpp @@ -60,8 +60,8 @@ bool CMOS::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(cmos, sizeof(cmos), 1); - state_fio->StateBool(modified); + state_fio->StateArray(cmos, sizeof(cmos), 1); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/fm16beta/keyboard.cpp b/source/src/vm/fm16beta/keyboard.cpp index ceee70c01..426ca15f2 100644 --- a/source/src/vm/fm16beta/keyboard.cpp +++ b/source/src/vm/fm16beta/keyboard.cpp @@ -87,9 +87,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(kbstat); - state_fio->StateInt32(kbdata); - state_fio->StateBuffer(table, sizeof(table), 1); + state_fio->StateValue(kbstat); + state_fio->StateValue(kbdata); + state_fio->StateArray(table, sizeof(table), 1); return true; } diff --git a/source/src/vm/fm16pi/sub.cpp b/source/src/vm/fm16pi/sub.cpp index 46f62326c..3be932b00 100644 --- a/source/src/vm/fm16pi/sub.cpp +++ b/source/src/vm/fm16pi/sub.cpp @@ -197,11 +197,11 @@ bool SUB::process_state(FILEIO* state_fio, bool loading) if(!key_buffer->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint8(key_data); - state_fio->StateBool(key_irq); - state_fio->StateUint8(fdc_drive); - state_fio->StateUint8(fdc_side); - state_fio->StateUint8(rtc_data); + state_fio->StateValue(key_data); + state_fio->StateValue(key_irq); + state_fio->StateValue(fdc_drive); + state_fio->StateValue(fdc_side); + state_fio->StateValue(rtc_data); return true; } diff --git a/source/src/vm/fm7/dummydevice.cpp b/source/src/vm/fm7/dummydevice.cpp index fbb3a58eb..e03599901 100644 --- a/source/src/vm/fm7/dummydevice.cpp +++ b/source/src/vm/fm7/dummydevice.cpp @@ -72,9 +72,9 @@ bool DUMMYDEVICE::process_state(FILEIO* state_fio, bool loading) } // Version 1 { - state_fio->StateUint32(status); - state_fio->StateBool(clear_on_reset); - state_fio->StateBool(clear_with_zero); + state_fio->StateValue(status); + state_fio->StateValue(clear_on_reset); + state_fio->StateValue(clear_with_zero); } return true; } diff --git a/source/src/vm/fm7/fm8_mainio.cpp b/source/src/vm/fm7/fm8_mainio.cpp index 4c73712dd..31fbc6c4c 100644 --- a/source/src/vm/fm7/fm8_mainio.cpp +++ b/source/src/vm/fm7/fm8_mainio.cpp @@ -462,7 +462,7 @@ bool FM8_MAINIO::decl_state(FILEIO *state_fio, bool loading) if(!FM7_MAINIO::decl_state(state_fio, loading)) { return false; } - state_fio->StateBool(connect_psg); + state_fio->StateValue(connect_psg); return true; } diff --git a/source/src/vm/fm7/jcommcard.cpp b/source/src/vm/fm7/jcommcard.cpp index 10c2ddc48..7cfa31ec7 100644 --- a/source/src/vm/fm7/jcommcard.cpp +++ b/source/src/vm/fm7/jcommcard.cpp @@ -228,15 +228,15 @@ bool FM7_JCOMMCARD::process_state(FILEIO *state_fio, bool loading) return false; } - state_fio->StateUint8(n_bank); - state_fio->StateUint8(rcb_address); - state_fio->StateUint32(kanji_address.d); - state_fio->StateBool(halted); + state_fio->StateValue(n_bank); + state_fio->StateValue(rcb_address); + state_fio->StateValue(kanji_address.d); + state_fio->StateValue(halted); - state_fio->StateBuffer(prog_rom, sizeof(prog_rom), 1); - state_fio->StateBuffer(dict_rom, sizeof(dict_rom), 1); - state_fio->StateBuffer(p_ram, sizeof(p_ram), 1); - state_fio->StateBool(firmware_ok); + state_fio->StateArray(prog_rom, sizeof(prog_rom), 1); + state_fio->StateArray(dict_rom, sizeof(dict_rom), 1); + state_fio->StateArray(p_ram, sizeof(p_ram), 1); + state_fio->StateValue(firmware_ok); if(loading) { n_bank &= 0x3f; diff --git a/source/src/vm/fm7/sound.cpp b/source/src/vm/fm7/sound.cpp index 9b2e1a74b..fb2a611b2 100644 --- a/source/src/vm/fm7/sound.cpp +++ b/source/src/vm/fm7/sound.cpp @@ -428,17 +428,17 @@ void FM7_MAINIO::event_beep_cycle(void) bool FM7_MAINIO::decl_state_opn(FILEIO *state_fio, bool loading) { - state_fio->StateBool(connect_opn); - state_fio->StateBool(connect_whg); - state_fio->StateBool(connect_thg); + state_fio->StateValue(connect_opn); + state_fio->StateValue(connect_whg); + state_fio->StateValue(connect_thg); - state_fio->StateBool(opn_psg_77av); - state_fio->StateBuffer(opn_address, sizeof(opn_address), 1); - state_fio->StateBuffer(opn_data, sizeof(opn_data), 1); - state_fio->StateBuffer(opn_stat, sizeof(opn_stat), 1); - state_fio->StateBuffer(opn_cmdreg, sizeof(opn_cmdreg), 1); - state_fio->StateBuffer(opn_prescaler_type, sizeof(opn_prescaler_type), 1); - state_fio->StateBuffer(opn_regs, sizeof(opn_regs), 1); + state_fio->StateValue(opn_psg_77av); + state_fio->StateArray(opn_address, sizeof(opn_address), 1); + state_fio->StateArray(opn_data, sizeof(opn_data), 1); + state_fio->StateArray(opn_stat, sizeof(opn_stat), 1); + state_fio->StateArray(opn_cmdreg, sizeof(opn_cmdreg), 1); + state_fio->StateArray(opn_prescaler_type, sizeof(opn_prescaler_type), 1); + state_fio->StateArray(&opn_regs[0][0], sizeof(opn_regs), 1); return true; } diff --git a/source/src/vm/fmgen/fmgen.cpp b/source/src/vm/fmgen/fmgen.cpp index 15604b2ef..b39fe512c 100644 --- a/source/src/vm/fmgen/fmgen.cpp +++ b/source/src/vm/fmgen/fmgen.cpp @@ -1071,8 +1071,8 @@ bool Channel4::ProcessState(void *f, bool loading) if(!state_fio->StateCheckUint32(CHANNEL4_STATE_VERSION)) { return false; } - state_fio->StateUint32(fb); - state_fio->StateBuffer(buf, sizeof(buf), 1); + state_fio->StateValue(fb); + state_fio->StateArray(buf, sizeof(buf), 1); if(loading) { for(int i = 0; i < 3; i++) { in [i] = &buf[0] + state_fio->FgetInt32_LE(); @@ -1086,7 +1086,7 @@ bool Channel4::ProcessState(void *f, bool loading) } state_fio->FputInt32_LE((int)(pms - &pmtable[0][0][0])); } - state_fio->StateInt32(algo_); + state_fio->StateValue(algo_); for(int i = 0; i < 4; i++) { if(!op[i].ProcessState(f, loading)) { return false; diff --git a/source/src/vm/fmr30/cmos.cpp b/source/src/vm/fmr30/cmos.cpp index 4ebeb2c16..3dde32498 100644 --- a/source/src/vm/fmr30/cmos.cpp +++ b/source/src/vm/fmr30/cmos.cpp @@ -60,8 +60,8 @@ bool CMOS::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(cmos, sizeof(cmos), 1); - state_fio->StateBool(modified); + state_fio->StateArray(cmos, sizeof(cmos), 1); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/fmr30/memory.cpp b/source/src/vm/fmr30/memory.cpp index c7bdcb8ce..ded9b3c02 100644 --- a/source/src/vm/fmr30/memory.cpp +++ b/source/src/vm/fmr30/memory.cpp @@ -528,22 +528,22 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(cvram, sizeof(cvram), 1); - state_fio->StateBuffer(kvram, sizeof(kvram), 1); - state_fio->StateUint8(mcr1); - state_fio->StateUint8(mcr2); - state_fio->StateUint8(a20); - state_fio->StateUint8(lcdadr); - state_fio->StateBuffer(lcdreg, sizeof(lcdreg), 1); - state_fio->StateUint16(dcr1); - state_fio->StateUint16(dcr2); - state_fio->StateInt32(kj_h); - state_fio->StateInt32(kj_l); - state_fio->StateInt32(kj_ofs); - state_fio->StateInt32(kj_row); - state_fio->StateInt32(blinkcnt); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(cvram, sizeof(cvram), 1); + state_fio->StateArray(kvram, sizeof(kvram), 1); + state_fio->StateValue(mcr1); + state_fio->StateValue(mcr2); + state_fio->StateValue(a20); + state_fio->StateValue(lcdadr); + state_fio->StateArray(lcdreg, sizeof(lcdreg), 1); + state_fio->StateValue(dcr1); + state_fio->StateValue(dcr2); + state_fio->StateValue(kj_h); + state_fio->StateValue(kj_l); + state_fio->StateValue(kj_ofs); + state_fio->StateValue(kj_row); + state_fio->StateValue(blinkcnt); // post process if(loading) { diff --git a/source/src/vm/fmr30/rtc.cpp b/source/src/vm/fmr30/rtc.cpp index 26da4c6fb..b1a7669e6 100644 --- a/source/src/vm/fmr30/rtc.cpp +++ b/source/src/vm/fmr30/rtc.cpp @@ -228,13 +228,13 @@ bool RTC::process_state(FILEIO* state_fio, bool loading) if(!cur_time.process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(register_id); - state_fio->StateUint16(rtcmr); - state_fio->StateUint16(rtdsr); - state_fio->StateUint16(rtadr); - state_fio->StateUint16(rtobr); - state_fio->StateUint16(rtibr); - state_fio->StateBuffer(regs, sizeof(regs), 1); + state_fio->StateValue(register_id); + state_fio->StateValue(rtcmr); + state_fio->StateValue(rtdsr); + state_fio->StateValue(rtadr); + state_fio->StateValue(rtobr); + state_fio->StateValue(rtibr); + state_fio->StateArray(regs, sizeof(regs), 1); return true; } diff --git a/source/src/vm/fmr30/scsi.cpp b/source/src/vm/fmr30/scsi.cpp index 5a98290ef..316881b18 100644 --- a/source/src/vm/fmr30/scsi.cpp +++ b/source/src/vm/fmr30/scsi.cpp @@ -175,10 +175,10 @@ bool SCSI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ctrl_reg); - state_fio->StateUint8(intm_reg); - state_fio->StateBool(phase_status); - state_fio->StateBool(eop_status); + state_fio->StateValue(ctrl_reg); + state_fio->StateValue(intm_reg); + state_fio->StateValue(phase_status); + state_fio->StateValue(eop_status); return true; } diff --git a/source/src/vm/fmr30/serial.cpp b/source/src/vm/fmr30/serial.cpp index fa76a9be7..243ea40e1 100644 --- a/source/src/vm/fmr30/serial.cpp +++ b/source/src/vm/fmr30/serial.cpp @@ -141,7 +141,7 @@ void SERIAL::update_intr(int ch) } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool SERIAL::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/fmr30/system.cpp b/source/src/vm/fmr30/system.cpp index 10c29368d..50ca3083d 100644 --- a/source/src/vm/fmr30/system.cpp +++ b/source/src/vm/fmr30/system.cpp @@ -67,9 +67,9 @@ bool SYSTEM::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(arr); - state_fio->StateUint8(nmistat); - state_fio->StateUint8(nmimask); + state_fio->StateValue(arr); + state_fio->StateValue(nmistat); + state_fio->StateValue(nmimask); return true; } diff --git a/source/src/vm/fmr30/timer.cpp b/source/src/vm/fmr30/timer.cpp index 25c447ad4..dd6cbda64 100644 --- a/source/src/vm/fmr30/timer.cpp +++ b/source/src/vm/fmr30/timer.cpp @@ -73,8 +73,8 @@ bool TIMER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ctrl); - state_fio->StateUint8(status); + state_fio->StateValue(ctrl); + state_fio->StateValue(status); return true; } diff --git a/source/src/vm/fmr50/cmos.cpp b/source/src/vm/fmr50/cmos.cpp index f9585b4dc..c52a26d2b 100644 --- a/source/src/vm/fmr50/cmos.cpp +++ b/source/src/vm/fmr50/cmos.cpp @@ -78,9 +78,9 @@ bool CMOS::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(cmos, sizeof(cmos), 1); - state_fio->StateBool(modified); - state_fio->StateUint8(bank); + state_fio->StateArray(&cmos[0][0], sizeof(cmos), 1); + state_fio->StateValue(modified); + state_fio->StateValue(bank); return true; } diff --git a/source/src/vm/fmr50/keyboard.cpp b/source/src/vm/fmr50/keyboard.cpp index ec12fa750..6a33e7d8c 100644 --- a/source/src/vm/fmr50/keyboard.cpp +++ b/source/src/vm/fmr50/keyboard.cpp @@ -114,11 +114,11 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint8(kbstat); - state_fio->StateUint8(kbdata); - state_fio->StateUint8(kbint); - state_fio->StateUint8(kbmsk); - state_fio->StateBuffer(table, sizeof(table), 1); + state_fio->StateValue(kbstat); + state_fio->StateValue(kbdata); + state_fio->StateValue(kbint); + state_fio->StateValue(kbmsk); + state_fio->StateArray(table, sizeof(table), 1); return true; } diff --git a/source/src/vm/fmr50/scsi.cpp b/source/src/vm/fmr50/scsi.cpp index 3cb02219b..5b8060f56 100644 --- a/source/src/vm/fmr50/scsi.cpp +++ b/source/src/vm/fmr50/scsi.cpp @@ -124,8 +124,8 @@ bool SCSI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ctrl_reg); - state_fio->StateBool(irq_status); + state_fio->StateValue(ctrl_reg); + state_fio->StateValue(irq_status); return true; } diff --git a/source/src/vm/fmr50/timer.cpp b/source/src/vm/fmr50/timer.cpp index 3e5999893..1df5acf69 100644 --- a/source/src/vm/fmr50/timer.cpp +++ b/source/src/vm/fmr50/timer.cpp @@ -95,11 +95,11 @@ bool TIMER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint16(free_run_counter); - state_fio->StateUint8(intr_reg); - state_fio->StateUint8(rtc_data); - state_fio->StateBool(tmout0); - state_fio->StateBool(tmout1); + state_fio->StateValue(free_run_counter); + state_fio->StateValue(intr_reg); + state_fio->StateValue(rtc_data); + state_fio->StateValue(tmout0); + state_fio->StateValue(tmout1); return true; } diff --git a/source/src/vm/fp1100/main.cpp b/source/src/vm/fp1100/main.cpp index 01d1587d8..ca07be685 100644 --- a/source/src/vm/fp1100/main.cpp +++ b/source/src/vm/fp1100/main.cpp @@ -258,14 +258,14 @@ bool MAIN::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(comm_data); - state_fio->StateBool(rom_sel); - state_fio->StateUint8(slot_sel); - state_fio->StateBuffer(slot_exp, sizeof(slot_exp), 1); - state_fio->StateUint8(intr_mask); - state_fio->StateUint8(intr_request); - state_fio->StateUint8(intr_in_service); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(comm_data); + state_fio->StateValue(rom_sel); + state_fio->StateValue(slot_sel); + state_fio->StateArray(slot_exp, sizeof(slot_exp), 1); + state_fio->StateValue(intr_mask); + state_fio->StateValue(intr_request); + state_fio->StateValue(intr_in_service); // post process if(loading) { diff --git a/source/src/vm/fp1100/rampack.cpp b/source/src/vm/fp1100/rampack.cpp index a30c4cbde..6a098341e 100644 --- a/source/src/vm/fp1100/rampack.cpp +++ b/source/src/vm/fp1100/rampack.cpp @@ -66,8 +66,8 @@ bool RAMPACK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBool(modified); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/fp1100/sub.cpp b/source/src/vm/fp1100/sub.cpp index d5ece71c3..ce670cf08 100644 --- a/source/src/vm/fp1100/sub.cpp +++ b/source/src/vm/fp1100/sub.cpp @@ -581,7 +581,61 @@ void SUB::draw_screen() state_fio->StateUint8(foo.counter); \ } -#define STATE_VERSION 2 +#define STATE_VERSION 3 + +void process_state_ls74(ls74_t* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->in_d); + state_fio->StateValue(val->in_ck); + state_fio->StateValue(val->in_s); + state_fio->StateValue(val->in_r); + state_fio->StateValue(val->out_q); + state_fio->StateValue(val->out_nq); + state_fio->StateValue(val->tmp_ck); +} + +void process_state_ls151(ls151_t* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->in_d0); + state_fio->StateValue(val->in_d1); + state_fio->StateValue(val->in_d2); + state_fio->StateValue(val->in_d3); + state_fio->StateValue(val->in_d4); + state_fio->StateValue(val->in_d5); + state_fio->StateValue(val->in_d6); + state_fio->StateValue(val->in_d7); + state_fio->StateValue(val->in_a); + state_fio->StateValue(val->in_b); + state_fio->StateValue(val->in_c); + state_fio->StateValue(val->in_s); + state_fio->StateValue(val->out_y); + state_fio->StateValue(val->out_ny); +} + +void process_state_ls93(ls93_t* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->in_a); + state_fio->StateValue(val->in_b); + state_fio->StateValue(val->in_rc1); + state_fio->StateValue(val->in_rc2); + state_fio->StateValue(val->out_qa); + state_fio->StateValue(val->out_qb); + state_fio->StateValue(val->out_qc); + state_fio->StateValue(val->tmp_a); + state_fio->StateValue(val->tmp_b); + state_fio->StateValue(val->counter_a); + state_fio->StateValue(val->counter_b); +} + +void process_state_tc4024bp(tc4024bp_t* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->in_ck); + state_fio->StateValue(val->in_clr); + state_fio->StateValue(val->out_q5); + state_fio->StateValue(val->out_q6); + state_fio->StateValue(val->tmp_ck); + state_fio->StateValue(val->counter); +} bool SUB::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/fp1100/sub.h b/source/src/vm/fp1100/sub.h index c39275099..7a2282d98 100644 --- a/source/src/vm/fp1100/sub.h +++ b/source/src/vm/fp1100/sub.h @@ -58,103 +58,10 @@ private: bool so; uint8_t clock; - // 74LS74 - struct { - bool in_d, in_ck, in_s, in_r; - bool out_q, out_nq; - bool tmp_ck; - void update() - { - if(!in_s && in_r) { - out_q = true; - out_nq = false; - } else if(in_s && !in_r) { - out_q = false; - out_nq = true; - } else if(!in_s && !in_r) { - out_q = out_nq = true; // undetermined - } else if(!tmp_ck && in_ck) { - out_q = in_d; - out_nq = !in_d; - } - tmp_ck = in_ck; - } - } b16_1, b16_2, g21_1, g21_2; - - // 74LS151 - struct { - bool in_d0, in_d1, in_d2, in_d3, in_d4, in_d5, in_d6, in_d7; - bool in_a, in_b, in_c, in_s; - bool out_y, out_ny; - void update() - { - if(in_s) { - out_y = false; - } else if(!in_a && !in_b && !in_c) { - out_y = in_d0; - } else if( in_a && !in_b && !in_c) { - out_y = in_d1; - } else if(!in_a && in_b && !in_c) { - out_y = in_d2; - } else if( in_a && in_b && !in_c) { - out_y = in_d3; - } else if(!in_a && !in_b && in_c) { - out_y = in_d4; - } else if( in_a && !in_b && in_c) { - out_y = in_d5; - } else if(!in_a && in_b && in_c) { - out_y = in_d6; - } else if( in_a && in_b && in_c) { - out_y = in_d7; - } - out_ny = !out_y; - } - } c15; - - // 74LS93 - struct { - bool in_a, in_b, in_rc1, in_rc2; - bool out_qa, out_qb, out_qc; - bool tmp_a, tmp_b; - uint8_t counter_a, counter_b; - void update() - { - if(in_rc1 && in_rc2) { - counter_a = counter_b = 0; - } else { - if(tmp_a && !in_a) { - counter_a++; - } - if(tmp_b && !in_b) { - counter_b++; - } - } - tmp_a = in_a; - tmp_b = in_b; - out_qa = ((counter_a & 1) != 0); - out_qb = ((counter_b & 1) != 0); - out_qc = ((counter_b & 2) != 0); - } - } c16; - - // TC4024BP - struct { - bool in_ck, in_clr; - bool out_q5, out_q6; - bool tmp_ck; - uint8_t counter; - void update() - { - if(in_clr) { - counter = 0; - } else if(tmp_ck && !in_ck) { - counter++; - } - tmp_ck = in_ck; - out_q5 = ((counter & 0x10) != 0); - out_q6 = ((counter & 0x20) != 0); - } - } f21; + ls74_t b16_1, b16_2, g21_1, g21_2; + ls151_t c15; + ls93_t c16; + tc4024bp_t f21; void update_cmt(); diff --git a/source/src/vm/fp200/io.h b/source/src/vm/fp200/io.h index 7dc9bdab5..f78b7ca38 100644 --- a/source/src/vm/fp200/io.h +++ b/source/src/vm/fp200/io.h @@ -21,6 +21,104 @@ class FILEIO; namespace FP200 { +// 74LS74 +typedef struct ls74_s { + bool in_d, in_ck, in_s, in_r; + bool out_q, out_nq; + bool tmp_ck; + void update() + { + if(!in_s && in_r) { + out_q = true; + out_nq = false; + } else if(in_s && !in_r) { + out_q = false; + out_nq = true; + } else if(!in_s && !in_r) { + out_q = out_nq = true; // undetermined + } else if(!tmp_ck && in_ck) { + out_q = in_d; + out_nq = !in_d; + } + tmp_ck = in_ck; + } +} ls74_t; + +// 74LS151 +typedef struct ls151_s { + bool in_d0, in_d1, in_d2, in_d3, in_d4, in_d5, in_d6, in_d7; + bool in_a, in_b, in_c, in_s; + bool out_y, out_ny; + void update() + { + if(in_s) { + out_y = false; + } else if(!in_a && !in_b && !in_c) { + out_y = in_d0; + } else if( in_a && !in_b && !in_c) { + out_y = in_d1; + } else if(!in_a && in_b && !in_c) { + out_y = in_d2; + } else if( in_a && in_b && !in_c) { + out_y = in_d3; + } else if(!in_a && !in_b && in_c) { + out_y = in_d4; + } else if( in_a && !in_b && in_c) { + out_y = in_d5; + } else if(!in_a && in_b && in_c) { + out_y = in_d6; + } else if( in_a && in_b && in_c) { + out_y = in_d7; + } + out_ny = !out_y; + } +} ls151_t; + +// 74LS93 +typedef struct ls93_s { + bool in_a, in_b, in_rc1, in_rc2; + bool out_qa, out_qb, out_qc; + bool tmp_a, tmp_b; + uint8_t counter_a, counter_b; + void update() + { + if(in_rc1 && in_rc2) { + counter_a = counter_b = 0; + } else { + if(tmp_a && !in_a) { + counter_a++; + } + if(tmp_b && !in_b) { + counter_b++; + } + } + tmp_a = in_a; + tmp_b = in_b; + out_qa = ((counter_a & 1) != 0); + out_qb = ((counter_b & 1) != 0); + out_qc = ((counter_b & 2) != 0); + } +} ls93_t; + +// TC4024BP +typedef struct tc4024bp_s { + bool in_ck, in_clr; + bool out_q5, out_q6; + bool tmp_ck; + uint8_t counter; + void update() + { + if(in_clr) { + counter = 0; + } else if(tmp_ck && !in_ck) { + counter++; + } + tmp_ck = in_ck; + out_q5 = ((counter & 0x10) != 0); + out_q6 = ((counter & 0x20) != 0); + } +} tc4024bp_t; + class IO : public DEVICE { private: @@ -54,96 +152,10 @@ private: // from FP-1100 uint8_t cmt_clock; - struct { - bool in_d, in_ck, in_s, in_r; - bool out_q, out_nq; - bool tmp_ck; - void update() - { - if(!in_s && in_r) { - out_q = true; - out_nq = false; - } else if(in_s && !in_r) { - out_q = false; - out_nq = true; - } else if(!in_s && !in_r) { - out_q = out_nq = true; // undetermined - } else if(!tmp_ck && in_ck) { - out_q = in_d; - out_nq = !in_d; - } - tmp_ck = in_ck; - } - } b16_1, b16_2, g21_1, g21_2; - struct { - bool in_d0, in_d1, in_d2, in_d3, in_d4, in_d5, in_d6, in_d7; - bool in_a, in_b, in_c, in_s; - bool out_y, out_ny; - void update() - { - if(in_s) { - out_y = false; - } else if(!in_a && !in_b && !in_c) { - out_y = in_d0; - } else if( in_a && !in_b && !in_c) { - out_y = in_d1; - } else if(!in_a && in_b && !in_c) { - out_y = in_d2; - } else if( in_a && in_b && !in_c) { - out_y = in_d3; - } else if(!in_a && !in_b && in_c) { - out_y = in_d4; - } else if( in_a && !in_b && in_c) { - out_y = in_d5; - } else if(!in_a && in_b && in_c) { - out_y = in_d6; - } else if( in_a && in_b && in_c) { - out_y = in_d7; - } - out_ny = !out_y; - } - } c15; - struct { - bool in_a, in_b, in_rc1, in_rc2; - bool out_qa, out_qb, out_qc; - bool tmp_a, tmp_b; - uint8_t counter_a, counter_b; - void update() - { - if(in_rc1 && in_rc2) { - counter_a = counter_b = 0; - } else { - if(tmp_a && !in_a) { - counter_a++; - } - if(tmp_b && !in_b) { - counter_b++; - } - } - tmp_a = in_a; - tmp_b = in_b; - out_qa = ((counter_a & 1) != 0); - out_qb = ((counter_b & 1) != 0); - out_qc = ((counter_b & 2) != 0); - } - } c16; - struct { - bool in_ck, in_clr; - bool out_q5, out_q6; - bool tmp_ck; - uint8_t counter; - void update() - { - if(in_clr) { - counter = 0; - } else if(tmp_ck && !in_ck) { - counter++; - } - tmp_ck = in_ck; - out_q5 = ((counter & 0x10) != 0); - out_q6 = ((counter & 0x20) != 0); - } - } f21; + ls74_t b16_1, b16_2, g21_1, g21_2; + ls151_t c15; + ls93_t c16; + tc4024bp_t f21; void update_cmt(); // keyboard diff --git a/source/src/vm/hc20/memory.cpp b/source/src/vm/hc20/memory.cpp index 1e26e9702..263158940 100644 --- a/source/src/vm/hc20/memory.cpp +++ b/source/src/vm/hc20/memory.cpp @@ -801,7 +801,7 @@ void MEMORY::draw_screen() } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool MEMORY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/hc40/io.cpp b/source/src/vm/hc40/io.cpp index ec68f0bd0..126f3df25 100644 --- a/source/src/vm/hc40/io.cpp +++ b/source/src/vm/hc40/io.cpp @@ -736,18 +736,18 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(cur_clock); - state_fio->StateUint8(bcr); - state_fio->StateUint8(slbcr); - state_fio->StateUint8(isr); - state_fio->StateUint8(ier); - state_fio->StateUint8(bankr); - state_fio->StateUint8(ioctlr); - state_fio->StateUint32(icrc); - state_fio->StateUint32(icrb); - state_fio->StateBool(ear); - state_fio->StateUint8(vadr); - state_fio->StateUint8(yoff); + state_fio->StateValue(cur_clock); + state_fio->StateValue(bcr); + state_fio->StateValue(slbcr); + state_fio->StateValue(isr); + state_fio->StateValue(ier); + state_fio->StateValue(bankr); + state_fio->StateValue(ioctlr); + state_fio->StateValue(icrc); + state_fio->StateValue(icrb); + state_fio->StateValue(ear); + state_fio->StateValue(vadr); + state_fio->StateValue(yoff); if(!cmd_buf->process_state((void *)state_fio, loading)) { return false; } @@ -757,35 +757,35 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!cur_time.process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(register_id_1sec); - state_fio->StateBool(onesec_intr); - state_fio->StateBool(onesec_intr_enb); - state_fio->StateBool(alarm_intr); - state_fio->StateBool(alarm_intr_enb); - state_fio->StateBuffer(alarm, sizeof(alarm), 1); + state_fio->StateValue(register_id_1sec); + state_fio->StateValue(onesec_intr); + state_fio->StateValue(onesec_intr_enb); + state_fio->StateValue(alarm_intr); + state_fio->StateValue(alarm_intr_enb); + state_fio->StateArray(alarm, sizeof(alarm), 1); if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateBool(kb_intr_enb); - state_fio->StateBool(kb_rep_enb); - state_fio->StateBool(kb_caps); - state_fio->StateUint8(kb_rep_spd1); - state_fio->StateUint8(kb_rep_spd2); + state_fio->StateValue(kb_intr_enb); + state_fio->StateValue(kb_rep_enb); + state_fio->StateValue(kb_caps); + state_fio->StateValue(kb_rep_spd1); + state_fio->StateValue(kb_rep_spd2); if(!art_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint8(artsr); - state_fio->StateUint8(artdir); - state_fio->StateBool(txen); - state_fio->StateBool(rxen); - state_fio->StateBool(dsr); - state_fio->StateInt32(register_id_art); - state_fio->StateBool(beep); - state_fio->StateBool(res_z80); - state_fio->StateBool(res_7508); - state_fio->StateBuffer(ext, sizeof(ext), 1); - state_fio->StateUint32(extar); - state_fio->StateUint8(extcr); + state_fio->StateValue(artsr); + state_fio->StateValue(artdir); + state_fio->StateValue(txen); + state_fio->StateValue(rxen); + state_fio->StateValue(dsr); + state_fio->StateValue(register_id_art); + state_fio->StateValue(beep); + state_fio->StateValue(res_z80); + state_fio->StateValue(res_7508); + state_fio->StateArray(ext, sizeof(ext), 1); + state_fio->StateValue(extar); + state_fio->StateValue(extcr); return true; } diff --git a/source/src/vm/hc40/memory.cpp b/source/src/vm/hc40/memory.cpp index a16450df0..65b170c7c 100644 --- a/source/src/vm/hc40/memory.cpp +++ b/source/src/vm/hc40/memory.cpp @@ -140,8 +140,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(bank); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(bank); // post process if(loading) { diff --git a/source/src/vm/hc80/io.cpp b/source/src/vm/hc80/io.cpp index 08a12b544..6cbe9f425 100644 --- a/source/src/vm/hc80/io.cpp +++ b/source/src/vm/hc80/io.cpp @@ -1910,17 +1910,17 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(cur_clock); - state_fio->StateUint8(bcr); - state_fio->StateUint8(slbcr); - state_fio->StateUint8(isr); - state_fio->StateUint8(ier); - state_fio->StateUint8(ioctlr); - state_fio->StateUint32(icrc); - state_fio->StateUint32(icrb); - state_fio->StateBool(ear); - state_fio->StateUint8(vadr); - state_fio->StateUint8(yoff); + state_fio->StateValue(cur_clock); + state_fio->StateValue(bcr); + state_fio->StateValue(slbcr); + state_fio->StateValue(isr); + state_fio->StateValue(ier); + state_fio->StateValue(ioctlr); + state_fio->StateValue(icrc); + state_fio->StateValue(icrb); + state_fio->StateValue(ear); + state_fio->StateValue(vadr); + state_fio->StateValue(yoff); if(!cmd7508_buf->process_state((void *)state_fio, loading)) { return false; } @@ -1930,65 +1930,65 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!cur_time.process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(register_id); - state_fio->StateBool(onesec_intr); - state_fio->StateBool(onesec_intr_enb); - state_fio->StateBool(alarm_intr); - state_fio->StateBool(alarm_intr_enb); - state_fio->StateBuffer(alarm, sizeof(alarm), 1); + state_fio->StateValue(register_id); + state_fio->StateValue(onesec_intr); + state_fio->StateValue(onesec_intr_enb); + state_fio->StateValue(alarm_intr); + state_fio->StateValue(alarm_intr_enb); + state_fio->StateArray(alarm, sizeof(alarm), 1); if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateBool(kb_intr_enb); - state_fio->StateBool(kb_rep_enb); - state_fio->StateBool(kb_caps); - state_fio->StateUint8(kb_rep_spd1); - state_fio->StateUint8(kb_rep_spd2); - state_fio->StateBool(beep); - state_fio->StateBool(res_z80); - state_fio->StateBool(res_7508); - state_fio->StateUint8(cmd6303); - state_fio->StateUint8(psr); + state_fio->StateValue(kb_intr_enb); + state_fio->StateValue(kb_rep_enb); + state_fio->StateValue(kb_caps); + state_fio->StateValue(kb_rep_spd1); + state_fio->StateValue(kb_rep_spd2); + state_fio->StateValue(beep); + state_fio->StateValue(res_z80); + state_fio->StateValue(res_7508); + state_fio->StateValue(cmd6303); + state_fio->StateValue(psr); if(!cmd6303_buf->process_state((void *)state_fio, loading)) { return false; } if(!rsp6303_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint16(cs_addr); - state_fio->StateUint16(gs_addr); - state_fio->StateUint8(lcd_on); - state_fio->StateUint8(scr_mode); - state_fio->StateUint16(scr_ptr); - state_fio->StateUint8(num_lines); - state_fio->StateUint8(curs_mode); - state_fio->StateUint8(curs_x); - state_fio->StateUint8(curs_y); - state_fio->StateUint8(wnd_ptr_x); - state_fio->StateUint8(wnd_ptr_y); - state_fio->StateUint8(flash_block); - state_fio->StateUint8(cs_blocks); - state_fio->StateBuffer(cs_block, sizeof(cs_block), 1); - state_fio->StateUint8(gs_blocks); - state_fio->StateBuffer(gs_block, sizeof(gs_block), 1); - state_fio->StateBuffer(font, sizeof(font), 1); - state_fio->StateBuffer(udgc, sizeof(udgc), 1); - state_fio->StateBuffer(mov, sizeof(mov), 1); - state_fio->StateBuffer(lcd, sizeof(lcd), 1); - state_fio->StateInt32(blink); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(cs_addr); + state_fio->StateValue(gs_addr); + state_fio->StateValue(lcd_on); + state_fio->StateValue(scr_mode); + state_fio->StateValue(scr_ptr); + state_fio->StateValue(num_lines); + state_fio->StateValue(curs_mode); + state_fio->StateValue(curs_x); + state_fio->StateValue(curs_y); + state_fio->StateValue(wnd_ptr_x); + state_fio->StateValue(wnd_ptr_y); + state_fio->StateValue(flash_block); + state_fio->StateValue(cs_blocks); + state_fio->StateArray(&cs_block[0][0], sizeof(cs_block), 1); + state_fio->StateValue(gs_blocks); + state_fio->StateArray(&gs_block[0][0], sizeof(gs_block), 1); + state_fio->StateArray(font, sizeof(font), 1); + state_fio->StateArray(&udgc[0][0], sizeof(udgc), 1); + state_fio->StateArray(&mov[0][0], sizeof(mov), 1); + state_fio->StateArray(&lcd[0][0], sizeof(lcd), 1); + state_fio->StateValue(blink); if(!tf20_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(device_type); - state_fio->StateBuffer(ext, sizeof(ext), 1); - state_fio->StateUint32(extar); - state_fio->StateUint8(extcr); - state_fio->StateBuffer(iramdisk_sectors, sizeof(iramdisk_sectors), 1); - state_fio->StateUint8(iramdisk_cmd); - state_fio->StateInt32(iramdisk_count); - state_fio->StateInt32(iramdisk_dest); - state_fio->StateBuffer(iramdisk_buf, sizeof(iramdisk_buf), 1); + state_fio->StateValue(device_type); + state_fio->StateArray(ext, sizeof(ext), 1); + state_fio->StateValue(extar); + state_fio->StateValue(extcr); + state_fio->StateArray(&iramdisk_sectors[0][0][0], sizeof(iramdisk_sectors), 1); + state_fio->StateValue(iramdisk_cmd); + state_fio->StateValue(iramdisk_count); + state_fio->StateValue(iramdisk_dest); + state_fio->StateArray(iramdisk_buf, sizeof(iramdisk_buf), 1); if(loading) { iramdisk_ptr = iramdisk_buf + state_fio->FgetInt32_LE(); } else { diff --git a/source/src/vm/hc80/memory.cpp b/source/src/vm/hc80/memory.cpp index b9d6d6295..b726d66d3 100644 --- a/source/src/vm/hc80/memory.cpp +++ b/source/src/vm/hc80/memory.cpp @@ -101,8 +101,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(bank); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(bank); // post process if(loading) { diff --git a/source/src/vm/i386.cpp b/source/src/vm/i386.cpp index b3ad522c0..b7c487e67 100644 --- a/source/src/vm/i386.cpp +++ b/source/src/vm/i386.cpp @@ -67,10 +67,6 @@ #define CPU_INIT(name) void* CPU_INIT_NAME(name)() #define CPU_INIT_CALL(name) CPU_INIT_NAME(name)() -#define CPU_TABLE_NAME(name) cpu_table_##name -#define CPU_TABLE(name) void CPU_TABLE_NAME(name)(i386_state *cpustate) -#define CPU_TABLE_CALL(name) CPU_TABLE_NAME(name)(cpustate) - #define CPU_RESET_NAME(name) cpu_reset_##name #define CPU_RESET(name) void CPU_RESET_NAME(name)(i386_state *cpustate) #define CPU_RESET_CALL(name) CPU_RESET_NAME(name)(cpustate) @@ -541,83 +537,191 @@ int I386::get_shutdown_flag() return cpustate->shutdown; } -#define STATE_VERSION 3 +#define STATE_VERSION 4 + +void process_state_SREG(I386_SREG* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->selector); + state_fio->StateValue(val->flags); + state_fio->StateValue(val->base); + state_fio->StateValue(val->limit); + state_fio->StateValue(val->d); + state_fio->StateValue(val->valid); +} + +void process_state_SYS_TABLE(I386_SYS_TABLE* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->base); + state_fio->StateValue(val->limit); +} + +void process_state_SEG_DESC(I386_SEG_DESC* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->segment); + state_fio->StateValue(val->flags); + state_fio->StateValue(val->base); + state_fio->StateValue(val->limit); +} + +void process_state_GPR(I386_GPR* val, FILEIO* state_fio) +{ + state_fio->StateArray(val->d, sizeof(val->d), 1); + state_fio->StateArray(val->w, sizeof(val->w), 1); + state_fio->StateArray(val->b, sizeof(val->b), 1); +} + +void process_state_floatx80(floatx80* val, FILEIO* state_fio) +{ + state_fio->StateValue(val->high); + state_fio->StateValue(val->low); +} + +void process_state_XMM_REG(XMM_REG* val, FILEIO* state_fio) +{ + state_fio->StateArray(val->b, sizeof(val->b), 1); + state_fio->StateArray(val->w, sizeof(val->w), 1); + state_fio->StateArray(val->d, sizeof(val->d), 1); + state_fio->StateArray(val->q, sizeof(val->q), 1); + state_fio->StateArray(val->c, sizeof(val->c), 1); + state_fio->StateArray(val->s, sizeof(val->s), 1); + state_fio->StateArray(val->i, sizeof(val->i), 1); + state_fio->StateArray(val->l, sizeof(val->l), 1); + state_fio->StateArray(val->f, sizeof(val->f), 1); + state_fio->StateArray(val->f64, sizeof(val->f64), 1); +} + +void process_state_vtlb(vtlb_state* val, FILEIO* state_fio) +{ +// state_fio->StateValue(val->space); +// state_fio->StateValue(val->dynamic); +// state_fio->StateValue(val->fixed); + state_fio->StateValue(val->dynindex); +// state_fio->StateValue(val->pageshift); +// state_fio->StateValue(val->addrwidth); + if(val->live != NULL) { + state_fio->StateArray(val->live, val->fixed + val->dynamic, 1); + } + if(val->fixedpages != NULL) { + state_fio->StateArray(val->fixedpages, val->fixed, 1); + } + if(val->table != NULL) { + state_fio->StateArray(val->table, (size_t) 1 << (val->addrwidth - val->pageshift), 1); + } +} bool I386::process_state(FILEIO* state_fio, bool loading) { i386_state *cpustate = (i386_state *)opaque; - vtlb_state *vtlb = cpustate->vtlb; - void *cpudevice = NULL; - offs_t *live = NULL; - int live_size = 0; - int *fixedpages = NULL; - int fixedpages_size = 0; - vtlb_entry *table = NULL; - int table_size = 0; -// vtlb_entry *save = NULL; -// int save_size = 0; - if(vtlb != NULL) { - cpudevice = vtlb->cpudevice; - live = vtlb->live; - live_size = vtlb->live_size; - fixedpages = vtlb->fixedpages; - fixedpages_size = vtlb->fixedpages_size; - table = vtlb->table; - table_size = vtlb->table_size; -// save = vtlb->save; -// save_size = vtlb->save_size; - } + if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(opaque, sizeof(i386_state), 1); - if(vtlb != NULL) { - state_fio->StateBuffer(vtlb, sizeof(vtlb_state), 1); + process_state_GPR(&cpustate->reg, state_fio); + for(int i = 0; i < array_length(cpustate->sreg); i++) { + process_state_SREG(&cpustate->sreg[i], state_fio); } - if(live != NULL && live_size > 0) { - state_fio->StateBuffer(live, live_size, 1); + state_fio->StateValue(cpustate->eip); + state_fio->StateValue(cpustate->pc); + state_fio->StateValue(cpustate->prev_eip); + state_fio->StateValue(cpustate->prev_pc); + state_fio->StateValue(cpustate->eflags); + state_fio->StateValue(cpustate->eflags_mask); + state_fio->StateValue(cpustate->CF); + state_fio->StateValue(cpustate->DF); + state_fio->StateValue(cpustate->SF); + state_fio->StateValue(cpustate->OF); + state_fio->StateValue(cpustate->ZF); + state_fio->StateValue(cpustate->PF); + state_fio->StateValue(cpustate->AF); + state_fio->StateValue(cpustate->IF); + state_fio->StateValue(cpustate->TF); + state_fio->StateValue(cpustate->IOP1); + state_fio->StateValue(cpustate->IOP2); + state_fio->StateValue(cpustate->NT); + state_fio->StateValue(cpustate->RF); + state_fio->StateValue(cpustate->VM); + state_fio->StateValue(cpustate->AC); + state_fio->StateValue(cpustate->VIF); + state_fio->StateValue(cpustate->VIP); + state_fio->StateValue(cpustate->ID); + state_fio->StateValue(cpustate->CPL); + state_fio->StateValue(cpustate->performed_intersegment_jump); + state_fio->StateValue(cpustate->delayed_interrupt_enable); + state_fio->StateArray(cpustate->cr, sizeof(cpustate->cr), 1); + state_fio->StateArray(cpustate->dr, sizeof(cpustate->dr), 1); + state_fio->StateArray(cpustate->tr, sizeof(cpustate->tr), 1); + process_state_SYS_TABLE(&cpustate->gdtr, state_fio); + process_state_SYS_TABLE(&cpustate->idtr, state_fio); + process_state_SEG_DESC(&cpustate->task, state_fio); + process_state_SEG_DESC(&cpustate->ldtr, state_fio); + state_fio->StateValue(cpustate->ext); + state_fio->StateValue(cpustate->halted); + state_fio->StateValue(cpustate->busreq); + state_fio->StateValue(cpustate->shutdown); + state_fio->StateValue(cpustate->operand_size); + state_fio->StateValue(cpustate->xmm_operand_size); + state_fio->StateValue(cpustate->address_size); + state_fio->StateValue(cpustate->operand_prefix); + state_fio->StateValue(cpustate->address_prefix); + state_fio->StateValue(cpustate->segment_prefix); + state_fio->StateValue(cpustate->segment_override); +#ifdef USE_DEBUGGER + state_fio->StateValue(cpustate->total_cycles); +#endif + state_fio->StateValue(cpustate->cycles); + state_fio->StateValue(cpustate->extra_cycles); + state_fio->StateValue(cpustate->base_cycles); + state_fio->StateValue(cpustate->opcode); + state_fio->StateValue(cpustate->irq_state); + state_fio->StateValue(cpustate->a20_mask); + state_fio->StateValue(cpustate->cpuid_max_input_value_eax); + state_fio->StateValue(cpustate->cpuid_id0); + state_fio->StateValue(cpustate->cpuid_id1); + state_fio->StateValue(cpustate->cpuid_id2); + state_fio->StateValue(cpustate->cpu_version); + state_fio->StateValue(cpustate->feature_flags); + state_fio->StateValue(cpustate->tsc); + state_fio->StateArray(cpustate->perfctr, sizeof(cpustate->perfctr), 1); + for(int i = 0; i < array_length(cpustate->x87_reg); i++) { + process_state_floatx80(&cpustate->x87_reg[i], state_fio); } - if(fixedpages != NULL && fixedpages_size > 0) { - state_fio->StateBuffer(fixedpages, fixedpages_size, 1); + state_fio->StateValue(cpustate->x87_cw); + state_fio->StateValue(cpustate->x87_sw); + state_fio->StateValue(cpustate->x87_tw); + state_fio->StateValue(cpustate->x87_data_ptr); + state_fio->StateValue(cpustate->x87_inst_ptr); + state_fio->StateValue(cpustate->x87_opcode); + for(int i = 0; i < array_length(cpustate->sse_reg); i++) { + process_state_XMM_REG(&cpustate->sse_reg[i], state_fio); } - if(table != NULL && table_size > 0) { - state_fio->StateBuffer(table, table_size, 1); + state_fio->StateValue(cpustate->mxcsr); + state_fio->StateArray(&cpustate->lock_table[0][0], sizeof(cpustate->lock_table), 1); + if(cpustate->vtlb != NULL) { + process_state_vtlb(cpustate->vtlb, state_fio); } -// if(save != NULL && save_size > 0) { -// state_fio->StateBuffer(save, save_size, 1); -// } + state_fio->StateValue(cpustate->smm); + state_fio->StateValue(cpustate->smi); + state_fio->StateValue(cpustate->smi_latched); + state_fio->StateValue(cpustate->nmi_masked); + state_fio->StateValue(cpustate->nmi_latched); + state_fio->StateValue(cpustate->smbase); +// state_fio->StateValue(cpustate->smiact); + state_fio->StateValue(cpustate->lock); +#ifdef DEBUG_MISSING_OPCODE + state_fio->StateArray(cpustate->opcode_bytes, sizeof(cpustate->opcode_bytes), 1); + state_fio->StateValue(cpustate->opcode_pc); + state_fio->StateValue(cpustate->opcode_bytes_length); +#endif +#ifdef USE_DEBUGGER // post process if(loading) { - cpustate->vtlb = vtlb; - if(vtlb != NULL) { - vtlb->cpudevice = cpudevice; - vtlb->live = live; - vtlb->fixedpages = fixedpages; - vtlb->table = table; -// vtlb->save = save; - } - cpustate->pic = d_pic; - cpustate->program = d_mem; - cpustate->io = d_io; -#ifdef I86_PSEUDO_BIOS - cpustate->bios = d_bios; -#endif -#ifdef SINGLE_MODE_DMA - cpustate->dma = d_dma; -#endif -#ifdef USE_DEBUGGER - cpustate->emu = emu; - cpustate->debugger = d_debugger; - cpustate->program_stored = d_mem; - cpustate->io_stored = d_io; cpustate->prev_total_cycles = cpustate->total_cycles; -#endif - CPU_TABLE_CALL(CPU_MODEL); } +#endif return true; } diff --git a/source/src/vm/i8259.cpp b/source/src/vm/i8259.cpp index 543249fc8..fe916405d 100644 --- a/source/src/vm/i8259.cpp +++ b/source/src/vm/i8259.cpp @@ -277,7 +277,7 @@ uint32_t I8259::get_intr_ack() return vector; } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool I8259::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/jr100/memory.cpp b/source/src/vm/jr100/memory.cpp index 711a0af57..185dac1e8 100644 --- a/source/src/vm/jr100/memory.cpp +++ b/source/src/vm/jr100/memory.cpp @@ -176,10 +176,10 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateInt32(key_column); - state_fio->StateBool(cmode); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateValue(key_column); + state_fio->StateValue(cmode); return true; } diff --git a/source/src/vm/jx/display.cpp b/source/src/vm/jx/display.cpp index 952b8116a..92ca3acc3 100644 --- a/source/src/vm/jx/display.cpp +++ b/source/src/vm/jx/display.cpp @@ -537,17 +537,17 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(extvram, sizeof(extvram), 1); - state_fio->StateBuffer(vgarray, sizeof(vgarray), 1); - state_fio->StateBuffer(palette, sizeof(palette), 1); - state_fio->StateInt32(vgarray_num); - state_fio->StateBuffer(bankreg, sizeof(bankreg), 1); - state_fio->StateInt32(bankreg_num); - state_fio->StateUint8(hires_mode); - state_fio->StateUint8(page); - state_fio->StateUint8(status); - state_fio->StateInt32(cblink); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(extvram, sizeof(extvram), 1); + state_fio->StateArray(vgarray, sizeof(vgarray), 1); + state_fio->StateArray(palette, sizeof(palette), 1); + state_fio->StateValue(vgarray_num); + state_fio->StateArray(bankreg, sizeof(bankreg), 1); + state_fio->StateValue(bankreg_num); + state_fio->StateValue(hires_mode); + state_fio->StateValue(page); + state_fio->StateValue(status); + state_fio->StateValue(cblink); return true; } diff --git a/source/src/vm/jx/floppy.cpp b/source/src/vm/jx/floppy.cpp index 29398f071..181a469f0 100644 --- a/source/src/vm/jx/floppy.cpp +++ b/source/src/vm/jx/floppy.cpp @@ -64,8 +64,8 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(prev); - state_fio->StateInt32(register_id); + state_fio->StateValue(prev); + state_fio->StateValue(register_id); return true; } diff --git a/source/src/vm/jx/keyboard.cpp b/source/src/vm/jx/keyboard.cpp index 617bb7413..22ef59e49 100644 --- a/source/src/vm/jx/keyboard.cpp +++ b/source/src/vm/jx/keyboard.cpp @@ -208,11 +208,11 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) return false; } #ifndef KEYBOARD_HACK - state_fio->StateUint64(send_data); - state_fio->StateInt32(send_count); + state_fio->StateValue(send_data); + state_fio->StateValue(send_count); #endif - state_fio->StateBool(key_latched); - state_fio->StateUint8(nmi_reg); + state_fio->StateValue(key_latched); + state_fio->StateValue(nmi_reg); return true; } diff --git a/source/src/vm/m5/cmt.cpp b/source/src/vm/m5/cmt.cpp index 3bc2f34bb..02788738c 100644 --- a/source/src/vm/m5/cmt.cpp +++ b/source/src/vm/m5/cmt.cpp @@ -80,13 +80,13 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(in); - state_fio->StateBool(out); - state_fio->StateBool(remote); - state_fio->StateBool(eot); - state_fio->StateUint8(pout); - state_fio->StateBool(strobe); - state_fio->StateBool(busy); + state_fio->StateValue(in); + state_fio->StateValue(out); + state_fio->StateValue(remote); + state_fio->StateValue(eot); + state_fio->StateValue(pout); + state_fio->StateValue(strobe); + state_fio->StateValue(busy); return true; } diff --git a/source/src/vm/m6502.cpp b/source/src/vm/m6502.cpp index a218ad373..fdbc8c0ca 100644 --- a/source/src/vm/m6502.cpp +++ b/source/src/vm/m6502.cpp @@ -931,7 +931,7 @@ void M6502::reset() int M6502::run(int clock) { if(clock == -1) { - if (busreq) { + if(busreq) { // don't run cpu! #ifdef USE_DEBUGGER total_icount += 1; diff --git a/source/src/vm/mc6809_base.cpp b/source/src/vm/mc6809_base.cpp index 52efa9a46..6ea312fc3 100644 --- a/source/src/vm/mc6809_base.cpp +++ b/source/src/vm/mc6809_base.cpp @@ -1432,7 +1432,7 @@ OP_HANDLER(sync_09) // Rename 20101110 /* $14 trap(HALT) */ OP_HANDLER(trap) { int_state |= MC6809_INSN_HALT; // HALTフラグ - // Debug: トラップ要因 + // Debug: トラチEE要因 this->out_debug_log(_T("TRAP(HALT) @%04x %02x %02x\n"), PC - 1, RM((PC - 1)), RM(PC)); } diff --git a/source/src/vm/msx/joystick.cpp b/source/src/vm/msx/joystick.cpp index 26cfb9a2b..c34c2ded3 100644 --- a/source/src/vm/msx/joystick.cpp +++ b/source/src/vm/msx/joystick.cpp @@ -57,7 +57,7 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(select); + state_fio->StateValue(select); return true; } diff --git a/source/src/vm/msx/keyboard.cpp b/source/src/vm/msx/keyboard.cpp index 971bd664d..ca741441b 100644 --- a/source/src/vm/msx/keyboard.cpp +++ b/source/src/vm/msx/keyboard.cpp @@ -83,8 +83,8 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); -// state_fio->StateBool(break_pressed); + state_fio->StateValue(column); +// state_fio->StateValue(break_pressed); return true; } diff --git a/source/src/vm/msx/memory.cpp b/source/src/vm/msx/memory.cpp index 897e20527..75cb30cc7 100644 --- a/source/src/vm/msx/memory.cpp +++ b/source/src/vm/msx/memory.cpp @@ -182,7 +182,7 @@ bool SLOT0::process_state(FILEIO* state_fio, bool loading) return false; } #if defined(_PX7) - state_fio->StateBuffer(ram, sizeof(ram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); #endif return true; } @@ -257,9 +257,9 @@ bool SLOT1::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(inserted); + state_fio->StateValue(inserted); #if defined(_MSX2) - state_fio->StateBuffer(mapper, sizeof(mapper), 1); + state_fio->StateArray(mapper, sizeof(mapper), 1); #endif // post process @@ -396,14 +396,14 @@ bool SLOT2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(clock); - state_fio->StateBool(exv); - state_fio->StateBool(ack); - state_fio->StateBool(super_impose); - state_fio->StateBool(req_intr); - state_fio->StateBool(pc4); - state_fio->StateBool(mute_l); - state_fio->StateBool(mute_r); + state_fio->StateValue(clock); + state_fio->StateValue(exv); + state_fio->StateValue(ack); + state_fio->StateValue(super_impose); + state_fio->StateValue(req_intr); + state_fio->StateValue(pc4); + state_fio->StateValue(mute_l); + state_fio->StateValue(mute_r); return true; } #else @@ -522,9 +522,9 @@ bool SLOT3::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBool(inserted); - state_fio->StateBuffer(mapper, sizeof(mapper), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(inserted); + state_fio->StateArray(mapper, sizeof(mapper), 1); // post process if(loading) { @@ -950,7 +950,7 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) } } #endif - state_fio->StateUint32(slot_select); + state_fio->StateValue(slot_select); // post process if(loading) { diff --git a/source/src/vm/msx/memory_ex.cpp b/source/src/vm/msx/memory_ex.cpp index 34f86c400..f88427ad5 100644 --- a/source/src/vm/msx/memory_ex.cpp +++ b/source/src/vm/msx/memory_ex.cpp @@ -274,7 +274,7 @@ bool SLOT_MAINROM::process_state(FILEIO* state_fio, bool loading) return false; } #ifdef MAINROM_PLUS_RAM_32K - state_fio->StateBuffer(ram, sizeof(ram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); #endif return true; } @@ -433,10 +433,10 @@ bool SLOT_CART::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(inserted); + state_fio->StateValue(inserted); #ifdef USE_MEGAROM - state_fio->StateInt32(type); - state_fio->StateBool(bank_scc); + state_fio->StateValue(type); + state_fio->StateValue(bank_scc); /* Todo: MEGA ROM bank select */ /* is this OK? */ if(loading) { @@ -529,7 +529,7 @@ bool SLOT_MSXDOS2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(mapper, sizeof(mapper), 1); + state_fio->StateArray(mapper, sizeof(mapper), 1); // post process if(loading) { @@ -663,14 +663,14 @@ bool SLOT_LDC::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(clock); - state_fio->StateBool(exv); - state_fio->StateBool(ack); - state_fio->StateBool(super_impose); - state_fio->StateBool(req_intr); - state_fio->StateBool(pc4); - state_fio->StateBool(mute_l); - state_fio->StateBool(mute_r); + state_fio->StateValue(clock); + state_fio->StateValue(exv); + state_fio->StateValue(ack); + state_fio->StateValue(super_impose); + state_fio->StateValue(req_intr); + state_fio->StateValue(pc4); + state_fio->StateValue(mute_l); + state_fio->StateValue(mute_r); return true; } #endif @@ -817,8 +817,8 @@ bool SLOT_MAPPERRAM::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(mapper, sizeof(mapper), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(mapper, sizeof(mapper), 1); // post process if(loading) { @@ -859,7 +859,7 @@ bool SLOT_RAM64K::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); return true; } #endif @@ -1404,11 +1404,11 @@ bool MEMORY_EX::process_state(FILEIO* state_fio, bool loading) } } #endif - state_fio->StateUint8(psl); - state_fio->StateUint8(ssl[0]); - state_fio->StateUint8(ssl[1]); - state_fio->StateUint8(ssl[2]); - state_fio->StateUint8(ssl[3]); + state_fio->StateValue(psl); + state_fio->StateValue(ssl[0]); + state_fio->StateValue(ssl[1]); + state_fio->StateValue(ssl[2]); + state_fio->StateValue(ssl[3]); // post process if(loading) { diff --git a/source/src/vm/msx/rtcif.cpp b/source/src/vm/msx/rtcif.cpp index 3967f3f8c..dd0edae4d 100644 --- a/source/src/vm/msx/rtcif.cpp +++ b/source/src/vm/msx/rtcif.cpp @@ -40,7 +40,7 @@ bool RTCIF::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(adrs); + state_fio->StateValue(adrs); return true; } diff --git a/source/src/vm/multi8/cmt.cpp b/source/src/vm/multi8/cmt.cpp index ca10b4146..ecf79707a 100644 --- a/source/src/vm/multi8/cmt.cpp +++ b/source/src/vm/multi8/cmt.cpp @@ -109,10 +109,10 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(remote); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(remote); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -143,8 +143,8 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); return true; } diff --git a/source/src/vm/multi8/display.cpp b/source/src/vm/multi8/display.cpp index 0ff7bedbd..0c82997ee 100644 --- a/source/src/vm/multi8/display.cpp +++ b/source/src/vm/multi8/display.cpp @@ -321,17 +321,17 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(pal, sizeof(pal), 1); - state_fio->StateBool(text_wide); - state_fio->StateBool(text_color); - state_fio->StateUint8(graph_color); - state_fio->StateUint8(graph_page); - state_fio->StateUint16(cursor); - state_fio->StateUint16(cblink); - state_fio->StateBool(hsync); - state_fio->StateBool(vsync); - state_fio->StateBool(display); - state_fio->StateBool(blink); + state_fio->StateArray(pal, sizeof(pal), 1); + state_fio->StateValue(text_wide); + state_fio->StateValue(text_color); + state_fio->StateValue(graph_color); + state_fio->StateValue(graph_page); + state_fio->StateValue(cursor); + state_fio->StateValue(cblink); + state_fio->StateValue(hsync); + state_fio->StateValue(vsync); + state_fio->StateValue(display); + state_fio->StateValue(blink); return true; } diff --git a/source/src/vm/multi8/floppy.cpp b/source/src/vm/multi8/floppy.cpp index cc80e7e5b..612bb086b 100644 --- a/source/src/vm/multi8/floppy.cpp +++ b/source/src/vm/multi8/floppy.cpp @@ -57,7 +57,7 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(drq); + state_fio->StateValue(drq); return true; } diff --git a/source/src/vm/multi8/kanji.cpp b/source/src/vm/multi8/kanji.cpp index e190f8c8a..70bb8df40 100644 --- a/source/src/vm/multi8/kanji.cpp +++ b/source/src/vm/multi8/kanji.cpp @@ -67,7 +67,7 @@ bool KANJI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(ptr); + state_fio->StateValue(ptr); return true; } diff --git a/source/src/vm/multi8/keyboard.cpp b/source/src/vm/multi8/keyboard.cpp index afce0af08..214c9e444 100644 --- a/source/src/vm/multi8/keyboard.cpp +++ b/source/src/vm/multi8/keyboard.cpp @@ -253,16 +253,16 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(init); - state_fio->StateUint8(code); - state_fio->StateUint8(code_prev); - state_fio->StateUint8(stat); - state_fio->StateBool(caps); - state_fio->StateBool(caps_prev); - state_fio->StateBool(graph); - state_fio->StateBool(graph_prev); - state_fio->StateBool(kana); - state_fio->StateBool(kana_prev); + state_fio->StateValue(init); + state_fio->StateValue(code); + state_fio->StateValue(code_prev); + state_fio->StateValue(stat); + state_fio->StateValue(caps); + state_fio->StateValue(caps_prev); + state_fio->StateValue(graph); + state_fio->StateValue(graph_prev); + state_fio->StateValue(kana); + state_fio->StateValue(kana_prev); return true; } diff --git a/source/src/vm/multi8/memory.cpp b/source/src/vm/multi8/memory.cpp index deec04e95..c8349841f 100644 --- a/source/src/vm/multi8/memory.cpp +++ b/source/src/vm/multi8/memory.cpp @@ -149,11 +149,11 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram0, sizeof(ram0), 1); - state_fio->StateBuffer(ram1, sizeof(ram1), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateUint8(map1); - state_fio->StateUint8(map2); + state_fio->StateArray(ram0, sizeof(ram0), 1); + state_fio->StateArray(ram1, sizeof(ram1), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateValue(map1); + state_fio->StateValue(map2); // post process if(loading) { diff --git a/source/src/vm/mycomz80a/display.cpp b/source/src/vm/mycomz80a/display.cpp index 73227a424..28cd63092 100644 --- a/source/src/vm/mycomz80a/display.cpp +++ b/source/src/vm/mycomz80a/display.cpp @@ -221,12 +221,12 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(chr); - state_fio->StateBool(wide); - state_fio->StateUint16(cursor); - state_fio->StateUint16(cblink); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateUint16(vram_addr); + state_fio->StateValue(chr); + state_fio->StateValue(wide); + state_fio->StateValue(cursor); + state_fio->StateValue(cblink); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateValue(vram_addr); return true; } diff --git a/source/src/vm/mycomz80a/keyboard.cpp b/source/src/vm/mycomz80a/keyboard.cpp index 31c362d0c..af8e2025a 100644 --- a/source/src/vm/mycomz80a/keyboard.cpp +++ b/source/src/vm/mycomz80a/keyboard.cpp @@ -232,9 +232,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(key_code); - state_fio->StateBool(kana); - state_fio->StateInt32(event_cnt); + state_fio->StateValue(key_code); + state_fio->StateValue(kana); + state_fio->StateValue(event_cnt); return true; } diff --git a/source/src/vm/mycomz80a/memory.cpp b/source/src/vm/mycomz80a/memory.cpp index 723342739..a22e1c847 100644 --- a/source/src/vm/mycomz80a/memory.cpp +++ b/source/src/vm/mycomz80a/memory.cpp @@ -116,9 +116,9 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint32(addr_mask); - state_fio->StateBool(rom_sel); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(addr_mask); + state_fio->StateValue(rom_sel); // post process if(loading) { diff --git a/source/src/vm/mz1p17.cpp b/source/src/vm/mz1p17.cpp index 6f06d0777..24ca7bd5b 100644 --- a/source/src/vm/mz1p17.cpp +++ b/source/src/vm/mz1p17.cpp @@ -3754,7 +3754,7 @@ void MZ1P17::finish_paper() dest_paper_y = 0; } -#define STATE_VERSION 3 +#define STATE_VERSION 4 bool MZ1P17::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/mz2500/cmt.cpp b/source/src/vm/mz2500/cmt.cpp index 7850d14db..6ce843622 100644 --- a/source/src/vm/mz2500/cmt.cpp +++ b/source/src/vm/mz2500/cmt.cpp @@ -327,23 +327,23 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(pa); - state_fio->StateUint8(pc); - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(now_play); - state_fio->StateBool(now_rewind); - state_fio->StateInt32(register_id_frew); - state_fio->StateInt32(register_id_ffwd); - state_fio->StateInt32(register_id_fwd); - state_fio->StateInt32(register_id_stop); - state_fio->StateInt32(register_id_eject); + state_fio->StateValue(pa); + state_fio->StateValue(pc); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(now_play); + state_fio->StateValue(now_rewind); + state_fio->StateValue(register_id_frew); + state_fio->StateValue(register_id_ffwd); + state_fio->StateValue(register_id_fwd); + state_fio->StateValue(register_id_stop); + state_fio->StateValue(register_id_eject); #ifndef _MZ80B - state_fio->StateInt32(register_id_apss); - state_fio->StateBool(now_apss); - state_fio->StateBool(now_apss_tmp); + state_fio->StateValue(register_id_apss); + state_fio->StateValue(now_apss); + state_fio->StateValue(now_apss_tmp); #endif - state_fio->StateInt32(register_id_ipl); + state_fio->StateValue(register_id_ipl); return true; } diff --git a/source/src/vm/mz2500/floppy.cpp b/source/src/vm/mz2500/floppy.cpp index 5ab3e11a3..58b48c4e2 100644 --- a/source/src/vm/mz2500/floppy.cpp +++ b/source/src/vm/mz2500/floppy.cpp @@ -59,7 +59,7 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(reversed); + state_fio->StateValue(reversed); return true; } diff --git a/source/src/vm/mz2500/interrupt.cpp b/source/src/vm/mz2500/interrupt.cpp index 6e1fdac4e..ae425ebdd 100644 --- a/source/src/vm/mz2500/interrupt.cpp +++ b/source/src/vm/mz2500/interrupt.cpp @@ -171,7 +171,7 @@ void INTERRUPT::notify_intr_reti() #endif } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool INTERRUPT::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/mz2500/joystick.cpp b/source/src/vm/mz2500/joystick.cpp index 1cf851ef2..162bc132f 100644 --- a/source/src/vm/mz2500/joystick.cpp +++ b/source/src/vm/mz2500/joystick.cpp @@ -63,7 +63,7 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(mode); + state_fio->StateValue(mode); return true; } diff --git a/source/src/vm/mz2500/keyboard.cpp b/source/src/vm/mz2500/keyboard.cpp index 2e8ccc691..444a61faf 100644 --- a/source/src/vm/mz2500/keyboard.cpp +++ b/source/src/vm/mz2500/keyboard.cpp @@ -85,7 +85,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); + state_fio->StateValue(column); return true; } diff --git a/source/src/vm/mz2500/memory.cpp b/source/src/vm/mz2500/memory.cpp index ece9b98f7..fddd8fc34 100644 --- a/source/src/vm/mz2500/memory.cpp +++ b/source/src/vm/mz2500/memory.cpp @@ -341,18 +341,18 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(tvram, sizeof(tvram), 1); - state_fio->StateBuffer(pcg, sizeof(pcg), 1); - state_fio->StateUint8(bank); - state_fio->StateBuffer(page, sizeof(page), 1); - state_fio->StateUint8(dic_bank); - state_fio->StateUint8(kanji_bank); - state_fio->StateBool(blank); - state_fio->StateBool(hblank); - state_fio->StateBool(vblank); - state_fio->StateBool(busreq); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(tvram, sizeof(tvram), 1); + state_fio->StateArray(pcg, sizeof(pcg), 1); + state_fio->StateValue(bank); + state_fio->StateArray(page, sizeof(page), 1); + state_fio->StateValue(dic_bank); + state_fio->StateValue(kanji_bank); + state_fio->StateValue(blank); + state_fio->StateValue(hblank); + state_fio->StateValue(vblank); + state_fio->StateValue(busreq); // post process if(loading) { diff --git a/source/src/vm/mz2500/memory80b.cpp b/source/src/vm/mz2500/memory80b.cpp index ea6b102bb..a1645addc 100644 --- a/source/src/vm/mz2500/memory80b.cpp +++ b/source/src/vm/mz2500/memory80b.cpp @@ -634,23 +634,23 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(tvram, sizeof(tvram), 1); - state_fio->StateBool(ipl_selected); - state_fio->StateUint8(vram_sel); - state_fio->StateUint8(vram_page); - state_fio->StateUint8(back_color); - state_fio->StateUint8(text_color); - state_fio->StateUint8(vram_mask); - state_fio->StateBool(width80); - state_fio->StateBool(reverse); - state_fio->StateBool(vgate); - state_fio->StateBool(hblank); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(tvram, sizeof(tvram), 1); + state_fio->StateValue(ipl_selected); + state_fio->StateValue(vram_sel); + state_fio->StateValue(vram_page); + state_fio->StateValue(back_color); + state_fio->StateValue(text_color); + state_fio->StateValue(vram_mask); + state_fio->StateValue(width80); + state_fio->StateValue(reverse); + state_fio->StateValue(vgate); + state_fio->StateValue(hblank); #ifdef _MZ80B - state_fio->StateBuffer(pio3039_palette, sizeof(pio3039_palette), 1); - state_fio->StateBool(pio3039_txt_sw); - state_fio->StateUint8(pio3039_data); + state_fio->StateArray(pio3039_palette, sizeof(pio3039_palette), 1); + state_fio->StateValue(pio3039_txt_sw); + state_fio->StateValue(pio3039_data); #endif // post process diff --git a/source/src/vm/mz2500/mouse.cpp b/source/src/vm/mz2500/mouse.cpp index f48d2b399..0f728fbec 100644 --- a/source/src/vm/mz2500/mouse.cpp +++ b/source/src/vm/mz2500/mouse.cpp @@ -50,7 +50,7 @@ bool MOUSE::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(select); + state_fio->StateValue(select); return true; } diff --git a/source/src/vm/mz2500/mz1e30.cpp b/source/src/vm/mz2500/mz1e30.cpp index 7bf6ab14e..249fb0312 100644 --- a/source/src/vm/mz2500/mz1e30.cpp +++ b/source/src/vm/mz2500/mz1e30.cpp @@ -152,9 +152,9 @@ bool MZ1E30::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(rom_address); - state_fio->StateBool(irq_status); - state_fio->StateBool(drq_status); + state_fio->StateValue(rom_address); + state_fio->StateValue(irq_status); + state_fio->StateValue(drq_status); return true; } diff --git a/source/src/vm/mz2500/mz1m01.cpp b/source/src/vm/mz2500/mz1m01.cpp index 0b104fc6b..09ab60907 100644 --- a/source/src/vm/mz2500/mz1m01.cpp +++ b/source/src/vm/mz2500/mz1m01.cpp @@ -123,8 +123,8 @@ bool MZ1M01::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(port, sizeof(port), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(port, sizeof(port), 1); return true; } diff --git a/source/src/vm/mz2500/mz1r12.cpp b/source/src/vm/mz2500/mz1r12.cpp index 8b37e7356..e001d4828 100644 --- a/source/src/vm/mz2500/mz1r12.cpp +++ b/source/src/vm/mz2500/mz1r12.cpp @@ -87,10 +87,10 @@ bool MZ1R12::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(sram, sizeof(sram), 1); - state_fio->StateBool(read_only); - state_fio->StateUint16(address); - state_fio->StateUint32(crc32); + state_fio->StateArray(sram, sizeof(sram), 1); + state_fio->StateValue(read_only); + state_fio->StateValue(address); + state_fio->StateValue(crc32); return true; } diff --git a/source/src/vm/mz2500/mz1r13.cpp b/source/src/vm/mz2500/mz1r13.cpp index cb247a8e0..c3c5b47ab 100644 --- a/source/src/vm/mz2500/mz1r13.cpp +++ b/source/src/vm/mz2500/mz1r13.cpp @@ -82,8 +82,8 @@ bool MZ1R13::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint16(address); - state_fio->StateBool(select_kanji); + state_fio->StateValue(address); + state_fio->StateValue(select_kanji); return true; } diff --git a/source/src/vm/mz2500/mz1r37.cpp b/source/src/vm/mz2500/mz1r37.cpp index 1620f250b..36448a3c3 100644 --- a/source/src/vm/mz2500/mz1r37.cpp +++ b/source/src/vm/mz2500/mz1r37.cpp @@ -64,8 +64,8 @@ bool MZ1R37::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(buffer, EMM_SIZE, 1); - state_fio->StateUint32(address); + state_fio->StateArray(buffer, EMM_SIZE, 1); + state_fio->StateValue(address); return true; } } diff --git a/source/src/vm/mz2500/serial.cpp b/source/src/vm/mz2500/serial.cpp index ce35e1492..1cdf6ff8d 100644 --- a/source/src/vm/mz2500/serial.cpp +++ b/source/src/vm/mz2500/serial.cpp @@ -79,7 +79,7 @@ bool SERIAL::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(addr_a0); + state_fio->StateValue(addr_a0); return true; } diff --git a/source/src/vm/mz2800/joystick.cpp b/source/src/vm/mz2800/joystick.cpp index 510b32619..8de2ed739 100644 --- a/source/src/vm/mz2800/joystick.cpp +++ b/source/src/vm/mz2800/joystick.cpp @@ -63,7 +63,7 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(mode); + state_fio->StateValue(mode); return true; } diff --git a/source/src/vm/mz2800/keyboard.cpp b/source/src/vm/mz2800/keyboard.cpp index 61f9e7132..3cc415db0 100644 --- a/source/src/vm/mz2800/keyboard.cpp +++ b/source/src/vm/mz2800/keyboard.cpp @@ -97,7 +97,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); + state_fio->StateValue(column); return true; } diff --git a/source/src/vm/mz2800/memory.cpp b/source/src/vm/mz2800/memory.cpp index 2aec94497..df134baaf 100644 --- a/source/src/vm/mz2800/memory.cpp +++ b/source/src/vm/mz2800/memory.cpp @@ -187,15 +187,15 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(ext, sizeof(ext), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(tvram, sizeof(tvram), 1); - state_fio->StateBuffer(pcg, sizeof(pcg), 1); - state_fio->StateUint32(mem_window); - state_fio->StateUint8(vram_bank); - state_fio->StateUint8(dic_bank); - state_fio->StateUint8(kanji_bank); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(ext, sizeof(ext), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(tvram, sizeof(tvram), 1); + state_fio->StateArray(pcg, sizeof(pcg), 1); + state_fio->StateValue(mem_window); + state_fio->StateValue(vram_bank); + state_fio->StateValue(dic_bank); + state_fio->StateValue(kanji_bank); // post process if(loading) { diff --git a/source/src/vm/mz2800/mouse.cpp b/source/src/vm/mz2800/mouse.cpp index 826b1f50a..f3826905a 100644 --- a/source/src/vm/mz2800/mouse.cpp +++ b/source/src/vm/mz2800/mouse.cpp @@ -50,7 +50,7 @@ bool MOUSE::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(select); + state_fio->StateValue(select); return true; } diff --git a/source/src/vm/mz2800/reset.cpp b/source/src/vm/mz2800/reset.cpp index ceb8180f5..cb632689b 100644 --- a/source/src/vm/mz2800/reset.cpp +++ b/source/src/vm/mz2800/reset.cpp @@ -38,7 +38,7 @@ bool RESET::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(prev); + state_fio->StateValue(prev); return true; } diff --git a/source/src/vm/mz2800/sasi.cpp b/source/src/vm/mz2800/sasi.cpp index 9ff84b52b..4160b4da0 100644 --- a/source/src/vm/mz2800/sasi.cpp +++ b/source/src/vm/mz2800/sasi.cpp @@ -216,22 +216,22 @@ bool SASI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(control); - state_fio->StateUint8(prev_control); - state_fio->StateBool(bsy_status); - state_fio->StateBool(prev_bsy_status); - state_fio->StateBool(cxd_status); - state_fio->StateBool(prev_cxd_status); - state_fio->StateBool(ixo_status); - state_fio->StateBool(prev_ixo_status); - state_fio->StateBool(msg_status); - state_fio->StateBool(prev_msg_status); - state_fio->StateBool(req_status); - state_fio->StateBool(prev_req_status); - state_fio->StateBool(ack_status); - state_fio->StateBool(prev_ack_status); - state_fio->StateBool(irq_status); - state_fio->StateBool(drq_status); + state_fio->StateValue(control); + state_fio->StateValue(prev_control); + state_fio->StateValue(bsy_status); + state_fio->StateValue(prev_bsy_status); + state_fio->StateValue(cxd_status); + state_fio->StateValue(prev_cxd_status); + state_fio->StateValue(ixo_status); + state_fio->StateValue(prev_ixo_status); + state_fio->StateValue(msg_status); + state_fio->StateValue(prev_msg_status); + state_fio->StateValue(req_status); + state_fio->StateValue(prev_req_status); + state_fio->StateValue(ack_status); + state_fio->StateValue(prev_ack_status); + state_fio->StateValue(irq_status); + state_fio->StateValue(drq_status); return true; } diff --git a/source/src/vm/mz2800/serial.cpp b/source/src/vm/mz2800/serial.cpp index 02ff7ec13..b795e03d0 100644 --- a/source/src/vm/mz2800/serial.cpp +++ b/source/src/vm/mz2800/serial.cpp @@ -79,7 +79,7 @@ bool SERIAL::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(addr_a0); + state_fio->StateValue(addr_a0); return true; } diff --git a/source/src/vm/mz3500/keyboard.cpp b/source/src/vm/mz3500/keyboard.cpp index 028aaf62d..5a20a7972 100644 --- a/source/src/vm/mz3500/keyboard.cpp +++ b/source/src/vm/mz3500/keyboard.cpp @@ -475,16 +475,16 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(phase); - state_fio->StateUint16(send_data); - state_fio->StateUint32(stc_clock); - state_fio->StateUint8(recv_data); - state_fio->StateBool(recv_ok); - state_fio->StateBool(stc); - state_fio->StateBool(dc); - state_fio->StateBool(caps); - state_fio->StateBool(kana); - state_fio->StateBool(pro_mode); + state_fio->StateValue(phase); + state_fio->StateValue(send_data); + state_fio->StateValue(stc_clock); + state_fio->StateValue(recv_data); + state_fio->StateValue(recv_ok); + state_fio->StateValue(stc); + state_fio->StateValue(dc); + state_fio->StateValue(caps); + state_fio->StateValue(kana); + state_fio->StateValue(pro_mode); return true; } diff --git a/source/src/vm/mz3500/main.cpp b/source/src/vm/mz3500/main.cpp index 290e34774..374ef612b 100644 --- a/source/src/vm/mz3500/main.cpp +++ b/source/src/vm/mz3500/main.cpp @@ -401,30 +401,30 @@ bool MAIN::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(common, sizeof(common), 1); - state_fio->StateUint8(ma); - state_fio->StateUint8(ms); - state_fio->StateUint8(mo); - state_fio->StateBool(me1); - state_fio->StateBool(me2); - state_fio->StateUint8(srqb); - state_fio->StateUint8(sres); - state_fio->StateBool(sack); - state_fio->StateBool(srdy); - state_fio->StateBool(intfd); - state_fio->StateBool(int0); - state_fio->StateBool(int1); - state_fio->StateBool(int2); - state_fio->StateBool(int3); - state_fio->StateBool(int4); - state_fio->StateBool(me); - state_fio->StateBool(e1); - state_fio->StateUint8(inp); - state_fio->StateBool(motor); - state_fio->StateBool(drq); - state_fio->StateBool(index); - state_fio->StateBool(crt_400line); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(common, sizeof(common), 1); + state_fio->StateValue(ma); + state_fio->StateValue(ms); + state_fio->StateValue(mo); + state_fio->StateValue(me1); + state_fio->StateValue(me2); + state_fio->StateValue(srqb); + state_fio->StateValue(sres); + state_fio->StateValue(sack); + state_fio->StateValue(srdy); + state_fio->StateValue(intfd); + state_fio->StateValue(int0); + state_fio->StateValue(int1); + state_fio->StateValue(int2); + state_fio->StateValue(int3); + state_fio->StateValue(int4); + state_fio->StateValue(me); + state_fio->StateValue(e1); + state_fio->StateValue(inp); + state_fio->StateValue(motor); + state_fio->StateValue(drq); + state_fio->StateValue(index); + state_fio->StateValue(crt_400line); // post process if(loading) { diff --git a/source/src/vm/mz3500/sub.cpp b/source/src/vm/mz3500/sub.cpp index c4a51c517..b4d100473 100644 --- a/source/src/vm/mz3500/sub.cpp +++ b/source/src/vm/mz3500/sub.cpp @@ -579,12 +579,12 @@ bool SUB::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram_chr, sizeof(vram_chr), 1); - state_fio->StateBuffer(vram_gfx, sizeof(vram_gfx), 1); - state_fio->StateBuffer(disp, sizeof(disp), 1); - state_fio->StateInt32(cblink); - state_fio->StateBool(crt_400line); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram_chr, sizeof(vram_chr), 1); + state_fio->StateArray(vram_gfx, sizeof(vram_gfx), 1); + state_fio->StateArray(disp, sizeof(disp), 1); + state_fio->StateValue(cblink); + state_fio->StateValue(crt_400line); return true; } diff --git a/source/src/vm/mz5500/keyboard.cpp b/source/src/vm/mz5500/keyboard.cpp index e5e676267..7c50c2593 100644 --- a/source/src/vm/mz5500/keyboard.cpp +++ b/source/src/vm/mz5500/keyboard.cpp @@ -482,17 +482,17 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!rsp_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateBool(caps); - state_fio->StateBool(kana); - state_fio->StateBool(graph); - state_fio->StateInt32(dk); - state_fio->StateInt32(srk); - state_fio->StateInt32(dc); - state_fio->StateInt32(stc); - state_fio->StateInt32(send); - state_fio->StateInt32(recv); - state_fio->StateInt32(phase); - state_fio->StateInt32(timeout); + state_fio->StateValue(caps); + state_fio->StateValue(kana); + state_fio->StateValue(graph); + state_fio->StateValue(dk); + state_fio->StateValue(srk); + state_fio->StateValue(dc); + state_fio->StateValue(stc); + state_fio->StateValue(send); + state_fio->StateValue(recv); + state_fio->StateValue(phase); + state_fio->StateValue(timeout); return true; } diff --git a/source/src/vm/mz5500/memory.cpp b/source/src/vm/mz5500/memory.cpp index 16ff67b75..1f6a5ff5b 100644 --- a/source/src/vm/mz5500/memory.cpp +++ b/source/src/vm/mz5500/memory.cpp @@ -200,14 +200,14 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); #if defined(_MZ6500) || defined(_MZ6550) - state_fio->StateBuffer(mz1r32, sizeof(mz1r32), 1); + state_fio->StateArray(mz1r32, sizeof(mz1r32), 1); #endif - state_fio->StateUint8(bank1); - state_fio->StateUint8(bank2); - state_fio->StateUint32(haddr); + state_fio->StateValue(bank1); + state_fio->StateValue(bank2); + state_fio->StateValue(haddr); // post process if(loading) { diff --git a/source/src/vm/mz5500/sysport.cpp b/source/src/vm/mz5500/sysport.cpp index 99d6afec0..d69ab1021 100644 --- a/source/src/vm/mz5500/sysport.cpp +++ b/source/src/vm/mz5500/sysport.cpp @@ -78,8 +78,8 @@ bool SYSPORT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(rst); - state_fio->StateInt32(highden); + state_fio->StateValue(rst); + state_fio->StateValue(highden); return true; } diff --git a/source/src/vm/mz700/cmos.cpp b/source/src/vm/mz700/cmos.cpp index c26201af1..9c091a38a 100644 --- a/source/src/vm/mz700/cmos.cpp +++ b/source/src/vm/mz700/cmos.cpp @@ -94,9 +94,9 @@ bool CMOS::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(data_buffer, DATA_SIZE, 1); - state_fio->StateUint32(data_addr); - state_fio->StateBool(modified); + state_fio->StateArray(data_buffer, DATA_SIZE, 1); + state_fio->StateValue(data_addr); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/mz700/emm.cpp b/source/src/vm/mz700/emm.cpp index 77ebe5496..6e16bf7bf 100644 --- a/source/src/vm/mz700/emm.cpp +++ b/source/src/vm/mz700/emm.cpp @@ -85,8 +85,8 @@ bool EMM::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(data_buffer, DATA_SIZE, 1); - state_fio->StateUint32(data_addr); + state_fio->StateArray(data_buffer, DATA_SIZE, 1); + state_fio->StateValue(data_addr); return true; } diff --git a/source/src/vm/mz700/floppy.cpp b/source/src/vm/mz700/floppy.cpp index eb687def4..7b99575db 100644 --- a/source/src/vm/mz700/floppy.cpp +++ b/source/src/vm/mz700/floppy.cpp @@ -106,10 +106,10 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(prev_dc); - state_fio->StateInt32(register_id); - state_fio->StateBool(motor_on); - state_fio->StateBool(irq_enabled); + state_fio->StateValue(prev_dc); + state_fio->StateValue(register_id); + state_fio->StateValue(motor_on); + state_fio->StateValue(irq_enabled); return true; } diff --git a/source/src/vm/mz700/kanji.cpp b/source/src/vm/mz700/kanji.cpp index fbbaefca3..12f4c67d3 100644 --- a/source/src/vm/mz700/kanji.cpp +++ b/source/src/vm/mz700/kanji.cpp @@ -84,9 +84,9 @@ bool KANJI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint32(control_reg); - state_fio->StateUint32(kanji_addr); - state_fio->StateUint32(dic_addr); + state_fio->StateValue(control_reg); + state_fio->StateValue(kanji_addr); + state_fio->StateValue(dic_addr); return true; } diff --git a/source/src/vm/mz700/keyboard.cpp b/source/src/vm/mz700/keyboard.cpp index 5652533c6..dcc5f3ef3 100644 --- a/source/src/vm/mz700/keyboard.cpp +++ b/source/src/vm/mz700/keyboard.cpp @@ -75,7 +75,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); + state_fio->StateValue(column); return true; } diff --git a/source/src/vm/mz700/mz700.cpp b/source/src/vm/mz700/mz700.cpp index 2015793f9..42fbe75d4 100644 --- a/source/src/vm/mz700/mz700.cpp +++ b/source/src/vm/mz700/mz700.cpp @@ -744,7 +744,7 @@ bool VM::process_state(FILEIO* state_fio, bool loading) } } #if defined(_MZ800) - state_fio->StateInt32(boot_mode); + state_fio->StateValue(boot_mode); #endif return true; } diff --git a/source/src/vm/mz700/ramfile.cpp b/source/src/vm/mz700/ramfile.cpp index 7b166e1a9..ee3a6c623 100644 --- a/source/src/vm/mz700/ramfile.cpp +++ b/source/src/vm/mz700/ramfile.cpp @@ -65,8 +65,8 @@ bool RAMFILE::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(data_buffer, DATA_SIZE, 1); - state_fio->StateUint32(data_addr); + state_fio->StateArray(data_buffer, DATA_SIZE, 1); + state_fio->StateValue(data_addr); return true; } diff --git a/source/src/vm/mz80k/keyboard.cpp b/source/src/vm/mz80k/keyboard.cpp index 82c59f265..6d6d685a4 100644 --- a/source/src/vm/mz80k/keyboard.cpp +++ b/source/src/vm/mz80k/keyboard.cpp @@ -132,8 +132,8 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); - state_fio->StateBool(kana); + state_fio->StateValue(column); + state_fio->StateValue(kana); return true; } diff --git a/source/src/vm/mz80k/memory.cpp b/source/src/vm/mz80k/memory.cpp index 7abc72654..27df39651 100644 --- a/source/src/vm/mz80k/memory.cpp +++ b/source/src/vm/mz80k/memory.cpp @@ -420,32 +420,32 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBool(tempo); - state_fio->StateBool(blink); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateValue(tempo); + state_fio->StateValue(blink); #if defined(_MZ1200) || defined(_MZ80A) - state_fio->StateBool(hblank); - state_fio->StateBool(memory_swap); + state_fio->StateValue(hblank); + state_fio->StateValue(memory_swap); #endif #if defined(SUPPORT_MZ80AIF) - state_fio->StateBool(fdc_irq); - state_fio->StateBool(fdc_drq); + state_fio->StateValue(fdc_irq); + state_fio->StateValue(fdc_drq); #endif - state_fio->StateBool(vgate); + state_fio->StateValue(vgate); #if defined(_MZ1200) || defined(_MZ80A) - state_fio->StateBool(reverse); + state_fio->StateValue(reverse); #endif #if defined(_MZ80A) - state_fio->StateUint32(e200); + state_fio->StateValue(e200); #endif - state_fio->StateBuffer(pcg + 0x400, 0x400, 1); + state_fio->StateArray(pcg + 0x400, 0x400, 1); #if defined(_MZ1200) - state_fio->StateBuffer(pcg + 0xc00, 0x400, 1); + state_fio->StateArray(pcg + 0xc00, 0x400, 1); #endif - state_fio->StateUint8(pcg_data); - state_fio->StateUint8(pcg_addr); - state_fio->StateUint8(pcg_ctrl); + state_fio->StateValue(pcg_data); + state_fio->StateValue(pcg_addr); + state_fio->StateValue(pcg_ctrl); // post process if(loading) { diff --git a/source/src/vm/mz80k/printer.cpp b/source/src/vm/mz80k/printer.cpp index 1f5444b79..2f38d3fef 100644 --- a/source/src/vm/mz80k/printer.cpp +++ b/source/src/vm/mz80k/printer.cpp @@ -54,7 +54,7 @@ bool PRINTER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(out_ch); + state_fio->StateValue(out_ch); return true; } #endif diff --git a/source/src/vm/pasopia/display.cpp b/source/src/vm/pasopia/display.cpp index c3af671a7..3c568701e 100644 --- a/source/src/vm/pasopia/display.cpp +++ b/source/src/vm/pasopia/display.cpp @@ -641,9 +641,9 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(mode); - state_fio->StateUint16(cursor); - state_fio->StateUint16(cblink); + state_fio->StateValue(mode); + state_fio->StateValue(cursor); + state_fio->StateValue(cblink); return true; } diff --git a/source/src/vm/pasopia/floppy.cpp b/source/src/vm/pasopia/floppy.cpp index 00bc3245f..d691e616f 100644 --- a/source/src/vm/pasopia/floppy.cpp +++ b/source/src/vm/pasopia/floppy.cpp @@ -83,8 +83,8 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(intr); - state_fio->StateBool(supported); + state_fio->StateValue(intr); + state_fio->StateValue(supported); return true; } diff --git a/source/src/vm/pasopia/kanjipac2.cpp b/source/src/vm/pasopia/kanjipac2.cpp index b788f57c7..4d79de058 100644 --- a/source/src/vm/pasopia/kanjipac2.cpp +++ b/source/src/vm/pasopia/kanjipac2.cpp @@ -51,7 +51,7 @@ bool KANJIPAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateUint32(ptr); + state_fio->StateValue(ptr); return true; } diff --git a/source/src/vm/pasopia/keyboard.cpp b/source/src/vm/pasopia/keyboard.cpp index d8fbe43bb..f18bb6f48 100644 --- a/source/src/vm/pasopia/keyboard.cpp +++ b/source/src/vm/pasopia/keyboard.cpp @@ -84,7 +84,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(sel); + state_fio->StateValue(sel); return true; } diff --git a/source/src/vm/pasopia/memory.cpp b/source/src/vm/pasopia/memory.cpp index eba8d7d93..f618f0c9f 100644 --- a/source/src/vm/pasopia/memory.cpp +++ b/source/src/vm/pasopia/memory.cpp @@ -151,12 +151,12 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(attr, sizeof(attr), 1); - state_fio->StateUint16(vram_ptr); - state_fio->StateUint8(vram_data); - state_fio->StateUint8(mem_map); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(attr, sizeof(attr), 1); + state_fio->StateValue(vram_ptr); + state_fio->StateValue(vram_data); + state_fio->StateValue(mem_map); // post process if(loading) { diff --git a/source/src/vm/pasopia/pac2.cpp b/source/src/vm/pasopia/pac2.cpp index 41d94549b..85f1d06e3 100644 --- a/source/src/vm/pasopia/pac2.cpp +++ b/source/src/vm/pasopia/pac2.cpp @@ -92,7 +92,7 @@ bool PAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(device_type); + state_fio->StateValue(device_type); return get_device()->process_state(state_fio, loading); } diff --git a/source/src/vm/pasopia/rampac2.cpp b/source/src/vm/pasopia/rampac2.cpp index 9b0d6563b..9df727cb9 100644 --- a/source/src/vm/pasopia/rampac2.cpp +++ b/source/src/vm/pasopia/rampac2.cpp @@ -103,10 +103,10 @@ bool RAMPAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint32(ptr); - state_fio->StateBool(opened); - state_fio->StateBool(modified); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(ptr); + state_fio->StateValue(opened); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/pasopia7/display.cpp b/source/src/vm/pasopia7/display.cpp index f0244b55d..d230434be 100644 --- a/source/src/vm/pasopia7/display.cpp +++ b/source/src/vm/pasopia7/display.cpp @@ -767,13 +767,13 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(mode); - state_fio->StateUint8(text_page); - state_fio->StateUint16(cursor); - state_fio->StateUint16(cblink); - state_fio->StateUint16(flash_cnt); - state_fio->StateBool(blink); - state_fio->StateBool(pal_dis); + state_fio->StateValue(mode); + state_fio->StateValue(text_page); + state_fio->StateValue(cursor); + state_fio->StateValue(cblink); + state_fio->StateValue(flash_cnt); + state_fio->StateValue(blink); + state_fio->StateValue(pal_dis); return true; } diff --git a/source/src/vm/pasopia7/floppy.cpp b/source/src/vm/pasopia7/floppy.cpp index 97bb94505..3e0fdedf6 100644 --- a/source/src/vm/pasopia7/floppy.cpp +++ b/source/src/vm/pasopia7/floppy.cpp @@ -66,7 +66,7 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(intr); + state_fio->StateValue(intr); return true; } diff --git a/source/src/vm/pasopia7/iobus.cpp b/source/src/vm/pasopia7/iobus.cpp index 18c9086be..34da9ed62 100644 --- a/source/src/vm/pasopia7/iobus.cpp +++ b/source/src/vm/pasopia7/iobus.cpp @@ -53,7 +53,7 @@ bool IOBUS::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(mio); + state_fio->StateValue(mio); return true; } diff --git a/source/src/vm/pasopia7/iotrap.cpp b/source/src/vm/pasopia7/iotrap.cpp index 33f0ef691..d0e3121ba 100644 --- a/source/src/vm/pasopia7/iotrap.cpp +++ b/source/src/vm/pasopia7/iotrap.cpp @@ -89,8 +89,8 @@ bool IOTRAP::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(nmi_mask); - state_fio->StateBool(pasopia); + state_fio->StateValue(nmi_mask); + state_fio->StateValue(pasopia); return true; } diff --git a/source/src/vm/pasopia7/kanjipac2.cpp b/source/src/vm/pasopia7/kanjipac2.cpp index a8e1dac0e..02546933f 100644 --- a/source/src/vm/pasopia7/kanjipac2.cpp +++ b/source/src/vm/pasopia7/kanjipac2.cpp @@ -54,7 +54,7 @@ bool KANJIPAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateUint32(ptr); + state_fio->StateValue(ptr); return true; } diff --git a/source/src/vm/pasopia7/keyboard.cpp b/source/src/vm/pasopia7/keyboard.cpp index a647ff71f..148255363 100644 --- a/source/src/vm/pasopia7/keyboard.cpp +++ b/source/src/vm/pasopia7/keyboard.cpp @@ -89,7 +89,7 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(sel); + state_fio->StateValue(sel); return true; } diff --git a/source/src/vm/pasopia7/memory.cpp b/source/src/vm/pasopia7/memory.cpp index f54e8f1a8..a010ca07e 100644 --- a/source/src/vm/pasopia7/memory.cpp +++ b/source/src/vm/pasopia7/memory.cpp @@ -177,16 +177,16 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(pal, sizeof(pal), 1); - state_fio->StateUint8(mem_map); - state_fio->StateUint8(plane); - state_fio->StateUint8(attr_data); - state_fio->StateUint8(attr_latch); - state_fio->StateBool(vram_sel); - state_fio->StateBool(pal_sel); - state_fio->StateBool(attr_wrap); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(pal, sizeof(pal), 1); + state_fio->StateValue(mem_map); + state_fio->StateValue(plane); + state_fio->StateValue(attr_data); + state_fio->StateValue(attr_latch); + state_fio->StateValue(vram_sel); + state_fio->StateValue(pal_sel); + state_fio->StateValue(attr_wrap); // post process if(loading) { diff --git a/source/src/vm/pasopia7/pac2.cpp b/source/src/vm/pasopia7/pac2.cpp index 5ea1c73e8..3a4a16ce3 100644 --- a/source/src/vm/pasopia7/pac2.cpp +++ b/source/src/vm/pasopia7/pac2.cpp @@ -105,7 +105,7 @@ bool PAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(sel); + state_fio->StateValue(sel); if(!rampac2[0]->process_state(state_fio, loading)) { return false; } diff --git a/source/src/vm/pasopia7/rampac2.cpp b/source/src/vm/pasopia7/rampac2.cpp index c2109d3cc..ea44de0bc 100644 --- a/source/src/vm/pasopia7/rampac2.cpp +++ b/source/src/vm/pasopia7/rampac2.cpp @@ -103,10 +103,10 @@ bool RAMPAC2::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckUint32(STATE_VERSION)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint32(ptr); - state_fio->StateBool(opened); - state_fio->StateBool(modified); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(ptr); + state_fio->StateValue(opened); + state_fio->StateValue(modified); return true; } diff --git a/source/src/vm/pc100/ioctrl.cpp b/source/src/vm/pc100/ioctrl.cpp index 7e2bac689..55839a59c 100644 --- a/source/src/vm/pc100/ioctrl.cpp +++ b/source/src/vm/pc100/ioctrl.cpp @@ -229,18 +229,18 @@ bool IOCTRL::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(caps); - state_fio->StateBool(kana); + state_fio->StateValue(caps); + state_fio->StateValue(kana); if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint32(key_val); - state_fio->StateUint32(key_mouse); - state_fio->StateInt32(key_prev); - state_fio->StateBool(key_res); - state_fio->StateBool(key_done); - state_fio->StateInt32(register_id); - state_fio->StateUint8(ts); + state_fio->StateValue(key_val); + state_fio->StateValue(key_mouse); + state_fio->StateValue(key_prev); + state_fio->StateValue(key_res); + state_fio->StateValue(key_done); + state_fio->StateValue(register_id); + state_fio->StateValue(ts); return true; } diff --git a/source/src/vm/pc100/kanji.cpp b/source/src/vm/pc100/kanji.cpp index ef3cf25f1..0249276cb 100644 --- a/source/src/vm/pc100/kanji.cpp +++ b/source/src/vm/pc100/kanji.cpp @@ -67,8 +67,8 @@ bool KANJI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint16(ptr); - state_fio->StateBool(strobe); + state_fio->StateValue(ptr); + state_fio->StateValue(strobe); return true; } diff --git a/source/src/vm/pc2001/io.cpp b/source/src/vm/pc2001/io.cpp index 383b4a89d..276feeb52 100644 --- a/source/src/vm/pc2001/io.cpp +++ b/source/src/vm/pc2001/io.cpp @@ -285,12 +285,12 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(port_a); - state_fio->StateUint8(port_b); - state_fio->StateUint8(port_s); - state_fio->StateBool(drec_in); - state_fio->StateBool(rtc_in); - state_fio->StateUint16(key_strobe); + state_fio->StateValue(port_a); + state_fio->StateValue(port_b); + state_fio->StateValue(port_s); + state_fio->StateValue(drec_in); + state_fio->StateValue(rtc_in); + state_fio->StateValue(key_strobe); return true; } diff --git a/source/src/vm/pc2001/pc2001.cpp b/source/src/vm/pc2001/pc2001.cpp index b6a17534f..1fb0918e7 100644 --- a/source/src/vm/pc2001/pc2001.cpp +++ b/source/src/vm/pc2001/pc2001.cpp @@ -314,6 +314,6 @@ bool VM::process_state(FILEIO* state_fio, bool loading) return false; } } - state_fio->StateBuffer(ram, sizeof(ram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); return true; } diff --git a/source/src/vm/pc6001/floppy.cpp b/source/src/vm/pc6001/floppy.cpp index d373294d4..64be0efbf 100644 --- a/source/src/vm/pc6001/floppy.cpp +++ b/source/src/vm/pc6001/floppy.cpp @@ -599,7 +599,7 @@ void FLOPPY::update_config() // } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool FLOPPY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/pc6001/memory.cpp b/source/src/vm/pc6001/memory.cpp index 2362b18ec..4e1d8061b 100644 --- a/source/src/vm/pc6001/memory.cpp +++ b/source/src/vm/pc6001/memory.cpp @@ -695,7 +695,7 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(RAM, RAM_SIZE, 1); + state_fio->StateArray(RAM, RAM_SIZE, 1); if(loading) { CGROM = MEMORY_BASE + state_fio->FgetInt32_LE(); EXTROM1 = MEMORY_BASE + state_fio->FgetInt32_LE(); @@ -715,29 +715,29 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) } state_fio->FputInt32_LE((int)(VRAM - MEMORY_BASE)); } - state_fio->StateBuffer(EnWrite, sizeof(EnWrite), 1); - state_fio->StateUint8(CGSW93); - state_fio->StateBool(inserted); + state_fio->StateArray(EnWrite, sizeof(EnWrite), 1); + state_fio->StateValue(CGSW93); + state_fio->StateValue(inserted); #ifndef _PC6001 - state_fio->StateUint8(CRTKILL); + state_fio->StateValue(CRTKILL); if(loading) { CurKANJIROM = MEMORY_BASE + state_fio->FgetInt32_LE(); } else { state_fio->FputInt32_LE((int)(CurKANJIROM - MEMORY_BASE)); } - state_fio->StateUint8(CRTMode1); - state_fio->StateUint8(CRTMode2); - state_fio->StateUint8(CRTMode3); - state_fio->StateUint8(CSS1); - state_fio->StateUint8(CSS2); - state_fio->StateUint8(CSS3); - state_fio->StateUint8(portF0); - state_fio->StateUint8(portF1); + state_fio->StateValue(CRTMode1); + state_fio->StateValue(CRTMode2); + state_fio->StateValue(CRTMode3); + state_fio->StateValue(CSS1); + state_fio->StateValue(CSS2); + state_fio->StateValue(CSS3); + state_fio->StateValue(portF0); + state_fio->StateValue(portF1); #if defined(_PC6601SR) || defined(_PC6001MK2SR) - state_fio->StateInt32(bitmap); - state_fio->StateInt32(cols); - state_fio->StateInt32(rows); - state_fio->StateInt32(lines); + state_fio->StateValue(bitmap); + state_fio->StateValue(cols); + state_fio->StateValue(rows); + state_fio->StateValue(lines); if(loading) { TEXTVRAM = MEMORY_BASE + state_fio->FgetInt32_LE(); SYSROM2 = MEMORY_BASE + state_fio->FgetInt32_LE(); @@ -745,16 +745,16 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE((int)(TEXTVRAM - MEMORY_BASE)); state_fio->FputInt32_LE((int)(SYSROM2 - MEMORY_BASE)); } - state_fio->StateBuffer(EXTRAM, EXTRAM_SIZE, 1); - state_fio->StateBuffer(port60, sizeof(port60), 1); - state_fio->StateUint8(portC1); - state_fio->StateUint8(portC8); - state_fio->StateUint8(portCA); - state_fio->StateUint8(portCB); - state_fio->StateUint8(portCC); - state_fio->StateUint8(portCE); - state_fio->StateUint8(portCF); - state_fio->StateBuffer(palet, sizeof(palet), 1); + state_fio->StateArray(EXTRAM, EXTRAM_SIZE, 1); + state_fio->StateArray(port60, sizeof(port60), 1); + state_fio->StateValue(portC1); + state_fio->StateValue(portC8); + state_fio->StateValue(portCA); + state_fio->StateValue(portCB); + state_fio->StateValue(portCC); + state_fio->StateValue(portCE); + state_fio->StateValue(portCF); + state_fio->StateArray(palet, sizeof(palet), 1); #endif #endif return true; diff --git a/source/src/vm/pc6001/psub.cpp b/source/src/vm/pc6001/psub.cpp index bf27b6793..5f66602ff 100644 --- a/source/src/vm/pc6001/psub.cpp +++ b/source/src/vm/pc6001/psub.cpp @@ -1077,11 +1077,11 @@ bool PSUB::process_state(FILEIO* state_fio, bool loading) if(loading) { close_tape(); } - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(is_wav); - state_fio->StateBool(is_p6t); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(is_wav); + state_fio->StateValue(is_p6t); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -1112,24 +1112,24 @@ bool PSUB::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(CasIntFlag); - state_fio->StateInt32(CasIndex); - state_fio->StateInt32(CasRecv); - state_fio->StateInt32(CasMode); - state_fio->StateInt32(CasBaud); - state_fio->StateInt32(FileBaud); - state_fio->StateBuffer(CasData, sizeof(CasData), 1); - state_fio->StateInt32(CasLength); - state_fio->StateInt32(CasSkipFlag); - state_fio->StateInt32(kbFlagFunc); - state_fio->StateInt32(kbFlagGraph); - state_fio->StateInt32(kbFlagCtrl); - state_fio->StateInt32(kanaMode); - state_fio->StateInt32(katakana); - state_fio->StateInt32(p6key); - state_fio->StateInt32(stick0); - state_fio->StateInt32(StrigIntFlag); - state_fio->StateInt32(StrigEventID); + state_fio->StateValue(CasIntFlag); + state_fio->StateValue(CasIndex); + state_fio->StateValue(CasRecv); + state_fio->StateValue(CasMode); + state_fio->StateValue(CasBaud); + state_fio->StateValue(FileBaud); + state_fio->StateArray(CasData, sizeof(CasData), 1); + state_fio->StateValue(CasLength); + state_fio->StateValue(CasSkipFlag); + state_fio->StateValue(kbFlagFunc); + state_fio->StateValue(kbFlagGraph); + state_fio->StateValue(kbFlagCtrl); + state_fio->StateValue(kanaMode); + state_fio->StateValue(katakana); + state_fio->StateValue(p6key); + state_fio->StateValue(stick0); + state_fio->StateValue(StrigIntFlag); + state_fio->StateValue(StrigEventID); return true; } diff --git a/source/src/vm/pc6001/sub.cpp b/source/src/vm/pc6001/sub.cpp index cd95cf4e2..e9a62d7f4 100644 --- a/source/src/vm/pc6001/sub.cpp +++ b/source/src/vm/pc6001/sub.cpp @@ -357,15 +357,15 @@ bool SUB::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(p1_out); - state_fio->StateInt32(p2_in); - state_fio->StateBool(drec_in); - state_fio->StateBool(rxrdy_in); - state_fio->StateBool(update_key); - state_fio->StateBool(rec); - state_fio->StateBool(is_wav); - state_fio->StateBool(is_p6t); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(p1_out); + state_fio->StateValue(p2_in); + state_fio->StateValue(drec_in); + state_fio->StateValue(rxrdy_in); + state_fio->StateValue(update_key); + state_fio->StateValue(rec); + state_fio->StateValue(is_wav); + state_fio->StateValue(is_p6t); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -396,11 +396,11 @@ bool SUB::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(prev_command); - state_fio->StateInt32(baud); - state_fio->StateInt32(index); - state_fio->StateBool(skip); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); + state_fio->StateValue(prev_command); + state_fio->StateValue(baud); + state_fio->StateValue(index); + state_fio->StateValue(skip); + state_fio->StateArray(buffer, sizeof(buffer), 1); return true; } diff --git a/source/src/vm/pc6001/timer.cpp b/source/src/vm/pc6001/timer.cpp index e455d7783..da8ef8c87 100644 --- a/source/src/vm/pc6001/timer.cpp +++ b/source/src/vm/pc6001/timer.cpp @@ -291,20 +291,20 @@ bool TIMER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(IRQ); - state_fio->StateUint8(NewIRQ); - state_fio->StateInt32(timer_id); + state_fio->StateValue(IRQ); + state_fio->StateValue(NewIRQ); + state_fio->StateValue(timer_id); #ifndef _PC6001 #if defined(_PC6601SR) || defined(_PC6001MK2SR) - state_fio->StateBuffer(sr_vectors, sizeof(sr_vectors), 1); - state_fio->StateUint8(portFA); - state_fio->StateUint8(portFB); + state_fio->StateArray(sr_vectors, sizeof(sr_vectors), 1); + state_fio->StateValue(portFA); + state_fio->StateValue(portFB); #endif - state_fio->StateUint8(portF3); - state_fio->StateUint8(portF4); - state_fio->StateUint8(portF5); - state_fio->StateUint8(portF6); - state_fio->StateUint8(portF7); + state_fio->StateValue(portF3); + state_fio->StateValue(portF4); + state_fio->StateValue(portF5); + state_fio->StateValue(portF6); + state_fio->StateValue(portF7); #endif return true; } diff --git a/source/src/vm/pc6031.cpp b/source/src/vm/pc6031.cpp index 9c971b46a..accc225fe 100644 --- a/source/src/vm/pc6031.cpp +++ b/source/src/vm/pc6031.cpp @@ -423,7 +423,7 @@ void PC6031::update_config() // } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool PC6031::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/pc8201/cmt.cpp b/source/src/vm/pc8201/cmt.cpp index b2a9c53ba..da892e81f 100644 --- a/source/src/vm/pc8201/cmt.cpp +++ b/source/src/vm/pc8201/cmt.cpp @@ -150,10 +150,10 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(is_wav); - state_fio->StateBool(rec); - state_fio->StateBool(remote); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(is_wav); + state_fio->StateValue(rec); + state_fio->StateValue(remote); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -184,10 +184,10 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); - state_fio->StateInt32(prev_signal); - state_fio->StateUint32(prev_clock); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); + state_fio->StateValue(prev_signal); + state_fio->StateValue(prev_clock); return true; } diff --git a/source/src/vm/pc8201/keyboard.cpp b/source/src/vm/pc8201/keyboard.cpp index 9b82f03f8..0757efc69 100644 --- a/source/src/vm/pc8201/keyboard.cpp +++ b/source/src/vm/pc8201/keyboard.cpp @@ -93,9 +93,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint16(column); - state_fio->StateBool(caps); - state_fio->StateBool(kana); + state_fio->StateValue(column); + state_fio->StateValue(caps); + state_fio->StateValue(kana); return true; } diff --git a/source/src/vm/pc8201/lcd.cpp b/source/src/vm/pc8201/lcd.cpp index 2265e9e51..377c92f20 100644 --- a/source/src/vm/pc8201/lcd.cpp +++ b/source/src/vm/pc8201/lcd.cpp @@ -163,7 +163,7 @@ void LCD::draw_screen() } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool LCD::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/pc8201/memory.cpp b/source/src/vm/pc8201/memory.cpp index 138acab25..6bded22d7 100644 --- a/source/src/vm/pc8201/memory.cpp +++ b/source/src/vm/pc8201/memory.cpp @@ -154,9 +154,9 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(sio); - state_fio->StateUint8(bank); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(sio); + state_fio->StateValue(bank); // post process if(loading) { diff --git a/source/src/vm/pc9801/cmt.cpp b/source/src/vm/pc9801/cmt.cpp index d91c1c8e9..8c5588743 100644 --- a/source/src/vm/pc9801/cmt.cpp +++ b/source/src/vm/pc9801/cmt.cpp @@ -116,11 +116,11 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBool(remote); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(remote); return true; } diff --git a/source/src/vm/pc9801/floppy.cpp b/source/src/vm/pc9801/floppy.cpp index a033dff23..026846b70 100644 --- a/source/src/vm/pc9801/floppy.cpp +++ b/source/src/vm/pc9801/floppy.cpp @@ -330,16 +330,16 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) return false; } #if defined(SUPPORT_2HD_FDD_IF) - state_fio->StateUint8(ctrlreg_2hd); + state_fio->StateValue(ctrlreg_2hd); #endif #if defined(SUPPORT_2DD_FDD_IF) - state_fio->StateUint8(ctrlreg_2dd); + state_fio->StateValue(ctrlreg_2dd); #endif #if defined(SUPPORT_2HD_2DD_FDD_IF) - state_fio->StateUint8(ctrlreg); - state_fio->StateUint8(modereg); + state_fio->StateValue(ctrlreg); + state_fio->StateValue(modereg); #endif - state_fio->StateInt32(timer_id); + state_fio->StateValue(timer_id); return true; } diff --git a/source/src/vm/pc9801/fmsound.cpp b/source/src/vm/pc9801/fmsound.cpp index e85a4be3d..455d7de8e 100644 --- a/source/src/vm/pc9801/fmsound.cpp +++ b/source/src/vm/pc9801/fmsound.cpp @@ -94,7 +94,7 @@ bool FMSOUND::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(mask); + state_fio->StateValue(mask); return true; } #endif diff --git a/source/src/vm/pc9801/joystick.cpp b/source/src/vm/pc9801/joystick.cpp index f7a0e3774..e50400b82 100644 --- a/source/src/vm/pc9801/joystick.cpp +++ b/source/src/vm/pc9801/joystick.cpp @@ -53,7 +53,7 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(select); + state_fio->StateValue(select); return true; } diff --git a/source/src/vm/pc9801/keyboard.cpp b/source/src/vm/pc9801/keyboard.cpp index 8b5e83816..5d7e8268f 100644 --- a/source/src/vm/pc9801/keyboard.cpp +++ b/source/src/vm/pc9801/keyboard.cpp @@ -95,9 +95,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(kana); - state_fio->StateBool(caps); - state_fio->StateBuffer(flag, sizeof(flag), 1); + state_fio->StateValue(kana); + state_fio->StateValue(caps); + state_fio->StateArray(flag, sizeof(flag), 1); return true; } diff --git a/source/src/vm/pc9801/mouse.cpp b/source/src/vm/pc9801/mouse.cpp index 24f96953d..e6ecd1823 100644 --- a/source/src/vm/pc9801/mouse.cpp +++ b/source/src/vm/pc9801/mouse.cpp @@ -137,14 +137,14 @@ bool MOUSE::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(ctrlreg); - state_fio->StateInt32(freq); - state_fio->StateInt32(cur_freq); - state_fio->StateInt32(dx); - state_fio->StateInt32(dy); - state_fio->StateInt32(lx); - state_fio->StateInt32(ly); - state_fio->StateInt32(register_id); + state_fio->StateValue(ctrlreg); + state_fio->StateValue(freq); + state_fio->StateValue(cur_freq); + state_fio->StateValue(dx); + state_fio->StateValue(dy); + state_fio->StateValue(lx); + state_fio->StateValue(ly); + state_fio->StateValue(register_id); return true; } diff --git a/source/src/vm/pc9801/sasi.cpp b/source/src/vm/pc9801/sasi.cpp index f4a2856c0..3a063d166 100644 --- a/source/src/vm/pc9801/sasi.cpp +++ b/source/src/vm/pc9801/sasi.cpp @@ -207,9 +207,9 @@ bool SASI::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ocr); - state_fio->StateBool(irq_status); - state_fio->StateBool(drq_status); + state_fio->StateValue(ocr); + state_fio->StateValue(irq_status); + state_fio->StateValue(drq_status); return true; } diff --git a/source/src/vm/pc98ha/calendar.cpp b/source/src/vm/pc98ha/calendar.cpp index 56facd087..04bb5200b 100644 --- a/source/src/vm/pc98ha/calendar.cpp +++ b/source/src/vm/pc98ha/calendar.cpp @@ -65,7 +65,7 @@ bool CALENDAR::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ch); + state_fio->StateValue(ch); return true; } #endif diff --git a/source/src/vm/pc98ha/floppy.cpp b/source/src/vm/pc98ha/floppy.cpp index c60135fe0..4b0415290 100644 --- a/source/src/vm/pc98ha/floppy.cpp +++ b/source/src/vm/pc98ha/floppy.cpp @@ -79,8 +79,8 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ctrlreg); - state_fio->StateUint8(modereg); + state_fio->StateValue(ctrlreg); + state_fio->StateValue(modereg); return true; } diff --git a/source/src/vm/pc98ha/keyboard.cpp b/source/src/vm/pc98ha/keyboard.cpp index 214c02ef1..acb986273 100644 --- a/source/src/vm/pc98ha/keyboard.cpp +++ b/source/src/vm/pc98ha/keyboard.cpp @@ -82,9 +82,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(kana); - state_fio->StateBool(caps); - state_fio->StateBuffer(flag, sizeof(flag), 1); + state_fio->StateValue(kana); + state_fio->StateValue(caps); + state_fio->StateArray(flag, sizeof(flag), 1); return true; } diff --git a/source/src/vm/pc98ha/memory.cpp b/source/src/vm/pc98ha/memory.cpp index 81433fb20..0772f2768 100644 --- a/source/src/vm/pc98ha/memory.cpp +++ b/source/src/vm/pc98ha/memory.cpp @@ -288,27 +288,27 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(learn, sizeof(learn), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(learn, sizeof(learn), 1); #ifdef _PC98HA - state_fio->StateBuffer(ramdrv, sizeof(ramdrv), 1); - state_fio->StateBuffer(ems, sizeof(ems), 1); - state_fio->StateBuffer(memcard, sizeof(memcard), 1); + state_fio->StateArray(ramdrv, sizeof(ramdrv), 1); + state_fio->StateArray(ems, sizeof(ems), 1); + state_fio->StateArray(memcard, sizeof(memcard), 1); #endif - state_fio->StateUint32(learn_crc32); + state_fio->StateValue(learn_crc32); #ifdef _PC98HA - state_fio->StateUint32(ramdrv_crc32); - state_fio->StateUint32(memcard_crc32); + state_fio->StateValue(ramdrv_crc32); + state_fio->StateValue(memcard_crc32); #endif - state_fio->StateUint8(learn_bank); - state_fio->StateUint8(dic_bank); - state_fio->StateUint8(kanji_bank); - state_fio->StateUint8(romdrv_bank); + state_fio->StateValue(learn_bank); + state_fio->StateValue(dic_bank); + state_fio->StateValue(kanji_bank); + state_fio->StateValue(romdrv_bank); #ifdef _PC98HA - state_fio->StateUint8(ramdrv_bank); - state_fio->StateUint8(ramdrv_sel); - state_fio->StateBuffer(ems_bank, sizeof(ems_bank), 1); + state_fio->StateValue(ramdrv_bank); + state_fio->StateValue(ramdrv_sel); + state_fio->StateArray(ems_bank, sizeof(ems_bank), 1); #endif // post process diff --git a/source/src/vm/pc98ha/note.cpp b/source/src/vm/pc98ha/note.cpp index 7512986c9..16ce1e626 100644 --- a/source/src/vm/pc98ha/note.cpp +++ b/source/src/vm/pc98ha/note.cpp @@ -90,8 +90,8 @@ bool NOTE::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(ch); - state_fio->StateBuffer(regs, sizeof(regs), 1); + state_fio->StateValue(ch); + state_fio->StateArray(regs, sizeof(regs), 1); return true; } diff --git a/source/src/vm/pcengine/pce.h b/source/src/vm/pcengine/pce.h index 9dd0d7bce..54933fed5 100644 --- a/source/src/vm/pcengine/pce.h +++ b/source/src/vm/pcengine/pce.h @@ -43,6 +43,61 @@ class SCSI_CDROM; namespace PCEDEV { +typedef struct vdc_s { + int dvssr_write; /* Set when the DVSSR register has been written to */ + int physical_width; /* Width of the display */ + int physical_height; /* Height of the display */ + uint16_t sprite_ram[64*4]; /* Sprite RAM */ + int curline; /* the current scanline we're on */ + int current_segment; /* current segment of display */ + int current_segment_line; /* current line inside a segment of display */ + int vblank_triggered; /* to indicate whether vblank has been triggered */ + int raster_count; /* counter to compare RCR against */ + int satb_countdown; /* scanlines to wait to trigger the SATB irq */ + uint8_t vram[0x10000]; + uint8_t inc; + uint8_t vdc_register; + uint8_t vdc_latch; + pair32_t vdc_data[32]; + int status; + int y_scroll; +} vdc_t; + +typedef struct vce_s { + uint8_t vce_control; /* VCE control register */ + pair32_t vce_address; /* Current address in the palette */ + pair32_t vce_data[512]; /* Palette data */ + int current_bitmap_line; /* The current line in the display we are on */ + //bitmap_ind16 *bmp; + scrntype_t bmp[VDC_LPF][VDC_WPF]; + scrntype_t palette[1024]; +} vce_t; + +typedef struct vpc_s { + struct { + UINT8 prio; + UINT8 vdc0_enabled; + UINT8 vdc1_enabled; + } vpc_prio[4]; + UINT8 prio_map[512]; /* Pre-calculated priority map */ + pair32_t priority; /* Priority settings registers */ + pair32_t window1; /* Window 1 setting */ + pair32_t window2; /* Window 2 setting */ + UINT8 vdc_select; /* Which VDC do the ST0, ST1, and ST2 instructions write to */ +} vpc_t; + +typedef struct { + // registers + uint8_t regs[8]; + uint8_t wav[32]; + uint8_t wavptr; + // sound gen + uint32_t genptr; + uint32_t remain; + bool noise; + uint32_t randval; +} psg_t; + class PCE : public DEVICE { private: @@ -79,48 +134,9 @@ private: bool inserted; // vdc - struct { - int dvssr_write; /* Set when the DVSSR register has been written to */ - int physical_width; /* Width of the display */ - int physical_height; /* Height of the display */ - uint16_t sprite_ram[64*4]; /* Sprite RAM */ - int curline; /* the current scanline we're on */ - int current_segment; /* current segment of display */ - int current_segment_line; /* current line inside a segment of display */ - int vblank_triggered; /* to indicate whether vblank has been triggered */ - int raster_count; /* counter to compare RCR against */ - int satb_countdown; /* scanlines to wait to trigger the SATB irq */ - uint8_t vram[0x10000]; - uint8_t inc; - uint8_t vdc_register; - uint8_t vdc_latch; - pair32_t vdc_data[32]; - int status; - int y_scroll; - } vdc[2]; - - struct { - uint8_t vce_control; /* VCE control register */ - pair32_t vce_address; /* Current address in the palette */ - pair32_t vce_data[512]; /* Palette data */ - int current_bitmap_line; /* The current line in the display we are on */ - //bitmap_ind16 *bmp; - scrntype_t bmp[VDC_LPF][VDC_WPF]; - scrntype_t palette[1024]; - } vce; - - struct { - struct { - UINT8 prio; - UINT8 vdc0_enabled; - UINT8 vdc1_enabled; - } vpc_prio[4]; - UINT8 prio_map[512]; /* Pre-calculated priority map */ - pair32_t priority; /* Priority settings registers */ - pair32_t window1; /* Window 1 setting */ - pair32_t window2; /* Window 2 setting */ - UINT8 vdc_select; /* Which VDC do the ST0, ST1, and ST2 instructions write to */ - } vpc; + vdc_t vdc[2]; + vce_t vce; + vpc_t vpc; void pce_interrupt(); #ifdef SUPPORT_SUPER_GFX @@ -152,17 +168,6 @@ private: #endif // psg - typedef struct { - // registers - uint8_t regs[8]; - uint8_t wav[32]; - uint8_t wavptr; - // sound gen - uint32_t genptr; - uint32_t remain; - bool noise; - uint32_t randval; - } psg_t; psg_t psg[8]; uint8_t psg_ch, psg_vol, psg_lfo_freq, psg_lfo_ctrl; int sample_rate; diff --git a/source/src/vm/phc20/memory.cpp b/source/src/vm/phc20/memory.cpp index 262dc6ef1..550a971df 100644 --- a/source/src/vm/phc20/memory.cpp +++ b/source/src/vm/phc20/memory.cpp @@ -168,10 +168,10 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateBuffer(status, sizeof(status), 1); - state_fio->StateUint8(sysport); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateArray(status, sizeof(status), 1); + state_fio->StateValue(sysport); return true; } diff --git a/source/src/vm/phc25/keyboard.cpp b/source/src/vm/phc25/keyboard.cpp index 25e4c6830..bb8113b4b 100644 --- a/source/src/vm/phc25/keyboard.cpp +++ b/source/src/vm/phc25/keyboard.cpp @@ -131,9 +131,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) return false; } #ifdef _MAP1010 - state_fio->StateInt32(kana_pressed); + state_fio->StateValue(kana_pressed); #else - state_fio->StateBuffer(status, sizeof(status), 1); + state_fio->StateArray(status, sizeof(status), 1); #endif return true; } diff --git a/source/src/vm/phc25/memory.cpp b/source/src/vm/phc25/memory.cpp index ca12d0161..63cf708a0 100644 --- a/source/src/vm/phc25/memory.cpp +++ b/source/src/vm/phc25/memory.cpp @@ -97,8 +97,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); return true; } diff --git a/source/src/vm/phc25/system.cpp b/source/src/vm/phc25/system.cpp index d024d779f..ac607019b 100644 --- a/source/src/vm/phc25/system.cpp +++ b/source/src/vm/phc25/system.cpp @@ -55,7 +55,7 @@ bool SYSTEM::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(sysport); + state_fio->StateValue(sysport); return true; } diff --git a/source/src/vm/pv1000/joystick.cpp b/source/src/vm/pv1000/joystick.cpp index 41f47923a..6798a2fca 100644 --- a/source/src/vm/pv1000/joystick.cpp +++ b/source/src/vm/pv1000/joystick.cpp @@ -96,8 +96,8 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); - state_fio->StateUint8(status); + state_fio->StateValue(column); + state_fio->StateValue(status); return true; } diff --git a/source/src/vm/pv1000/psg.cpp b/source/src/vm/pv1000/psg.cpp index c3f345ebf..b904cf493 100644 --- a/source/src/vm/pv1000/psg.cpp +++ b/source/src/vm/pv1000/psg.cpp @@ -73,7 +73,7 @@ bool PSG::process_state(FILEIO* state_fio, bool loading) return false; } for(int i = 0; i < 3; i++) { - state_fio->StateInt32(ch[i].period); + state_fio->StateValue(ch[i].period); } return true; } diff --git a/source/src/vm/pv1000/vdp.cpp b/source/src/vm/pv1000/vdp.cpp index e133a338c..b634ca4a4 100644 --- a/source/src/vm/pv1000/vdp.cpp +++ b/source/src/vm/pv1000/vdp.cpp @@ -149,7 +149,7 @@ bool VDP::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE((int)(pcg - base)); state_fio->FputInt32_LE((int)(pattern - base)); } - state_fio->StateBool(force_pattern); + state_fio->StateValue(force_pattern); return true; } diff --git a/source/src/vm/pv2000/cmt.cpp b/source/src/vm/pv2000/cmt.cpp index 2e2387de1..6117e09af 100644 --- a/source/src/vm/pv2000/cmt.cpp +++ b/source/src/vm/pv2000/cmt.cpp @@ -141,12 +141,12 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateUint8(start); - state_fio->StateUint8(bit); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateValue(start); + state_fio->StateValue(bit); return true; } diff --git a/source/src/vm/pv2000/keyboard.cpp b/source/src/vm/pv2000/keyboard.cpp index 89f42464f..ac69d6a55 100644 --- a/source/src/vm/pv2000/keyboard.cpp +++ b/source/src/vm/pv2000/keyboard.cpp @@ -121,9 +121,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(key_stat, sizeof(key_stat), 1); - state_fio->StateInt32(key_no); - state_fio->StateBool(intr_enb); + state_fio->StateArray(key_stat, sizeof(key_stat), 1); + state_fio->StateValue(key_no); + state_fio->StateValue(intr_enb); return true; } diff --git a/source/src/vm/pv2000/printer.cpp b/source/src/vm/pv2000/printer.cpp index ec89ea882..32424f523 100644 --- a/source/src/vm/pv2000/printer.cpp +++ b/source/src/vm/pv2000/printer.cpp @@ -50,10 +50,10 @@ bool PRINTER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(out); - state_fio->StateUint8(ctrl0); - state_fio->StateUint8(ctrl1); - state_fio->StateBool(busy); + state_fio->StateValue(out); + state_fio->StateValue(ctrl0); + state_fio->StateValue(ctrl1); + state_fio->StateValue(busy); return true; } diff --git a/source/src/vm/pyuta/memory.cpp b/source/src/vm/pyuta/memory.cpp index 0a5fb3ecc..81bf7e1a7 100644 --- a/source/src/vm/pyuta/memory.cpp +++ b/source/src/vm/pyuta/memory.cpp @@ -325,11 +325,11 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(cmt_signal); - state_fio->StateBool(cmt_remote); - state_fio->StateBool(has_extrom); - state_fio->StateBool(cart_enabled); - state_fio->StateInt32(ctype); + state_fio->StateValue(cmt_signal); + state_fio->StateValue(cmt_remote); + state_fio->StateValue(has_extrom); + state_fio->StateValue(cart_enabled); + state_fio->StateValue(ctype); // post process if(loading) { diff --git a/source/src/vm/qc10/display.cpp b/source/src/vm/qc10/display.cpp index 33e45340e..d567d3823 100644 --- a/source/src/vm/qc10/display.cpp +++ b/source/src/vm/qc10/display.cpp @@ -318,14 +318,14 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) return false; } #ifdef _COLOR_MONITOR - state_fio->StateBuffer(vram_r, sizeof(vram_r), 1); - state_fio->StateBuffer(vram_g, sizeof(vram_g), 1); - state_fio->StateBuffer(vram_b, sizeof(vram_b), 1); + state_fio->StateArray(vram_r, sizeof(vram_r), 1); + state_fio->StateArray(vram_g, sizeof(vram_g), 1); + state_fio->StateArray(vram_b, sizeof(vram_b), 1); #else - state_fio->StateBuffer(vram, sizeof(vram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); #endif - state_fio->StateUint8(bank); - state_fio->StateInt32(blink); + state_fio->StateValue(bank); + state_fio->StateValue(blink); return true; } diff --git a/source/src/vm/qc10/memory.cpp b/source/src/vm/qc10/memory.cpp index 05b19120f..ebce09b0a 100644 --- a/source/src/vm/qc10/memory.cpp +++ b/source/src/vm/qc10/memory.cpp @@ -192,17 +192,17 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(cmos, sizeof(cmos), 1); - state_fio->StateUint32(cmos_crc32); - state_fio->StateUint8(bank); - state_fio->StateUint8(psel); - state_fio->StateUint8(csel); - state_fio->StateBool(pcm_on); - state_fio->StateBool(pcm_cont); - state_fio->StateBool(pcm_pit); - state_fio->StateBool(fdc_irq); - state_fio->StateBool(motor); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(cmos, sizeof(cmos), 1); + state_fio->StateValue(cmos_crc32); + state_fio->StateValue(bank); + state_fio->StateValue(psel); + state_fio->StateValue(csel); + state_fio->StateValue(pcm_on); + state_fio->StateValue(pcm_cont); + state_fio->StateValue(pcm_pit); + state_fio->StateValue(fdc_irq); + state_fio->StateValue(motor); // post process if(loading) { diff --git a/source/src/vm/qc10/mfont.cpp b/source/src/vm/qc10/mfont.cpp index 55913509f..7548aa956 100644 --- a/source/src/vm/qc10/mfont.cpp +++ b/source/src/vm/qc10/mfont.cpp @@ -104,7 +104,7 @@ bool MFONT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(status); + state_fio->StateValue(status); if(!cmd->process_state((void *)state_fio, loading)) { return false; } diff --git a/source/src/vm/rx78/cmt.cpp b/source/src/vm/rx78/cmt.cpp index 73f4764b8..8fd3f2e0d 100644 --- a/source/src/vm/rx78/cmt.cpp +++ b/source/src/vm/rx78/cmt.cpp @@ -80,11 +80,11 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(in); - state_fio->StateBool(out); - state_fio->StateBool(remote); - state_fio->StateBool(now_acc); - state_fio->StateInt32(framecnt); + state_fio->StateValue(in); + state_fio->StateValue(out); + state_fio->StateValue(remote); + state_fio->StateValue(now_acc); + state_fio->StateValue(framecnt); return true; } diff --git a/source/src/vm/rx78/keyboard.cpp b/source/src/vm/rx78/keyboard.cpp index 2d54be293..740bfbc30 100644 --- a/source/src/vm/rx78/keyboard.cpp +++ b/source/src/vm/rx78/keyboard.cpp @@ -104,8 +104,8 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(status, sizeof(status), 1); - state_fio->StateUint8(column); + state_fio->StateArray(status, sizeof(status), 1); + state_fio->StateValue(column); return true; } diff --git a/source/src/vm/rx78/memory.cpp b/source/src/vm/rx78/memory.cpp index 2ebd64fdd..59d64e64a 100644 --- a/source/src/vm/rx78/memory.cpp +++ b/source/src/vm/rx78/memory.cpp @@ -147,12 +147,12 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(ext, sizeof(ext), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); - state_fio->StateInt32(rpage); - state_fio->StateInt32(wpage); - state_fio->StateBool(inserted); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(ext, sizeof(ext), 1); + state_fio->StateArray(vram, sizeof(vram), 1); + state_fio->StateValue(rpage); + state_fio->StateValue(wpage); + state_fio->StateValue(inserted); return true; } diff --git a/source/src/vm/rx78/printer.cpp b/source/src/vm/rx78/printer.cpp index 469c84ce1..ccf5c3a0f 100644 --- a/source/src/vm/rx78/printer.cpp +++ b/source/src/vm/rx78/printer.cpp @@ -54,9 +54,9 @@ bool PRINTER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(strobe); - state_fio->StateBool(busy); - state_fio->StateUint8(out); + state_fio->StateValue(strobe); + state_fio->StateValue(busy); + state_fio->StateValue(out); return true; } diff --git a/source/src/vm/sc3000/keyboard.cpp b/source/src/vm/sc3000/keyboard.cpp index 1449f7843..5f670b24f 100644 --- a/source/src/vm/sc3000/keyboard.cpp +++ b/source/src/vm/sc3000/keyboard.cpp @@ -90,8 +90,8 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); - state_fio->StateBool(break_pressed); + state_fio->StateValue(column); + state_fio->StateValue(break_pressed); return true; } diff --git a/source/src/vm/sc3000/memory.cpp b/source/src/vm/sc3000/memory.cpp index 742872d3b..d52ff381a 100644 --- a/source/src/vm/sc3000/memory.cpp +++ b/source/src/vm/sc3000/memory.cpp @@ -148,10 +148,10 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBool(inserted); - state_fio->StateBool(ram_selected); - state_fio->StateBuffer(bank, sizeof(bank), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(inserted); + state_fio->StateValue(ram_selected); + state_fio->StateArray(bank, sizeof(bank), 1); // post process if(loading) { diff --git a/source/src/vm/scsi_dev.cpp b/source/src/vm/scsi_dev.cpp index b3cc3dcfe..8f24b549a 100644 --- a/source/src/vm/scsi_dev.cpp +++ b/source/src/vm/scsi_dev.cpp @@ -167,7 +167,7 @@ void SCSI_DEV::write_signal(int id, uint32_t data, uint32_t mask) buffer->write(data_bus); break; } - set_req_delay(0, 0.1); + set_req_delay(0, 1.0); } else if(prev_status && !ack_status) { // H -> L if(atn_pending) { diff --git a/source/src/vm/scv/io.cpp b/source/src/vm/scv/io.cpp index 263f2ee3c..4da6bb376 100644 --- a/source/src/vm/scv/io.cpp +++ b/source/src/vm/scv/io.cpp @@ -118,9 +118,9 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(pa); - state_fio->StateUint8(pb); - state_fio->StateUint8(pc); + state_fio->StateValue(pa); + state_fio->StateValue(pb); + state_fio->StateValue(pc); return true; } diff --git a/source/src/vm/scv/memory.cpp b/source/src/vm/scv/memory.cpp index d17fa7cf3..24a2643a8 100644 --- a/source/src/vm/scv/memory.cpp +++ b/source/src/vm/scv/memory.cpp @@ -214,7 +214,7 @@ void MEMORY::close_cart() memset(sram, 0xff, sizeof(sram)); } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool MEMORY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/scv/sound.h b/source/src/vm/scv/sound.h index 9434bc68d..36fdf48bf 100644 --- a/source/src/vm/scv/sound.h +++ b/source/src/vm/scv/sound.h @@ -29,21 +29,22 @@ namespace SCV { +typedef struct { + int count; + int diff; + int period; + int timbre; + int volume; + int output; + int ptr; +} channel_t; + class SOUND : public DEVICE { private: DEVICE* d_cpu; // sound gen - typedef struct { - int count; - int diff; - int period; - int timbre; - int volume; - int output; - int ptr; - } channel_t; channel_t tone; channel_t noise; channel_t square1; diff --git a/source/src/vm/scv/vdp.cpp b/source/src/vm/scv/vdp.cpp index f69456eb4..a31f7b111 100644 --- a/source/src/vm/scv/vdp.cpp +++ b/source/src/vm/scv/vdp.cpp @@ -348,10 +348,10 @@ bool VDP::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(vdc0); - state_fio->StateUint8(vdc1); - state_fio->StateUint8(vdc2); - state_fio->StateUint8(vdc3); + state_fio->StateValue(vdc0); + state_fio->StateValue(vdc1); + state_fio->StateValue(vdc2); + state_fio->StateValue(vdc3); return true; } diff --git a/source/src/vm/smb80te/memory.cpp b/source/src/vm/smb80te/memory.cpp index daed47c27..250e7b023 100644 --- a/source/src/vm/smb80te/memory.cpp +++ b/source/src/vm/smb80te/memory.cpp @@ -288,12 +288,12 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(pio1_pa); - state_fio->StateUint8(pio1_pb); - state_fio->StateUint8(shift_reg); - state_fio->StateUint32(a15_mask); - state_fio->StateBool(led); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(pio1_pa); + state_fio->StateValue(pio1_pb); + state_fio->StateValue(shift_reg); + state_fio->StateValue(a15_mask); + state_fio->StateValue(led); return true; } diff --git a/source/src/vm/smc777/memory.cpp b/source/src/vm/smc777/memory.cpp index 6090bd1ed..aaa829e1c 100644 --- a/source/src/vm/smc777/memory.cpp +++ b/source/src/vm/smc777/memory.cpp @@ -975,7 +975,7 @@ void MEMORY::draw_graph_320x200() } } -#define STATE_VERSION 2 +#define STATE_VERSION 3 bool MEMORY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/sn76489an.cpp b/source/src/vm/sn76489an.cpp index 4343d0441..f39c08b02 100644 --- a/source/src/vm/sn76489an.cpp +++ b/source/src/vm/sn76489an.cpp @@ -198,7 +198,7 @@ void SN76489AN::initialize_sound(int rate, int clock, int volume) diff = (int)(16.0 * (double)clock / (double)rate + 0.5); } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool SN76489AN::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/tk80bs/cmt.cpp b/source/src/vm/tk80bs/cmt.cpp index aa58cb00a..115d89f9c 100644 --- a/source/src/vm/tk80bs/cmt.cpp +++ b/source/src/vm/tk80bs/cmt.cpp @@ -152,14 +152,14 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBool(mic); - state_fio->StateBool(ear); - state_fio->StateBool(pulse); - state_fio->StateInt32(pulse_count); + state_fio->StateValue(mic); + state_fio->StateValue(ear); + state_fio->StateValue(pulse); + state_fio->StateValue(pulse_count); #if defined(_TK80BS) - state_fio->StateBool(play); - state_fio->StateBool(rec); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(play); + state_fio->StateValue(rec); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(rec) { @@ -190,8 +190,8 @@ bool CMT::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(bufcnt); - state_fio->StateBuffer(buffer, sizeof(buffer), 1); + state_fio->StateValue(bufcnt); + state_fio->StateArray(buffer, sizeof(buffer), 1); #endif return true; } diff --git a/source/src/vm/tk80bs/display.cpp b/source/src/vm/tk80bs/display.cpp index 28a4d7b76..7c1664126 100644 --- a/source/src/vm/tk80bs/display.cpp +++ b/source/src/vm/tk80bs/display.cpp @@ -221,9 +221,9 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading) return false; } #if defined(_TK80BS) - state_fio->StateInt32(mode); + state_fio->StateValue(mode); #endif - state_fio->StateBool(dma); + state_fio->StateValue(dma); return true; } diff --git a/source/src/vm/tk80bs/keyboard.cpp b/source/src/vm/tk80bs/keyboard.cpp index b2ac7f89e..b6053f1c4 100644 --- a/source/src/vm/tk80bs/keyboard.cpp +++ b/source/src/vm/tk80bs/keyboard.cpp @@ -294,13 +294,13 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) return false; } #if defined(_TK80BS) - state_fio->StateUint8(prev_type); - state_fio->StateUint8(prev_brk); - state_fio->StateUint8(prev_kana); - state_fio->StateBool(kana_lock); - state_fio->StateUint32(kb_type); + state_fio->StateValue(prev_type); + state_fio->StateValue(prev_brk); + state_fio->StateValue(prev_kana); + state_fio->StateValue(kana_lock); + state_fio->StateValue(kb_type); #endif - state_fio->StateUint32(column); + state_fio->StateValue(column); return true; } diff --git a/source/src/vm/tk80bs/membus.cpp b/source/src/vm/tk80bs/membus.cpp index 08d4726b5..9b1038d7f 100644 --- a/source/src/vm/tk80bs/membus.cpp +++ b/source/src/vm/tk80bs/membus.cpp @@ -62,8 +62,8 @@ bool MEMBUS::process_state(FILEIO* state_fio, bool loading) return false; } #if defined(_TK85) - state_fio->StateUint32(pc7); - state_fio->StateUint32(count); + state_fio->StateValue(pc7); + state_fio->StateValue(count); #endif return MEMORY::process_state(state_fio, loading); } diff --git a/source/src/vm/tk80bs/memory.cpp b/source/src/vm/tk80bs/memory.cpp index 1b8f0b85f..0046ca9f1 100644 --- a/source/src/vm/tk80bs/memory.cpp +++ b/source/src/vm/tk80bs/memory.cpp @@ -171,8 +171,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBuffer(vram, sizeof(vram), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateArray(vram, sizeof(vram), 1); return true; } diff --git a/source/src/vm/tms3631.cpp b/source/src/vm/tms3631.cpp index 30c5e26e9..0915a126a 100644 --- a/source/src/vm/tms3631.cpp +++ b/source/src/vm/tms3631.cpp @@ -119,7 +119,7 @@ void TMS3631::initialize_sound(int rate, int volume) vol = volume / 8; } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool TMS3631::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/tms9995.cpp b/source/src/vm/tms9995.cpp index 31d81650b..631bc1e3f 100644 --- a/source/src/vm/tms9995.cpp +++ b/source/src/vm/tms9995.cpp @@ -1706,29 +1706,29 @@ bool TMS9995::process_state(FILEIO* state_fio, bool loading) return false; } #ifdef USE_DEBUGGER - state_fio->StateUint64(total_count); + state_fio->StateValue(total_count); #endif - state_fio->StateInt32(count); - state_fio->StateInt32(period); - state_fio->StateUint16(WP); - state_fio->StateUint16(PC); - state_fio->StateUint16(prevPC); - state_fio->StateUint16(ST); - state_fio->StateBuffer(RAM, sizeof(RAM), 1); - state_fio->StateUint8(irq_level); - state_fio->StateUint8(int_state); - state_fio->StateUint8(int_latch); - state_fio->StateBool(int_pending); - state_fio->StateBool(int_enabled); - state_fio->StateUint16(dec_count); - state_fio->StateUint16(dec_interval); - state_fio->StateInt32(dec_timer); - state_fio->StateBool(dec_enabled); - state_fio->StateUint16(mode); - state_fio->StateUint8(lastparity); - state_fio->StateBool(nmi); - state_fio->StateBool(mid); - state_fio->StateBool(idle); + state_fio->StateValue(count); + state_fio->StateValue(period); + state_fio->StateValue(WP); + state_fio->StateValue(PC); + state_fio->StateValue(prevPC); + state_fio->StateValue(ST); + state_fio->StateArray(RAM, sizeof(RAM), 1); + state_fio->StateValue(irq_level); + state_fio->StateValue(int_state); + state_fio->StateValue(int_latch); + state_fio->StateValue(int_pending); + state_fio->StateValue(int_enabled); + state_fio->StateValue(dec_count); + state_fio->StateValue(dec_interval); + state_fio->StateValue(dec_timer); + state_fio->StateValue(dec_enabled); + state_fio->StateValue(mode); + state_fio->StateValue(lastparity); + state_fio->StateValue(nmi); + state_fio->StateValue(mid); + state_fio->StateValue(idle); #ifdef USE_DEBUGGER // post process diff --git a/source/src/vm/upd71071.cpp b/source/src/vm/upd71071.cpp index 387d8cbfe..02063325e 100644 --- a/source/src/vm/upd71071.cpp +++ b/source/src/vm/upd71071.cpp @@ -301,21 +301,21 @@ bool UPD71071::process_state(FILEIO* state_fio, bool loading) return false; } for(int i = 0; i < 4; i++) { - state_fio->StateUint32(dma[i].areg); - state_fio->StateUint32(dma[i].bareg); - state_fio->StateUint16(dma[i].creg); - state_fio->StateUint16(dma[i].bcreg); - state_fio->StateUint8(dma[i].mode); + state_fio->StateValue(dma[i].areg); + state_fio->StateValue(dma[i].bareg); + state_fio->StateValue(dma[i].creg); + state_fio->StateValue(dma[i].bcreg); + state_fio->StateValue(dma[i].mode); } - state_fio->StateUint8(b16); - state_fio->StateUint8(selch); - state_fio->StateUint8(base); - state_fio->StateUint16(cmd); - state_fio->StateUint16(tmp); - state_fio->StateUint8(req); - state_fio->StateUint8(sreq); - state_fio->StateUint8(mask); - state_fio->StateUint8(tc); + state_fio->StateValue(b16); + state_fio->StateValue(selch); + state_fio->StateValue(base); + state_fio->StateValue(cmd); + state_fio->StateValue(tmp); + state_fio->StateValue(req); + state_fio->StateValue(sreq); + state_fio->StateValue(mask); + state_fio->StateValue(tc); return true; } diff --git a/source/src/vm/x07/io.cpp b/source/src/vm/x07/io.cpp index a4553b7df..541d8254a 100644 --- a/source/src/vm/x07/io.cpp +++ b/source/src/vm/x07/io.cpp @@ -1253,36 +1253,36 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(rregs, sizeof(rregs), 1); - state_fio->StateBuffer(wregs, sizeof(wregs), 1); + state_fio->StateArray(rregs, sizeof(rregs), 1); + state_fio->StateArray(wregs, sizeof(wregs), 1); if(!cur_time.process_state((void *)state_fio, loading)) { return false; } - state_fio->StateInt32(register_id_1sec); + state_fio->StateValue(register_id_1sec); if(!cmd_buf->process_state((void *)state_fio, loading)) { return false; } if(!rsp_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateUint8(sub_int); - state_fio->StateBuffer(wram, sizeof(wram), 1); - state_fio->StateBuffer(alarm, sizeof(alarm), 1); + state_fio->StateValue(sub_int); + state_fio->StateArray(wram, sizeof(wram), 1); + state_fio->StateArray(alarm, sizeof(alarm), 1); if(!key_buf->process_state((void *)state_fio, loading)) { return false; } - state_fio->StateBool(ctrl); - state_fio->StateBool(shift); - state_fio->StateBool(kana); - state_fio->StateBool(graph); - state_fio->StateBool(brk); - state_fio->StateUint8(stick); - state_fio->StateUint8(strig); - state_fio->StateUint8(strig1); - state_fio->StateBool(cmt_play); - state_fio->StateBool(cmt_rec); - state_fio->StateBool(cmt_mode); - state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1); + state_fio->StateValue(ctrl); + state_fio->StateValue(shift); + state_fio->StateValue(kana); + state_fio->StateValue(graph); + state_fio->StateValue(brk); + state_fio->StateValue(stick); + state_fio->StateValue(strig); + state_fio->StateValue(strig1); + state_fio->StateValue(cmt_play); + state_fio->StateValue(cmt_rec); + state_fio->StateValue(cmt_mode); + state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1); if(loading) { int length_tmp = state_fio->FgetInt32_LE(); if(cmt_rec) { @@ -1313,24 +1313,24 @@ bool IO::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE(0); } } - state_fio->StateInt32(cmt_len); - state_fio->StateInt32(cmt_ptr); - state_fio->StateBuffer(cmt_buf, sizeof(cmt_buf), 1); - state_fio->StateBool(vblank); - state_fio->StateUint8(font_code); - state_fio->StateBuffer(udc, sizeof(udc), 1); - state_fio->StateBuffer(lcd, sizeof(lcd), 1); - state_fio->StateBool(locate_on); - state_fio->StateBool(cursor_on); - state_fio->StateBool(udk_on); - state_fio->StateInt32(locate_x); - state_fio->StateInt32(locate_y); - state_fio->StateInt32(cursor_x); - state_fio->StateInt32(cursor_y); - state_fio->StateInt32(cursor_blink); - state_fio->StateInt32(scroll_min); - state_fio->StateInt32(scroll_max); - state_fio->StateInt32(register_id_beep); + state_fio->StateValue(cmt_len); + state_fio->StateValue(cmt_ptr); + state_fio->StateArray(cmt_buf, sizeof(cmt_buf), 1); + state_fio->StateValue(vblank); + state_fio->StateValue(font_code); + state_fio->StateArray(udc, sizeof(udc), 1); + state_fio->StateArray(&lcd[0][0], sizeof(lcd), 1); + state_fio->StateValue(locate_on); + state_fio->StateValue(cursor_on); + state_fio->StateValue(udk_on); + state_fio->StateValue(locate_x); + state_fio->StateValue(locate_y); + state_fio->StateValue(cursor_x); + state_fio->StateValue(cursor_y); + state_fio->StateValue(cursor_blink); + state_fio->StateValue(scroll_min); + state_fio->StateValue(scroll_max); + state_fio->StateValue(register_id_beep); return true; } diff --git a/source/src/vm/x1/display.cpp b/source/src/vm/x1/display.cpp index 89039f615..fbc36ac5e 100644 --- a/source/src/vm/x1/display.cpp +++ b/source/src/vm/x1/display.cpp @@ -1513,7 +1513,7 @@ uint16_t DISPLAY::jis2sjis(uint16_t jis) return (c1 << 8) | c2; } -#define STATE_VERSION 4 +#define STATE_VERSION 5 bool DISPLAY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/x1/iobus.cpp b/source/src/vm/x1/iobus.cpp index 74886cad8..467ff2aab 100644 --- a/source/src/vm/x1/iobus.cpp +++ b/source/src/vm/x1/iobus.cpp @@ -257,17 +257,17 @@ bool IOBUS::process_state(FILEIO* state_fio, bool loading) state_fio->FputInt32_LE((int)(vram_r - vram)); state_fio->FputInt32_LE((int)(vram_g - vram)); } - state_fio->StateUint8(vdisp); - state_fio->StateUint32(prev_clock); - state_fio->StateUint32(vram_wait_index); - state_fio->StateBool(column40); + state_fio->StateValue(vdisp); + state_fio->StateValue(prev_clock); + state_fio->StateValue(vram_wait_index); + state_fio->StateValue(column40); #ifdef _X1TURBO_FEATURE - state_fio->StateBuffer(crtc_regs, sizeof(crtc_regs), 1); - state_fio->StateInt32(crtc_ch); - state_fio->StateBool(hireso); + state_fio->StateArray(crtc_regs, sizeof(crtc_regs), 1); + state_fio->StateValue(crtc_ch); + state_fio->StateValue(hireso); #ifdef _X1TURBOZ - state_fio->StateUint8(zmode1); - state_fio->StateUint8(zmode2); + state_fio->StateValue(zmode1); + state_fio->StateValue(zmode2); #endif #endif return true; diff --git a/source/src/vm/yalky/io.cpp b/source/src/vm/yalky/io.cpp index 5268df6bc..a8c59d62b 100644 --- a/source/src/vm/yalky/io.cpp +++ b/source/src/vm/yalky/io.cpp @@ -279,16 +279,16 @@ bool IO::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(pb); - state_fio->StateUint8(pc); - state_fio->StateUint8(div_counter); - state_fio->StateUint8(counter); - state_fio->StateInt32(posi_counter); - state_fio->StateInt32(nega_counter); - state_fio->StateBool(drec_in); - state_fio->StateBool(drec_toggle); - state_fio->StateUint32(prev_clock); - state_fio->StateInt32(register_id); + state_fio->StateValue(pb); + state_fio->StateValue(pc); + state_fio->StateValue(div_counter); + state_fio->StateValue(counter); + state_fio->StateValue(posi_counter); + state_fio->StateValue(nega_counter); + state_fio->StateValue(drec_in); + state_fio->StateValue(drec_toggle); + state_fio->StateValue(prev_clock); + state_fio->StateValue(register_id); return true; } diff --git a/source/src/vm/yis/display.cpp b/source/src/vm/yis/display.cpp index ee18db77b..ac59c6107 100644 --- a/source/src/vm/yis/display.cpp +++ b/source/src/vm/yis/display.cpp @@ -1599,7 +1599,7 @@ void DISPLAY::draw_text() } } -#define STATE_VERSION 2 +#define STATE_VERSION 3 bool DISPLAY::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/yis/keyboard.cpp b/source/src/vm/yis/keyboard.cpp index b9ad83493..97c1e1d90 100644 --- a/source/src/vm/yis/keyboard.cpp +++ b/source/src/vm/yis/keyboard.cpp @@ -180,9 +180,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateUint8(column); - state_fio->StateBool(caps_locked); - state_fio->StateBool(kana_locked); + state_fio->StateValue(column); + state_fio->StateValue(caps_locked); + state_fio->StateValue(kana_locked); return true; } diff --git a/source/src/vm/yis/mapper.cpp b/source/src/vm/yis/mapper.cpp index aba0a3356..fdea51922 100644 --- a/source/src/vm/yis/mapper.cpp +++ b/source/src/vm/yis/mapper.cpp @@ -111,10 +111,10 @@ bool MAPPER::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateUint8(mapper_reg); - state_fio->StateBuffer(bank_reg, sizeof(bank_reg), 1); -// state_fio->StateBuffer(cur_bank, sizeof(cur_bank), 1); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(mapper_reg); + state_fio->StateArray(bank_reg, sizeof(bank_reg), 1); +// state_fio->StateArray(cur_bank, sizeof(cur_bank), 1); // post process if(loading) { diff --git a/source/src/vm/ym2151.cpp b/source/src/vm/ym2151.cpp index 8551b5ceb..b7e38e6d1 100644 --- a/source/src/vm/ym2151.cpp +++ b/source/src/vm/ym2151.cpp @@ -232,7 +232,7 @@ void YM2151::update_timing(int new_clocks, double new_frames_per_sec, int new_li clock_const = (uint32_t)((double)chip_clock * 1024.0 * 1024.0 / (double)new_clocks + 0.5); } -#define STATE_VERSION 2 +#define STATE_VERSION 3 bool YM2151::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/ym2203.cpp b/source/src/vm/ym2203.cpp index ab49a2130..8b8792cdc 100644 --- a/source/src/vm/ym2203.cpp +++ b/source/src/vm/ym2203.cpp @@ -722,7 +722,7 @@ void YM2203::update_timing(int new_clocks, double new_frames_per_sec, int new_li clock_const = (uint32_t)((double)chip_clock * 1024.0 * 1024.0 / (double)new_clocks + 0.5); } -#define STATE_VERSION 4 +#define STATE_VERSION 5 bool YM2203::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/z80dma.cpp b/source/src/vm/z80dma.cpp index bff925dc7..92c58cb45 100644 --- a/source/src/vm/z80dma.cpp +++ b/source/src/vm/z80dma.cpp @@ -760,7 +760,7 @@ void Z80DMA::notify_intr_reti() } } -#define STATE_VERSION 1 +#define STATE_VERSION 2 bool Z80DMA::process_state(FILEIO* state_fio, bool loading) { diff --git a/source/src/vm/z80tvgame/memory.cpp b/source/src/vm/z80tvgame/memory.cpp index 1cbebcfa3..a4acc269c 100644 --- a/source/src/vm/z80tvgame/memory.cpp +++ b/source/src/vm/z80tvgame/memory.cpp @@ -108,8 +108,8 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading) if(!state_fio->StateCheckInt32(this_device_id)) { return false; } - state_fio->StateBuffer(ram, sizeof(ram), 1); - state_fio->StateBool(inserted); + state_fio->StateArray(ram, sizeof(ram), 1); + state_fio->StateValue(inserted); return true; } -- 2.11.0