OSDN Git Service

[VM}[FM7][PC8801][X1] At least enable to build FM7,PC8801 and X1 (excepts X!Twin).
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 25 Oct 2018 08:23:53 +0000 (17:23 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 25 Oct 2018 08:23:53 +0000 (17:23 +0900)
22 files changed:
source/src/vm/fm7/display.cpp
source/src/vm/fm7/fm7.cpp
source/src/vm/fm7/fm7_mainio.cpp
source/src/vm/fm7/fm7_mainmem.cpp
source/src/vm/fm7/fm_bubblecasette.cpp
source/src/vm/fm7/hd6844.cpp
source/src/vm/fm7/joystick.cpp
source/src/vm/fm7/kanjirom.cpp
source/src/vm/fm7/keyboard.cpp
source/src/vm/fm7/mb61vh010.cpp
source/src/vm/pc8801/pc88.cpp
source/src/vm/pc8801/pc8801.cpp
source/src/vm/x1/display.cpp
source/src/vm/x1/emm.cpp
source/src/vm/x1/floppy.cpp
source/src/vm/x1/iobus.cpp
source/src/vm/x1/keyboard.cpp
source/src/vm/x1/memory.cpp
source/src/vm/x1/psub.cpp
source/src/vm/x1/sasi.cpp
source/src/vm/x1/sub.cpp
source/src/vm/x1/x1.cpp

index 839bf25..d573b8b 100644 (file)
@@ -3520,144 +3520,144 @@ bool DISPLAY::process_state(FILEIO *state_fio, bool loading)
        }
        {
                int i;
-               state_fio->StateBool(delay_busy);
-               state_fio->StateBool(halt_flag);
-               state_fio->StateInt32(active_page);
-               state_fio->StateBool(sub_busy);
-               state_fio->StateBool(crt_flag);
-               state_fio->StateBool(vram_wrote);
-               state_fio->StateBool(is_cyclesteal);
+               state_fio->StateValue(delay_busy);
+               state_fio->StateValue(halt_flag);
+               state_fio->StateValue(active_page);
+               state_fio->StateValue(sub_busy);
+               state_fio->StateValue(crt_flag);
+               state_fio->StateValue(vram_wrote);
+               state_fio->StateValue(is_cyclesteal);
                
-               state_fio->StateBool(clock_fast);
+               state_fio->StateValue(clock_fast);
                
 #if defined(_FM77AV_VARIANTS)
-               state_fio->StateBool(subcpu_resetreq);
-               state_fio->StateBool(power_on_reset);
+               state_fio->StateValue(subcpu_resetreq);
+               state_fio->StateValue(power_on_reset);
 #endif 
-               state_fio->StateBool(cancel_request);
-               state_fio->StateBool(key_firq_req);
-               state_fio->StateInt32(display_mode);
-               state_fio->StateUint32(prev_clock);
+               state_fio->StateValue(cancel_request);
+               state_fio->StateValue(key_firq_req);
+               state_fio->StateValue(display_mode);
+               state_fio->StateValue(prev_clock);
 #if !defined(_FM8)     
-               state_fio->StateBuffer(dpalette_data, sizeof(dpalette_data), 1);
-               state_fio->StateUint8(multimode_accessmask);
-               state_fio->StateUint8(multimode_dispmask);
+               state_fio->StateArray(dpalette_data, sizeof(dpalette_data), 1);
+               state_fio->StateValue(multimode_accessmask);
+               state_fio->StateValue(multimode_dispmask);
 #endif         
-               state_fio->StateUint32(offset_point);
+               state_fio->StateValue(offset_point);
 #if defined(_FM77AV_VARIANTS)
-               state_fio->StateUint32(offset_point_bank1);
+               state_fio->StateValue(offset_point_bank1);
 #endif         
                //for(i = 0; i < 2; i++) {
-               state_fio->StateBuffer(tmp_offset_point, sizeof(tmp_offset_point), 1);
-               state_fio->StateBuffer(offset_changed, sizeof(offset_changed), 1);
+               state_fio->StateArray(tmp_offset_point, sizeof(tmp_offset_point), 1);
+               state_fio->StateArray(offset_changed, sizeof(offset_changed), 1);
                //}
-               state_fio->StateBool(offset_77av);
-               state_fio->StateBool(diag_load_subrom_c);
-               state_fio->StateBuffer(io_w_latch, sizeof(io_w_latch), 1);
-               state_fio->StateBuffer(console_ram, sizeof(console_ram), 1);
-               state_fio->StateBuffer(work_ram, sizeof(work_ram), 1);
-               state_fio->StateBuffer(shared_ram, sizeof(shared_ram), 1);
-               state_fio->StateBuffer(subsys_c, sizeof(subsys_c), 1);
-               state_fio->StateBuffer(gvram, sizeof(gvram), 1);
-               state_fio->StateBuffer(gvram_shadow, sizeof(gvram_shadow), 1);
+               state_fio->StateValue(offset_77av);
+               state_fio->StateValue(diag_load_subrom_c);
+               state_fio->StateArray(io_w_latch, sizeof(io_w_latch), 1);
+               state_fio->StateArray(console_ram, sizeof(console_ram), 1);
+               state_fio->StateArray(work_ram, sizeof(work_ram), 1);
+               state_fio->StateArray(shared_ram, sizeof(shared_ram), 1);
+               state_fio->StateArray(subsys_c, sizeof(subsys_c), 1);
+               state_fio->StateArray(gvram, sizeof(gvram), 1);
+               state_fio->StateArray(gvram_shadow, sizeof(gvram_shadow), 1);
 #if defined(_FM77_VARIANTS)
-               state_fio->StateBool(kanjisub);
-               state_fio->StateUint32(kanjiaddr.d);
+               state_fio->StateValue(kanjisub);
+               state_fio->StateValue(kanjiaddr.d);
 # if defined(_FM77L4)
-               state_fio->StateBool(mode400line);
-               state_fio->StateBool(stat_400linecard);
+               state_fio->StateValue(mode400line);
+               state_fio->StateValue(stat_400linecard);
 # endif
 #elif defined(_FM77AV_VARIANTS)
-               state_fio->StateBool(kanjisub);
-               state_fio->StateUint32(kanjiaddr.d);
-               state_fio->StateBool(mode320);
-               state_fio->StateInt32(cgrom_bank);
+               state_fio->StateValue(kanjisub);
+               state_fio->StateValue(kanjiaddr.d);
+               state_fio->StateValue(mode320);
+               state_fio->StateValue(cgrom_bank);
 #if defined(_FM77AV40) || defined(_FM77AV40SX)|| defined(_FM77AV40SX) || \
        defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
-               state_fio->StateInt32(vram_bank);
+               state_fio->StateValue(vram_bank);
 #endif 
-               state_fio->StateUint32(displine);
-               state_fio->StateUint8(subrom_bank);
-               state_fio->StateUint8(subrom_bank_using);
-               state_fio->StateBool(nmi_enable);
-               state_fio->StateBool(use_alu);
-               state_fio->StateUint32(apalette_index.d);
-               state_fio->StateBuffer(analog_palette_r, sizeof(analog_palette_r), 1);
-               state_fio->StateBuffer(analog_palette_g, sizeof(analog_palette_g), 1);
-               state_fio->StateBuffer(analog_palette_b, sizeof(analog_palette_b), 1);
-               state_fio->StateBool(diag_load_subrom_a);
-               state_fio->StateBool(diag_load_subrom_b);
-               state_fio->StateBool(diag_load_subrom_cg);
+               state_fio->StateValue(displine);
+               state_fio->StateValue(subrom_bank);
+               state_fio->StateValue(subrom_bank_using);
+               state_fio->StateValue(nmi_enable);
+               state_fio->StateValue(use_alu);
+               state_fio->StateValue(apalette_index.d);
+               state_fio->StateArray(analog_palette_r, sizeof(analog_palette_r), 1);
+               state_fio->StateArray(analog_palette_g, sizeof(analog_palette_g), 1);
+               state_fio->StateArray(analog_palette_b, sizeof(analog_palette_b), 1);
+               state_fio->StateValue(diag_load_subrom_a);
+               state_fio->StateValue(diag_load_subrom_b);
+               state_fio->StateValue(diag_load_subrom_cg);
        
-               state_fio->StateBuffer(subsys_a, sizeof(subsys_a), 1);
-               state_fio->StateBuffer(subsys_b, sizeof(subsys_b), 1);
-               state_fio->StateBuffer(subsys_cg, sizeof(subsys_cg), 1);
-               state_fio->StateBuffer(submem_hidden, sizeof(submem_hidden), 1);
+               state_fio->StateArray(subsys_a, sizeof(subsys_a), 1);
+               state_fio->StateArray(subsys_b, sizeof(subsys_b), 1);
+               state_fio->StateArray(subsys_cg, sizeof(subsys_cg), 1);
+               state_fio->StateArray(submem_hidden, sizeof(submem_hidden), 1);
 # if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
-               state_fio->StateBool(mode400line);
-               state_fio->StateBool(mode256k);
-               state_fio->StateBool(monitor_ram);
+               state_fio->StateValue(mode400line);
+               state_fio->StateValue(mode256k);
+               state_fio->StateValue(monitor_ram);
 #  if defined(_FM77AV40EX) || defined(_FM77AV40SX)
-               state_fio->StateUint16(window_low);
-               state_fio->StateUint16(window_high);
-               state_fio->StateUint16(window_xbegin);
-               state_fio->StateUint16(window_xend);
-               state_fio->StateBool(window_opened);
+               state_fio->StateValue(window_low);
+               state_fio->StateValue(window_high);
+               state_fio->StateValue(window_xbegin);
+               state_fio->StateValue(window_xend);
+               state_fio->StateValue(window_opened);
 #  endif       
-               state_fio->StateBool(kanji_level2);
-               state_fio->StateUint8(vram_active_block);
-               state_fio->StateUint8(vram_display_block);
-               state_fio->StateUint8(console_ram_bank);
-               state_fio->StateBool(ram_protect);
-               state_fio->StateUint8(cgram_bank);
-               state_fio->StateBuffer(subsys_ram, sizeof(subsys_ram), 1);
-               state_fio->StateBuffer(submem_cgram, sizeof(submem_cgram), 1);
-               state_fio->StateBuffer(submem_console_av40, sizeof(submem_console_av40), 1);
+               state_fio->StateValue(kanji_level2);
+               state_fio->StateValue(vram_active_block);
+               state_fio->StateValue(vram_display_block);
+               state_fio->StateValue(console_ram_bank);
+               state_fio->StateValue(ram_protect);
+               state_fio->StateValue(cgram_bank);
+               state_fio->StateArray(subsys_ram, sizeof(subsys_ram), 1);
+               state_fio->StateArray(submem_cgram, sizeof(submem_cgram), 1);
+               state_fio->StateArray(submem_console_av40, sizeof(submem_console_av40), 1);
 # endif
 #endif
        }
        // V2
        {
-               state_fio->StateInt32(nmi_event_id);
+               state_fio->StateValue(nmi_event_id);
 //#if defined(_FM77AV_VARIANTS)
-               state_fio->StateInt32(hblank_event_id);
-               state_fio->StateInt32(hdisp_event_id);
-               state_fio->StateInt32(vsync_event_id);
-               state_fio->StateInt32(vstart_event_id);
+               state_fio->StateValue(hblank_event_id);
+               state_fio->StateValue(hdisp_event_id);
+               state_fio->StateValue(vsync_event_id);
+               state_fio->StateValue(vstart_event_id);
 //#endif
-               state_fio->StateBool(firq_mask);
-               state_fio->StateBool(vram_accessflag);
-               state_fio->StateInt8(display_page);
-               state_fio->StateInt8(display_page_bak);
-               state_fio->StateBool(vblank);
-               state_fio->StateBool(vsync);
-               state_fio->StateBool(hblank);
-               state_fio->StateInt32(vblank_count);
+               state_fio->StateValue(firq_mask);
+               state_fio->StateValue(vram_accessflag);
+               state_fio->StateValue(display_page);
+               state_fio->StateValue(display_page_bak);
+               state_fio->StateValue(vblank);
+               state_fio->StateValue(vsync);
+               state_fio->StateValue(hblank);
+               state_fio->StateValue(vblank_count);
        }                       
 #if defined(_FM77L4)
