From dc241b8a3534e9b96dee40a01701266667fd3b8c Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Sun, 20 Oct 2013 12:50:18 -0700 Subject: [PATCH] begin removal of loadstate/savestate from h/w emulation code --- src/hardware/adlib.cpp | 295 ------------------- src/hardware/adlib.h | 6 - src/hardware/disney.cpp | 158 ---------- src/hardware/gameblaster.cpp | 150 ---------- src/hardware/gus.cpp | 233 --------------- src/hardware/innova.cpp | 104 ------- src/hardware/mixer.cpp | 137 --------- src/hardware/opl.cpp | 209 -------------- src/hardware/pcspeaker.cpp | 124 -------- src/hardware/ps1_sound.cpp | 127 --------- src/hardware/sblaster.cpp | 234 --------------- src/hardware/tandy_sound.cpp | 186 ------------ src/hardware/vga.cpp | 522 ---------------------------------- src/hardware/vga_draw.cpp | 281 ------------------ src/hardware/vga_other.cpp | 79 ----- src/hardware/vga_paradise.cpp | 46 --- src/hardware/vga_s3.cpp | 105 ------- src/hardware/vga_tseng.cpp | 77 ----- src/hardware/vga_xga.cpp | 67 ----- src/ints/int10.cpp | 24 -- 20 files changed, 3164 deletions(-) diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 5e265eb95..54da38fa4 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -27,7 +27,6 @@ #include "mapper.h" #include "mem.h" #include "dbopl.h" -#include "../save_state.h" namespace OPL2 { #include "opl.cpp" @@ -54,41 +53,6 @@ namespace OPL2 { adlib_init(rate); } - virtual void SaveState( std::ostream& stream ) { - const char pod_name[32] = "OPL2"; - - if( stream.fail() ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //************************************************ - //************************************************ - //************************************************ - - adlib_savestate(stream); - } - - virtual void LoadState( std::istream& stream ) { - char pod_name[32] = {0}; - - if( stream.fail() ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "OPL2" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - adlib_loadstate(stream); - } - ~Handler() { } }; @@ -120,41 +84,6 @@ namespace OPL3 { adlib_init(rate); } - virtual void SaveState( std::ostream& stream ) { - const char pod_name[32] = "OPL3"; - - if( stream.fail() ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //************************************************ - //************************************************ - //************************************************ - - adlib_savestate(stream); - } - - virtual void LoadState( std::istream& stream ) { - char pod_name[32] = {0}; - - if( stream.fail() ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "OPL3" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - adlib_loadstate(stream); - } - ~Handler() { } }; @@ -781,227 +710,3 @@ void OPL_ShutDown(Section* sec){ } - - -// savestate support -void Adlib::Module::SaveState( std::ostream& stream ) -{ - // - pure data - WRITE_POD( &mode, mode ); - WRITE_POD( ®, reg ); - WRITE_POD( &oplmode, oplmode ); - WRITE_POD( &lastUsed, lastUsed ); - - handler->SaveState(stream); - - WRITE_POD( &cache, cache ); - WRITE_POD( &chip, chip ); -} - - -void Adlib::Module::LoadState( std::istream& stream ) -{ - // - pure data - READ_POD( &mode, mode ); - READ_POD( ®, reg ); - READ_POD( &oplmode, oplmode ); - READ_POD( &lastUsed, lastUsed ); - - handler->LoadState(stream); - - READ_POD( &cache, cache ); - READ_POD( &chip, chip ); -} - - -void POD_Save_Adlib(std::ostream& stream) -{ - const char pod_name[32] = "Adlib"; - - if( stream.fail() ) return; - if( !module ) return; - if( !module->mixerChan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //************************************************ - //************************************************ - //************************************************ - - module->SaveState(stream); - module->mixerChan->SaveState(stream); -} - - -void POD_Load_Adlib(std::istream& stream) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !module ) return; - if( !module->mixerChan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "Adlib" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - module->LoadState(stream); - module->mixerChan->LoadState(stream); -} - - -/* -ykhwong 2012-05-21 - - -class Module: public Module_base { - - // - system data - IO_ReadHandleObject ReadHandler[3]; - IO_WriteHandleObject WriteHandler[3]; - MixerObject mixerObject; - - // - pure data - Mode mode; - union { - Bit32u normal; - Bit8u dual[2]; - } reg; - - // - pure data - static OPL_Mode oplmode; - - // - system 'new' ptr - MixerChannel* mixerChan; - - // - pure data - Bit32u lastUsed; - - // - static 'new' ptr (no data) - Handler* handler; - - // - pure data - RegisterCache cache; - - // - system data - Capture* capture; - - // - pure struct data - Chip chip[2]; - - // - pure struct data - Timer timer[2]; - - // - pure data - double start; - double delay; - bool enabled, overflow, masked; - Bit8u counter; - - - -Handler : OPL2 -Handler : OPL3 - -opl.cpp - // - pure data - fltype recipsamp; - Bit16s wavtable[WAVEPREC*3]; - - // - static data - Bit32s vib_table[VIBTAB_SIZE]; - Bit32s trem_table[TREMTAB_SIZE*2]; - Bit32s vibval_const[BLOCKBUF_SIZE]; - Bit32s tremval_const[BLOCKBUF_SIZE]; - - // - pure data - Bit32s vibval_var1[BLOCKBUF_SIZE]; - Bit32s vibval_var2[BLOCKBUF_SIZE]; - - // - reloc ptr (!!!) - Bit32s *vibval1, *vibval2, *vibval3, *vibval4; - Bit32s *tremval1, *tremval2, *tremval3, *tremval4; - - // - static data - fltype kslmul[4]; - fltype frqmul_tab[16]; - fltype frqmul[16]; - Bit8u kslev[8][16]; - Bit8u modulatorbase[9]; - Bit8u regbase2modop[44]; - Bit8u regbase2op[44]; - Bit32u waveform[8]; - Bit32u wavemask[8]; - Bit32u wavestart[8]; - fltype attackconst[4]; - fltype decrelconst[4]; - - -opl.h - - // - pure data - Bitu chip_num; - - // - struct data - op_type op[MAXOPERATORS]; - - // - pure data - Bit32s cval, lastcval; - Bit32u tcount, wfpos, tinc; - fltype amp, step_amp; - fltype vol; - fltype sustain_level; - Bit32s mfbi; - fltype a0, a1, a2, a3; - fltype decaymul, releasemul; - Bit32u op_state; - Bit32u toff; - Bit32s freq_high; - - // - reloc ptr (!!!) - Bit16s* cur_wform; - - // - pure data - Bit32u cur_wmask; - Bit32u act_state; - bool sus_keep; - bool vibrato,tremolo; - - Bit32u generator_pos; - Bits cur_env_step; - Bits env_step_a,env_step_d,env_step_r; - Bit8u step_skip_pos_a; - Bits env_step_skip_a; - - // - OPL3 only (!!!) - bool is_4op,is_4op_attached; - Bit32s left_pan,right_pan; - - - Bits int_samplerate; - - Bit8u status; - Bit32u opl_index; - Bit8u adlibreg[OPL2 / OPL3]; - Bit8u wave_sel[OPL2 / OPL3]; - - // - pure data - Bit32u vibtab_pos; - Bit32u vibtab_add; - Bit32u tremtab_pos; - Bit32u tremtab_add; - Bit32u generator_add; - - -Handler : DBOPL -(see dbopl.cpp) -*/ diff --git a/src/hardware/adlib.h b/src/hardware/adlib.h index 81c2ce287..57a80aeec 100644 --- a/src/hardware/adlib.h +++ b/src/hardware/adlib.h @@ -104,9 +104,6 @@ public: //Initialize at a specific sample rate and mode virtual void Init( Bitu rate ) = 0; - virtual void SaveState( std::ostream& stream ) {} - virtual void LoadState( std::istream& stream ) {} - virtual ~Handler() { } }; @@ -146,9 +143,6 @@ public: Bitu PortRead( Bitu port, Bitu iolen ); void Init( Mode m ); - virtual void SaveState( std::ostream& stream ); - virtual void LoadState( std::istream& stream ); - Module( Section* configuration); ~Module(); }; diff --git a/src/hardware/disney.cpp b/src/hardware/disney.cpp index 3c702d9aa..1a07e75b2 100644 --- a/src/hardware/disney.cpp +++ b/src/hardware/disney.cpp @@ -25,7 +25,6 @@ #include "setup.h" #include "bios.h" #include "mem.h" -#include "../save_state.h" #define DISNEY_BASE 0x0378 @@ -412,160 +411,3 @@ void DISNEY_Init(Section* sec) { // save state support void *DISNEY_disable_PIC_Event = (void*)DISNEY_disable; - -void POD_Save_Disney( std::ostream& stream ) -{ - const char pod_name[32] = "Disney"; - - if( stream.fail() ) return; - if( !test ) return; - if( !disney.chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //************************************************ - //************************************************ - //************************************************ - - Bit8u dac_leader_idx; - - - dac_leader_idx = 0xff; - for( int lcv=0; lcv<2; lcv++ ) { - if( disney.leader == &disney.da[lcv] ) { dac_leader_idx = lcv; break; } - } - - // ******************************************* - // ******************************************* - - // - near-pure struct data - WRITE_POD( &disney, disney ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - WRITE_POD( &dac_leader_idx, dac_leader_idx ); - - // ******************************************* - // ******************************************* - - disney.chan->SaveState(stream); -} - - -void POD_Load_Disney( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !disney.chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "Disney" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - Bit8u dac_leader_idx; - MixerObject *mo_old; - MixerChannel *chan_old; - - - // save old ptrs - mo_old = disney.mo; - chan_old = disney.chan; - - // ******************************************* - // ******************************************* - - // - near-pure struct data - READ_POD( &disney, disney ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - READ_POD( &dac_leader_idx, dac_leader_idx ); - - - disney.leader = NULL; - if( dac_leader_idx != 0xff ) disney.leader = &disney.da[dac_leader_idx]; - - // ******************************************* - // ******************************************* - - // restore old ptrs - disney.mo = mo_old; - disney.chan = chan_old; - - - disney.chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -static struct disney - - // - pure data - Bit8u data; - Bit8u status; - Bit8u control; - dac_channel da[2]; - - // - pure data - Bit8u buffer[DISNEY_SIZE]; - Bitu used; - double speedcheck_sum; - double speedcheck_last; - bool speedcheck_failed; - bool speedcheck_init; - - - // - pure data - Bitu last_used; - - - // - static 'new' ptrs - MixerObject * mo; - MixerChannel * chan; - - - // - pure data - bool stereo; - - - // - reloc ptr (!!!) - dac_channel* leader; - - - // - pure data - Bitu state; - Bitu interface_det; - Bitu interface_det_ext; - - - -// - static 'new' ptr -static DISNEY* test; - - // - static data - IO_ReadHandleObject ReadHandler; - IO_WriteHandleObject WriteHandler; - IO_WriteHandleObject WriteHandler_cvm; - //MixerObject MixerChan; -*/ diff --git a/src/hardware/gameblaster.cpp b/src/hardware/gameblaster.cpp index 2f6afd890..5c5fc1bce 100644 --- a/src/hardware/gameblaster.cpp +++ b/src/hardware/gameblaster.cpp @@ -26,7 +26,6 @@ #include "pic.h" #include #include -#include "../save_state.h" #define LEFT 0x00 @@ -498,152 +497,3 @@ void CMS_ShutDown(Section* sec) { delete test; } - - -// save state support -void POD_Save_Gameblaster( std::ostream& stream ) -{ - const char pod_name[32] = "CMS"; - - if( stream.fail() ) return; - if( !test ) return; - if( !cms_chan ) return; - - WRITE_POD( &pod_name, pod_name ); - - // - pure data - WRITE_POD( &sample_rate, sample_rate ); - WRITE_POD( &saa1099, saa1099 ); - - WRITE_POD( &cms_buffer, cms_buffer ); - WRITE_POD( &last_command, last_command ); - WRITE_POD( &base_port, base_port ); - WRITE_POD( &cms_detect_register, cms_detect_register ); - - //************************************************ - //************************************************ - - cms_chan->SaveState(stream); -} - - -void POD_Load_Gameblaster( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !cms_chan ) return; - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "CMS" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - // - pure data - READ_POD( &sample_rate, sample_rate ); - READ_POD( &saa1099, saa1099 ); - - READ_POD( &cms_buffer, cms_buffer ); - READ_POD( &last_command, last_command ); - READ_POD( &base_port, base_port ); - READ_POD( &cms_detect_register, cms_detect_register ); - - //************************************************ - //************************************************ - - cms_chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -struct SAA1099 - - // - pure data - int stream; - int noise_params[2]; - int env_enable[2]; - int env_reverse_right[2]; - int env_mode[2]; - int env_bits[2]; - int env_clock[2]; - int env_step[2]; - int all_ch_enable; - int sync_state; - int selected_reg; - struct saa1099_channel channels[6]; - struct saa1099_noise noise[2]; - - - struct saa1099_channel: - - // - pure data - int frequency; - int freq_enable; - int noise_enable; - int octave; - int amplitude[2]; - int envelope[2]; - - // - pure data - double counter; - double freq; - int level; - - - struct saa1099_noise: - - // - pure data - double counter; - double freq; - int level; - - - -// - static data -static const UINT8 envelope[8][64]; -static const int amplitude_lookup[16]; - - -// - pure data -static double sample_rate; -static SAA1099 saa1099[2]; - - -// - static 'new' ptr -static MixerChannel * cms_chan; - - -// - pure data -static Bit16s cms_buffer[2][2][CMS_BUFFER_SIZE]; - - -// - static ptrs -static Bit16s * cms_buf_point[4] = { - cms_buffer[0][0],cms_buffer[0][1],cms_buffer[1][0],cms_buffer[1][1] }; - - -// - pure data -static Bitu last_command; -static Bitu base_port; -static Bit8u cms_detect_register; - - - -// - static 'new' ptr -static CMS* test; - - // - static data - IO_WriteHandleObject WriteHandler; - IO_WriteHandleObject DetWriteHandler; - IO_ReadHandleObject DetReadHandler; - MixerObject MixerChan; -*/ diff --git a/src/hardware/gus.cpp b/src/hardware/gus.cpp index 87d307f79..d7452fe99 100644 --- a/src/hardware/gus.cpp +++ b/src/hardware/gus.cpp @@ -29,7 +29,6 @@ #include "shell.h" #include "math.h" #include "regs.h" -#include "../save_state.h" using namespace std; //Extra bits of precision over normal gus @@ -916,235 +915,3 @@ void GUS_Init(Section* sec) { void *GUS_TimerEvent_PIC_Event = (void*)GUS_TimerEvent; void *GUS_DMA_Callback_Func = (void*)GUS_DMA_Callback; - -void POD_Save_GUS( std::ostream& stream ) -{ - const char pod_name[32] = "GUS"; - - if( stream.fail() ) return; - if( !test ) return; - if( !gus_chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - Bit8u curchan_idx; - - - curchan_idx = 0xff; - for( int lcv=0; lcv<32; lcv++ ) { - if( curchan == guschan[lcv] ) { curchan_idx = lcv; break; } - } - - // ******************************************* - // ******************************************* - // ******************************************* - - // - pure data - WRITE_POD( &adlib_commandreg, adlib_commandreg ); - WRITE_POD( &GUSRam, GUSRam ); - WRITE_POD( &AutoAmp, AutoAmp ); - WRITE_POD( &vol16bit, vol16bit ); - WRITE_POD( &pantable, pantable ); - - // - pure struct data - WRITE_POD( &myGUS, myGUS ); - - - // - pure data - for( int lcv=0; lcv<32; lcv++ ) { - WRITE_POD( guschan[lcv], *guschan[lcv] ); - } - - // ******************************************* - // ******************************************* - // ******************************************* - - // - reloc ptr - WRITE_POD( &curchan_idx, curchan_idx ); - - // ******************************************* - // ******************************************* - // ******************************************* - - gus_chan->SaveState(stream); -} - - -void POD_Load_GUS( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !gus_chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "GUS" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - Bit8u curchan_idx; - - // ******************************************* - // ******************************************* - // ******************************************* - - // - pure data - READ_POD( &adlib_commandreg, adlib_commandreg ); - READ_POD( &GUSRam, GUSRam ); - READ_POD( &AutoAmp, AutoAmp ); - READ_POD( &vol16bit, vol16bit ); - READ_POD( &pantable, pantable ); - - READ_POD( &myGUS, myGUS ); - - for( int lcv=0; lcv<32; lcv++ ) { - if( !guschan[lcv] ) continue; - - READ_POD( guschan[lcv], *guschan[lcv] ); - } - - // ******************************************* - // ******************************************* - // ******************************************* - - // - reloc ptr - READ_POD( &curchan_idx, curchan_idx ); - - curchan = NULL; - if( curchan_idx != 0xff ) curchan = guschan[curchan_idx]; - - // ******************************************* - // ******************************************* - // ******************************************* - - gus_chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -// - pure data -Bit8u adlib_commandreg; - -// - static 'new' ptr -static MixerChannel * gus_chan; - -// - static data -static const Bit8u irqtable[8] = { 0, 2, 5, 3, 7, 11, 12, 15 }; -static const Bit8u dmatable[8] = { 0, 1, 3, 5, 6, 7, 0, 0 }; - -// - pure data -static Bit8u GUSRam[1024*1024]; // 1024K of GUS Ram -static Bit32s AutoAmp = 512; -static Bit16u vol16bit[4096]; -static Bit32u pantable[16]; - - - -struct GFGus myGUS - - // - pure data - Bit8u gRegSelect; - Bit16u gRegData; - Bit32u gDramAddr; - Bit16u gCurChannel; - - // - pure data - Bit8u DMAControl; - Bit16u dmaAddr; - Bit8u TimerControl; - Bit8u SampControl; - Bit8u mixControl; - Bit8u ActiveChannels; - Bit32u basefreq; - - // - pure data - struct GusTimer { - Bit8u value; - bool reached; - bool raiseirq; - bool masked; - bool running; - float delay; - } timers[2]; - - // - pure data - Bit32u rate; - Bitu portbase; - Bit8u dma1; - Bit8u dma2; - - // - pure data - Bit8u irq1; - Bit8u irq2; - - // - pure data - bool irqenabled; - bool ChangeIRQDMA; - Bit8u IRQStatus; - Bit32u ActiveMask; - Bit8u IRQChan; - Bit32u RampIRQ; - Bit32u WaveIRQ; - - -// - static 'new' ptr -static GUSChannels *guschan[32]; - -// - reloc ptr (!!!) -static GUSChannels *curchan; - - // - pure data - Bit32u WaveStart; - Bit32u WaveEnd; - Bit32u WaveAddr; - Bit32u WaveAdd; - Bit8u WaveCtrl; - Bit16u WaveFreq; - - Bit32u RampStart; - Bit32u RampEnd; - Bit32u RampVol; - Bit32u RampAdd; - Bit32u RampAddReal; - - Bit8u RampRate; - Bit8u RampCtrl; - - Bit8u PanPot; - Bit8u channum; - Bit32u irqmask; - Bit32u PanLeft; - Bit32u PanRight; - Bit32s VolLeft; - Bit32s VolRight; - - - -// - static 'new' ptr -static GUS* test; - - // - static data - IO_ReadHandleObject ReadHandler[8]; - IO_WriteHandleObject WriteHandler[9]; - AutoexecObject autoexecline[2]; - MixerObject MixerChan; -*/ diff --git a/src/hardware/innova.cpp b/src/hardware/innova.cpp index 2a092c136..deddeafe9 100644 --- a/src/hardware/innova.cpp +++ b/src/hardware/innova.cpp @@ -22,7 +22,6 @@ #include "mixer.h" #include "pic.h" #include "setup.h" -#include "../save_state.h" #include "reSID/sid.h" @@ -122,106 +121,3 @@ void INNOVA_Init(Section* sec) { sec->AddDestroyFunction(&INNOVA_ShutDown,true); } - - -// save state support -void POD_Save_Innova( std::ostream& stream ) -{ - const char pod_name[32] = "Innova"; - - if( stream.fail() ) return; - if( !test ) return; - if( !innova.chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - // - pure data - WRITE_POD( &innova.rate, innova.rate ); - WRITE_POD( &innova.basePort, innova.basePort ); - WRITE_POD( &innova.last_used, innova.last_used ); - - - innova.sid->SaveState(stream); - - // ******************************************* - // ******************************************* - // ******************************************* - - innova.chan->SaveState(stream); -} - - -void POD_Load_Innova( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !innova.chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "Innova" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - MixerChannel *chan_old; - - - // - save static ptrs - chan_old = innova.chan; - - // ******************************************* - // ******************************************* - // ******************************************* - - // - pure data - READ_POD( &innova.rate, innova.rate ); - READ_POD( &innova.basePort, innova.basePort ); - READ_POD( &innova.last_used, innova.last_used ); - - - innova.sid->LoadState(stream); - - // ******************************************* - // ******************************************* - // ******************************************* - - // - restore static ptrs - innova.chan = chan_old; - - - innova.chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -static struct innova - // - static ptr - SID2* sid; - - // - pure data - Bitu rate; - Bitu basePort; - Bitu last_used; - - // - static ptr - MixerChannel * chan; -*/ diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index 9407908ac..975ff136b 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -47,7 +47,6 @@ #include "mapper.h" #include "hardware.h" #include "programs.h" -#include "../save_state.h" #define MIXER_SSIZE 4 #define MIXER_SHIFT 14 @@ -717,139 +716,3 @@ void MIXER_Init(Section* sec) { void *MIXER_Mix_NoSound_PIC_Timer = (void*)MIXER_Mix_NoSound; void *MIXER_Mix_PIC_Timer = (void*)MIXER_Mix; - -void MixerChannel::SaveState( std::ostream& stream ) -{ - // - pure data - WRITE_POD( &volmain, volmain ); - WRITE_POD( &scale, scale ); - WRITE_POD( &volmul, volmul ); - WRITE_POD( &freq_add, freq_add ); - WRITE_POD( &freq_index, freq_index ); - WRITE_POD( &enabled, enabled ); -} - - -void MixerChannel::LoadState( std::istream& stream ) -{ - // - pure data - READ_POD( &volmain, volmain ); - READ_POD( &scale, scale ); - READ_POD( &volmul, volmul ); - READ_POD( &freq_add, freq_add ); - READ_POD( &freq_index, freq_index ); - READ_POD( &enabled, enabled ); - - //******************************************** - //******************************************** - //******************************************** - - // reset mixer channel (system data) - done = 0; - needed = 0; - last[0] = 0; - last[1] = 0; -} - -extern void POD_Save_Adlib(std::ostream& stream); -extern void POD_Save_Disney(std::ostream& stream); -extern void POD_Save_Gameblaster(std::ostream& stream); -extern void POD_Save_GUS(std::ostream& stream); -extern void POD_Save_Innova(std::ostream& stream); -extern void POD_Save_MPU401(std::ostream& stream); -extern void POD_Save_PCSpeaker(std::ostream& stream); -extern void POD_Save_PS1_Sound(std::ostream& stream); -extern void POD_Save_Sblaster(std::ostream& stream); -extern void POD_Save_Tandy_Sound(std::ostream& stream); -extern void POD_Load_Adlib(std::istream& stream); -extern void POD_Load_Disney(std::istream& stream); -extern void POD_Load_Gameblaster(std::istream& stream); -extern void POD_Load_GUS(std::istream& stream); -extern void POD_Load_Innova(std::istream& stream); -extern void POD_Load_MPU401(std::istream& stream); -extern void POD_Load_PCSpeaker(std::istream& stream); -extern void POD_Load_PS1_Sound(std::istream& stream); -extern void POD_Load_Sblaster(std::istream& stream); -extern void POD_Load_Tandy_Sound(std::istream& stream); - -namespace -{ -class SerializeMixer : public SerializeGlobalPOD -{ -public: - SerializeMixer() : SerializeGlobalPOD("Mixer") - {} - -private: - virtual void getBytes(std::ostream& stream) - { - //************************************************* - //************************************************* - - SerializeGlobalPOD::getBytes(stream); - - - POD_Save_Adlib(stream); - POD_Save_Disney(stream); - POD_Save_Gameblaster(stream); - POD_Save_GUS(stream); - POD_Save_Innova(stream); - POD_Save_MPU401(stream); - POD_Save_PCSpeaker(stream); - POD_Save_PS1_Sound(stream); - POD_Save_Sblaster(stream); - POD_Save_Tandy_Sound(stream); - } - - virtual void setBytes(std::istream& stream) - { - //************************************************* - //************************************************* - - SerializeGlobalPOD::setBytes(stream); - - - POD_Load_Adlib(stream); - POD_Load_Disney(stream); - POD_Load_Gameblaster(stream); - POD_Load_GUS(stream); - POD_Load_Innova(stream); - POD_Load_MPU401(stream); - POD_Load_PCSpeaker(stream); - POD_Load_PS1_Sound(stream); - POD_Load_Sblaster(stream); - POD_Load_Tandy_Sound(stream); - } - -} dummy; -} - - - -/* -ykhwong svn-daum 2012-02-20 - - -class MixerChannel { - // - static func ptr - MIXER_Handler handler; - - // - pure data - float volmain[2]; - float scale; - Bit32s volmul[2]; - Bitu freq_add,freq_index; - - // - system data - Bitu done,needed; - Bits last[2]; - - // - static data - const char * name; - - // - pure data - bool enabled; - - // - static ptr - MixerChannel * next; -*/ diff --git a/src/hardware/opl.cpp b/src/hardware/opl.cpp index 07cb84afb..27848b757 100644 --- a/src/hardware/opl.cpp +++ b/src/hardware/opl.cpp @@ -30,7 +30,6 @@ #include "dosbox.h" #include "opl.h" #include -#include "../save_state.h" static fltype recipsamp; // inverse of sampling rate @@ -1462,211 +1461,3 @@ void adlib_getsample(Bit16s* sndptr, Bits numsamples) { } } - -void adlib_savestate( std::ostream& stream ) -{ - Bit32u cur_wform_idx[MAXOPERATORS]; - - - for( int lcv=0; lcvAddDestroyFunction(&PCSPEAKER_ShutDown,true); } - - -// save state support -void POD_Save_PCSpeaker( std::ostream& stream ) -{ - const char pod_name[32] = "PCSpeaker"; - - if( stream.fail() ) return; - if( !test ) return; - if( !spkr.chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - // - near-pure data - WRITE_POD( &spkr, spkr ); - - // ******************************************* - // ******************************************* - - spkr.chan->SaveState(stream); -} - - -void POD_Load_PCSpeaker( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !spkr.chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "PCSpeaker" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - MixerChannel *chan_old; - - - // - save static ptrs - chan_old = spkr.chan; - - // ******************************************* - // ******************************************* - - // - near-pure data - READ_POD( &spkr, spkr ); - - // ******************************************* - // ******************************************* - - // - restore static ptrs - spkr.chan = chan_old; - - - spkr.chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - - -static struct spkr - // - static ptr - MixerChannel * chan; - - - // - pure data - Bitu pit_mode; - Bitu rate; - - // - pure data - bool pit_output_enabled; - bool pit_clock_gate_enabled; - bool pit_output_level; - float pit_new_max,pit_new_half; - float pit_max,pit_half; - float pit_index; - bool pit_mode1_waiting_for_counter; - bool pit_mode1_waiting_for_trigger; - float pit_mode1_pending_max; - - // - pure data - bool pit_mode3_counting; - float volwant,volcur; - Bitu last_ticks; - float last_index; - Bitu minimum_counter; - DelayEntry entries[SPKR_ENTRIES]; - - // - pure data - struct DelayEntry { - float index; - bool output_level; - }; - - Bitu used; - - - -// - static ptr -static PCSPEAKER* test; - - // - static data - MixerObject MixerChan; -*/ diff --git a/src/hardware/ps1_sound.cpp b/src/hardware/ps1_sound.cpp index 0957d9c43..cfb5a2dd3 100644 --- a/src/hardware/ps1_sound.cpp +++ b/src/hardware/ps1_sound.cpp @@ -26,7 +26,6 @@ #include "pic.h" #include "dma.h" #include "sn76496.h" -#include "../save_state.h" extern bool PS1AudioCard; #define DAC_CLOCK 1000000 @@ -383,129 +382,3 @@ void PS1SOUND_Init(Section* sec) { sec->AddDestroyFunction(&PS1SOUND_ShutDown,true); } - - -// save state support -void POD_Save_PS1_Sound( std::ostream& stream ) -{ - const char pod_name[32] = "PS1"; - - if( stream.fail() ) return; - if( !test ) return; - if( !ps1.chanDAC ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - // - near-pure struct data - WRITE_POD( &ps1, ps1 ); - - // ******************************************* - // ******************************************* - - ps1.chanDAC->SaveState(stream); - ps1.chanSN->SaveState(stream); -} - - -void POD_Load_PS1_Sound( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !ps1.chanDAC ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "PS1" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - MixerChannel *chanDAC_old, *chanSN_old; - - - // save old ptrs - chanDAC_old = ps1.chanDAC; - chanSN_old = ps1.chanSN; - - // ******************************************* - // ******************************************* - - // - near-pure struct data - READ_POD( &ps1, ps1 ); - - // ******************************************* - // ******************************************* - - // restore old ptrs - ps1.chanDAC = chanDAC_old; - ps1.chanSN = chanSN_old; - - - ps1.chanDAC->LoadState(stream); - ps1.chanSN->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -struct PS1AUDIO ps1 - - // - static 'new' ptr - MixerChannel * chanDAC; - MixerChannel * chanSN; - - // - pure data - bool enabledDAC; - bool enabledSN; - Bitu last_writeDAC; - Bitu last_writeSN; - int SampleRate; - - // - pure struct data - struct SN76496 sn; - - // - pure data - Bit8u FIFO[FIFOSIZE]; - Bit16u FIFO_RDIndex; - Bit16u FIFO_WRIndex; - bool Playing; - bool CanTriggerIRQ; - Bit32u Rate; - Bitu RDIndexHi; - Bitu Adder; - Bitu Pending; - - // - pure data - Bit8u Status; - Bit8u Command; - Bit8u Data; - Bit8u Divisor; - Bit8u Unknown; - - - -// - static 'new' ptr -static PS1SOUND* test; - - // - static data - IO_ReadHandleObject ReadHandler[2]; - IO_WriteHandleObject WriteHandler[2]; - MixerObject MixerChanDAC, MixerChanSN; -*/ diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index 65dab798f..8263cd82e 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -31,7 +31,6 @@ #include "setup.h" #include "support.h" #include "shell.h" -#include "../save_state.h" using namespace std; void MIDI_RawOutByte(Bit8u data); @@ -2055,236 +2054,3 @@ void *SB_DSP_DMA_CallBack_Func = (void*)DSP_DMA_CallBack; void *SB_DSP_ADC_CallBack_Func = (void*)DSP_ADC_CallBack; void *SB_DSP_E2_DMA_CallBack_Func = (void*)DSP_E2_DMA_CallBack; - -void POD_Save_Sblaster( std::ostream& stream ) -{ - const char pod_name[32] = "SBlaster"; - - if( stream.fail() ) return; - if( !test ) return; - if( !sb.chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - Bit8u dma_idx; - - dma_idx = 0xff; - for( int lcv=0; lcv<8; lcv++ ) { - if( sb.dma.chan == GetDMAChannel(lcv) ) { dma_idx = lcv; break; } - } - - // ******************************************* - // ******************************************* - - // - near-pure data - WRITE_POD( &sb, sb ); - - - // - pure data - WRITE_POD( &ASP_regs, ASP_regs ); - WRITE_POD( &ASP_init_in_progress, ASP_init_in_progress ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - WRITE_POD( &dma_idx, dma_idx ); - - // ******************************************* - // ******************************************* - - sb.chan->SaveState(stream); -} - - -void POD_Load_Sblaster( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !sb.chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "SBlaster" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - Bit8u dma_idx; - MixerChannel *mixer_old; - - - // save static ptr - mixer_old = sb.chan; - - // ******************************************* - // ******************************************* - - // - near-pure data - READ_POD( &sb, sb ); - - - // - pure data - READ_POD( &ASP_regs, ASP_regs ); - READ_POD( &ASP_init_in_progress, ASP_init_in_progress ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - READ_POD( &dma_idx, dma_idx ); - - - sb.dma.chan = NULL; - if( dma_idx != 0xff ) sb.dma.chan = GetDMAChannel(dma_idx); - - // ******************************************* - // ******************************************* - - // restore static ptr - sb.chan = mixer_old; - - - sb.chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -static SB_INFO sb; - - // - pure data - Bitu freq; - - // - near-pure struct data - struct { - bool stereo,sign,autoinit; - DMA_MODES mode; - Bitu rate,mul; - Bitu total,left,min; - Bit64u start; - union { - Bit8u b8[DMA_BUFSIZE]; - Bit16s b16[DMA_BUFSIZE]; - } buf; - Bitu bits; - - // - reloc ptr (!!!) - DmaChannel * chan; - - Bitu remain_size; - } dma; - - // - pure struct data - bool speaker; - bool midi; - Bit8u time_constant; - DSP_MODES mode; - SB_TYPES type; - - // - pure struct data - struct { - bool pending_8bit; - bool pending_16bit; - } irq; - - // - pure struct data - struct { - Bit8u state; - Bit8u cmd; - Bit8u cmd_len; - Bit8u cmd_in_pos; - Bit8u cmd_in[DSP_BUFSIZE]; - struct { - Bit8u lastval; - Bit8u data[DSP_BUFSIZE]; - Bitu pos,used; - } in,out; - Bit8u test_register; - Bitu write_busy; - } dsp; - - // - pure struct data - struct { - Bit16s data[DSP_DACSIZE+1]; - Bitu used; - Bit16s last; - } dac; - - // - pure struct data - struct { - Bit8u index; - Bit8u dac[2],fm[2],cda[2],master[2],lin[2]; - Bit8u mic; - bool stereo; - bool enabled; - bool filtered; - Bit8u unhandled[0x48]; - } mixer; - - // - pure struct data - struct { - Bit8u reference; - Bits stepsize; - bool haveref; - } adpcm; - - // - pure struct data - struct { - Bitu base; - Bitu irq; - Bit8u dma8,dma16; - } hw; - - // - pure struct data - struct { - Bits value; - Bitu count; - } e2; - - // - static ptr (constructor) - MixerChannel * chan; - - -// - static data -static char const * const copyright_string="COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; -static const Bit8u DSP_cmd_len_sb[256]; -static const Bit8u DSP_cmd_len_sb16[256]; - - -// - pure data -static Bit8u ASP_regs[256]; -static bool ASP_init_in_progress = false; - - -// - static data -static const int E2_incr_table[4][9]; - - -// - static ptr -static SBLASTER* test; - - // - static data (constructor) - IO_ReadHandleObject ReadHandler[0x10]; - IO_WriteHandleObject WriteHandler[0x10]; - AutoexecObject autoexecline; - MixerObject MixerChan; - OPL_Mode oplmode; -*/ diff --git a/src/hardware/tandy_sound.cpp b/src/hardware/tandy_sound.cpp index 32af31a67..44512d2e9 100644 --- a/src/hardware/tandy_sound.cpp +++ b/src/hardware/tandy_sound.cpp @@ -31,7 +31,6 @@ #include "sn76496.h" #include #include -#include "../save_state.h" #define MAX_OUTPUT 0x7fff #define STEP 0x10000 @@ -526,188 +525,3 @@ void TANDYSOUND_Init(Section* sec) { // save state support void *TandyDAC_DMA_CallBack_Func = (void*)TandyDAC_DMA_CallBack; - -void POD_Save_Tandy_Sound( std::ostream& stream ) -{ - const char pod_name[32] = "Tandy"; - - if( stream.fail() ) return; - if( !test ) return; - if( !tandy.chan ) return; - - - WRITE_POD( &pod_name, pod_name ); - - //******************************************* - //******************************************* - //******************************************* - - Bit8u dma_idx; - - - dma_idx = 0xff; - if( tandy.dac.chan ) { - for( int lcv=0; lcv<8; lcv++ ) { - if( tandy.dac.dma.chan == GetDMAChannel(lcv) ) { dma_idx = lcv; break; } - } - } - - // ******************************************* - // ******************************************* - - // - pure data - WRITE_POD( &sn, sn ); - - - // - near-pure data - WRITE_POD( &tandy, tandy ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - WRITE_POD( &dma_idx, dma_idx ); - - // ******************************************* - // ******************************************* - - tandy.chan->SaveState(stream); - if( tandy.dac.chan ) tandy.dac.chan->SaveState(stream); -} - - -void POD_Load_Tandy_Sound( std::istream& stream ) -{ - char pod_name[32] = {0}; - - if( stream.fail() ) return; - if( !test ) return; - if( !tandy.chan ) return; - - - // error checking - READ_POD( &pod_name, pod_name ); - if( strcmp( pod_name, "Tandy" ) ) { - stream.clear( std::istream::failbit | std::istream::badbit ); - return; - } - - //************************************************ - //************************************************ - //************************************************ - - Bit8u dma_idx; - MixerChannel *chan_old, *dac_chan_old; - - - // - save static ptrs - chan_old = tandy.chan; - dac_chan_old = tandy.dac.chan; - - // ******************************************* - // ******************************************* - - // - pure data - READ_POD( &sn, sn ); - - - // - near-pure data - READ_POD( &tandy, tandy ); - - // ******************************************* - // ******************************************* - - // - reloc ptr - READ_POD( &dma_idx, dma_idx ); - - - tandy.dac.dma.chan = NULL; - if( dma_idx != 0xff ) tandy.dac.dma.chan = GetDMAChannel(dma_idx); - - // ******************************************* - // ******************************************* - - // - restore static ptrs - tandy.chan = chan_old; - tandy.dac.chan = dac_chan_old; - - - tandy.chan->LoadState(stream); - if( tandy.dac.chan ) tandy.dac.chan->LoadState(stream); -} - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - - -static struct SN76496 sn; - // - pure data - int SampleRate; - unsigned int UpdateStep; - int VolTable[16]; - int Register[8]; - int LastRegister; - int Volume[4]; - unsigned int RNG; - int NoiseFB; - int Period[4]; - int Count[4]; - int Output[4]; - - -static struct tandy: - // - static ptr (constructor) = mono - MixerChannel * chan; - - // - pure data - bool enabled; - Bitu last_write; - - struct { - // - static ptr (constructor) = mono - MixerChannel * chan; - - // - pure data - bool enabled; - - // - pure data - struct { - Bitu base; - Bit8u irq,dma; - } hw; - - // - near-pure data - struct { - Bitu rate; - Bit8u buf[TDAC_DMA_BUFSIZE]; - Bit8u last_sample; - - // - reloc ptr (!!!) - DmaChannel * chan; - - bool transfer_done; - } dma; - - // - pure data - Bit8u mode,control; - Bit16u frequency; - Bit8u amplitude; - bool irq_activated; - } dac; - - - - -// - static ptr -static TANDYSOUND* test; - - // - static data (constructor) - IO_WriteHandleObject WriteHandler[4]; - IO_ReadHandleObject ReadHandler[4]; - MixerObject MixerChan; - MixerObject MixerChanDAC; -*/ diff --git a/src/hardware/vga.cpp b/src/hardware/vga.cpp index f62cd0237..2d6979356 100644 --- a/src/hardware/vga.cpp +++ b/src/hardware/vga.cpp @@ -25,7 +25,6 @@ #include "programs.h" #include "support.h" #include "setup.h" -#include "../save_state.h" #include "mem.h" #include @@ -429,527 +428,6 @@ void SVGA_Setup_Driver(void) { } } - //save state support void *VGA_SetupDrawing_PIC_Event = (void*)VGA_SetupDrawing; -extern void POD_Save_VGA_Draw( std::ostream & ); -extern void POD_Save_VGA_Seq( std::ostream & ); -extern void POD_Save_VGA_Attr( std::ostream & ); -extern void POD_Save_VGA_Crtc( std::ostream & ); -extern void POD_Save_VGA_Gfx( std::ostream & ); -extern void POD_Save_VGA_Dac( std::ostream & ); -extern void POD_Save_VGA_S3( std::ostream & ); -extern void POD_Save_VGA_Other( std::ostream & ); -extern void POD_Save_VGA_Memory( std::ostream & ); -extern void POD_Save_VGA_Paradise( std::ostream & ); -extern void POD_Save_VGA_Tseng( std::ostream & ); -extern void POD_Save_VGA_XGA( std::ostream & ); -extern void POD_Load_VGA_Draw( std::istream & ); -extern void POD_Load_VGA_Seq( std::istream & ); -extern void POD_Load_VGA_Attr( std::istream & ); -extern void POD_Load_VGA_Crtc( std::istream & ); -extern void POD_Load_VGA_Gfx( std::istream & ); -extern void POD_Load_VGA_Dac( std::istream & ); -extern void POD_Load_VGA_S3( std::istream & ); -extern void POD_Load_VGA_Other( std::istream & ); -extern void POD_Load_VGA_Memory( std::istream & ); -extern void POD_Load_VGA_Paradise( std::istream & ); -extern void POD_Load_VGA_Tseng( std::istream & ); -extern void POD_Load_VGA_XGA( std::istream & ); - -namespace { -class SerializeVga : public SerializeGlobalPOD { -public: - SerializeVga() : SerializeGlobalPOD("Vga") - {} - -private: - virtual void getBytes(std::ostream& stream) - { - Bit32u tandy_drawbase_idx, tandy_membase_idx; - - - if( vga.tandy.draw_base == vga.mem.linear ) tandy_drawbase_idx=0xffffffff; - else tandy_drawbase_idx = vga.tandy.draw_base - MemBase; - - if( vga.tandy.mem_base == vga.mem.linear ) tandy_membase_idx=0xffffffff; - else tandy_membase_idx = vga.tandy.mem_base - MemBase; - - //******************************** - //******************************** - - SerializeGlobalPOD::getBytes(stream); - - - // - pure data - WRITE_POD( &vga.mode, vga.mode ); - WRITE_POD( &vga.lastmode, vga.lastmode ); - WRITE_POD( &vga.misc_output, vga.misc_output ); - - - // VGA_Draw.cpp - POD_Save_VGA_Draw(stream); - - - // - pure struct data - WRITE_POD( &vga.config, vga.config ); - WRITE_POD( &vga.internal, vga.internal ); - - - // VGA_Seq.cpp / VGA_Attr.cpp / (..) - POD_Save_VGA_Seq(stream); - POD_Save_VGA_Attr(stream); - POD_Save_VGA_Crtc(stream); - POD_Save_VGA_Gfx(stream); - POD_Save_VGA_Dac(stream); - - - // - pure data - WRITE_POD( &vga.latch, vga.latch ); - - - // VGA_S3.cpp - POD_Save_VGA_S3(stream); - - - // - pure struct data - WRITE_POD( &vga.svga, vga.svga ); - WRITE_POD( &vga.herc, vga.herc ); - - - // - near-pure struct data - WRITE_POD( &vga.tandy, vga.tandy ); - - // - reloc data - WRITE_POD( &tandy_drawbase_idx, tandy_drawbase_idx ); - WRITE_POD( &tandy_membase_idx, tandy_membase_idx ); - - - // - pure struct data - WRITE_POD( &vga.amstrad, vga.amstrad ); - - - // vga_other.cpp / vga_memory.cpp - POD_Save_VGA_Other(stream); - POD_Save_VGA_Memory(stream); - - - // - pure data - WRITE_POD( &vga.vmemwrap, vga.vmemwrap ); - - - // - static ptrs + 'new' data - //Bit8u* fastmem; - //Bit8u* fastmem_orgptr; - - // - 'new' data - WRITE_POD_SIZE( vga.fastmem_orgptr, sizeof(Bit8u) * ((vga.vmemsize << 1) + 4096 + 16) ); - - - // - pure data (variable on S3 card) - WRITE_POD( &vga.vmemsize, vga.vmemsize ); - - -#ifdef VGA_KEEP_CHANGES - // - static ptr - //Bit8u* map; - - // - 'new' data - WRITE_POD_SIZE( vga.changes.map, sizeof(Bit8u) * (VGA_MEMORY >> VGA_CHANGE_SHIFT) + 32 ); - - - // - pure data - WRITE_POD( &vga.changes.checkMask, vga.changes.checkMask ); - WRITE_POD( &vga.changes.frame, vga.changes.frame ); - WRITE_POD( &vga.changes.writeMask, vga.changes.writeMask ); - WRITE_POD( &vga.changes.active, vga.changes.active ); - WRITE_POD( &vga.changes.clearMask, vga.changes.clearMask ); - WRITE_POD( &vga.changes.start, vga.changes.start ); - WRITE_POD( &vga.changes.last, vga.changes.last ); - WRITE_POD( &vga.changes.lastAddress, vga.changes.lastAddress ); -#endif - - - // - pure data - WRITE_POD( &vga.lfb.page, vga.lfb.page ); - WRITE_POD( &vga.lfb.addr, vga.lfb.addr ); - WRITE_POD( &vga.lfb.mask, vga.lfb.mask ); - - // - static ptr - //PageHandler *handler; - - - // VGA_paradise.cpp / VGA_tseng.cpp / VGA_xga.cpp - POD_Save_VGA_Paradise(stream); - POD_Save_VGA_Tseng(stream); - POD_Save_VGA_XGA(stream); - } - - virtual void setBytes(std::istream& stream) - { - Bit32u tandy_drawbase_idx, tandy_membase_idx; - - //******************************** - //******************************** - - SerializeGlobalPOD::setBytes(stream); - - - // - pure data - READ_POD( &vga.mode, vga.mode ); - READ_POD( &vga.lastmode, vga.lastmode ); - READ_POD( &vga.misc_output, vga.misc_output ); - - - // VGA_Draw.cpp - POD_Load_VGA_Draw(stream); - - - // - pure struct data - READ_POD( &vga.config, vga.config ); - READ_POD( &vga.internal, vga.internal ); - - - // VGA_Seq.cpp / VGA_Attr.cpp / (..) - POD_Load_VGA_Seq(stream); - POD_Load_VGA_Attr(stream); - POD_Load_VGA_Crtc(stream); - POD_Load_VGA_Gfx(stream); - POD_Load_VGA_Dac(stream); - - - // - pure data - READ_POD( &vga.latch, vga.latch ); - - - // VGA_S3.cpp - POD_Load_VGA_S3(stream); - - - // - pure struct data - READ_POD( &vga.svga, vga.svga ); - READ_POD( &vga.herc, vga.herc ); - - - // - near-pure struct data - READ_POD( &vga.tandy, vga.tandy ); - - // - reloc data - READ_POD( &tandy_drawbase_idx, tandy_drawbase_idx ); - READ_POD( &tandy_membase_idx, tandy_membase_idx ); - - - // - pure struct data - READ_POD( &vga.amstrad, vga.amstrad ); - - - // vga_other.cpp / vga_memory.cpp - POD_Load_VGA_Other(stream); - POD_Load_VGA_Memory(stream); - - - // - pure data - READ_POD( &vga.vmemwrap, vga.vmemwrap ); - - - // - static ptrs + 'new' data - //Bit8u* fastmem; - //Bit8u* fastmem_orgptr; - - // - 'new' data - READ_POD_SIZE( vga.fastmem_orgptr, sizeof(Bit8u) * ((vga.vmemsize << 1) + 4096 + 16) ); - - - // - pure data (variable on S3 card) - READ_POD( &vga.vmemsize, vga.vmemsize ); - - -#ifdef VGA_KEEP_CHANGES - // - static ptr - //Bit8u* map; - - // - 'new' data - READ_POD_SIZE( vga.changes.map, sizeof(Bit8u) * (VGA_MEMORY >> VGA_CHANGE_SHIFT) + 32 ); - - - // - pure data - READ_POD( &vga.changes.checkMask, vga.changes.checkMask ); - READ_POD( &vga.changes.frame, vga.changes.frame ); - READ_POD( &vga.changes.writeMask, vga.changes.writeMask ); - READ_POD( &vga.changes.active, vga.changes.active ); - READ_POD( &vga.changes.clearMask, vga.changes.clearMask ); - READ_POD( &vga.changes.start, vga.changes.start ); - READ_POD( &vga.changes.last, vga.changes.last ); - READ_POD( &vga.changes.lastAddress, vga.changes.lastAddress ); -#endif - - - // - pure data - READ_POD( &vga.lfb.page, vga.lfb.page ); - READ_POD( &vga.lfb.addr, vga.lfb.addr ); - READ_POD( &vga.lfb.mask, vga.lfb.mask ); - - // - static ptr - //PageHandler *handler; - - - // VGA_paradise.cpp / VGA_tseng.cpp / VGA_xga.cpp - POD_Load_VGA_Paradise(stream); - POD_Load_VGA_Tseng(stream); - POD_Load_VGA_XGA(stream); - - //******************************** - //******************************** - - if( tandy_drawbase_idx == 0xffffffff ) vga.tandy.draw_base = vga.mem.linear; - else vga.tandy.draw_base = MemBase + tandy_drawbase_idx; - - if( tandy_membase_idx == 0xffffffff ) vga.tandy.mem_base = vga.mem.linear; - else vga.tandy.mem_base = MemBase + tandy_membase_idx; - } -} dummy; -} - - - -/* -ykhwong svn-daum 2012-02-20 - - -static globals: - -struct VGA_Type vga: - -// - pure data -- VGAModes mode; -- VGAModes lastmode; -- Bit8u misc_output; - -// - pure + reloc data -- VGA_Draw draw; -- VGA_Config config; -- VGA_Internal internal; -- VGA_Seq seq; -- VGA_Attr attr; -- VGA_Crtc crtc; -- VGA_Gfx gfx; -- VGA_Dac dac; -- VGA_Latch latch; -- VGA_S3 s3; -- VGA_SVGA svga; -- VGA_HERC herc; -- VGA_TANDY tandy; -- VGA_AMSTRAD amstrad; -- VGA_OTHER other; -- VGA_Memory mem; -- Bit32u vmemwrap; - - -// - static ptrs + 'new' data -- Bit8u* fastmem; -- Bit8u* fastmem_orgptr; - - -// - pure data -- Bit32u vmemsize; - - -#ifdef VGA_KEEP_CHANGES -- VGA_Changes changes; -#endif - - -- VGA_LFB lfb; - - - - -// - static class -struct SVGA_Driver svga: - -// - static function ptr (init time) -- tWritePort write_p3d5; -- tReadPort read_p3d5; -- tWritePort write_p3c5; -- tReadPort read_p3c5; -- tWritePort write_p3c0; -- tReadPort read_p3c1; -- tWritePort write_p3cf; -- tReadPort read_p3cf; -- tFinishSetMode set_video_mode; -- tDetermineMode determine_mode; -- tSetClock set_clock; -- tGetClock get_clock; -- tHWCursorActive hardware_cursor_active; -- tAcceptsMode accepts_mode; -- tSetupDAC setup_dac; -- tINT10Extensions int10_extensions; - - -// - static data -Bit32u CGA_2_Table[16]; -Bit32u CGA_4_Table[256]; -Bit32u CGA_4_HiRes_Table[256]; -Bit32u CGA_16_Table[256]; -Bit32u TXT_Font_Table[16]; -Bit32u TXT_FG_Table[16]; -Bit32u TXT_BG_Table[16]; -Bit32u ExpandTable[256]; -Bit32u Expand16Table[4][16]; -Bit32u FillTable[16]; -Bit32u ColorTable[16]; - - -// - pure data -static bool hadReset; - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_Config: - -// - (all) pure data -- Bitu mh_mask; - -- Bitu display_start; -- Bitu real_start; -- bool retrace; -- Bitu scan_len; -- Bitu cursor_start; - -- Bitu line_compare; -- bool chained; -- bool compatible_chain4; - -- Bit8u pel_panning; -- Bit8u hlines_skip; -- Bit8u bytes_skip; -- Bit8u addr_shift; - -- Bit8u read_mode; -- Bit8u write_mode; -- Bit8u read_map_select; -- Bit8u color_dont_care; -- Bit8u color_compare; -- Bit8u data_rotate; -- Bit8u raster_op; - -- Bit32u full_bit_mask; -- Bit32u full_map_mask; -- Bit32u full_not_map_mask; -- Bit32u full_set_reset; -- Bit32u full_not_enable_set_reset; -- Bit32u full_enable_set_reset; -- Bit32u full_enable_and_set_reset; - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_Internal: - -// - pure data -- bool attrindex; - - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_Latch: - -// - pure data -- Bit32u d; -- Bit8u b[4]; - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_SVGA: - -// - pure data -- Bitu readStart, writeStart; -- Bitu bankMask; -- Bitu bank_read_full; -- Bitu bank_write_full; -- Bit8u bank_read; -- Bit8u bank_write; -- Bitu bank_size; - - - -struct VGA_HERC: - -// - pure data -- Bit8u mode_control; -- Bit8u enable_bits; -- bool blend; - - - -struct VGA_TANDY: - -// - pure data -- Bit8u pcjr_flipflop; -- Bit8u mode_control; -- Bit8u color_select; -- Bit8u disp_bank; -- Bit8u reg_index; -- Bit8u gfx_control; -- Bit8u palette_mask; -- Bit8u extended_ram; -- Bit8u border_color; -- Bit8u line_mask, line_shift; -- Bit8u draw_bank, mem_bank; - -// - reloc ptrs -- Bit8u *draw_base, *mem_base; - -// - pure data -- Bitu addr_mask; - - - -struct VGA_AMSTRAD: - -// - pure data -- Bit8u mask_plane; -- Bit8u write_plane; -- Bit8u read_plane; -- Bit8u border_color; - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_Changes: - -// - static ptr + 'new' data -- Bit8u* map; //[(VGA_MEMORY >> VGA_CHANGE_SHIFT) + 32] - - -// - pure data -- Bit8u checkMask, frame, writeMask; -- bool active; -- Bit32u clearMask; -- Bit32u start, last; -- Bit32u lastAddress; - -// ============================================= -// ============================================= -// ============================================= - -struct VGA_LFB: - -// - pure data -- Bit32u page; -- Bit32u addr; -- Bit32u mask; - - -// - static ptr -- PageHandler *handler; -*/ diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index 8641c5207..102c3b33e 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -33,7 +33,6 @@ #include "vga.h" #include "pic.h" #include "timer.h" -#include "../save_state.h" //#undef C_DEBUG //#define C_DEBUG 1 @@ -2135,283 +2134,3 @@ void *VGA_PanningLatch_PIC_Event = (void*)VGA_PanningLatch; void *VGA_VertInterrupt_PIC_Event = (void*)VGA_VertInterrupt; void *VGA_VerticalTimer_PIC_Event = (void*)VGA_VerticalTimer; - -void POD_Save_VGA_Draw( std::ostream& stream ) -{ - Bit8u linear_base_idx; - Bit8u font_tables_idx[2]; - Bit8u drawline_idx; - - - if(0) {} - else if( vga.draw.linear_base == vga.mem.linear ) linear_base_idx = 0; - else if( vga.draw.linear_base == vga.fastmem ) linear_base_idx = 1; - - - for( int lcv=0; lcv<2; lcv++ ) { - if(0) {} - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[0*1024]) ) font_tables_idx[lcv] = 0; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[8*1024]) ) font_tables_idx[lcv] = 1; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[16*1024]) ) font_tables_idx[lcv] = 2; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[24*1024]) ) font_tables_idx[lcv] = 3; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[32*1024]) ) font_tables_idx[lcv] = 4; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[40*1024]) ) font_tables_idx[lcv] = 5; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[48*1024]) ) font_tables_idx[lcv] = 6; - else if( vga.draw.font_tables[lcv] == &(vga.draw.font[56*1024]) ) font_tables_idx[lcv] = 7; - } - - - if(0) {} - else if( VGA_DrawLine == VGA_Draw_AMS_4BPP_Line ) drawline_idx = 0; - else if( VGA_DrawLine == VGA_Draw_1BPP_Line ) drawline_idx = 1; - else if( VGA_DrawLine == VGA_Draw_1BPP_Blend_Line ) drawline_idx = 2; - else if( VGA_DrawLine == VGA_Draw_2BPP_Line ) drawline_idx = 3; - else if( VGA_DrawLine == VGA_Draw_2BPPHiRes_Line ) drawline_idx = 4; - else if( VGA_DrawLine == VGA_Draw_CGA16_Line ) drawline_idx = 5; - else if( VGA_DrawLine == VGA_Draw_4BPP_Line ) drawline_idx = 6; - else if( VGA_DrawLine == VGA_Draw_4BPP_Line_Double ) drawline_idx = 7; - else if( VGA_DrawLine == VGA_Draw_Linear_Line ) drawline_idx = 8; - else if( VGA_DrawLine == VGA_Draw_Xlat16_Linear_Line ) drawline_idx = 9; - else if( VGA_DrawLine == VGA_Draw_VGA_Line_Xlat16_HWMouse ) drawline_idx = 10; - else if( VGA_DrawLine == VGA_Draw_VGA_Line_HWMouse ) drawline_idx = 11; - else if( VGA_DrawLine == VGA_Draw_LIN16_Line_HWMouse ) drawline_idx = 12; - else if( VGA_DrawLine == VGA_Draw_LIN32_Line_HWMouse ) drawline_idx = 13; - else if( VGA_DrawLine == VGA_TEXT_Draw_Line ) drawline_idx = 14; - else if( VGA_DrawLine == VGA_TEXT_Herc_Draw_Line ) drawline_idx = 15; - else if( VGA_DrawLine == VGA_TEXT_Draw_Line89 ) drawline_idx = 16; - else if( VGA_DrawLine == VGA_TEXT_Xlat16_Draw_Line ) drawline_idx = 17; - - //********************************************** - //********************************************** - - // - near-pure (struct) data - WRITE_POD( &vga.draw, vga.draw ); - - - // - reloc ptr - WRITE_POD( &linear_base_idx, linear_base_idx ); - WRITE_POD( &font_tables_idx, font_tables_idx ); - - //********************************************** - //********************************************** - - // static globals - - // - reloc function ptr - WRITE_POD( &drawline_idx, drawline_idx ); - - - // - pure data - WRITE_POD( &TempLine, TempLine ); - - - // - system data - //WRITE_POD( &vsync, vsync ); - //WRITE_POD( &uservsyncjolt, uservsyncjolt ); - - - // - pure data - WRITE_POD( &temp, temp ); - WRITE_POD( &FontMask, FontMask ); - WRITE_POD( &bg_color_index, bg_color_index ); -} - - -void POD_Load_VGA_Draw( std::istream& stream ) -{ - Bit8u linear_base_idx; - Bit8u font_tables_idx[2]; - Bit8u drawline_idx; - - //********************************************** - //********************************************** - - // - near-pure (struct) data - READ_POD( &vga.draw, vga.draw ); - - - // - reloc ptr - READ_POD( &linear_base_idx, linear_base_idx ); - READ_POD( &font_tables_idx, font_tables_idx ); - - //********************************************** - //********************************************** - - // static globals - - // - reloc function ptr - READ_POD( &drawline_idx, drawline_idx ); - - - // - pure data - READ_POD( &TempLine, TempLine ); - - - // - system data - //READ_POD( &vsync, vsync ); - //READ_POD( &uservsyncjolt, uservsyncjolt ); - - - // - pure data - READ_POD( &temp, temp ); - READ_POD( &FontMask, FontMask ); - READ_POD( &bg_color_index, bg_color_index ); - - //********************************************** - //********************************************** - - switch( linear_base_idx ) { - case 0: vga.draw.linear_base = vga.mem.linear; break; - case 1: vga.draw.linear_base = vga.fastmem; break; - } - - - for( int lcv=0; lcv<2; lcv++ ) { - switch( font_tables_idx[lcv] ) { - case 0: vga.draw.font_tables[lcv] = &(vga.draw.font[0*1024]); break; - case 1: vga.draw.font_tables[lcv] = &(vga.draw.font[8*1024]); break; - case 2: vga.draw.font_tables[lcv] = &(vga.draw.font[16*1024]); break; - case 3: vga.draw.font_tables[lcv] = &(vga.draw.font[24*1024]); break; - case 4: vga.draw.font_tables[lcv] = &(vga.draw.font[32*1024]); break; - case 5: vga.draw.font_tables[lcv] = &(vga.draw.font[40*1024]); break; - case 6: vga.draw.font_tables[lcv] = &(vga.draw.font[48*1024]); break; - case 7: vga.draw.font_tables[lcv] = &(vga.draw.font[56*1024]); break; - } - } - - - switch( drawline_idx ) { - case 0: VGA_DrawLine = VGA_Draw_AMS_4BPP_Line; break; - case 1: VGA_DrawLine = VGA_Draw_1BPP_Line; break; - case 2: VGA_DrawLine = VGA_Draw_1BPP_Blend_Line; break; - case 3: VGA_DrawLine = VGA_Draw_2BPP_Line; break; - case 4: VGA_DrawLine = VGA_Draw_2BPPHiRes_Line; break; - case 5: VGA_DrawLine = VGA_Draw_CGA16_Line; break; - case 6: VGA_DrawLine = VGA_Draw_4BPP_Line; break; - case 7: VGA_DrawLine = VGA_Draw_4BPP_Line_Double; break; - case 8: VGA_DrawLine = VGA_Draw_Linear_Line; break; - case 9: VGA_DrawLine = VGA_Draw_Xlat16_Linear_Line; break; - case 10: VGA_DrawLine = VGA_Draw_VGA_Line_Xlat16_HWMouse; break; - case 11: VGA_DrawLine = VGA_Draw_VGA_Line_HWMouse; break; - case 12: VGA_DrawLine = VGA_Draw_LIN16_Line_HWMouse; break; - case 13: VGA_DrawLine = VGA_Draw_LIN32_Line_HWMouse; break; - case 14: VGA_DrawLine = VGA_TEXT_Draw_Line; break; - case 15: VGA_DrawLine = VGA_TEXT_Herc_Draw_Line; break; - case 16: VGA_DrawLine = VGA_TEXT_Draw_Line89; break; - case 17: VGA_DrawLine = VGA_TEXT_Xlat16_Draw_Line; break; - } -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - -// - reloc function ptr -static VGA_Line_Handler VGA_DrawLine; - -// - pure data -static Bit8u TempLine[SCALER_MAXWIDTH * 4 + 256]; - - -// - system data -static struct vsync -- double period; -- bool manual; -- bool persistent; -- bool faithful; - - -// - system data -static float uservsyncjolt; - - -// - pure data -static Bitu temp[643]; -static Bit32u FontMask[2]; -static Bit8u bg_color_index; - - - - -struct VGA_Draw: - -typedef struct { -// - pure data - bool resizing; - Bitu width; - Bitu height; - Bitu blocks; - Bitu address; - Bitu panning; - Bitu bytes_skip; - -// - reloc ptr - Bit8u *linear_base; - -// - pure data - Bitu linear_mask; - Bitu address_add; - Bitu line_length; - Bitu address_line_total; - Bitu address_line; - Bitu lines_total; - Bitu vblank_skip; - Bitu lines_done; - Bitu split_line; - Bitu parts_total; - Bitu parts_lines; - Bitu parts_left; - Bitu byte_panning_shift; - - -// - pure struct data - struct { - double framestart; - double vrstart, vrend; // V-retrace - double hrstart, hrend; // H-retrace - double hblkstart, hblkend; // H-blanking - double vblkstart, vblkend; // V-Blanking - double vdend, vtotal; - double hdend, htotal; - double parts; - float singleline_delay; - } delay; - - -// - pure data - double screen_ratio; - double refresh; - bool doublescan_merging; - Bit8u font[64*1024]; - -// - reloc ptr - Bit8u * font_tables[2]; - -// - pure data - Bitu blinking; - bool blink; - bool char9dot; - - -// - pure struct data - struct { - Bitu address; - Bit8u sline,eline; - Bit8u count,delay; - Bit8u enabled; - } cursor; - - -// - pure data - Drawmode mode; - bool vret_triggered; - bool vga_override; - bool linewise_set; - bool linewise_effect; - bool multiscan_set; - bool multiscan_effect; - bool char9_set; - Bitu bpp; -*/ diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 7d4cbd18e..2b05aeaf2 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -26,7 +26,6 @@ #include "pic.h" #include "render.h" #include "mapper.h" -#include "../save_state.h" static void write_crtc_index_other(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { vga.other.index=(Bit8u)(val & 0x1f); @@ -989,81 +988,3 @@ void VGA_SetupOther(void) { // AMSTRAD } - - -// save state support - -void POD_Save_VGA_Other( std::ostream& stream ) -{ - // - pure struct data - WRITE_POD( &vga.other, vga.other ); - - //**************************************** - //**************************************** - - // static globals - - // - system + user data - WRITE_POD( &hue_offset, hue_offset ); - WRITE_POD( &cga16_val, cga16_val ); - WRITE_POD( &herc_pal, herc_pal ); - WRITE_POD( &mono_cga_pal, mono_cga_pal ); - WRITE_POD( &mono_cga_bright, mono_cga_bright ); -} - - -void POD_Load_VGA_Other( std::istream& stream ) -{ - // - pure struct data - READ_POD( &vga.other, vga.other ); - - //**************************************** - //**************************************** - - // static globals - - // - system + user data - READ_POD( &hue_offset, hue_offset ); - READ_POD( &cga16_val, cga16_val ); - READ_POD( &herc_pal, herc_pal ); - READ_POD( &mono_cga_pal, mono_cga_pal ); - READ_POD( &mono_cga_bright, mono_cga_bright ); -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - -- pure data (system + exe modifiable) -static double hue_offset; -static Bit8u cga16_val; -static Bit8u herc_pal; -static Bit8u mono_cga_pal; -static Bit8u mono_cga_bright; - -- static data -static const Bit8u mono_cga_palettes[6][16][3]; - - - -struct VGA_Other: - -// - pure data - Bit8u index; - Bit8u htotal; - Bit8u hdend; - Bit8u hsyncp; - Bit8u hsyncw; - Bit8u vtotal; - Bit8u vdend; - Bit8u vadjust; - Bit8u vsyncp; - Bit8u vsyncw; - Bit8u max_scanline; - Bit16u lightpen; - bool lightpen_triggered; - Bit8u cursor_start; - Bit8u cursor_end; -*/ diff --git a/src/hardware/vga_paradise.cpp b/src/hardware/vga_paradise.cpp index 5b0847bef..2a545cdd6 100644 --- a/src/hardware/vga_paradise.cpp +++ b/src/hardware/vga_paradise.cpp @@ -22,7 +22,6 @@ #include "vga.h" #include "inout.h" #include "mem.h" -#include "../save_state.h" typedef struct { Bitu PR0A; @@ -243,48 +242,3 @@ void SVGA_Setup_ParadisePVGA1A(void) { IO_Write(0x3cf, 0x05); // Enable! } - - -// save state support - -void POD_Save_VGA_Paradise( std::ostream& stream ) -{ - // static globals - - - // - pure struct data - WRITE_POD( &pvga1a, pvga1a ); -} - - -void POD_Load_VGA_Paradise( std::istream& stream ) -{ - // static globals - - - // - pure struct data - READ_POD( &pvga1a, pvga1a ); -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - -static SVGA_PVGA1A_DATA pvga1a; - -// - pure data - Bitu PR0A; - Bitu PR0B; - Bitu PR1; - Bitu PR2; - Bitu PR3; - Bitu PR4; - Bitu PR5; - - inline bool locked() { return (PR5&7)!=5; } - - Bitu clockFreq[4]; - Bitu biosMode; -*/ diff --git a/src/hardware/vga_s3.cpp b/src/hardware/vga_s3.cpp index 14894580a..598083071 100644 --- a/src/hardware/vga_s3.cpp +++ b/src/hardware/vga_s3.cpp @@ -22,7 +22,6 @@ #include "vga.h" #include "mem.h" #include "pci_bus.h" -#include "../save_state.h" void SVGA_S3_WriteCRTC(Bitu reg,Bitu val,Bitu iolen) { switch (reg) { @@ -585,107 +584,3 @@ void SVGA_Setup_S3Trio(void) { PCI_AddSVGAS3_Device(); } - - -// save state support - -void POD_Save_VGA_S3( std::ostream& stream ) -{ - // - pure struct data - WRITE_POD( &vga.s3, vga.s3 ); - - //***************************************** - //***************************************** - - // static globals - - WRITE_POD( ®17index, reg17index ); -} - - -void POD_Load_VGA_S3( std::istream& stream ) -{ - // - pure struct data - READ_POD( &vga.s3, vga.s3 ); - - //***************************************** - //***************************************** - - // static globals - - READ_POD( ®17index, reg17index ); -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - -// - pure data -Bit8u reg17index; - - - -struct VGA_S3: - -typedef struct { - -// - pure data - Bit8u reg_lock1; - Bit8u reg_lock2; - Bit8u reg_31; - Bit8u reg_35; - Bit8u reg_36; // RAM size - Bit8u reg_3a; // 4/8/doublepixel bit in there - Bit8u reg_40; // 8415/A functionality register - Bit8u reg_41; // BIOS flags - Bit8u reg_42; // CR42 Mode Control - Bit8u reg_43; - Bit8u reg_45; // Hardware graphics cursor - Bit8u reg_50; - Bit8u reg_51; - Bit8u reg_52; - Bit8u reg_55; - Bit8u reg_58; - Bit8u reg_6b; // LFB BIOS scratchpad - Bit8u ex_hor_overflow; - Bit8u ex_ver_overflow; - Bit16u la_window; - Bit8u misc_control_2; - Bit8u ext_mem_ctrl; - Bitu xga_screen_width; - VGAModes xga_color_mode; - - -// - pure struct data - struct { - Bit8u r; - Bit8u n; - Bit8u m; - } clk[4],mclk; - - -// - pure struct data - struct { - Bit8u lock; - Bit8u cmd; - } pll; - - - VGA_HWCURSOR hgc; - - - -struct VGA_HWCURSOR: - -// - pure data - Bit8u curmode; - Bit16u originx, originy; - Bit8u fstackpos, bstackpos; - Bit8u forestack[4]; - Bit8u backstack[4]; - Bit16u startaddr; - Bit8u posx, posy; - Bit8u mc[64][64]; -*/ diff --git a/src/hardware/vga_tseng.cpp b/src/hardware/vga_tseng.cpp index 31f284fa2..c3ae4dcea 100644 --- a/src/hardware/vga_tseng.cpp +++ b/src/hardware/vga_tseng.cpp @@ -25,7 +25,6 @@ #include "mem.h" #include "regs.h" #include -#include "../save_state.h" // Tseng ET4K data typedef struct { @@ -955,79 +954,3 @@ void SVGA_Setup_TsengET3K(void) { phys_writeb(rom_base+0x007b,' '); } - - -// save state support - -void POD_Save_VGA_Tseng( std::ostream& stream ) -{ - // static globals - - - // - pure struct data - WRITE_POD( &et4k, et4k ); - WRITE_POD( &et3k, et3k ); -} - - -void POD_Load_VGA_Tseng( std::istream& stream ) -{ - // static globals - - - // - pure struct data - READ_POD( &et4k, et4k ); - READ_POD( &et3k, et3k ); -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - -static SVGA_ET4K_DATA et4k; - -// - pure data - Bit8u extensionsEnabled; - Bit8u hicolorDACcmdmode; - Bit8u hicolorDACcommand; - Bitu store_3d4_31; - Bitu store_3d4_32; - Bitu store_3d4_33; - Bitu store_3d4_34; - Bitu store_3d4_35; - Bitu store_3d4_36; - Bitu store_3d4_37; - Bitu store_3d4_3f; - Bitu store_3c0_16; - Bitu store_3c0_17; - - Bitu store_3c4_06; - Bitu store_3c4_07; - - Bitu clockFreq[16]; - Bitu biosMode; - - - -static SVGA_ET3K_DATA et3k; - -// - pure data - Bitu store_3d4_1b; - Bitu store_3d4_1c; - Bitu store_3d4_1d; - Bitu store_3d4_1e; - Bitu store_3d4_1f; - Bitu store_3d4_20; - Bitu store_3d4_21; - Bitu store_3d4_23; - Bitu store_3d4_24; - Bitu store_3d4_25; - Bitu store_3c0_16; - Bitu store_3c0_17; - Bitu store_3c4_06; - Bitu store_3c4_07; - Bitu clockFreq[8]; - Bitu biosMode; -*/ diff --git a/src/hardware/vga_xga.cpp b/src/hardware/vga_xga.cpp index 241786828..2e4ebe72b 100644 --- a/src/hardware/vga_xga.cpp +++ b/src/hardware/vga_xga.cpp @@ -25,7 +25,6 @@ #include #include "callback.h" #include "cpu.h" // for 0x3da delay -#include "../save_state.h" #define XGA_SCREEN_WIDTH vga.s3.xga_screen_width #define XGA_COLOR_MODE vga.s3.xga_color_mode @@ -1320,69 +1319,3 @@ void VGA_SetupXGA(void) { IO_RegisterReadHandler(0xe2ea,&XGA_Read,IO_MB | IO_MW | IO_MD); } - - -// save state support - -void POD_Save_VGA_XGA( std::ostream& stream ) -{ - // static globals - - - // - pure struct data - WRITE_POD( &xga, xga ); -} - - -void POD_Load_VGA_XGA( std::istream& stream ) -{ - // static globals - - - // - pure struct data - READ_POD( &xga, xga ); -} - - -/* -ykhwong svn-daum 2012-02-20 - -static globals: - - -struct XGAStatus xga; - - -// - pure struct data -- struct scissorreg scissors - - Bit16u x1, y1, x2, y2; - -// - pure data -- Bit32u readmask; -- Bit32u writemask; -- Bit32u forecolor; -- Bit32u backcolor; -- Bitu curcommand; -- Bit16u foremix; -- Bit16u backmix; -- Bit16u curx, cury; -- Bit16u destx, desty; -- Bit16u ErrTerm; -- Bit16u MIPcount; -- Bit16u MAPcount; -- Bit16u pix_cntl; -- Bit16u control1; -- Bit16u control2; -- Bit16u read_sel; - -// - pure struct data -- struct XGA_WaitCmd { - - bool newline; - - bool wait; - - Bit16u cmd; - - Bit16u curx, cury; - - Bit16u x1, y1, x2, y2, sizex, sizey; - - Bit32u data; - - Bitu datasize; - - Bitu buswidth; -*/ diff --git a/src/ints/int10.cpp b/src/ints/int10.cpp index 2318aefc8..eab216c1c 100644 --- a/src/ints/int10.cpp +++ b/src/ints/int10.cpp @@ -24,7 +24,6 @@ #include "inout.h" #include "int10.h" #include "setup.h" -#include "../save_state.h" Int10Data int10; static Bitu call_10; @@ -731,26 +730,3 @@ void INT10_Init(Section* /*sec*/) { INT10_SetVideoMode(0x3); } - - - -//save state support -namespace -{ -class SerializeInt10 : public SerializeGlobalPOD -{ -public: - SerializeInt10() : SerializeGlobalPOD("Int10") - { - registerPOD(int10); - //registerPOD(CurMode); - //registerPOD(call_10); - //registerPOD(warned_ff); - } - - // virtual void setBytes(std::istream& stream) - //{ - // SerializeGlobalPOD::setBytes(stream); - //} -} dummy; -}