Skip to content

Commit

Permalink
Added a 320x200x256 TGI driver to the Commander X16 library.
Browse files Browse the repository at this point in the history
Made the mandelbrot sample program handle the X16's 256 colors.
  • Loading branch information
greg-king5 committed Jul 15, 2020
1 parent 72fff0c commit 4296cba
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 22 deletions.
37 changes: 25 additions & 12 deletions doc/cx16.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ compiler.

<sect>Overview<p>

The Commander X16 is a modern small computer with firmware that is based on
the ROMs in Commodore's VIC-20 and 64C. It has a couple of I/O chips
(WDC65C22 VIA) that are like the ones in the VIC-20.
The Commander X16 is a modern small computer with firmware that is based partly
on the ROMs in Commodore's VIC-20 and 64C. It has a couple of I/O chips
(WDC65C22 VIA) that are like the ones in the VIC-20. It supports file storage
on Secure Digital cards. It allows two joysticks and a mouse. It has three
sound devices. It's VGA screen has twice the range of the C64 (similar to the

This comment has been minimized.

Copy link
@polluks

polluks Jul 15, 2020

Contributor

"Its"

This comment has been minimized.

Copy link
@greg-king5

greg-king5 Jul 16, 2020

Author Contributor

Typo fixed. Thanks.

C128's 80-column screen), with 256 colors.

This file contains an overview of the CX16 run-time system as it comes with the
cc65 C compiler. It describes the memory layout, CX16-specific header files,
Expand Down Expand Up @@ -108,7 +111,7 @@ cl65 -o file.prg -t cx16 -C cx16-asm.cfg source.s

To generate code that loads to &dollar;A000:
<tscreen><verb>
cl65 -o file.prg -Wl -S,$A000 -t cX16 -C cX16-asm.cfg source.s
cl65 -o file.prg -Wl -S,$A000 -t cx16 -C cx16-asm.cfg source.s
</verb></tscreen>

It also is possible to add a small BASIC header to the program, that uses SYS
Expand Down Expand Up @@ -208,12 +211,22 @@ structures, accessing the struct fields will access the chip registers.

<sect>Loadable drivers<p>

The names in the parentheses denote the symbols to be used for static linking of the drivers.
The names in the parentheses denote the symbols to be used for static linking
of the drivers. The names fit into the 8.3 character limit of the SD-Card's
FAT32 file-system.


<sect1>Graphics drivers<p>

No graphics drivers are available currently for the CX16.
The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/,
point to <tt/cx320p1.tgi (cx320p1_tgi)/.

<descrip>
<tag><tt/cx320p1.tgi (cx320p1_tgi)/</tag>
This driver features a resolution of 320 across and 200 down with 256 colors,
and a slightly adjustable palette (the order of the colors can be changed in
a way that's compatible with some of the other color drivers).
</descrip><p>


<sect1>Extended memory drivers<p>
Expand All @@ -224,10 +237,10 @@ No extended memory drivers are available currently for the CX16.
<sect1>Joystick drivers<p>

The default drivers, <tt/joy_stddrv (joy_static_stddrv)/,
point to <tt/cX16-std.joy (cx16_std_joy)/.
point to <tt/cx16-std.joy (cx16_std_joy)/.

<descrip>
<tag><tt/cX16-std.joy (cX16_std_joy)/</tag>
<tag><tt/cx16-std.joy (cx16_std_joy)/</tag>
Supports up to two NES (and SNES) controllers connected to the joystick ports
of the CX16. It reads the four directions, and the <bf/A/, <bf/B/,
<bf/Select/, and <bf/Start/ buttons. Buttons <bf/A/ and <bf/B/ are
Expand All @@ -238,15 +251,15 @@ point to <tt/cX16-std.joy (cx16_std_joy)/.
<sect1>Mouse drivers<p>

The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/,
point to <tt/cX16-std.mou (cx16_std_mou)/.
point to <tt/cx16-std.mou (cx16_std_mou)/.

<descrip>
<tag><tt/cX16-std.mou (cX16_std_mou)/</tag>
<tag><tt/cx16-std.mou (cx16_std_mou)/</tag>
Supports a standard 3-button mouse connected to the PS/2 mouse port of the
Commander X16.

Currently (r35), this driver doesn't support <tt/mouse_move()/
and <tt/mouse_setbox()/.
Currently, this driver doesn't support <tt/mouse_move()/ and
<tt/mouse_setbox()/.
</descrip><p>


Expand Down
24 changes: 22 additions & 2 deletions include/cx16.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F

/* TGI color defines */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_YELLOW COLOR_YELLOW
#define TGI_COLOR_ORANGE COLOR_ORANGE
#define TGI_COLOR_BROWN COLOR_BROWN
#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
#define TGI_COLOR_GRAY1 COLOR_GRAY1
#define TGI_COLOR_GRAY2 COLOR_GRAY2
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_GRAY3 COLOR_GRAY3

/* NES controller masks for joy_read() */

#define JOY_BTN_1_MASK 0x80
Expand Down Expand Up @@ -280,8 +299,9 @@ struct __emul {

/* The addresses of the static drivers */

extern void cx16_std_joy[]; /* Referred to by joy_static_stddrv[] */
extern void cx16_std_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void cx16_std_joy[]; /* Referenced by joy_static_stddrv[] */
extern void cx16_std_mou[]; /* Referenced by mouse_static_stddrv[] */
extern void cx320p1_tgi[]; /* Referenced by tgi_static_stddrv[] */



Expand Down

0 comments on commit 4296cba

Please sign in to comment.