*/
#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},
}
}
-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)) {
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]];
}
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]];
}
}
}
+#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;
+}
+}