CSRCS = devlpr.c devtty.c devfd.c devfd3.c devhd.c devgfx.c
-CSRCS += devices.c main.c devstringy.c
+CSRCS += devices.c main.c devstringy.c devinput.c
DISCARD_CSRCS = discard.c devhd_discard.c
ASRCS = trs80.s trs80-bank.s crt0.s vtsupport.s
TRS80 model I with Alpha SuperMem (or compatibles), 256K+ recommended
Options:
- Floppy Disk
+ Floppy Disk (somewhat basic support, no format tool yet)
Hard Disk (Tandy compatible)
Lower Case Kit (Optional, either Tandy or the simple mods)
Percom Compatible Doubler
In Progress:
Exatron stringy
+ Alpha Products Joystick
HR1G Graphics Card
Planned:
Orchestra 80 sound card
- Alpha Products Joystick
TRS80 model III with Alpha SuperMem (or compatibles), 256K+ recommended
Options:
In Progress:
Micro Labs Graphyx
Tandy Hi-Res Card
+ Alpha Products Joystick
Planned:
Orchestra 90 sound card
Lo-tech IDE adapter
#define CONFIG_VT_MULTI
/* Banked memory set up */
#define CONFIG_BANK_FIXED
-
+/* Direct I/O support */
#define CONFIG_LARGE_IO_DIRECT
+/* Raw input layer */
+#define CONFIG_INPUT
+/* Full keycode level grabbing supported */
+#define CONFIG_INPUT_GRABMAX 3
-#define MAX_MAPS 16
+#define MAX_MAPS 16 /* 512K */
#define MAP_SIZE 0x8000
--- /dev/null
+#include <kernel.h>
+#include <kdata.h>
+#include <input.h>
+#include <devgfx.h>
+#include <devinput.h>
+
+__sfr __at 0x00 stick;
+uint8_t old_stick;
+
+static char buf[32];
+static struct s_queue kqueue = {
+ buf, buf, buf, sizeof(buf), 0, sizeof(buf) / 2
+};
+
+/* Queue a character to the input device */
+void queue_input(uint8_t c)
+{
+ insq(&kqueue, c);
+ wakeup(&kqueue);
+}
+
+int platform_input_read(uint8_t *slot)
+{
+ uint8_t r, k;
+ if (remq(&kqueue, &r)) {
+ remq(&kqueue, &k);
+ *slot++ = KEYPRESS_CODE | r;
+ *slot++ = k;
+ return 2;
+ }
+
+ /* Clashes with Alpha joystick */
+ if (has_hr1g)
+ return 0;
+
+ r = ~stick;
+ if (r == old_stick)
+ return 0;
+
+ old_stick = r;
+
+ k = 0;
+ /* Legacy joystick encoding U|D = FIRE */
+ if ((r & 3) == 3) {
+ r &= ~3;
+ r |= 16;
+ }
+ if (r & 1)
+ k = STICK_DIGITAL_U;
+ if (r & 2)
+ k |= STICK_DIGITAL_D;
+ if (r & 4)
+ k |= STICK_DIGITAL_L;
+ if (r & 8)
+ k |= STICK_DIGITAL_R;
+ if (r & 16)
+ k |= BUTTON(0);
+ *slot++ = STICK_DIGITAL;
+ *slot++ = k;
+ return 2;
+}
+
+void platform_input_wait(void)
+{
+ psleep(&kqueue); /* We wake this on timers so it works for sticks */
+}
+
+int platform_input_write(uint8_t flag)
+{
+ flag;
+ udata.u_error = EINVAL;
+ return -1;
+}
+
+void poll_input(void)
+{
+ if (has_hr1g)
+ return;
+ if (~stick != old_stick)
+ wakeup(&kqueue);
+}
--- /dev/null
+
+extern void queue_input(uint8_t c);
+extern void poll_input(void);
+extern uint8_t vblank;
#include <tty.h>
#include <vt.h>
#include <devtty.h>
+#include <input.h>
+#include <devinput.h>
#include <stdarg.h>
static char tbuf1[TTYSIZ];
int m = 1;
for (n = 0; n < 8; n++) {
if ((key & m) && (keymap[i] & m)) {
- if (!(shiftmask[i] & m))
+ if (!(shiftmask[i] & m)) {
+ if (keyboard_grab == 3) {
+ queue_input(KEYPRESS_UP);
+ queue_input(keyboard[i][n]);
+ }
keysdown--;
+ }
}
if ((key & m) && !(keymap[i] & m)) {
if (!(shiftmask[i] & m)) {
static void keydecode(void)
{
uint8_t c;
+ uint8_t m = 0;
/* Convention for capslock or the mod */
- if (c == KEY_CAPSLOCK) {
- capslock = 1 - capslock;
- return;
- }
/* Only the model 3 has right shift (2) */
if (keymap[7] & 3) { /* shift (left/right) */
+ m = KEYPRESS_SHIFT;
c = shiftkeyboard[keybyte][keybit];
/* VT switcher */
if (c == KEY_LEFT || c == KEY_RIGHT) {
} else
c = keyboard[keybyte][keybit];
+ if (c == KEY_CAPSLOCK) {
+ capslock = 1 - capslock;
+ return;
+ }
/* The keyboard lacks some rather important symbols so remap them
with control (down arrow)*/
if ((keymap[6] | keymap[7]) & 16) { /* control */
+ m |= KEYPRESS_CTRL;
if (keymap[7] & 3) { /* shift */
if (c == '(')
c = '{';
else if (capslock && c >= 'a' && c <= 'z')
c -= 'a' - 'A';
if (c) {
-// kprintf("Typed %d:%c\n", c, c);
- vt_inproc(inputtty + 1, c);
- }
+ switch(keyboard_grab) {
+ case 0:
+ vt_inproc(inputtty + 1, c);
+ break;
+ case 1:
+ /* Proper rule needed FIXME */
+ if (c <= 0x83) {
+ vt_inproc(inputtty + 1, c);
+ break;
+ }
+ /* Fall through */
+ case 2:
+ queue_input(KEYPRESS_DOWN);
+ queue_input(c);
+ break;
+ case 3:
+ /* Queue an event giving the base key (unshifted)
+ and the state of shift/ctrl/alt */
+ queue_input(KEYPRESS_DOWN | m);
+ queue_input(keyboard[keybyte][keybit]);
+ break;
+ }
+ }
}
/* Polled 40 times a second */
}
if (vtq != vtbuf)
vtflush();
+ poll_input();
}
bankfixed.rel
vt.rel
devsys.rel
+devinput.rel
platform-trs80m1/devlpr.rel
platform-trs80m1/devtty.rel
platform-trs80m1/vtsupport.rel
+platform-trs80m1/devinput.rel
platform-trs80m1/discard.rel
-e