-       state_fio->StateBuffer(subsys_cg_l4, sizeof(subsys_cg_l4), 1);
-       state_fio->StateBuffer(subsys_l4, sizeof(subsys_l4), 1);
-       state_fio->StateBuffer(text_vram, sizeof(text_vram), 1);
+       state_fio->StateArray(subsys_cg_l4, sizeof(subsys_cg_l4), 1);
+       state_fio->StateArray(subsys_l4, sizeof(subsys_l4), 1);
+       state_fio->StateArray(text_vram, sizeof(text_vram), 1);
        //state_fio->Fwrite(crtc_regs, sizeof(crtc_regs), 1);
-       state_fio->StateBool(workram_l4);
-       state_fio->StateBool(cursor_lsb);
-       state_fio->StateBool(text_width40);
+       state_fio->StateValue(workram_l4);
+       state_fio->StateValue(cursor_lsb);
+       state_fio->StateValue(text_width40);
        
-       state_fio->StateBool(text_blink);
-       state_fio->StateBool(cursor_blink);
+       state_fio->StateValue(text_blink);
+       state_fio->StateValue(cursor_blink);
        
-       state_fio->StateUint32(text_start_addr.d);
-       state_fio->StateUint32(text_lines);
-       state_fio->StateUint32(text_xmax);
+       state_fio->StateValue(text_start_addr.d);
+       state_fio->StateValue(text_lines);
+       state_fio->StateValue(text_xmax);
        
-       state_fio->StateUint32(cursor_addr.d);
-       state_fio->StateInt32(cursor_start);
-       state_fio->StateInt32(cursor_end);
-       state_fio->StateUint8(cursor_type);
-       state_fio->StateUint8(text_scroll_count);
+       state_fio->StateValue(cursor_addr.d);
+       state_fio->StateValue(cursor_start);
+       state_fio->StateValue(cursor_end);
+       state_fio->StateValue(cursor_type);
+       state_fio->StateValue(text_scroll_count);
  
-       state_fio->StateInt32(event_id_l4_cursor_blink);
-       state_fio->StateInt32(event_id_l4_text_blink);
+       state_fio->StateValue(event_id_l4_cursor_blink);
+       state_fio->StateValue(event_id_l4_text_blink);
 #endif
 
        if(loading) {   
index 98d1d4e..adc2ca0 100644 (file)
@@ -1284,8 +1284,8 @@ bool VM::process_state(FILEIO* state_fio, bool loading)
                }
        }
        // Machine specified.
-       state_fio->StateBool(connect_320kfdc);
-       state_fio->StateBool(connect_1Mfdc);
+       state_fio->StateValue(connect_320kfdc);
+       state_fio->StateValue(connect_1Mfdc);
        if(loading) {
                update_config();
        }
index e91f89c..34a85c5 100644 (file)
@@ -1953,150 +1953,150 @@ bool FM7_MAINIO::decl_state(FILEIO *state_fio, bool loading)
                return false;
        }
 
-       state_fio->StateBuffer(io_w_latch, sizeof(io_w_latch), 1);
+       state_fio->StateArray(io_w_latch, sizeof(io_w_latch), 1);
        
-       state_fio->StateBool(clock_fast);
-       state_fio->StateBool(lpt_strobe);
-       state_fio->StateBool(lpt_slctin);
-       state_fio->StateBool(beep_flag);
-       state_fio->StateBool(beep_snd);
+       state_fio->StateValue(clock_fast);
+       state_fio->StateValue(lpt_strobe);
+       state_fio->StateValue(lpt_slctin);
+       state_fio->StateValue(beep_flag);
+       state_fio->StateValue(beep_snd);
        
        // FD01
-       state_fio->StateUint8(lpt_outdata);
+       state_fio->StateValue(lpt_outdata);
        // FD02
-       state_fio->StateBool(cmt_indat);
-       state_fio->StateBool(cmt_invert);
-       state_fio->StateBool(lpt_det2);
-       state_fio->StateBool(lpt_det1);
-       state_fio->StateBool(lpt_pe);
-       state_fio->StateBool(lpt_ackng_inv);
-       state_fio->StateBool(lpt_error_inv);
-       state_fio->StateUint8(irqmask_reg0);
+       state_fio->StateValue(cmt_indat);
+       state_fio->StateValue(cmt_invert);
+       state_fio->StateValue(lpt_det2);
+       state_fio->StateValue(lpt_det1);
+       state_fio->StateValue(lpt_pe);
+       state_fio->StateValue(lpt_ackng_inv);
+       state_fio->StateValue(lpt_error_inv);
+       state_fio->StateValue(irqmask_reg0);
        
-       state_fio->StateBool(irqmask_syndet);
-       state_fio->StateBool(irqmask_rxrdy);
-       state_fio->StateBool(irqmask_txrdy);
-       state_fio->StateBool(irqmask_mfd);
-       state_fio->StateBool(irqmask_timer);
-       state_fio->StateBool(irqmask_printer);
-       state_fio->StateBool(irqmask_keyboard);
-
-       state_fio->StateBool(irqreq_syndet);
-       state_fio->StateBool(irqreq_rxrdy);
-       state_fio->StateBool(irqreq_txrdy);
-       state_fio->StateBool(irqreq_printer);
-       state_fio->StateBool(irqreq_keyboard);
-       state_fio->StateUint8(irqstat_reg0);
+       state_fio->StateValue(irqmask_syndet);
+       state_fio->StateValue(irqmask_rxrdy);
+       state_fio->StateValue(irqmask_txrdy);
+       state_fio->StateValue(irqmask_mfd);
+       state_fio->StateValue(irqmask_timer);
+       state_fio->StateValue(irqmask_printer);
+       state_fio->StateValue(irqmask_keyboard);
+
+       state_fio->StateValue(irqreq_syndet);
+       state_fio->StateValue(irqreq_rxrdy);
+       state_fio->StateValue(irqreq_txrdy);
+       state_fio->StateValue(irqreq_printer);
+       state_fio->StateValue(irqreq_keyboard);
+       state_fio->StateValue(irqstat_reg0);
                
-       state_fio->StateBool(irqstat_timer);
-       state_fio->StateBool(irqstat_printer);
-       state_fio->StateBool(irqstat_keyboard);
+       state_fio->StateValue(irqstat_timer);
+       state_fio->StateValue(irqstat_printer);
+       state_fio->StateValue(irqstat_keyboard);
                
        // FD04
 #if defined(_FM77_VARIANTS)
-       state_fio->StateBool(stat_fdmode_2hd);
-       state_fio->StateBool(stat_kanjirom);
+       state_fio->StateValue(stat_fdmode_2hd);
+       state_fio->StateValue(stat_kanjirom);
 #elif defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || \
        defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
-       state_fio->StateBool(stat_kanjirom);
+       state_fio->StateValue(stat_kanjirom);
 #endif
-       state_fio->StateBool(firq_break_key);
-       state_fio->StateBool(firq_sub_attention);
+       state_fio->StateValue(firq_break_key);
+       state_fio->StateValue(firq_sub_attention);
        
-       state_fio->StateBool(intmode_fdc);
+       state_fio->StateValue(intmode_fdc);
        // FD05
-       state_fio->StateBool(extdet_neg);
-       state_fio->StateBool(sub_halt);
-       state_fio->StateBool(sub_cancel);
+       state_fio->StateValue(extdet_neg);
+       state_fio->StateValue(sub_halt);
+       state_fio->StateValue(sub_cancel);
        // FD06, 07
-       state_fio->StateBool(intstat_syndet);
-       state_fio->StateBool(intstat_rxrdy);
-       state_fio->StateBool(intstat_txrdy);
+       state_fio->StateValue(intstat_syndet);
+       state_fio->StateValue(intstat_rxrdy);
+       state_fio->StateValue(intstat_txrdy);
        
        
-       state_fio->StateBool(intstat_opn);
-       state_fio->StateBool(intstat_mouse);
-       state_fio->StateBool(mouse_enable);
+       state_fio->StateValue(intstat_opn);
+       state_fio->StateValue(intstat_mouse);
+       state_fio->StateValue(mouse_enable);
        
-       state_fio->StateBool(intstat_whg);
-       state_fio->StateBool(intstat_thg);
+       state_fio->StateValue(intstat_whg);
+       state_fio->StateValue(intstat_thg);
        
        // FDC
-       state_fio->StateBool(connect_fdc);
-       state_fio->StateUint8(fdc_statreg);
-       state_fio->StateUint8(fdc_cmdreg);
-       state_fio->StateUint8(fdc_trackreg);
-       state_fio->StateUint8(fdc_sectreg);
-       state_fio->StateUint8(fdc_datareg);
-       state_fio->StateUint8(fdc_headreg);
-       state_fio->StateUint8(fdc_drvsel);
-       state_fio->StateUint8(irqreg_fdc);
-       state_fio->StateBool(fdc_motor);
-       state_fio->StateBool(irqstat_fdc);
+       state_fio->StateValue(connect_fdc);
+       state_fio->StateValue(fdc_statreg);
+       state_fio->StateValue(fdc_cmdreg);
+       state_fio->StateValue(fdc_trackreg);
+       state_fio->StateValue(fdc_sectreg);
+       state_fio->StateValue(fdc_datareg);
+       state_fio->StateValue(fdc_headreg);
+       state_fio->StateValue(fdc_drvsel);
+       state_fio->StateValue(irqreg_fdc);
+       state_fio->StateValue(fdc_motor);
+       state_fio->StateValue(irqstat_fdc);
        // KANJI ROM
