diff --git a/include/tgi.h b/include/tgi.h index f458180c5..15a6437cc 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -134,7 +134,7 @@ void __fastcall__ tgi_setdrawpage (unsigned char page); /* Set the drawable page. Will set an error if the page is not available. */ unsigned char tgi_getcolorcount (void); -/* Get the number of available colors. */ +/* Get the number of available colors. Zero means 256 colors. */ unsigned char tgi_getmaxcolor (void); /* Return the maximum supported color number (the number of colors would diff --git a/libsrc/tgi/tgi_setcolor.s b/libsrc/tgi/tgi_setcolor.s index 8e6fdc555..16f075767 100644 --- a/libsrc/tgi/tgi_setcolor.s +++ b/libsrc/tgi/tgi_setcolor.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 21.06.2002 +; 2002-06-21, Ullrich von Bassewitz +; 2020-06-04, Greg King ; ; void __fastcall__ tgi_setcolor (unsigned char color); ; /* Set the current drawing color */ @@ -11,9 +12,11 @@ cmp _tgi_colorcount ; Compare to available colors bcs @L1 - sta _tgi_color ; Remember the drawing color +@L0: sta _tgi_color ; Remember the drawing color jmp tgi_setcolor ; Call the driver -@L1: jmp tgi_inv_arg ; Invalid argument + +@L1: ldx _tgi_colorcount + beq @L0 ; Zero means 256 colors + jmp tgi_inv_arg ; Invalid argument .endproc -