• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision4959af6b652c30e6fcf87b3cc5674d755a674920 (tree)
Time2018-06-06 17:09:41
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[VM][BABBAGE2ND] .

Change Summary

Incremental Difference

--- a/source/src/vm/babbage2nd/babbage2nd.h
+++ b/source/src/vm/babbage2nd/babbage2nd.h
@@ -83,6 +83,7 @@ const struct {
8383 };
8484
8585 class csp_state_utils;
86+
8687 class EMU;
8788 class DEVICE;
8889 class EVENT;
--- a/source/src/vm/babbage2nd/display.cpp
+++ b/source/src/vm/babbage2nd/display.cpp
@@ -162,29 +162,50 @@ void DISPLAY::draw_screen()
162162
163163 #define STATE_VERSION 1
164164
165+#include "../../statesub.h"
166+
167+void DISPLAY::decl_state()
168+{
169+ state_entry = new csp_state_utils(STATE_VERSION, this_device_id, _T("DISPLAY"));
170+
171+ DECL_STATE_ENTRY_1D_ARRAY(seg, sizeof(seg));
172+ DECL_STATE_ENTRY_UINT8(ls373);
173+ DECL_STATE_ENTRY_UINT8(pio_7seg);
174+ DECL_STATE_ENTRY_UINT8(pio_8bit);
175+
176+}
177+
165178 void DISPLAY::save_state(FILEIO* state_fio)
166179 {
167- state_fio->FputUint32(STATE_VERSION);
168- state_fio->FputInt32(this_device_id);
180+ if(state_entry != NULL) {
181+ state_entry->save_state(state_fio);
182+ }
183+ //state_fio->FputUint32(STATE_VERSION);
184+ //state_fio->FputInt32(this_device_id);
169185
170- state_fio->Fwrite(seg, sizeof(seg), 1);
171- state_fio->FputUint8(ls373);
172- state_fio->FputUint8(pio_7seg);
173- state_fio->FputUint8(pio_8bit);
186+ //state_fio->Fwrite(seg, sizeof(seg), 1);
187+ //state_fio->FputUint8(ls373);
188+ //state_fio->FputUint8(pio_7seg);
189+ //state_fio->FputUint8(pio_8bit);
174190 }
175191
176192 bool DISPLAY::load_state(FILEIO* state_fio)
177193 {
178- if(state_fio->FgetUint32() != STATE_VERSION) {
179- return false;
180- }
181- if(state_fio->FgetInt32() != this_device_id) {
182- return false;
194+ bool mb = false;
195+ if(state_entry != NULL) {
196+ mb = state_entry->load_state(state_fio);
183197 }
184- state_fio->Fread(seg, sizeof(seg), 1);
185- ls373 = state_fio->FgetUint8();
186- pio_7seg = state_fio->FgetUint8();
187- pio_8bit = state_fio->FgetUint8();
198+ if(!mb) return false;
199+ //if(state_fio->FgetUint32() != STATE_VERSION) {
200+ // return false;
201+ //}
202+ //if(state_fio->FgetInt32() != this_device_id) {
203+ // return false;
204+ //}
205+ //state_fio->Fread(seg, sizeof(seg), 1);
206+ //ls373 = state_fio->FgetUint8();
207+ //pio_7seg = state_fio->FgetUint8();
208+ //pio_8bit = state_fio->FgetUint8();
188209 return true;
189210 }
190211
--- a/source/src/vm/babbage2nd/display.h
+++ b/source/src/vm/babbage2nd/display.h
@@ -17,6 +17,7 @@
1717 #define SIG_DISPLAY_7SEG_LED 0
1818 #define SIG_DISPLAY_8BIT_LED 1
1919
20+
2021 class DISPLAY : public DEVICE
2122 {
2223 private:
@@ -38,6 +39,7 @@ public:
3839 void initialize();
3940 void write_signal(int id, uint32_t data, uint32_t mask);
4041 void event_vline(int v, int clock);
42+ void decl_state();
4143 void save_state(FILEIO* state_fio);
4244 bool load_state(FILEIO* state_fio);
4345
Show on old repository browser