-       state_fio->StateBool(connect_kanjiroml1);
+       state_fio->StateValue(connect_kanjiroml1);
 #if defined(_FM77AV_VARIANTS)
-       state_fio->StateBool(connect_kanjiroml2);
-       state_fio->StateBool(boot_ram);
-       state_fio->StateBool(hotreset);
+       state_fio->StateValue(connect_kanjiroml2);
+       state_fio->StateValue(boot_ram);
+       state_fio->StateValue(hotreset);
        // FD13
-       state_fio->StateUint8(sub_monitor_type);
+       state_fio->StateValue(sub_monitor_type);
 #endif 
        { // V2
-               state_fio->StateInt32(event_beep);
-               state_fio->StateInt32(event_beep_oneshot);
-               state_fio->StateInt32(event_timerirq);
+               state_fio->StateValue(event_beep);
+               state_fio->StateValue(event_beep_oneshot);
+               state_fio->StateValue(event_timerirq);
        }               
        {  // V3
-               state_fio->StateInt32(event_fdc_motor);
+               state_fio->StateValue(event_fdc_motor);
 #if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)|| \
        defined(_FM77AV20) || defined(_FM77AV20SX) || defined(_FM77AV20EX)
-               state_fio->StateBuffer(fdc_drive_table, sizeof(fdc_drive_table), 1);
-               state_fio->StateUint8(fdc_reg_fd1e);
+               state_fio->StateArray(fdc_drive_table, sizeof(fdc_drive_table), 1);
+               state_fio->StateValue(fdc_reg_fd1e);
 #endif 
 #if defined(HAS_DMA)
-               state_fio->StateBool(intstat_dma);
-               state_fio->StateUint8(dma_addr);
+               state_fio->StateValue(intstat_dma);
+               state_fio->StateValue(dma_addr);
 #endif                 
 #if defined(_FM77AV_VARIANTS)
-               state_fio->StateUint8(reg_fd12);
+               state_fio->StateValue(reg_fd12);
 #endif         
        }
 // FD05
-       state_fio->StateBool(req_z80run);
-       state_fio->StateBool(z80_run);
+       state_fio->StateValue(req_z80run);
+       state_fio->StateValue(z80_run);
  
        // UART
-       state_fio->StateBool(rs232c_enabled);
-       state_fio->StateBool(rs232c_dcd);
-       state_fio->StateBuffer(uart_enabled, sizeof(uart_enabled), 1);
+       state_fio->StateValue(rs232c_enabled);
+       state_fio->StateValue(rs232c_dcd);
+       state_fio->StateArray(uart_enabled, sizeof(uart_enabled), 1);
        
-       state_fio->StateBool(modem_irqmask_rxrdy);
-       state_fio->StateBool(modem_irqmask_txrdy);
-       state_fio->StateBool(modem_syndet);
-       state_fio->StateBool(modem_rxrdy);
-       state_fio->StateBool(modem_txrdy);
-
-       state_fio->StateBool(midi_uart_irqmask);
-       state_fio->StateBool(midi_syndet);
-       state_fio->StateBool(midi_rxrdy);
-       state_fio->StateBool(midi_txrdy);
+       state_fio->StateValue(modem_irqmask_rxrdy);
+       state_fio->StateValue(modem_irqmask_txrdy);
+       state_fio->StateValue(modem_syndet);
+       state_fio->StateValue(modem_rxrdy);
+       state_fio->StateValue(modem_txrdy);
+
+       state_fio->StateValue(midi_uart_irqmask);
+       state_fio->StateValue(midi_syndet);
+       state_fio->StateValue(midi_rxrdy);
+       state_fio->StateValue(midi_txrdy);
 #if defined(HAS_2HD)
-       state_fio->StateInt32(event_fdc_motor_2HD);
-       state_fio->StateBool(connect_fdc_2HD);
-       state_fio->StateUint8(fdc_2HD_statreg);
-       state_fio->StateUint8(fdc_2HD_cmdreg);
-       state_fio->StateUint8(fdc_2HD_trackreg);
-       state_fio->StateUint8(fdc_2HD_sectreg);
-       state_fio->StateUint8(fdc_2HD_datareg);
-       state_fio->StateUint8(fdc_2HD_headreg);
-       state_fio->StateUint8(fdc_2HD_drvsel);
-       state_fio->StateUint8(irqreg_fdc_2HD);
-       state_fio->StateBool(fdc_2HD_motor);
-       state_fio->StateInt32(event_2hd_nmi);
-       state_fio->StateUint32(nmi_delay);
-       state_fio->StateBool(irqstat_fdc_2hd);
-       state_fio->StateBool(drqstat_fdc_2hd);
+       state_fio->StateValue(event_fdc_motor_2HD);
+       state_fio->StateValue(connect_fdc_2HD);
+       state_fio->StateValue(fdc_2HD_statreg);
+       state_fio->StateValue(fdc_2HD_cmdreg);
+       state_fio->StateValue(fdc_2HD_trackreg);
+       state_fio->StateValue(fdc_2HD_sectreg);
+       state_fio->StateValue(fdc_2HD_datareg);
+       state_fio->StateValue(fdc_2HD_headreg);
+       state_fio->StateValue(fdc_2HD_drvsel);
+       state_fio->StateValue(irqreg_fdc_2HD);
+       state_fio->StateValue(fdc_2HD_motor);
+       state_fio->StateValue(event_2hd_nmi);
+       state_fio->StateValue(nmi_delay);
+       state_fio->StateValue(irqstat_fdc_2hd);
+       state_fio->StateValue(drqstat_fdc_2hd);
 #endif
        
        if(!decl_state_opn(state_fio, loading)) {
index 3852475..f808425 100644 (file)
@@ -532,115 +532,115 @@ bool FM7_MAINMEM::decl_state(FILEIO *state_fio, bool loading)
                return false;
        }
        
-       state_fio->StateBool(ioaccess_wait);
-       state_fio->StateInt32(waitfactor);
-       state_fio->StateInt32(waitcount);
-       state_fio->StateBool(sub_halted);
+       state_fio->StateValue(ioaccess_wait);
+       state_fio->StateValue(waitfactor);
+       state_fio->StateValue(waitcount);
+       state_fio->StateValue(sub_halted);
        
-       state_fio->StateBool(diag_load_basicrom);
-       state_fio->StateBool(diag_load_bootrom_bas);
-       state_fio->StateBool(diag_load_bootrom_dos);
-       state_fio->StateBool(diag_load_bootrom_mmr);
-       state_fio->StateBool(diag_load_bootrom_bubble);
-       state_fio->StateBool(diag_load_bootrom_bubble_128k);
-       state_fio->StateBool(diag_load_bootrom_sfd8);
-       state_fio->StateBool(diag_load_bootrom_2hd);
-
-       state_fio->StateBuffer(fm7_mainmem_omote, sizeof(fm7_mainmem_omote), 1);
-       state_fio->StateBuffer(fm7_mainmem_ura, sizeof(fm7_mainmem_ura), 1);
-       state_fio->StateBuffer(fm7_mainmem_basicrom, sizeof(fm7_mainmem_basicrom), 1);
-       state_fio->StateBuffer(fm7_mainmem_bioswork, sizeof(fm7_mainmem_bioswork), 1);
-       state_fio->StateBuffer(fm7_mainmem_bootrom_vector, sizeof(fm7_mainmem_bootrom_vector), 1);
-       state_fio->StateBuffer(fm7_mainmem_reset_vector, sizeof(fm7_mainmem_reset_vector), 1);
+       state_fio->StateValue(diag_load_basicrom);
+       state_fio->StateValue(diag_load_bootrom_bas);
+       state_fio->StateValue(diag_load_bootrom_dos);
+       state_fio->StateValue(diag_load_bootrom_mmr);
+       state_fio->StateValue(diag_load_bootrom_bubble);
+       state_fio->StateValue(diag_load_bootrom_bubble_128k);
+       state_fio->StateValue(diag_load_bootrom_sfd8);
+       state_fio->StateValue(diag_load_bootrom_2hd);
+
+       state_fio->StateArray(fm7_mainmem_omote, sizeof(fm7_mainmem_omote), 1);
+       state_fio->StateArray(fm7_mainmem_ura, sizeof(fm7_mainmem_ura), 1);
+       state_fio->StateArray(fm7_mainmem_basicrom, sizeof(fm7_mainmem_basicrom), 1);
+       state_fio->StateArray(fm7_mainmem_bioswork, sizeof(fm7_mainmem_bioswork), 1);
+       state_fio->StateArray(fm7_mainmem_bootrom_vector, sizeof(fm7_mainmem_bootrom_vector), 1);
+       state_fio->StateArray(fm7_mainmem_reset_vector, sizeof(fm7_mainmem_reset_vector), 1);
        
-       state_fio->StateBuffer(fm7_mainmem_null, sizeof(fm7_mainmem_null), 1);
+       state_fio->StateArray(fm7_mainmem_null, sizeof(fm7_mainmem_null), 1);
 
 #if defined(_FM77AV_VARIANTS) || defined(_FM77_VARIANTS)
-       state_fio->StateBuffer(fm7_bootram, sizeof(fm7_bootram), 1);
+       state_fio->StateArray(fm7_bootram, sizeof(fm7_bootram), 1);
 #endif 
 #if defined(_FM77_VARIANTS) || defined(_FM8)
-       for(int i = 0; i < 8; i++) state_fio->StateBuffer(fm7_bootroms[i], 0x200, 1);
+       for(int i = 0; i < 8; i++) state_fio->StateArray(fm7_bootroms[i], 0x200, 1);
 #elif defined(_FM7) || defined(_FMNEW7)
-       for(int i = 0; i < 4; i++) state_fio->StateBuffer(fm7_bootroms[i], 0x200, 1);
+       for(int i = 0; i < 4; i++) state_fio->StateArray(fm7_bootroms[i], 0x200, 1);
 #endif 
 
 #if defined(_FM8)
-       state_fio->StateBool(diag_load_sm11_14);
-       state_fio->StateBool(diag_load_sm11_15);
+       state_fio->StateValue(diag_load_sm11_14);
+       state_fio->StateValue(diag_load_sm11_15);
 #elif defined(_FM77_VARIANTS)
-       state_fio->StateBool(diag_load_wb11_12);
+       state_fio->StateValue(diag_load_wb11_12);
 #elif defined(_FM7) || defined(_FMNEW7)
-       state_fio->StateBool(diag_load_tl11_11);
+       state_fio->StateValue(diag_load_tl11_11);
 #  if defined(_FMNEW7)
-       state_fio->StateBool(diag_load_tl11_12);
+       state_fio->StateValue(diag_load_tl11_12);
 #  endif       
 #elif defined(_FM77AV_VARIANTS)
-       state_fio->StateBool(dictrom_connected);
-       state_fio->StateBool(use_page2_extram);
+       state_fio->StateValue(dictrom_connected);
+       state_fio->StateValue(use_page2_extram);
        
-       state_fio->StateBool(diag_load_initrom);
-       state_fio->StateBool(diag_load_dictrom);
-       state_fio->StateBool(diag_load_learndata);
-       state_fio->StateBuffer(fm7_mainmem_initrom, sizeof(fm7_mainmem_initrom), 1);
-       state_fio->StateBuffer(fm77av_hidden_bootmmr, sizeof(fm77av_hidden_bootmmr), 1);
+       state_fio->StateValue(diag_load_initrom);
+       state_fio->StateValue(diag_load_dictrom);
+       state_fio->StateValue(diag_load_learndata);
+       state_fio->StateArray(fm7_mainmem_initrom, sizeof(fm7_mainmem_initrom), 1);
+       state_fio->StateArray(fm77av_hidden_bootmmr, sizeof(fm77av_hidden_bootmmr), 1);
        
-       state_fio->StateBuffer(fm7_mainmem_mmrbank_0, sizeof(fm7_mainmem_mmrbank_0), 1);
-       state_fio->StateBuffer(fm7_mainmem_mmrbank_2, sizeof(fm7_mainmem_mmrbank_2), 1);
+       state_fio->StateArray(fm7_mainmem_mmrbank_0, sizeof(fm7_mainmem_mmrbank_0), 1);
+       state_fio->StateArray(fm7_mainmem_mmrbank_2, sizeof(fm7_mainmem_mmrbank_2), 1);
        
 # if defined(_FM77AV40EX) || defined(_FM77AV40SX)
-       state_fio->StateBool(diag_load_extrarom);
-       state_fio->StateBuffer(fm7_mainmem_extrarom, sizeof(fm7_mainmem_extrarom), 1);
+       state_fio->StateValue(diag_load_extrarom);
+       state_fio->StateArray(fm7_mainmem_extrarom, sizeof(fm7_mainmem_extrarom), 1);
 # endif
 # if defined(CAPABLE_DICTROM)
-       state_fio->StateBuffer(fm7_mainmem_dictrom, sizeof(fm7_mainmem_dictrom), 1);
-       state_fio->StateBuffer(fm7_mainmem_learndata, sizeof(fm7_mainmem_learndata), 1);
+       state_fio->StateArray(fm7_mainmem_dictrom, sizeof(fm7_mainmem_dictrom), 1);
+       state_fio->StateArray(fm7_mainmem_learndata, sizeof(fm7_mainmem_learndata), 1);
 # endif
 #endif
 
 #ifdef HAS_MMR
-       state_fio->StateBool(extram_connected);
+       state_fio->StateValue(extram_connected);
 # if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || \
        defined(_FM77_VARIANTS)
-       state_fio->StateInt32(extram_pages);
-       state_fio->StateBuffer(fm7_mainmem_extram, extram_size, 1);
+       state_fio->StateValue(extram_pages);
+       state_fio->StateArray(fm7_mainmem_extram, extram_size, 1);
 #  if defined(_FM77_VARIANTS)
-       state_fio->StateBuffer(fm77_shadowram, sizeof(fm77_shadowram), 1);
+       state_fio->StateArray(fm77_shadowram, sizeof(fm77_shadowram), 1);
 #  endif
 # endif
 #endif
                                                          
        { // V2;
-               state_fio->StateBool(is_basicrom);
-               state_fio->StateBool(clockmode);
-               state_fio->StateBool(basicrom_fd0f);
-               state_fio->StateUint32(bootmode);
+               state_fio->StateValue(is_basicrom);
+               state_fio->StateValue(clockmode);
+               state_fio->StateValue(basicrom_fd0f);
+               state_fio->StateValue(bootmode);
 #if defined(_FM77AV_VARIANTS)
-               state_fio->StateUint32(extcard_bank);
-               state_fio->StateBool(extrom_bank);
-               state_fio->StateBool(initiator_enabled);
-               state_fio->StateBool(dictrom_enabled);
-               state_fio->StateBool(dictram_enabled);
+               state_fio->StateValue(extcard_bank);
+               state_fio->StateValue(extrom_bank);
+               state_fio->StateValue(initiator_enabled);
+               state_fio->StateValue(dictrom_enabled);
+               state_fio->StateValue(dictram_enabled);
 #endif
 #if defined(_FM77AV_VARIANTS) || defined(_FM77_VARIANTS)
-               state_fio->StateBool(boot_ram_write);
+               state_fio->StateValue(boot_ram_write);
 #endif         
 #if defined(HAS_MMR)
-               state_fio->StateBool(window_enabled);
-               state_fio->StateBool(mmr_enabled);
-               state_fio->StateBool(mmr_fast);
-               state_fio->StateBool(mmr_extend);
+               state_fio->StateValue(window_enabled);
+               state_fio->StateValue(mmr_enabled);
+               state_fio->StateValue(mmr_fast);
+               state_fio->StateValue(mmr_extend);
                
-               state_fio->StateUint16(window_offset);
-               state_fio->StateBool(window_fast);
-               state_fio->StateBool(refresh_fast);
-               state_fio->StateUint8(mmr_segment);
-               state_fio->StateBuffer(mmr_map_data, sizeof(mmr_map_data), 1);
+               state_fio->StateValue(window_offset);
+               state_fio->StateValue(window_fast);
+               state_fio->StateValue(refresh_fast);
+               state_fio->StateValue(mmr_segment);
+               state_fio->StateArray(mmr_map_data, sizeof(mmr_map_data), 1);
 #endif
        }
-       state_fio->StateUint32(mem_waitfactor); // OK?
-       state_fio->StateUint32(mem_waitcount); // OK?
+       state_fio->StateValue(mem_waitfactor); // OK?
+       state_fio->StateValue(mem_waitcount); // OK?
 
-       state_fio->StateInt32(cpu_clocks); // OK?
+       state_fio->StateValue(cpu_clocks); // OK?
  
        return true;
 }
index 0e65bbc..e9d6033 100644 (file)
@@ -694,50 +694,50 @@ bool BUBBLECASETTE::process_state(FILEIO *state_fio, bool loading)
                return false;
        }
        
-       state_fio->StateBool(is_wrote);
-       state_fio->StateBool(is_b77);
-       state_fio->StateBool(header_changed);
-       state_fio->StateBool(read_access);
-       state_fio->StateBool(write_access);
+       state_fio->StateValue(is_wrote);
+       state_fio->StateValue(is_b77);
+       state_fio->StateValue(header_changed);
+       state_fio->StateValue(read_access);
+       state_fio->StateValue(write_access);
 
-       state_fio->StateUint8(offset_reg);
-       state_fio->StateUint8(data_reg);
-       state_fio->StateUint8(cmd_reg);
+       state_fio->StateValue(offset_reg);
+       state_fio->StateValue(data_reg);
+       state_fio->StateValue(cmd_reg);
 
-       state_fio->StateBool(cmd_error);  
-       state_fio->StateBool(stat_tdra);  
-       state_fio->StateBool(stat_rda);   
-       state_fio->StateBool(not_ready);  
-       state_fio->StateBool(write_protect); 
-       state_fio->StateBool(stat_error); 
-       state_fio->StateBool(stat_busy);  
+       state_fio->StateValue(cmd_error);  
+       state_fio->StateValue(stat_tdra);  
+       state_fio->StateValue(stat_rda);   
+       state_fio->StateValue(not_ready);  
+       state_fio->StateValue(write_protect); 
+       state_fio->StateValue(stat_error); 
+       state_fio->StateValue(stat_busy);  
 
-       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); 
        
-       state_fio->StateUint32(page_address.d);
-       state_fio->StateUint32(page_count.d);
-       state_fio->StateBool(bubble_inserted);
-       state_fio->StateInt32(bubble_type);
-       state_fio->StateInt32(media_num);
+       state_fio->StateValue(page_address.d);
+       state_fio->StateValue(page_count.d);
+       state_fio->StateValue(bubble_inserted);
+       state_fio->StateValue(bubble_type);
+       state_fio->StateValue(media_num);
        // Header
-       state_fio->StateBuffer(image_path, sizeof(image_path), 1);
-       state_fio->StateBuffer((bbl_header.filename), sizeof(bbl_header.filename), 1);
-       state_fio->StateUint32((bbl_header.size.d));
-       state_fio->StateUint32((bbl_header.offset.d));
-       state_fio->StateBuffer((bbl_header.misc), sizeof(bbl_header.misc), 1);
+       state_fio->StateArray(image_path, sizeof(image_path), 1);
+       state_fio->StateArray((bbl_header.filename), sizeof(bbl_header.filename), 1);
+       state_fio->StateValue(bbl_header.size.d);
+       state_fio->StateValue(bbl_header.offset.d);
+       state_fio->StateArray((bbl_header.misc), sizeof(bbl_header.misc), 1);
 
 
-       state_fio->StateUint32(media_offset);
-       state_fio->StateUint32(media_offset_new);
-       state_fio->StateUint32(media_size);
-       state_fio->StateUint32(file_length);
-       state_fio->StateBuffer(bubble_data, sizeof(bubble_data), 1);
+       state_fio->StateValue(media_offset);
+       state_fio->StateValue(media_offset_new);
+       state_fio->StateValue(media_size);
+       state_fio->StateValue(file_length);
+       state_fio->StateArray(bubble_data, sizeof(bubble_data), 1);
  
 #if 0
        if(loading) {
index 673e628..341cabd 100644 (file)
@@ -442,7 +442,7 @@ void HD6844::event_callback(int event_id, int err)
        }
 }
 
