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0,9,9},
+ {9,9,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,3,0,8,8,8,0,0,9,9},
+ {9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9},
+ {9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9},
+ {9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9},
+ {9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9},
+ {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
+ {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
+ {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
+ {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
};
void DISPLAY::initialize()
{
// load rom image
FILEIO* fio = new FILEIO();
- if(fio->Fopen(emu->bios_path(_T("FONT.ROM")), FILEIO_READ_BINARY)) {
+ if(fio->Fopen(create_local_path(_T("FONT.ROM")), FILEIO_READ_BINARY)) {
fio->Fread(font, sizeof(font), 1);
fio->Fclose();
}
delete fio;
mode = 2;
- dma = 0x80;
+ dma = true;
}
void DISPLAY::write_signal(int id, uint32 data, uint32 mask)
mode = data & mask;
} else if(id == SIG_DISPLAY_DMA) {
// 8255 PC on TK-80
- dma = data & mask;
+ dma = ((data & mask) != 0);
}
}
void DISPLAY::draw_screen()
{
// draw screen
- scrntype col_w = (mode & 2) ? RGB_COLOR(255, 255, 255) : 0;
- scrntype col_b = (mode & 2) ? 0 : RGB_COLOR(255, 255, 255);
+ scrntype color_w = (mode & 2) ? RGB_COLOR(255, 255, 255) : 0;
+ scrntype color_b = (mode & 2) ? 0 : RGB_COLOR(255, 255, 255);
int code_ofs = (mode & 1) << 8;
int ptr = 0;
for(int y = 0; y < 128; y += 8) {
for(int x = 0; x < 256; x += 8) {
- int code = vram[ptr++] | code_ofs;
+ int code = vram[ptr++];
+ if(code != 0x20) {
+ vm->draw_ranges = 9;
+ }
+ code |= code_ofs;
uint8* font_base = &font[code << 3];
for(int l = 0; l < 8; l++) {
uint8 pat = font_base[l];
scrntype* dest = &screen[l][x];
- dest[0] = (pat & 0x80) ? col_w : col_b;
- dest[1] = (pat & 0x40) ? col_w : col_b;
- dest[2] = (pat & 0x20) ? col_w : col_b;
- dest[3] = (pat & 0x10) ? col_w : col_b;
- dest[4] = (pat & 0x08) ? col_w : col_b;
- dest[5] = (pat & 0x04) ? col_w : col_b;
- dest[6] = (pat & 0x02) ? col_w : col_b;
- dest[7] = (pat & 0x01) ? col_w : col_b;
+ dest[0] = (pat & 0x80) ? color_w : color_b;
+ dest[1] = (pat & 0x40) ? color_w : color_b;
+ dest[2] = (pat & 0x20) ? color_w : color_b;
+ dest[3] = (pat & 0x10) ? color_w : color_b;
+ dest[4] = (pat & 0x08) ? color_w : color_b;
+ dest[5] = (pat & 0x04) ? color_w : color_b;
+ dest[6] = (pat & 0x02) ? color_w : color_b;
+ dest[7] = (pat & 0x01) ? color_w : color_b;
}
}
for(int l = 0; l < 8; l++) {
- scrntype* dest = emu->screen_buffer(y + l);
+ scrntype* dest0 = emu->screen_buffer(ranges[8].y + (y + l) * 2 + 0) + ranges[8].x;
+ scrntype* dest1 = emu->screen_buffer(ranges[8].y + (y + l) * 2 + 1) + ranges[8].x;
scrntype* src = screen[l];
- memcpy(dest, src, 256 * sizeof(scrntype));
+ for(int x = 0, xx = 0; x < 256; x++, xx += 2) {
+ dest0[xx] = dest0[xx + 1] = src[x];
+ }
+ memcpy(dest1, dest0, 256 * 2 * sizeof(scrntype));
}
}
// draw 7-seg LEDs
- scrntype col_red = RGB_COLOR(255, 0, 0);
- scrntype col_on = RGB_COLOR(255, 8, 72);
- scrntype col_off = RGB_COLOR(56, 0, 0);
scrntype col[10];
+ scrntype color_on = RGB_COLOR(255, 8, 72);
+ scrntype color_off = RGB_COLOR(56, 0, 0);
+ col[0] = RGB_COLOR(38, 8, 0);
+ col[9] = color_off;
memset(screen, 0, sizeof(screen));
for(int i = 0; i < 8; i++) {
- for(int i = 0; i < 8; i++) {
- uint8 pat = dma ? led[i] : 0;
- col[0] = 0;
- col[1] = pat & 0x01 ? col_on : col_off;
- col[2] = pat & 0x02 ? col_on : col_off;
- col[3] = pat & 0x04 ? col_on : col_off;
- col[4] = pat & 0x08 ? col_on : col_off;
- col[5] = pat & 0x10 ? col_on : col_off;
- col[6] = pat & 0x20 ? col_on : col_off;
- col[7] = pat & 0x40 ? col_on : col_off;
- col[8] = pat & 0x80 ? col_on : col_off;
- col[9] = col_red;
- for(int y = 0; y < 35; y++) {
- scrntype *dest = &screen[y + 1][dest_x[i]];
- for(int x = 0; x < 24; x++) {
- dest[x] = col[pat_led[y][x]];
- }
+ uint8 pat = dma ? led[i] : 0;
+ col[1] = pat & 0x01 ? color_on : color_off;
+ col[2] = pat & 0x02 ? color_on : color_off;
+ col[3] = pat & 0x04 ? color_on : color_off;
+ col[4] = pat & 0x08 ? color_on : color_off;
+ col[5] = pat & 0x10 ? color_on : color_off;
+ col[6] = pat & 0x20 ? color_on : color_off;
+ col[7] = pat & 0x40 ? color_on : color_off;
+ col[8] = pat & 0x80 ? color_on : color_off;
+ for(int y = 0; y < 46; y++) {
+ scrntype* dest = emu->screen_buffer(ranges[i].y + y) + ranges[i].x;
+ for(int x = 0; x < 33; x++) {
+ dest[x] = col[led_pattern[y][x]];
}
}
}
- // draw kb type
- col[1] = d_key->read_signal(0) & 1 ? col_red : col_off;
- col[2] = d_key->read_signal(0) & 2 ? col_red : col_off;
+}
+
+#define STATE_VERSION 1
+
+void DISPLAY::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
- for(int y = 0; y < 31; y++) {
- scrntype *dest = &screen[y + 3][210];
- for(int x = 0; x < 42; x++) {
- dest[x] = col[pat_kb[y][x]];
- }
+ state_fio->FputInt32(mode);
+ state_fio->FputBool(dma);
+}
+
+bool DISPLAY::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
}
-
- // copy to screen
- for(int y = 0; y < 36; y++) {
- scrntype* dest = emu->screen_buffer(y + 128);
- scrntype* src = screen[y];
- memcpy(dest, src, 256 * sizeof(scrntype));
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
}
+ mode = state_fio->FgetInt32();
+ dma = state_fio->FgetBool();
+ return true;
}