OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / babbage2nd / display.cpp
index a0a5864..655ef11 100644 (file)
@@ -8,7 +8,7 @@
 */
 
 #include "display.h"
-
+namespace BABBAGE2ND {
 static const int pat_7seg_led[58][34] = {
        {0,6,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2},
        {0,6,6,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2,2},
@@ -116,7 +116,7 @@ void DISPLAY::event_vline(int v, int clock)
        }
 }
 
-void DISPLAY::write_signal(int id, uint32 data, uint32 mask)
+void DISPLAY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(id == SIG_DISPLAY_7SEG_LED) {
                if((pio_7seg & 0x80) && !(data & 0x80)) {
@@ -131,18 +131,19 @@ void DISPLAY::write_signal(int id, uint32 data, uint32 mask)
 void DISPLAY::draw_screen()
 {
        // draw 7-seg LEDs
-       scrntype col_h, col_l;
-       scrntype col[8];
-
+       scrntype_t col_h, col_l;
+       scrntype_t col[8];
+       
        col_h = RGB_COLOR(255, 0, 0);
        col_l = RGB_COLOR(107, 0, 0);
        col[0] = RGB_COLOR(82, 8, 16);
+       
        for(int i = 0; i < 6; i++) {
                for(int j = 0; j < 7; j++) {
                        col[j + 1] = (seg[i][j] > 8) ? col_h : col_l;
                }
                for(int y = 0; y < 58; y++) {
-                       scrntype* dest = emu->screen_buffer(ranges[i].y + y) + ranges[i].x;
+                       scrntype_t* dest = emu->get_screen_buffer(vm_ranges[i].y + y) + vm_ranges[i].x;
                        for(int x = 0; x < 34; x++) {
                                dest[x] = col[pat_7seg_led[y][x]];
                        }
@@ -151,7 +152,7 @@ void DISPLAY::draw_screen()
        for(int i = 0; i < 8; i++) {
                col[1] = (pio_8bit & (1 << i)) ? col_h : col_l;
                for(int y = 0; y < 17; y++) {
-                       scrntype* dest = emu->screen_buffer(ranges[i + 6].y + y) + ranges[i + 6].x;
+                       scrntype_t* dest = emu->get_screen_buffer(vm_ranges[i + 6].y + y) + vm_ranges[i + 6].x;
                        for(int x = 0; x < 17; x++) {
                                dest[x] = col[pat_8bit_led[y][x]];
                        }
@@ -159,3 +160,20 @@ void DISPLAY::draw_screen()
        }
 }
 
+#define STATE_VERSION  1
+
+bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
+{
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+               return false;
+       }
+       if(!state_fio->StateCheckInt32(this_device_id)) {
+               return false;
+       }
+       state_fio->StateBuffer(seg, sizeof(seg), 1);
+       state_fio->StateUint8(ls373);
+       state_fio->StateUint8(pio_7seg);
+       state_fio->StateUint8(pio_8bit);
+       return true;
+}
+}