Commit 6f64d2b3 authored by deuce's avatar deuce
Browse files

Add C64 and C128 video modes and palettes.

Current;y, I'm useing the PC palette for C128 modes since the documentation
I found on the C128 said that it used CGA monitors (which were digital)

Can someone clarify this (ie: Did the Commodore monitor use the C64 palette)
parent 5b197a97
......@@ -169,6 +169,10 @@ enum text_modes
C4350 = C80X50, /* this is actually "64" in the "real" conio */
_ORIGMODE = 65 /* original mode at program startup */
C64_40X25 = 147, /* Commodore 64 40x25 colour mode */
C128_40X25, /* Commodore 128 40x25 colour mode */
C128_80X25, /* Commodore 128 40x25 colour mode */
};
#define COLOR_MODE C80
......
......@@ -1478,9 +1478,9 @@ update_pixels()
for (i = 0; i < 16; i++) {
XColor color;
color.red = dac_default16[palette[i]].red << 10;
color.green = dac_default16[palette[i]].green << 10;
color.blue = dac_default16[palette[i]].blue << 10;
color.red = dac_default[palette[i]].red << 8;
color.green = dac_default[palette[i]].green << 8;
color.blue = dac_default[palette[i]].blue << 8;
if (x11.XAllocColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), &color)) {
pixels[i] = color.pixel;
} else if (i < 7)
......
......@@ -1140,9 +1140,9 @@ int sdl_setup_colours(SDL_Surface *surf, int xor)
sdl.mutexP(sdl_vstatlock);
for(i=0; i<16; i++) {
co[i^xor].r=dac_default256[vstat.palette[i]].red;
co[i^xor].g=dac_default256[vstat.palette[i]].green;
co[i^xor].b=dac_default256[vstat.palette[i]].blue;
co[i^xor].r=dac_default[vstat.palette[i]].red;
co[i^xor].g=dac_default[vstat.palette[i]].green;
co[i^xor].b=dac_default[vstat.palette[i]].blue;
}
sdl.mutexV(sdl_vstatlock);
sdl.SetColors(surf, co, 0, 16);
......@@ -1186,17 +1186,17 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y, struct
ch=(sch >> 8) & 0x0f;
if(lastfg!=ch) {
co.r=dac_default256[vs->palette[ch]].red;
co.g=dac_default256[vs->palette[ch]].green;
co.b=dac_default256[vs->palette[ch]].blue;
co.r=dac_default[vs->palette[ch]].red;
co.g=dac_default[vs->palette[ch]].green;
co.b=dac_default[vs->palette[ch]].blue;
sdl.SetColors(sdl_font, &co, 1, 1);
lastfg=ch;
}
ch=(sch >> 12) & 0x07;
if(lastbg!=ch) {
co.r=dac_default256[vs->palette[ch]].red;
co.g=dac_default256[vs->palette[ch]].green;
co.b=dac_default256[vs->palette[ch]].blue;
co.r=dac_default[vs->palette[ch]].red;
co.g=dac_default[vs->palette[ch]].green;
co.b=dac_default[vs->palette[ch]].blue;
sdl.SetColors(sdl_font, &co, 0, 1);
lastbg=ch;
}
......
......@@ -4,7 +4,7 @@
#include "vidmodes.h"
struct video_params vparams[36] = {
struct video_params vparams[39] = {
/* BW 40x25 */
{BW40, GREYSCALE_PALETTE, 40, 25, 14, 15, 16, 8},
/* CO 40x25 */
......@@ -77,6 +77,12 @@ struct video_params vparams[36] = {
{MONO60, MONO_PALETTE, 80, 60, 7, 7, 8, 8},
/* Magical C4350 Mode */
{C4350, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8},
/* Commodore 64 40x25 mode */
{C64_40X25, C64_PALETTE, 40, 25, 0, 7, 8, 8},
/* Commodore 128 40x25 mode */
{C128_40X25, COLOUR_PALETTE, 40, 25, 0, 7, 8, 8},
/* Commodore 128 80x25 mode */
{C128_80X25, COLOUR_PALETTE, 80, 25, 0, 7, 8, 8},
};
unsigned char palettes[3][16] = {
......@@ -92,20 +98,26 @@ unsigned char palettes[3][16] = {
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
}
/* C64 */
{ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
}
};
struct dac_colors dac_default16[16] = {
{0, 0, 0}, {0, 0, 42}, {0, 42, 0}, {0, 42, 42},
{42, 0, 0}, {42, 0, 42}, {42, 21, 0}, {42, 42, 42},
{21, 21, 21}, {21, 21, 63}, {21, 63, 21}, {21, 63, 63},
{63, 21, 21}, {63, 21, 63}, {63, 63, 21}, {63, 63, 63}
};
struct dac_colors dac_default256[16] = {
struct dac_colors dac_default[16] = {
{0, 0, 0}, {0, 0, 168}, {0, 168, 0}, {0, 168, 168},
{168, 0, 0}, {168, 0, 168}, {168, 84, 0}, {168, 168, 168},
{84, 84, 84}, {84, 84, 255}, {84, 255, 84}, {84, 255, 255},
{255, 84, 84}, {255, 84, 255}, {255, 255, 84}, {255, 255, 255}
/* C64 colours */
/* Black, White, Red, Cyan, Purple, Green, Blue, Yellow */
/* Orange, Brown, Lt Red, Dk Grey, Grey, Lt Green, Lt Blue, Lt Grey */
{0x00, 0x00, 0x00}, {0xff, 0xff, 0xff}, {0x68, 0x37, 0x2b},
{0x70, 0xa4, 0xb2}, {0x6f, 0x3d, 0x86}, {0x58, 0x8d, 0x43},
{0x35, 0x29, 0x79}, {0xb8, 0xc7, 0x6f}, {0x6f, 0x4f, 0x25},
{0x43, 0x39, 0x00}, {0x9a, 0x67, 0x59}, {0x44, 0x44, 0x44},
{0x6c, 0x6c, 0x6c}, {0x9a, 0xd2, 0x84}, {0x6c, 0x5e, 0xb5},
{0x95, 0x95, 0x95}
};
int find_vmode(int mode)
......
......@@ -84,13 +84,13 @@ enum {
MONO_PALETTE
,GREYSCALE_PALETTE
,COLOUR_PALETTE
,C64_PALETTE
};
extern struct video_params vparams[36];
#define NUMMODES (sizeof(vparams) / sizeof(struct video_params))
extern unsigned char palettes[3][16];
extern struct dac_colors dac_default16[16];
extern struct dac_colors dac_default256[16];
extern unsigned char palettes[4][16];
extern struct dac_colors dac_default[32];
extern char vga_font_bitmap[4096];
extern char vga_font_bitmap14[3584];
extern char vga_font_bitmap8[2048];
......
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