Commit 46f976d1 authored by deuce's avatar deuce
Browse files

Add default attributes and video flags to the vparams array.

This allows Lt. Blue on Blue for C64, Green on bright black for C128 40 col,
and Light grey on black for C128.
Commodore modes are no longer capable of blinking, which I believe is accurate.
parent 7ef426f7
......@@ -1548,8 +1548,8 @@ int bitmap_drv_init_mode(int mode, int *width, int *height)
/* Initialize video memory with black background, white foreground */
for (i = 0; i < vstat.cols*vstat.rows; ++i) {
vstat.vmem->vmem[i].ch = 0;
vstat.vmem->vmem[i].legacy_attr = 7;
bitmap_attr2palette_locked(7, &vstat.vmem->vmem[i].fg, &vstat.vmem->vmem[i].bg);
vstat.vmem->vmem[i].legacy_attr = vstat.currattr;
bitmap_attr2palette_locked(vstat.currattr, &vstat.vmem->vmem[i].fg, &vstat.vmem->vmem[i].bg);
}
pthread_mutex_lock(&screen.screenlock);
......@@ -1573,8 +1573,8 @@ int bitmap_drv_init_mode(int mode, int *width, int *height)
current_font[i]=default_font;
bitmap_loadfont_locked(NULL);
cio_textinfo.attribute=7;
cio_textinfo.normattr=7;
cio_textinfo.attribute=vstat.currattr;
cio_textinfo.normattr=vstat.currattr;
cio_textinfo.currmode=mode;
if (vstat.rows > 0xff)
......
......@@ -439,16 +439,20 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode)
cio_textinfo.wintop=1;
cio_textinfo.winright=cio_textinfo.screenwidth;
cio_textinfo.winbottom=cio_textinfo.screenheight;
/* Default C64 is Lt Blue on Black (As per CGTerm) */
/* Default C64 is Lt Blue on Dark Blue (As per Every picture ever) */
switch(cio_textinfo.currmode) {
case C64_40X25:
cio_textinfo.normattr=0x6e;
break;
case C128_40X25:
case C128_80X25:
cio_textinfo.normattr=14;
cio_textinfo.normattr=6e;
break;
default:
cio_textinfo.normattr=LIGHTGRAY;
break;
}
_beginthread(ciolib_mouse_thread,0,NULL);
return(0);
}
......@@ -826,14 +830,17 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_textmode(int mode)
cio_textinfo.wintop=1;
cio_textinfo.winright=cio_textinfo.screenwidth;
cio_textinfo.winbottom=cio_textinfo.screenheight;
switch(cio_textinfo.currmode) {
case C64_40X25:
cio_textinfo.normattr=0x6e;
break;
case C128_40X25:
case C128_80X25:
cio_textinfo.normattr=14;
cio_textinfo.normattr=6e;
break;
default:
cio_textinfo.normattr=7;
cio_textinfo.normattr=LIGHTGRAY;
break;
}
}
......
......@@ -36,6 +36,7 @@
#include <string.h>
#if defined(_WIN32)
#include <malloc.h> /* alloca() on Win32 */
#include <xpprintf.h> /* asprintf() on Win32 */
#endif
#include <genwrap.h>
......@@ -3377,6 +3378,7 @@ void CIOLIBCALL cterm_start(struct cterminal *cterm)
cterm->fg_color += 16;
cterm->bg_color += 16;
TEXTATTR(cterm->attr);
ciolib_setcolour(cterm->fg_color, cterm->bg_color);
SETCURSORTYPE(cterm->cursor);
cterm->started=1;
if(ti.winleft != cterm->x || ti.wintop != cterm->y || ti.winright != cterm->x+cterm->width-1 || ti.winleft != cterm->y+cterm->height-1)
......
......@@ -10,110 +10,110 @@
struct video_params vparams[] = {
/* BW 40x25 */
{BW40, GREYSCALE_PALETTE, 40, 25, 14, 15, 16, 8, 1},
{BW40, GREYSCALE_PALETTE, 40, 25, 14, 15, 16, 8, 1, 7, 0},
/* CO 40x25 */
{C40, COLOUR_PALETTE, 40, 25, 14, 15, 16, 8, 1},
{C40, COLOUR_PALETTE, 40, 25, 14, 15, 16, 8, 1, 7, 0},
/* BW 80x25 */
{BW80, GREYSCALE_PALETTE, 80, 25, 14, 15, 16, 8, 1},
{BW80, GREYSCALE_PALETTE, 80, 25, 14, 15, 16, 8, 1, 7, 0},
/* CO 80x25 */
{C80, COLOUR_PALETTE, 80, 25, 14, 15, 16, 8, 1},
{C80, COLOUR_PALETTE, 80, 25, 14, 15, 16, 8, 1, 7, 0},
/* MONO */
{MONO, 0, 80, 25, 14, 15, 16, 8, 1},
{MONO, 0, 80, 25, 14, 15, 16, 8, 1, 7, 0},
/* CO 40x14 */
{C40X14, COLOUR_PALETTE, 40, 14, 14, 15, 16, 8, 1},
{C40X14, COLOUR_PALETTE, 40, 14, 14, 15, 16, 8, 1, 7, 0},
/* CO 40x21 */
{C40X21, COLOUR_PALETTE, 40, 21, 14, 15, 16, 8, 1},
{C40X21, COLOUR_PALETTE, 40, 21, 14, 15, 16, 8, 1, 7, 0},
/* CO 40x28 */
{C40X28, COLOUR_PALETTE, 40, 28, 12, 13, 14, 8, 1},
{C40X28, COLOUR_PALETTE, 40, 28, 12, 13, 14, 8, 1, 7, 0},
/* CO 40x43 */
{C40X43, COLOUR_PALETTE, 40, 43, 7, 7, 8, 8, 1},
{C40X43, COLOUR_PALETTE, 40, 43, 7, 7, 8, 8, 1, 7, 0},
/* CO 40x50 */
{C40X50, COLOUR_PALETTE, 40, 50, 7, 7, 8, 8, 1},
{C40X50, COLOUR_PALETTE, 40, 50, 7, 7, 8, 8, 1, 7, 0},
/* CO 40x60 */
{C40X60, COLOUR_PALETTE, 40, 60, 7, 7, 8, 8, 1},
{C40X60, COLOUR_PALETTE, 40, 60, 7, 7, 8, 8, 1, 7, 0},
/* CO 80x14 */
{C80X14, COLOUR_PALETTE, 80, 14, 14, 15, 16, 8, 1},
{C80X14, COLOUR_PALETTE, 80, 14, 14, 15, 16, 8, 1, 7, 0},
/* CO 80x21 */
{C80X21, COLOUR_PALETTE, 80, 21, 14, 15, 16, 8, 1},
{C80X21, COLOUR_PALETTE, 80, 21, 14, 15, 16, 8, 1, 7, 0},
/* CO 80x28 */
{C80X28, COLOUR_PALETTE, 80, 28, 12, 13, 14, 8, 1},
{C80X28, COLOUR_PALETTE, 80, 28, 12, 13, 14, 8, 1, 7, 0},
/* CO 80x30 */
{C80X30, COLOUR_PALETTE, 80, 30, 14, 15, 16, 8, 1},
{C80X30, COLOUR_PALETTE, 80, 30, 14, 15, 16, 8, 1, 7, 0},
/* CO 80x43 */
{C80X43, COLOUR_PALETTE, 80, 43, 7, 7, 8, 8, 1},
{C80X43, COLOUR_PALETTE, 80, 43, 7, 7, 8, 8, 1, 7, 0},
/* CO 80x50 */
{C80X50, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8, 1},
{C80X50, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8, 1, 7, 0},
/* CO 80x60 */
{C80X60, COLOUR_PALETTE, 80, 60, 7, 7, 8, 8, 1},
{C80X60, COLOUR_PALETTE, 80, 60, 7, 7, 8, 8, 1, 7, 0},
/* B 40x14 */
{BW40X14, GREYSCALE_PALETTE, 40, 14, 14, 15, 16, 8, 1},
{BW40X14, GREYSCALE_PALETTE, 40, 14, 14, 15, 16, 8, 1, 7, 0},
/* BW 40x21 */
{BW40X21, GREYSCALE_PALETTE, 40, 21, 14, 15, 16, 8, 1},
{BW40X21, GREYSCALE_PALETTE, 40, 21, 14, 15, 16, 8, 1, 7, 0},
/* BW 40x28 */
{BW40X28, GREYSCALE_PALETTE, 40, 28, 12, 13, 14, 8, 1},
{BW40X28, GREYSCALE_PALETTE, 40, 28, 12, 13, 14, 8, 1, 7, 0},
/* BW 40x43 */
{BW40X43, GREYSCALE_PALETTE, 40, 43, 7, 7, 8, 8, 1},
{BW40X43, GREYSCALE_PALETTE, 40, 43, 7, 7, 8, 8, 1, 7, 0},
/* BW 40x50 */
{BW40X50, GREYSCALE_PALETTE, 40, 50, 7, 7, 8, 8, 1},
{BW40X50, GREYSCALE_PALETTE, 40, 50, 7, 7, 8, 8, 1, 7, 0},
/* BW 40x60 */
{BW40X60, GREYSCALE_PALETTE, 40, 60, 7, 7, 8, 8, 1},
{BW40X60, GREYSCALE_PALETTE, 40, 60, 7, 7, 8, 8, 1, 7, 0},
/* BW 80x14 */
{BW80X14, GREYSCALE_PALETTE, 80, 14, 14, 15, 16, 8, 1},
{BW80X14, GREYSCALE_PALETTE, 80, 14, 14, 15, 16, 8, 1, 7, 0},
/* BW 80x21 */
{BW80X21, GREYSCALE_PALETTE, 80, 21, 14, 15, 16, 8, 1},
{BW80X21, GREYSCALE_PALETTE, 80, 21, 14, 15, 16, 8, 1, 7, 0},
/* BW 80x28 */
{BW80X28, GREYSCALE_PALETTE, 80, 28, 12, 13, 14, 8, 1},
{BW80X28, GREYSCALE_PALETTE, 80, 28, 12, 13, 14, 8, 1, 7, 0},
/* BW 80x43 */
{BW80X43, GREYSCALE_PALETTE, 80, 43, 7, 7, 8, 8, 1},
{BW80X43, GREYSCALE_PALETTE, 80, 43, 7, 7, 8, 8, 1, 7, 0},
/* BW 80x50 */
{BW80X50, GREYSCALE_PALETTE, 80, 50, 7, 7, 8, 8, 1},
{BW80X50, GREYSCALE_PALETTE, 80, 50, 7, 7, 8, 8, 1, 7, 0},
/* BW 80x60 */
{BW80X60, GREYSCALE_PALETTE, 80, 60, 7, 7, 8, 8, 1},
{BW80X60, GREYSCALE_PALETTE, 80, 60, 7, 7, 8, 8, 1, 7, 0},
/* MONO 80x14 */
{MONO14, MONO_PALETTE, 80, 14, 14, 15, 16, 8, 1},
{MONO14, MONO_PALETTE, 80, 14, 14, 15, 16, 8, 1, 7, 0},
/* MONO 80x21 */
{MONO21, MONO_PALETTE, 80, 21, 14, 15, 16, 8, 1},
{MONO21, MONO_PALETTE, 80, 21, 14, 15, 16, 8, 1, 7, 0},
/* MONO 80x28 */
{MONO28, MONO_PALETTE, 80, 28, 12, 13, 14, 8, 1},
{MONO28, MONO_PALETTE, 80, 28, 12, 13, 14, 8, 1, 7, 0},
/* MONO 80x43 */
{MONO43, MONO_PALETTE, 80, 43, 7, 7, 8, 8, 1},
{MONO43, MONO_PALETTE, 80, 43, 7, 7, 8, 8, 1, 7, 0},
/* MONO 80x50 */
{MONO50, MONO_PALETTE, 80, 50, 7, 7, 8, 8, 1},
{MONO50, MONO_PALETTE, 80, 50, 7, 7, 8, 8, 1, 7, 0},
/* MONO 80x60 */
{MONO60, MONO_PALETTE, 80, 60, 7, 7, 8, 8, 1},
{MONO60, MONO_PALETTE, 80, 60, 7, 7, 8, 8, 1, 7, 0},
/* Magical C4350 Mode */
{C4350, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8, 1},
{C4350, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8, 1, 7, 0},
/* Commodore 64 40x25 mode */
{C64_40X25, C64_PALETTE, 40, 25, 0, 7, 8, 8, 1},
{C64_40X25, C64_PALETTE, 40, 25, 0, 7, 8, 8, 1, 0x6e, CIOLIB_VIDEO_BGBRIGHT|CIOLIB_VIDEO_NOBLINK},
/* Commodore 128 40x25 mode */
{C128_40X25, COLOUR_PALETTE, 40, 25, 0, 7, 8, 8, 1},
{C128_40X25, COLOUR_PALETTE, 40, 25, 0, 7, 8, 8, 1, 0x82, CIOLIB_VIDEO_BGBRIGHT|CIOLIB_VIDEO_NOBLINK},
/* Commodore 128 80x25 mode */
{C128_80X25, COLOUR_PALETTE, 80, 25, 0, 7, 8, 8, 2},
{C128_80X25, COLOUR_PALETTE, 80, 25, 0, 7, 8, 8, 2, 7, CIOLIB_VIDEO_BGBRIGHT|CIOLIB_VIDEO_NOBLINK},
/* Atari 800 40x24 mode */
{ATARI_40X24, ATARI_PALETTE, 40, 24, 0, 7, 8, 8, 1},
{ATARI_40X24, ATARI_PALETTE, 40, 24, 0, 7, 8, 8, 1, 7, 0},
/* Atari 800 XEP80 80x25 mode */
{ATARI_80X25, GREYSCALE_PALETTE, 80, 25, 0, 15, 16, 8, 1},
{ATARI_80X25, GREYSCALE_PALETTE, 80, 25, 0, 15, 16, 8, 1, 7, 0},
/* VESA 21x132 mode */
{VESA_132X21, COLOUR_PALETTE, 132, 21, 14, 15, 16, 8, 1},
{VESA_132X21, COLOUR_PALETTE, 132, 21, 14, 15, 16, 8, 1, 7, 0},
/* VESA 25x132 mode */
{VESA_132X25, COLOUR_PALETTE, 132, 25, 14, 15, 16, 8, 1},
{VESA_132X25, COLOUR_PALETTE, 132, 25, 14, 15, 16, 8, 1, 7, 0},
/* VESA 28x132 mode */
{VESA_132X28, COLOUR_PALETTE, 132, 28, 12, 13, 14, 8, 1},
{VESA_132X28, COLOUR_PALETTE, 132, 28, 12, 13, 14, 8, 1, 7, 0},
/* VESA 30x132 mode */
{VESA_132X30, COLOUR_PALETTE, 132, 30, 14, 15, 16, 8, 1},
{VESA_132X30, COLOUR_PALETTE, 132, 30, 14, 15, 16, 8, 1, 7, 0},
/* VESA 34x132 mode */
{VESA_132X34, COLOUR_PALETTE, 132, 34, 12, 13, 14, 8, 1},
{VESA_132X34, COLOUR_PALETTE, 132, 34, 12, 13, 14, 8, 1, 7, 0},
/* VESA 43x132 mode */
{VESA_132X43, COLOUR_PALETTE, 132, 43, 7, 7, 8, 8, 1},
{VESA_132X43, COLOUR_PALETTE, 132, 43, 7, 7, 8, 8, 1, 7, 0},
/* VESA 50x132 mode */
{VESA_132X50, COLOUR_PALETTE, 132, 50, 7, 7, 8, 8, 1},
{VESA_132X50, COLOUR_PALETTE, 132, 50, 7, 7, 8, 8, 1, 7, 0},
/* VESA 60x132 mode */
{VESA_132X60, COLOUR_PALETTE, 132, 60, 7, 7, 8, 8, 1},
{VESA_132X60, COLOUR_PALETTE, 132, 60, 7, 7, 8, 8, 1, 7, 0},
/* Awesome modes */
{ST132X37_16_9, COLOUR_PALETTE, 132, 37, 14, 15, 16, 8, 1},
{ST132X52_5_4, COLOUR_PALETTE, 132, 52, 14, 15, 16, 8, 1},
{ST132X37_16_9, COLOUR_PALETTE, 132, 37, 14, 15, 16, 8, 1, 7, 0},
{ST132X52_5_4, COLOUR_PALETTE, 132, 52, 14, 15, 16, 8, 1, 7, 0},
/* Custom mode */
{CIOLIB_MODE_CUSTOM, COLOUR_PALETTE, 80, 25, 14, 15, 16, 8, 1},
{CIOLIB_MODE_CUSTOM, COLOUR_PALETTE, 80, 25, 14, 15, 16, 8, 1, 7, 0},
};
uint32_t palettes[5][16] = {
......@@ -310,11 +310,11 @@ int load_vmode(struct video_stats *vs, int mode)
vs->curs_visible=1;
vs->curs_row=1;
vs->curs_col=1;
vs->bright_background=0;
vs->no_bright=0;
vs->bright_altcharset=0;
vs->no_blink=0;
vs->blink_altcharset=0;
vs->bright_background=vparams[i].flags & CIOLIB_VIDEO_BGBRIGHT;
vs->no_bright=vparams[i].flags & CIOLIB_VIDEO_NOBRIGHT;
vs->bright_altcharset=vparams[i].flags & CIOLIB_VIDEO_ALTCHARS;
vs->no_blink=vparams[i].flags & CIOLIB_VIDEO_NOBLINK;
vs->blink_altcharset=vparams[i].flags & CIOLIB_VIDEO_BLINKALTCHARS;
if(vs->curs_row < 0)
vs->curs_row=0;
if(vs->curs_row >= vparams[i].rows)
......@@ -328,5 +328,6 @@ int load_vmode(struct video_stats *vs, int mode)
vs->charwidth=vparams[i].charwidth;
vs->mode=mode;
vs->vmultiplier=vparams[i].vmultiplier;
vs->currattr = vparams[i].default_attr;
return(0);
}
......@@ -62,6 +62,8 @@ struct video_params {
int charheight;
int charwidth;
int vmultiplier;
int default_attr;
int flags;
};
struct vstat_vmem {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment