#define FMT_UBEE 130 /* Microbee 6545 modes */
uint8_t hardware;
#define HW_UNACCEL 1 /* Simple display */
-#define HW_VDP_9918 128 /* Not neccessarily MSX... */
+#define HW_VDP_9918A 128 /* Not neccessarily MSX... */
#define HW_VDP_9938 129
#define HW_TRS80GFX 130 /* TRS80 model 4 graphics board */
#define HW_HRG1B 131 /* HRG1B for TRS80 and VidoeGenie */
__sfr __at 0x00 hrg_off;
__sfr __at 0x04 hrg_data;
+__sfr __at 0x79 vdps;
+__sfr __at 0x7C chromajs0;
__sfr __at 0x82 gfx_data;
__sfr __at 0x83 gfx_ctrl;
__sfr __at 0xFF ioctrl;
uint8_t has_hrg1;
+uint8_t has_chroma; /* and thus 2 joystick ports */
uint8_t video_mode;
static uint8_t max_mode = 0;
-static struct display trsdisplay[4] = {
+static struct display trsdisplay[5] = {
/* Text mode */
{
0,
GFX_MULTIMODE|GFX_MAPPABLE|GFX_TEXT,
9,
0
+ },
+ /* CHROMAtrs */
+ {
+ 1,
+ 256, 192,
+ 256, 192,
+ 255, 255,
+ FMT_VDP,
+ HW_VDP_9918A,
+ GFX_MAPPABLE, /* We don't support it as a console yet */
+ 16,
+ 0
}
};
-static struct videomap trsmap[4] = {
+static struct videomap trsmap[5] = {
{
0,
0,
1, /* Standard spacing */
MAP_PIO
},
+ /* CHROMAtrs */
+ {
+ 0,
+ 0x78, /* I/O ports 0x78/79 */
+ 0, 0,
+ 0, 0,
+ 1,
+ MAP_PIO /* VDP is I/O mapped */
+ }
};
static uint8_t displaymap[2] = {0, 0};
displaymap[1] = 1;
}
}
+ /* It's possible to have a CHROMAtrs and other adapters as it fits
+ on the external bus. 70-7C is also a common location for RTC clocks
+ which makes detection trickier. The clock will show 0 in the upper
+ bits, the joystick port will not */
+ if (vdps != 0xFF && (chromajs0 & 0xC0) == 0xC0) {
+ displaymap[++max_mode] = 4;
+ trsdisplay[4].mode = max_mode;
+ has_chroma = 1;
+ }
}
#include <devinput.h>
__sfr __at 0x00 stick;
-uint8_t old_stick;
+static uint8_t old_stick;
+
+__sfr __at 0x7C chroma0;
+__sfr __at 0x7E chroma1;
+static uint8_t old_cj[2];
static char buf[32];
static struct s_queue kqueue = {
wakeup(&kqueue);
}
+/* If both are present number the Chroma joysticks 1 and 2 */
+static int chroma_js(uint8_t *slot, uint8_t n, uint8_t v)
+{
+ uint8_t k = 0;
+ if (v == old_cj[n])
+ return 0;
+ old_cj[n] = v;
+ if (v & 1)
+ k = STICK_DIGITAL_L;
+ if (v & 2)
+ k = STICK_DIGITAL_R;
+ if (v & 4)
+ k = STICK_DIGITAL_U;
+ if (v & 8)
+ k = STICK_DIGITAL_D;
+ if (v & 16)
+ k = BUTTON(0);
+ *slot++ = STICK_DIGITAL | (n + 1);
+ *slot = k;
+ return 2;
+}
+
int platform_input_read(uint8_t *slot)
{
uint8_t r, k;
return 2;
}
+ if (has_chroma) {
+ if (chroma_js(slot, 0, ~chroma0))
+ return 2;
+ if (chroma_js(slot, 1, ~chroma1))
+ return 2;
+ }
/* Clashes with Alpha joystick */
if (has_hrg1)
return 0;
if (r & 16)
k |= BUTTON(0);
*slot++ = STICK_DIGITAL;
- *slot++ = k;
+ *slot = k;
return 2;
}
void poll_input(void)
{
- if (has_hrg1)
- return;
- if (~stick != old_stick)
- wakeup(&kqueue);
+ if ((!has_hrg1 && ~stick != old_stick) ||
+ (has_chroma && (old_cj[0] != ~chroma0 || old_cj[1] != ~chroma1)))
+ wakeup(&kqueue);
}