-#define STATE_VERSION 5
+#define STATE_VERSION 6
 
 bool HD6844::process_state(FILEIO *state_fio, bool loading)
 {
@@ -453,27 +453,24 @@ bool HD6844::process_state(FILEIO *state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateUint32(addr_reg[i]);
-               state_fio->StateUint16(words_reg[i]);
-               state_fio->StateUint8(channel_control[i]);
-       }
-       state_fio->StateUint8(priority_reg);
-       state_fio->StateUint8(interrupt_reg);
-       state_fio->StateUint8(datachain_reg);
-       state_fio->StateUint8(num_reg);
-       state_fio->StateUint32(addr_offset);
-               
-       for(int i = 0; i < 4; i++) {
-               state_fio->StateBool(transfering[i]);
-               state_fio->StateBool(first_transfer[i]);
-               state_fio->StateBool(cycle_steal[i]);
-               state_fio->StateBool(halt_flag[i]);
+       state_fio->StateArray(addr_reg, sizeof(addr_reg), 1);
+       state_fio->StateArray(words_reg, sizeof(words_reg), 1);
+       state_fio->StateArray(channel_control, sizeof(channel_control), 1);
+       state_fio->StateValue(priority_reg);
+       state_fio->StateValue(interrupt_reg);
+       state_fio->StateValue(datachain_reg);
+       state_fio->StateValue(num_reg);
+       state_fio->StateValue(addr_offset);
                
-               state_fio->StateUint32(fixed_addr[i]);
-               state_fio->StateUint8(data_reg[i]);
-               state_fio->StateInt32(event_dmac[i]);
-       }
+       state_fio->StateArray(transfering, sizeof(transfering), 1);
+       state_fio->StateArray(first_transfer, sizeof(first_transfer), 1);
+       state_fio->StateArray(cycle_steal, sizeof(cycle_steal), 1);
+       state_fio->StateArray(halt_flag, sizeof(halt_flag), 1);
+
+       state_fio->StateArray(fixed_addr, sizeof(fixed_addr), 1);
+       state_fio->StateArray(data_reg, sizeof(data_reg), 1);
+       state_fio->StateArray(event_dmac, sizeof(event_dmac), 1);
+
        return true;
 }
 
index 9ef80c5..d73766a 100644 (file)
@@ -297,7 +297,7 @@ void JOYSTICK::update_config(void)
        }
 #endif 
 }
-#define STATE_VERSION 5
+#define STATE_VERSION 6
 
 bool JOYSTICK::process_state(FILEIO *state_fio, bool loading)
 {
@@ -307,27 +307,24 @@ bool JOYSTICK::process_state(FILEIO *state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       for(int ch = 0; ch < 2; ch++) {
-               state_fio->StateUint32(joydata[ch]);
-       }
+       state_fio->StateArray(joydata, sizeof(joydata), 1);
 #if !defined(_FM8)
-       for(int ch = 0; ch < 2; ch++) {
-               state_fio->StateBool(emulate_mouse[ch]);
-       }
-       state_fio->StateInt32(dx);
-       state_fio->StateInt32(dy);
-       state_fio->StateInt32(lx);
-       state_fio->StateInt32(ly);
-       state_fio->StateUint32(mouse_button);
-       state_fio->StateBool(mouse_strobe);
-       state_fio->StateInt32(mouse_phase);
-       state_fio->StateUint32(mouse_data);
-       //state_fio->StateInt32(mouse_timeout_event);
+       state_fio->StateArray(emulate_mouse, sizeof(emulate_mouse), 1);
+       state_fio->StateValue(dx);
+       state_fio->StateValue(dy);
+       state_fio->StateValue(lx);
+       state_fio->StateValue(ly);
+       state_fio->StateValue(mouse_button);
+       state_fio->StateValue(mouse_strobe);
+       state_fio->StateValue(mouse_phase);
+       state_fio->StateValue(mouse_data);
+       //state_fio->StateValue(mouse_timeout_event);
 #endif 
        // Version 3
-       state_fio->StateUint8(lpmask);
+       state_fio->StateValue(lpmask);
        // Version 4
-       state_fio->StateUint8(port_b_val);
+       state_fio->StateValue(port_b_val);
+       // Version 5
 
        return true;
 }
index 2a4b91c..32584ea 100644 (file)
@@ -116,10 +116,10 @@ bool KANJIROM::process_state(FILEIO *state_fio, bool loading)
                return false;
        }
        
-       state_fio->StateBool(class2);
-       state_fio->StateBool(read_ok);
-       state_fio->StateBuffer(data_table, sizeof(data_table), 1);
-       state_fio->StateUint32(kanjiaddr.d);
+       state_fio->StateValue(class2);
+       state_fio->StateValue(read_ok);
+       state_fio->StateArray(data_table, sizeof(data_table), 1);
+       state_fio->StateValue(kanjiaddr.d);
        if(loading) {
                kanjiaddr.w.h = 0;
        }
index f479e55..557beda 100644 (file)
@@ -1245,52 +1245,52 @@ bool KEYBOARD::decl_state(FILEIO *state_fio, bool loading)
                return false;
        }
        
-       state_fio->StateUint32(keycode_7);
-       state_fio->StateInt32(keymode);
-       state_fio->StateBool(ctrl_pressed);
-       state_fio->StateBool(lshift_pressed);
-       state_fio->StateBool(rshift_pressed);
-       state_fio->StateBool(shift_pressed);
-       state_fio->StateBool(graph_pressed);
-       state_fio->StateBool(caps_pressed);
-       state_fio->StateBool(kana_pressed);
-       state_fio->StateBool(break_pressed);
-
-       state_fio->StateInt32(event_keyrepeat);
+       state_fio->StateValue(keycode_7);
+       state_fio->StateValue(keymode);
+       state_fio->StateValue(ctrl_pressed);
+       state_fio->StateValue(lshift_pressed);
+       state_fio->StateValue(rshift_pressed);
+       state_fio->StateValue(shift_pressed);
+       state_fio->StateValue(graph_pressed);
+       state_fio->StateValue(caps_pressed);
+       state_fio->StateValue(kana_pressed);
+       state_fio->StateValue(break_pressed);
+
+       state_fio->StateValue(event_keyrepeat);
           
-       state_fio->StateUint8(scancode); // After V.4, uint8_t
-       state_fio->StateUint8(datareg);
-       state_fio->StateUint32(older_vk);
+       state_fio->StateValue(scancode); // After V.4, uint8_t
+       state_fio->StateValue(datareg);
+       state_fio->StateValue(older_vk);
           
-       state_fio->StateBool(repeat_mode);
-       state_fio->StateInt32(repeat_time_short);
-       state_fio->StateInt32(repeat_time_long);
-       state_fio->StateUint8(repeat_keycode);
+       state_fio->StateValue(repeat_mode);
+       state_fio->StateValue(repeat_time_short);
+       state_fio->StateValue(repeat_time_long);
+       state_fio->StateValue(repeat_keycode);
           
 #if defined(_FM77AV_VARIANTS)
-       state_fio->StateInt32(event_key_rtc);
-       state_fio->StateUint8(rtc_yy);
-       state_fio->StateUint8(rtc_mm);
-       state_fio->StateUint8(rtc_dd);
-       state_fio->StateUint8(rtc_dayofweek);
-       state_fio->StateUint8(rtc_hour);
-       state_fio->StateUint8(rtc_minute);
-       state_fio->StateUint8(rtc_sec);
-
-       state_fio->StateBool(rtc_count24h);
-       state_fio->StateBool(rtc_ispm);
-
-       state_fio->StateBool(rtc_set);
-       state_fio->StateBool(rtc_set_flag);
-       state_fio->StateBool(rxrdy_status);
-       state_fio->StateBool(key_ack_status);
+       state_fio->StateValue(event_key_rtc);
+       state_fio->StateValue(rtc_yy);
+       state_fio->StateValue(rtc_mm);
+       state_fio->StateValue(rtc_dd);
+       state_fio->StateValue(rtc_dayofweek);
+       state_fio->StateValue(rtc_hour);
+       state_fio->StateValue(rtc_minute);
+       state_fio->StateValue(rtc_sec);
+
+       state_fio->StateValue(rtc_count24h);
+       state_fio->StateValue(rtc_ispm);
+
+       state_fio->StateValue(rtc_set);
+       state_fio->StateValue(rtc_set_flag);
+       state_fio->StateValue(rxrdy_status);
+       state_fio->StateValue(key_ack_status);
                
-       state_fio->StateBool(did_hidden_message_av_1);
-       state_fio->StateInt32(event_hidden1_av);
+       state_fio->StateValue(did_hidden_message_av_1);
+       state_fio->StateValue(event_hidden1_av);
 
-       state_fio->StateInt32(cmd_phase);
-       state_fio->StateUint16(hidden1_ptr);
-       state_fio->StateInt32(beep_phase);
+       state_fio->StateValue(cmd_phase);
+       state_fio->StateValue(hidden1_ptr);
+       state_fio->StateValue(beep_phase);
        
        if(!cmd_fifo->process_state(state_fio, loading)) {
                return false;
@@ -1305,14 +1305,14 @@ bool KEYBOARD::decl_state(FILEIO *state_fio, bool loading)
        if(!key_fifo->process_state(state_fio, loading)) {
                return false;
        }
-       state_fio->StateInt32(event_int);
-       state_fio->StateUint8(autokey_backup);
+       state_fio->StateValue(event_int);
+       state_fio->StateValue(autokey_backup);
        // Version 5
-       state_fio->StateBool(ins_led_status);
-       state_fio->StateBool(kana_led_status);
-       state_fio->StateBool(caps_led_status);
+       state_fio->StateValue(ins_led_status);
+       state_fio->StateValue(kana_led_status);
+       state_fio->StateValue(caps_led_status);
        // Version 6
-       state_fio->StateBool(override_break_key);
+       state_fio->StateValue(override_break_key);
 
        return true;
 }
@@ -1322,7 +1322,7 @@ void KEYBOARD::save_state(FILEIO *state_fio)
        decl_state(state_fio, false);
        //state_fio->FputUint32_BE(STATE_VERSION);
        //state_fio->FputInt32_BE(this_device_id);
-       this->out_debug_log(_T("Save State: KEYBOARD: id=%d ver=%d\n"), this_device_id, STATE_VERSION);
+       //this->out_debug_log(_T("Save State: KEYBOARD: id=%d ver=%d\n"), this_device_id, STATE_VERSION);
 }
  
 bool KEYBOARD::load_state(FILEIO *state_fio)
index 0744672..f330e15 100644 (file)
@@ -935,37 +935,37 @@ bool MB61VH010::decl_state(FILEIO *state_fio, bool loading)
                return false;
        }
        
-       state_fio->StateUint8(command_reg);
-       state_fio->StateUint8(color_reg);
-       state_fio->StateUint8(mask_reg);
-       state_fio->StateUint8(cmp_status_reg);
-       state_fio->StateUint8(bank_disable_reg);
-       state_fio->StateUint8(multi_page);
-       state_fio->StateUint32(direct_access_offset);
+       state_fio->StateValue(command_reg);
+       state_fio->StateValue(color_reg);
+       state_fio->StateValue(mask_reg);
+       state_fio->StateValue(cmp_status_reg);
+       state_fio->StateValue(bank_disable_reg);
+       state_fio->StateValue(multi_page);
+       state_fio->StateValue(direct_access_offset);
        
