aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-09-29 17:57:09 -0700
committerH. Peter Anvin <hpa@zytor.com>2018-09-29 17:57:09 -0700
commit22c7eacbe24e0851e45c0679a0e61692e9ae6151 (patch)
tree4cf59c1d2d5360750cb8e2b12102cc741c649a07
parent1be2cf62bd06685e82508a8316285a68e175c6ff (diff)
downloadabc80sim-22c7eacbe24e0851e45c0679a0e61692e9ae6151.tar.gz
abc80sim-22c7eacbe24e0851e45c0679a0e61692e9ae6151.tar.xz
abc80sim-22c7eacbe24e0851e45c0679a0e61692e9ae6151.zip
Add an option to disable ABC800C-style color
It isn't really authentic, after all...
-rw-r--r--abc80.c8
-rw-r--r--screen.h2
-rw-r--r--sdlscrn.c10
3 files changed, 16 insertions, 4 deletions
diff --git a/abc80.c b/abc80.c
index 98465ff..625d33c 100644
--- a/abc80.c
+++ b/abc80.c
@@ -109,6 +109,8 @@ static no_return help(void)
" -v, --version print the version string\n"
" -h, --help print this help message\n"
" -k, --kb # set the memory size in K (ABC80: 1-32 or 64)\n"
+ " --color allow ABC800C-style color graphics (default)\n"
+ " --no-color black and white only\n"
" --diskdir ... set directory for disk images (default abcdisk)\n"
" --filedir ... set directory for file sharing (default abcdir)\n"
" --scrndir ... set directory for screen shots (default .)\n"
@@ -224,6 +226,7 @@ int main(int argc, char **argv)
const char *memfile = NULL;
bool detach = false;
const char *console = NULL;
+ bool color = true;
attach_console();
@@ -305,6 +308,9 @@ int main(int argc, char **argv)
filelist_add_file(&cas_files, LONG_ARG());
} else if (!strcmp(optstr, "caslist")) {
filelist_add_list(&cas_files, LONG_ARG());
+ } else if (!strcmp(optstr, "color") ||
+ !strcmp(optstr, "colour")) {
+ color = enable;
} else {
fprintf(stderr, "%s: unknown option: --%s\n",
program_name, optstr);
@@ -399,7 +405,7 @@ int main(int argc, char **argv)
if (detach)
detach_console();
- screen_init(startup_width40);
+ screen_init(startup_width40, color);
mem_init(memflags, memfile);
io_init();
diff --git a/screen.h b/screen.h
index a183a6e..357dfe8 100644
--- a/screen.h
+++ b/screen.h
@@ -5,7 +5,7 @@
#include <SDL.h>
-extern void screen_init(bool);
+extern void screen_init(bool, bool);
extern void screen_reset(void);
extern void screen_write(int, int);
extern void screen_flush(void);
diff --git a/sdlscrn.c b/sdlscrn.c
index 42e5e95..70ffd9e 100644
--- a/sdlscrn.c
+++ b/sdlscrn.c
@@ -456,7 +456,7 @@ static void abc_screenshot(void)
/*
* Initialize SDL and the data structures
*/
-void screen_init(bool width40)
+void screen_init(bool width40, bool color)
{
int window = 1; /* True = run in a window */
int debug = 1; /* False = force clean shutdown */
@@ -476,7 +476,13 @@ void screen_init(bool width40)
if ( !window )
SDL_ShowCursor(SDL_DISABLE);
- /* Initialize CRTC values to something sensible (also applies for ABC80) */
+ /* If not color, then overwrite colors 1-6 with white */
+ if (!color) {
+ for (i = 1; i < NCOLORS-1; i++)
+ rgbcolors[i] = rgbcolors[NCOLORS-1];
+ }
+
+ /* Initialize CRTC values to something sensible (also used by ABC80) */
memset(&crtc, 0, sizeof crtc);
crtc.r.htotal = 80;
crtc.r.hdisp = 80;