-       state_fio->StateBuffer(cmp_color_data, sizeof(cmp_color_data), 1);
-       state_fio->StateBuffer(tile_reg, sizeof(tile_reg), 1);
-
-       state_fio->StateUint32(line_addr_offset.d);
-       state_fio->StateUint32(line_pattern.d);
-       state_fio->StateUint32(line_xbegin.d);
-       state_fio->StateUint32(line_ybegin.d);
-       state_fio->StateUint32(line_xend.d);
-       state_fio->StateUint32(line_yend.d);
+       state_fio->StateArray(cmp_color_data, sizeof(cmp_color_data), 1);
+       state_fio->StateArray(tile_reg, sizeof(tile_reg), 1);
+
+       state_fio->StateValue(line_addr_offset.d);
+       state_fio->StateValue(line_pattern.d);
+       state_fio->StateValue(line_xbegin.d);
+       state_fio->StateValue(line_ybegin.d);
+       state_fio->StateValue(line_xend.d);
+       state_fio->StateValue(line_yend.d);
                
-       state_fio->StateBool(busy_flag);
-       state_fio->StateUint32(line_style.d);
+       state_fio->StateValue(busy_flag);
+       state_fio->StateValue(line_style.d);
  
-       state_fio->StateUint32(total_bytes);
-       state_fio->StateUint32(oldaddr);
-       state_fio->StateUint32(alu_addr);
-
-       state_fio->StateUint32(planes);
-       state_fio->StateBool(is_400line);
-       state_fio->StateUint32(screen_width);
-       state_fio->StateUint32(screen_height);
+       state_fio->StateValue(total_bytes);
+       state_fio->StateValue(oldaddr);
+       state_fio->StateValue(alu_addr);
+
+       state_fio->StateValue(planes);
+       state_fio->StateValue(is_400line);
+       state_fio->StateValue(screen_width);
+       state_fio->StateValue(screen_height);
  
-       state_fio->StateInt32(eventid_busy);
+       state_fio->StateValue(eventid_busy);
 
        return true;
 }
index 36903e6..93e7109 100644 (file)
@@ -2971,164 +2971,103 @@ bool PC88::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);
 #if defined(PC88_EXRAM_BANKS)
-       state_fio->StateBuffer(exram, sizeof(exram), 1);
-#endif
-       state_fio->StateBuffer(gvram, sizeof(gvram), 1);
-       state_fio->StateBuffer(tvram, sizeof(tvram), 1);
-       state_fio->StateBuffer(port, sizeof(port), 1);
-       //state_fio->StateBuffer(&crtc, sizeof(crtc), 1);
-       {
-               {
-                       state_fio->StateInt32(crtc.blink.rate);
-                       state_fio->StateInt32(crtc.blink.counter);
-                       state_fio->StateUint8(crtc.blink.cursor);
-                       state_fio->StateUint8(crtc.blink.attrib);
-               }
-               {
-                       state_fio->StateInt32(crtc.cursor.type);
-                       state_fio->StateInt32(crtc.cursor.mode);
-                       state_fio->StateInt32(crtc.cursor.x);
-                       state_fio->StateInt32(crtc.cursor.y);
-               }
-               {
-                       state_fio->StateUint8(crtc.attrib.data);
-                       state_fio->StateInt32(crtc.attrib.num);
-                       for(int i = 0; i < 200; i++) {
-                               for(int j = 0; j < 80; j++) {
-                                       state_fio->StateUint8(crtc.attrib.expand[i][j]);
-                               }
-                       }
-               }
-               {
-                       for(int i = 0; i < 200; i++) {
-                               for(int j = 0; j < 80; j++) {
-                                       state_fio->StateUint8(crtc.text.expand[i][j]);
-                               }
-                       }
-               }
-               state_fio->StateInt32(crtc.width);
-               state_fio->StateInt32(crtc.height);
-               state_fio->StateInt32(crtc.char_height);
-               state_fio->StateBool(crtc.skip_line);
-               state_fio->StateInt32(crtc.vretrace);
-               state_fio->StateBool(crtc.timing_changed);
-               state_fio->StateBuffer(crtc.buffer, sizeof(crtc.buffer), 1);
-               state_fio->StateInt32(crtc.buffer_ptr);
-               state_fio->StateUint8(crtc.cmd);
-               state_fio->StateInt32(crtc.cmd_ptr);
-               state_fio->StateUint8(crtc.mode);
-               state_fio->StateUint8(crtc.reverse);
-               state_fio->StateUint8(crtc.intr_mask);
-               state_fio->StateUint8(crtc.status);
-               state_fio->StateBool(crtc.vblank);
-       }
-       //state_fio->StateBuffer(&dmac, sizeof(dmac), 1);
-       {
-               for(int i = 0; i < 4; i++) {
-                       state_fio->StateUint32(dmac.ch[i].addr.d);
-                       state_fio->StateUint32(dmac.ch[i].count.d);
-                       state_fio->StateUint8(dmac.ch[i].mode);
-                       state_fio->StateInt32(dmac.ch[i].nbytes);
-                       state_fio->StateBool(dmac.ch[i].running);
-               }
-               state_fio->StateUint8(dmac.mode);
-               state_fio->StateUint8(dmac.status);
-               state_fio->StateBool(dmac.high_low);
-
-       }
-       state_fio->StateBuffer(alu_reg, sizeof(alu_reg), 1);
-       state_fio->StateUint8(gvram_plane);
-       state_fio->StateUint8(gvram_sel);
-       state_fio->StateBool(cpu_clock_low);
+       state_fio->StateArray(exram, sizeof(exram), 1);
+#endif
+       state_fio->StateArray(gvram, sizeof(gvram), 1);
+       state_fio->StateArray(tvram, sizeof(tvram), 1);
+       state_fio->StateArray(port, sizeof(port), 1);
+       state_fio->StateValue(crtc.blink.rate);
+       state_fio->StateValue(crtc.blink.counter);
+       state_fio->StateValue(crtc.blink.cursor);
+       state_fio->StateValue(crtc.blink.attrib);
+       state_fio->StateValue(crtc.cursor.type);
+       state_fio->StateValue(crtc.cursor.mode);
+       state_fio->StateValue(crtc.cursor.x);
+       state_fio->StateValue(crtc.cursor.y);
+       state_fio->StateValue(crtc.attrib.data);
+       state_fio->StateValue(crtc.attrib.num);
+       state_fio->StateArray(&crtc.attrib.expand[0][0], sizeof(crtc.attrib.expand), 1);
+       state_fio->StateArray(&crtc.text.expand[0][0], sizeof(crtc.text.expand), 1);
+       state_fio->StateValue(crtc.width);
+       state_fio->StateValue(crtc.height);
+       state_fio->StateValue(crtc.char_height);
+       state_fio->StateValue(crtc.skip_line);
+       state_fio->StateValue(crtc.vretrace);
+       state_fio->StateValue(crtc.timing_changed);
+       state_fio->StateArray(crtc.buffer, sizeof(crtc.buffer), 1);
+       state_fio->StateValue(crtc.buffer_ptr);
+       state_fio->StateValue(crtc.cmd);
+       state_fio->StateValue(crtc.cmd_ptr);
+       state_fio->StateValue(crtc.mode);
+       state_fio->StateValue(crtc.reverse);
+       state_fio->StateValue(crtc.intr_mask);
+       state_fio->StateValue(crtc.status);
+       state_fio->StateValue(crtc.vblank);
+       for(int i = 0; i < array_length(dmac.ch); i++) {
+               state_fio->StateValue(dmac.ch[i].addr);
+               state_fio->StateValue(dmac.ch[i].count);
+               state_fio->StateValue(dmac.ch[i].mode);
+               state_fio->StateValue(dmac.ch[i].nbytes);
+               state_fio->StateValue(dmac.ch[i].running);
+       }
+       state_fio->StateValue(dmac.mode);
+       state_fio->StateValue(dmac.status);
+       state_fio->StateValue(dmac.high_low);
+       state_fio->StateArray(alu_reg, sizeof(alu_reg), 1);
+       state_fio->StateValue(gvram_plane);
+       state_fio->StateValue(gvram_sel);
+       state_fio->StateValue(cpu_clock_low);
 #if defined(SUPPORT_PC88_HIGH_CLOCK)
-       state_fio->StateBool(cpu_clock_high_fe2);
-#endif
-       state_fio->StateBool(mem_wait_on);
-       state_fio->StateInt32(m1_wait_clocks);
-       state_fio->StateInt32(f000_m1_wait_clocks);
-       state_fio->StateInt32(mem_wait_clocks_r);
-       state_fio->StateInt32(mem_wait_clocks_w);
-       state_fio->StateInt32(tvram_wait_clocks_r);
-       state_fio->StateInt32(tvram_wait_clocks_w);
-       state_fio->StateInt32(gvram_wait_clocks_r);
-       state_fio->StateInt32(gvram_wait_clocks_w);
-       state_fio->StateInt32(busreq_clocks);
-       //state_fio->StateBuffer(palette, sizeof(palette), 1);
-       for(int i = 0; i < 9; i++) {
-               state_fio->StateUint8(palette[i].b);
-               state_fio->StateUint8(palette[i].r);
-               state_fio->StateUint8(palette[i].g);
-       }
-       state_fio->StateBool(update_palette);
-       state_fio->StateBool(hireso);
-       state_fio->StateBuffer(text, sizeof(text), 1);
-       state_fio->StateBuffer(graph, sizeof(graph), 1);
-
-       //state_fio->StateBuffer(palette_text_pc, sizeof(palette_text_pc), 1);
-       //state_fio->StateBuffer(palette_graph_pc, sizeof(palette_graph_pc), 1);
-       if(loading) {
-               for(int i = 0; i < (sizeof(palette_text_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = state_fio->FgetUint8();
-                       g = state_fio->FgetUint8();
-                       b = state_fio->FgetUint8();
-                       palette_text_pc[i] = RGB_COLOR(r, g, b);
-               }
-       } else {
-               for(int i = 0; i < (sizeof(palette_text_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = R_OF_COLOR(palette_text_pc[i]);
-                       g = G_OF_COLOR(palette_text_pc[i]);
-                       b = B_OF_COLOR(palette_text_pc[i]);
-                       state_fio->FputUint8(r);
-                       state_fio->FputUint8(g);
-                       state_fio->FputUint8(b);
-               }
-       }
-       if(loading) {
-               for(int i = 0; i < (sizeof(palette_graph_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = state_fio->FgetUint8();
-                       g = state_fio->FgetUint8();
-                       b = state_fio->FgetUint8();
-                       palette_graph_pc[i] = RGB_COLOR(r, g, b);
-               }
-       } else {
-               for(int i = 0; i < (sizeof(palette_graph_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = R_OF_COLOR(palette_graph_pc[i]);
-                       g = G_OF_COLOR(palette_graph_pc[i]);
-                       b = B_OF_COLOR(palette_graph_pc[i]);
-                       state_fio->FputUint8(r);
-                       state_fio->FputUint8(g);
-                       state_fio->FputUint8(b);
-               }
-       }
-       state_fio->StateBool(usart_dcd);
-       state_fio->StateBool(opn_busy);
-       state_fio->StateUint8(key_caps);
-       state_fio->StateUint8(key_kana);
+       state_fio->StateValue(cpu_clock_high_fe2);
+#endif
+       state_fio->StateValue(mem_wait_on);
+       state_fio->StateValue(m1_wait_clocks);
+       state_fio->StateValue(f000_m1_wait_clocks);
+       state_fio->StateValue(mem_wait_clocks_r);
+       state_fio->StateValue(mem_wait_clocks_w);
+       state_fio->StateValue(tvram_wait_clocks_r);
+       state_fio->StateValue(tvram_wait_clocks_w);
+       state_fio->StateValue(gvram_wait_clocks_r);
+       state_fio->StateValue(gvram_wait_clocks_w);
+       state_fio->StateValue(busreq_clocks);
+       for(int i = 0; i < array_length(palette); i++) {
+               state_fio->StateValue(palette[i].r);
+               state_fio->StateValue(palette[i].g);
+               state_fio->StateValue(palette[i].b);
+       }
+       state_fio->StateValue(update_palette);
+       state_fio->StateValue(hireso);
+       state_fio->StateArray(&text[0][0], sizeof(text), 1);
+       state_fio->StateArray(&graph[0][0], sizeof(graph), 1);
+
+       state_fio->StateArrayScrnType_t(palette_graph_pc, sizeof(palette_text_pc), 1);
+       state_fio->StateArrayScrnType_t(palette_graph_pc, sizeof(palette_graph_pc), 1);
+
+       state_fio->StateValue(usart_dcd);
+       state_fio->StateValue(opn_busy);
+       state_fio->StateValue(key_caps);
+       state_fio->StateValue(key_kana);
 #ifdef SUPPORT_PC88_JOYSTICK
-       state_fio->StateUint32(mouse_strobe_clock);
-       state_fio->StateUint32(mouse_strobe_clock_lim);
-       state_fio->StateInt32(mouse_phase);
-       state_fio->StateInt32(mouse_dx);
-       state_fio->StateInt32(mouse_dy);
-       state_fio->StateInt32(mouse_lx);
-       state_fio->StateInt32(mouse_ly);
-#endif
-       state_fio->StateUint8(intr_req);
-       state_fio->StateBool(intr_req_sound);
+       state_fio->StateValue(mouse_strobe_clock);
+       state_fio->StateValue(mouse_strobe_clock_lim);
+       state_fio->StateValue(mouse_phase);
+       state_fio->StateValue(mouse_dx);
+       state_fio->StateValue(mouse_dy);
+       state_fio->StateValue(mouse_lx);
+       state_fio->StateValue(mouse_ly);
+#endif
+       state_fio->StateValue(intr_req);
+       state_fio->StateValue(intr_req_sound);
 #ifdef SUPPORT_PC88_SB2
-       state_fio->StateBool(intr_req_sb2);
+       state_fio->StateValue(intr_req_sb2);
 #endif
-       state_fio->StateUint8(intr_mask1);
-       state_fio->StateUint8(intr_mask2);
-       state_fio->StateBool(cmt_play);
-       state_fio->StateBool(cmt_rec);
-       state_fio->StateBuffer(rec_file_path, sizeof(rec_file_path), 1);
+       state_fio->StateValue(intr_mask1);
+       state_fio->StateValue(intr_mask2);
+       state_fio->StateValue(cmt_play);
+       state_fio->StateValue(cmt_rec);
+       state_fio->StateArray(rec_file_path, sizeof(rec_file_path), 1);
        if(loading) {
                int length_tmp = state_fio->FgetInt32_LE();
                if(cmt_rec) {
@@ -3159,26 +3098,23 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
                        state_fio->FputInt32_LE(0);
                }
        }
-       state_fio->StateInt32(cmt_bufptr);
-       state_fio->StateInt32(cmt_bufcnt);
-       state_fio->StateBuffer(cmt_buffer, sizeof(cmt_buffer), 1);
-       //state_fio->StateBuffer(cmt_data_carrier, sizeof(cmt_data_carrier), 1);
-       for(int i = 0; i < (sizeof(cmt_data_carrier) / sizeof(int)); i++) {
-               state_fio->StateInt32(cmt_data_carrier[i]);
-       }
-       state_fio->StateInt32(cmt_data_carrier_cnt);
-       state_fio->StateInt32(cmt_register_id);
-       state_fio->StateBool(beep_on);
-       state_fio->StateBool(beep_signal);
-       state_fio->StateBool(sing_signal);
+       state_fio->StateValue(cmt_bufptr);
+       state_fio->StateValue(cmt_bufcnt);
+       state_fio->StateArray(cmt_buffer, sizeof(cmt_buffer), 1);
+       state_fio->StateArray(cmt_data_carrier, sizeof(cmt_data_carrier), 1);
+       state_fio->StateValue(cmt_data_carrier_cnt);
+       state_fio->StateValue(cmt_register_id);
+       state_fio->StateValue(beep_on);
+       state_fio->StateValue(beep_signal);
+       state_fio->StateValue(sing_signal);
 #ifdef SUPPORT_PC88_PCG8100
-       state_fio->StateUint16(pcg_addr);
-       state_fio->StateUint8(pcg_data);
-       state_fio->StateUint8(pcg_ctrl);
-       state_fio->StateBuffer(pcg_pattern, sizeof(pcg_pattern), 1);
+       state_fio->StateValue(pcg_addr);
+       state_fio->StateValue(pcg_data);
+       state_fio->StateValue(pcg_ctrl);
+       state_fio->StateArray(pcg_pattern, sizeof(pcg_pattern), 1);
 #endif
 #ifdef NIPPY_PATCH
-       state_fio->StateBool(nippy_patch);
+       state_fio->StateValue(nippy_patch);
 #endif
        
        // post process
index 19d2667..24ad543 100644 (file)
@@ -526,7 +526,7 @@ void VM::update_config()
        }
 }
 
-#define STATE_VERSION  9
+#define STATE_VERSION  10
 
 bool VM::process_state(FILEIO* state_fio, bool loading)
 {
@@ -553,7 +553,7 @@ bool VM::process_state(FILEIO* state_fio, bool loading)
                }
        }
        // Machine specified.
-       state_fio->StateInt32(boot_mode);
+       state_fio->StateValue(boot_mode);
        return true;
 }
 
index fbc36ac..643213e 100644 (file)
@@ -1523,86 +1523,68 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateBuffer(vram_t, sizeof(vram_t), 1);
-       state_fio->StateBuffer(vram_a, sizeof(vram_a), 1);
+       state_fio->StateArray(vram_t, sizeof(vram_t), 1);
+       state_fio->StateArray(vram_a, sizeof(vram_a), 1);
 #ifdef _X1TURBO_FEATURE
-       state_fio->StateBuffer(vram_k, sizeof(vram_k), 1);
+       state_fio->StateArray(vram_k, sizeof(vram_k), 1);
 #endif
-       state_fio->StateBuffer(pcg_b, sizeof(pcg_b), 1);
-       state_fio->StateBuffer(pcg_r, sizeof(pcg_r), 1);
-       state_fio->StateBuffer(pcg_g, sizeof(pcg_g), 1);
+       state_fio->StateArray(&pcg_b[0][0], sizeof(pcg_b), 1);
+       state_fio->StateArray(&pcg_r[0][0], sizeof(pcg_r), 1);
+       state_fio->StateArray(&pcg_g[0][0], sizeof(pcg_g), 1);
 #ifdef _X1TURBO_FEATURE
-       state_fio->StateBuffer(gaiji_b, sizeof(gaiji_b), 1);
-       state_fio->StateBuffer(gaiji_r, sizeof(gaiji_r), 1);
-       state_fio->StateBuffer(gaiji_g, sizeof(gaiji_g), 1);
-#endif
-       state_fio->StateUint8(cur_code);
-       state_fio->StateUint8(cur_line);
-       state_fio->StateInt32(kaddr);
-       state_fio->StateInt32(kofs);
-       state_fio->StateInt32(kflag);
+       state_fio->StateArray(&gaiji_b[0][0], sizeof(gaiji_b), 1);
+       state_fio->StateArray(&gaiji_r[0][0], sizeof(gaiji_r), 1);
+       state_fio->StateArray(&gaiji_g[0][0], sizeof(gaiji_g), 1);
+#endif
+       state_fio->StateValue(cur_code);
+       state_fio->StateValue(cur_line);
+       state_fio->StateValue(kaddr);
+       state_fio->StateValue(kofs);
+       state_fio->StateValue(kflag);
        if(loading) {
-               kanji_ptr = &kanji[0] + state_fio->FgetInt32_LE();
+               intptr_t p = (intptr_t)(&kanji[0]);
+               kanji_ptr = (uint8_t*)(p + state_fio->FgetInt32_LE());
        } else {
-               state_fio->FputInt32_LE((int)(kanji_ptr - &kanji[0]));
+               intptr_t p = (intptr_t)(&kanji[0]);
+               intptr_t q = (intptr_t)kanji_ptr;
+               state_fio->FputInt32_LE((int)(q - p));
        }
-       state_fio->StateBuffer(pal, sizeof(pal), 1);
-       state_fio->StateUint8(priority);
-       state_fio->StateBuffer(pri, sizeof(pri), 1);
-       state_fio->StateBool(column40);
+       state_fio->StateArray(pal, sizeof(pal), 1);
+       state_fio->StateValue(priority);
+       state_fio->StateArray(&pri[0][0], sizeof(pri), 1);
+       state_fio->StateValue(column40);
 #ifdef _X1TURBO_FEATURE
-       state_fio->StateUint8(mode1);
-       state_fio->StateUint8(mode2);
-       state_fio->StateBool(hireso);
+       state_fio->StateValue(mode1);
+       state_fio->StateValue(mode2);
+       state_fio->StateValue(hireso);
 #endif
 #ifdef _X1TURBOZ
-       state_fio->StateUint8(zmode1);
-       state_fio->StateUint8(zpriority);
-       state_fio->StateUint8(zadjust);
-       state_fio->StateUint8(zmosaic);
-       state_fio->StateUint8(zchromakey);
-       state_fio->StateUint8(zscroll);
-       state_fio->StateUint8(zmode2);
-       state_fio->StateBuffer(ztpal, sizeof(ztpal), 1);
-       //state_fio->StateBuffer(zpal, sizeof(zpal), 1);
-       for(int i = 0; i < 4096; i++) {
-               state_fio->StateUint8(zpal[i].b);
-               state_fio->StateUint8(zpal[i].r);
-               state_fio->StateUint8(zpal[i].g);
-       }                                                         
-       state_fio->StateInt32(zpal_num);
-       //state_fio->StateBuffer(zpalette_pc, sizeof(zpalette_pc), 1);
-       if(loading) {
-               for(int i = 0; i < (sizeof(zpalette_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = state_fio->FgetUint8();
-                       g = state_fio->FgetUint8();
-                       b = state_fio->FgetUint8();
-                       zpalette_pc[i] = RGB_COLOR(r, g, b);
-               }
-       } else {
-               for(int i = 0; i < (sizeof(zpalette_pc) / sizeof(scrntype_t)); i++) {
-                       uint8_t r, g, b;
-                       r = R_OF_COLOR(zpalette_pc[i]);
-                       g = G_OF_COLOR(zpalette_pc[i]);
-                       b = B_OF_COLOR(zpalette_pc[i]);
-                       state_fio->FputUint8(r);
-                       state_fio->FputUint8(g);
-                       state_fio->FputUint8(b);
-               }
+       state_fio->StateValue(zmode1);
+       state_fio->StateValue(zpriority);
+       state_fio->StateValue(zadjust);
+       state_fio->StateValue(zmosaic);
+       state_fio->StateValue(zchromakey);
+       state_fio->StateValue(zscroll);
+       state_fio->StateValue(zmode2);
+       state_fio->StateArray(ztpal, sizeof(ztpal), 1);
+       for(int i = 0; i < array_length(zpal); i++){
+               state_fio->StateValue(zpal[i].r);
+               state_fio->StateValue(zpal[i].g);
+               state_fio->StateValue(zpal[i].b);
        }
-
-#endif
-       state_fio->StateBool(prev_vert_double);
-       state_fio->StateInt32(raster);
-       state_fio->StateInt32(cblink);
-       state_fio->StateInt32(ch_height);
-       state_fio->StateInt32(hz_total);
-       state_fio->StateInt32(hz_disp);
-       state_fio->StateInt32(vt_disp);
-       state_fio->StateInt32(st_addr);
-       state_fio->StateUint32(vblank_clock);
-       state_fio->StateBool(cur_blank);
+       state_fio->StateValue(zpal_num);
+       state_fio->StateArrayScrnType_t(zpalette_pc, sizeof(zpalette_pc), 1);
+#endif
+       state_fio->StateValue(prev_vert_double);
+       state_fio->StateValue(raster);
+       state_fio->StateValue(cblink);
+       state_fio->StateValue(ch_height);
+       state_fio->StateValue(hz_total);
+       state_fio->StateValue(hz_disp);
+       state_fio->StateValue(vt_disp);
+       state_fio->StateValue(st_addr);
+       state_fio->StateValue(vblank_clock);
+       state_fio->StateValue(cur_blank);
        
        // post process
        if(loading) {
index c69d15d..4be1a4b 100644 (file)
@@ -70,8 +70,8 @@ bool EMM::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateBuffer(data_buffer, sizeof(data_buffer), 1);
-       state_fio->StateUint32(data_addr);
+       state_fio->StateArray(data_buffer, sizeof(data_buffer), 1);
+       state_fio->StateValue(data_addr);
        return true;
 }
 
index abd24d2..5f14089 100644 (file)
@@ -106,9 +106,9 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateInt32(prev);
-       state_fio->StateBool(motor_on);
-       state_fio->StateInt32(register_id);
+       state_fio->StateValue(prev);
+       state_fio->StateValue(motor_on);
+       state_fio->StateValue(register_id);
        return true;
 }
 
index 467ff2a..8c211df 100644 (file)
@@ -245,17 +245,23 @@ bool IOBUS::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->StateBool(vram_mode);
-       state_fio->StateBool(signal);
+       state_fio->StateArray(vram, sizeof(vram), 1);
+       state_fio->StateValue(vram_mode);
+       state_fio->StateValue(signal);
        if(loading) {
-               vram_b = vram + state_fio->FgetInt32_LE();
-               vram_r = vram + state_fio->FgetInt32_LE();
-               vram_g = vram + state_fio->FgetInt32_LE();
+               intptr_t _v = (intptr_t)vram;
+               vram_b = (uint8_t*)(_v + state_fio->FgetInt32_LE());
+               vram_r = (uint8_t*)(_v + state_fio->FgetInt32_LE());
+               vram_g = (uint8_t*)(_v + state_fio->FgetInt32_LE());
        } else {
-               state_fio->FputInt32_LE((int)(vram_b - vram));
-               state_fio->FputInt32_LE((int)(vram_r - vram));
-               state_fio->FputInt32_LE((int)(vram_g - vram));
+               intptr_t _v = (intptr_t)vram;
+               intptr_t _b = (intptr_t)vram_b;
+               intptr_t _r = (intptr_t)vram_r;
+               intptr_t _g = (intptr_t)vram_g;
+               
+               state_fio->FputInt32_LE((int)(_b - _v));
+               state_fio->FputInt32_LE((int)(_r - _v));
+               state_fio->FputInt32_LE((int)(_g - _v));
        }
        state_fio->StateValue(vdisp);
        state_fio->StateValue(prev_clock);
index 783049c..93b35bd 100644 (file)
@@ -174,9 +174,9 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateUint8(caps_locked);
-       state_fio->StateUint8(kana_locked);
-       state_fio->StateUint16(column);
+       state_fio->StateValue(caps_locked);
+       state_fio->StateValue(kana_locked);
+       state_fio->StateValue(column);
        return true;
 }
 
index 3e077a5..374540c 100644 (file)
@@ -172,13 +172,13 @@ 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(romsel);
+       state_fio->StateArray(ram, sizeof(ram), 1);
+       state_fio->StateValue(romsel);
 #ifdef _X1TURBO_FEATURE
-       state_fio->StateBuffer(extram, sizeof(extram), 1);
-       state_fio->StateUint8(bank);
+       state_fio->StateArray(extram, sizeof(extram), 1);
+       state_fio->StateValue(bank);
 #else
-       state_fio->StateInt32(m1_cycle);
+       state_fio->StateValue(m1_cycle);
 #endif
        
        // post process
index 720e5a8..2db5af5 100644 (file)
@@ -840,37 +840,39 @@ bool PSUB::process_state(FILEIO* state_fio, bool loading)
        if(!cur_time.process_state((void *)state_fio, loading)) {
                return false;
        }
-       state_fio->StateInt32(time_register_id);
-       state_fio->StateBuffer(databuf, sizeof(databuf), 1);
+       state_fio->StateValue(time_register_id);
+       state_fio->StateArray(&databuf[0][0], sizeof(databuf), 1);
        if(loading) {
-               datap = &databuf[0][0] + state_fio->FgetInt32_LE();
+               intptr_t _d = (intptr_t)(&databuf[0][0]);
+               datap = (uint8_t*)(_d + state_fio->FgetInt32_LE());
        } else {
-               state_fio->FputInt32_LE((int)(datap - &databuf[0][0]));
+               intptr_t _d = (intptr_t)(&databuf[0][0]);
+               state_fio->FputInt32_LE((int)((intptr_t)datap - _d));
        }
-       state_fio->StateUint8(mode);
-       state_fio->StateUint8(inbuf);
-       state_fio->StateUint8(outbuf);
-       state_fio->StateBool(ibf);
-       state_fio->StateBool(obf);
-       state_fio->StateInt32(cmdlen);
-       state_fio->StateInt32(datalen);
+       state_fio->StateValue(mode);
+       state_fio->StateValue(inbuf);
+       state_fio->StateValue(outbuf);
+       state_fio->StateValue(ibf);
+       state_fio->StateValue(obf);
+       state_fio->StateValue(cmdlen);
+       state_fio->StateValue(datalen);
        if(!key_buf->process_state((void *)state_fio, loading)) {
                return false;
        }
-       state_fio->StateInt32(key_prev);
-       state_fio->StateInt32(key_break);
-       state_fio->StateBool(key_shift);
-       state_fio->StateBool(key_ctrl);
-       state_fio->StateBool(key_graph);
-       state_fio->StateBool(key_caps_locked);
-       state_fio->StateBool(key_kana_locked);
-       state_fio->StateInt32(key_register_id);
-       state_fio->StateBool(play);
-       state_fio->StateBool(rec);
-       state_fio->StateBool(eot);
-       state_fio->StateBool(iei);
-       state_fio->StateBool(intr);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateValue(key_prev);
+       state_fio->StateValue(key_break);
+       state_fio->StateValue(key_shift);
+       state_fio->StateValue(key_ctrl);
+       state_fio->StateValue(key_graph);
+       state_fio->StateValue(key_caps_locked);
+       state_fio->StateValue(key_kana_locked);
+       state_fio->StateValue(key_register_id);
+       state_fio->StateValue(play);
+       state_fio->StateValue(rec);
+       state_fio->StateValue(eot);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(intr);
+       state_fio->StateValue(intr_bit);
        return true;
 }
 
index 6ac3a1b..6097c3d 100644 (file)
@@ -133,8 +133,8 @@ bool SASI::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateBool(irq_status);
-       state_fio->StateBool(drq_status);
+       state_fio->StateValue(irq_status);
+       state_fio->StateValue(drq_status);
        return true;
 }
 
index d9670e9..23577c0 100644 (file)
@@ -276,19 +276,19 @@ bool SUB::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateUint8(p1_out);
-       state_fio->StateUint8(p1_in);
-       state_fio->StateUint8(p2_out);
-       state_fio->StateUint8(p2_in);
-       state_fio->StateUint8(portc);
-       state_fio->StateBool(tape_play);
-       state_fio->StateBool(tape_rec);
-       state_fio->StateBool(tape_eot);
-       state_fio->StateBool(tape_apss);
-       state_fio->StateBool(intr);
-       state_fio->StateBool(obf);
-       state_fio->StateBool(iei);
-       state_fio->StateUint32(intr_bit);
+       state_fio->StateValue(p1_out);
+       state_fio->StateValue(p1_in);
+       state_fio->StateValue(p2_out);
+       state_fio->StateValue(p2_in);
+       state_fio->StateValue(portc);
+       state_fio->StateValue(tape_play);
+       state_fio->StateValue(tape_rec);
+       state_fio->StateValue(tape_eot);
+       state_fio->StateValue(tape_apss);
+       state_fio->StateValue(intr);
+       state_fio->StateValue(obf);
+       state_fio->StateValue(iei);
+       state_fio->StateValue(intr_bit);
        return true;
 }
 
index cd97227..83c7f37 100644 (file)
@@ -962,7 +962,7 @@ void VM::update_dipswitch()
 }
 #endif
 
-#define STATE_VERSION  10
+#define STATE_VERSION  11
 
 bool VM::process_state(FILEIO* state_fio, bool loading)
 {
@@ -988,8 +988,8 @@ bool VM::process_state(FILEIO* state_fio, bool loading)
                        return false;
                }
        }
-       state_fio->StateBool(pseudo_sub_cpu);
-       state_fio->StateInt32(sound_type);
+       state_fio->StateValue(pseudo_sub_cpu);
+       state_fio->StateValue(sound_type);
        
 #ifdef _X1TURBO_FEATURE
        // post process