if ((PicoIn.AHW & PAHW_SC) && (a & 0x2) && !(d & 0x80)) {
// For SC-3000: 8255 control port. BSR mode used for printer and tape.
// debug hack to copy printer data to stdout.
- // Printer data is sent at about 4 KBaud, 10 bits per character:
+ // Printer data is sent at about 4.7 KBaud, 10 bits per character:
// start=0, 8 data bits (LSB first), stop=1. data line is inverted.
// no Baud tracking needed as all bits are sent through here.
static int chr, bit;
#include "../libpicofe/plat.h"
#include "emu.h" // for menuscreen hack
+#define KBD_ROWS 5
+
// pico
static struct key kbd_pico_row1[] = {
{ 0, "esc", "esc", PEVB_KBD_ESCAPE },
{ 0 },
};
-struct key *kbd_pico[] =
+struct key *kbd_pico[KBD_ROWS+1] =
{ kbd_pico_row1, kbd_pico_row2, kbd_pico_row3, kbd_pico_row4, kbd_pico_row5, NULL };
{ 0 },
};
-struct key *kbd_sc3000[] =
+struct key *kbd_sc3000[KBD_ROWS+1] =
{ kbd_sc3000_row1, kbd_sc3000_row2, kbd_sc3000_row3, kbd_sc3000_row4, kbd_sc3000_row5, NULL };
{
int i, j, k;
struct key *key;
+ int ypos = (vkbd->top ? 0 : g_screen_height - KBD_ROWS*me_sfont_h);
// HACK: smalltext_out is only available on menuscreen :-/
g_menuscreen_ptr = (u16 *)g_screen_ptr;
for (i = 0; vkbd->kbd[i]; i++) {
// darken background
for (j = 0; j < me_sfont_h; j++) {
- u16 *p = (u16 *)g_menuscreen_ptr + (i*me_sfont_h+j)*g_menuscreen_pp;
+ u16 *p = (u16 *)g_menuscreen_ptr + (ypos+i*me_sfont_h+j)*g_menuscreen_pp;
for (k = 0; k < g_menuscreen_w; k++) {
u16 v = *p;
*p++ = PXMASKH(v,1)>>1;
PXMAKE(0xa0, 0xa0, 0xa0);
char *text = (vkbd->shift ? key->upper : key->lower);
int xpos = key->xpos*me_sfont_w * g_menuscreen_w/320;
- smalltext_out16(xpos, i*me_sfont_h, text, color);
+ smalltext_out16(xpos, ypos+i*me_sfont_h, text, color);
}
}
}
}
if (pressed & (1<<GBTN_C)) {
vkbd->top = !vkbd->top;
+ plat_video_clear_buffers(); // if renderer isn't using full screen
}
if (pressed & (1<<GBTN_B)) {
vkbd->shift = !vkbd->shift;
}
if (pressed & (1<<GBTN_A)) {
- for (i = 0; i < VKBD_METAS; i++)
+ for (i = 0; i < VKBD_METAS && vkbd->meta[i][0] != -1; i++)
if (vkbd->y == vkbd->meta[i][0] && vkbd->x == vkbd->meta[i][1])
vkbd->meta_state = (vkbd->meta_state ^ (1<<i)) & (1<<i);
}
struct vkbd *vkbd_init(int is_pico)
{
struct vkbd *vkbd = is_pico ? &vkbd_pico : &vkbd_sc3000;
- memset(vkbd->meta+1, 0, sizeof(*vkbd) - sizeof(vkbd->kbd) - sizeof(vkbd->meta));
+ int offs = (u8 *)vkbd->meta - (u8 *)vkbd + sizeof(vkbd->meta);
+ memset((u8 *)vkbd + offs, 0, sizeof(*vkbd) - offs);
+ vkbd->top = 1;
return vkbd;
}
int i, j;
struct key *key;
+ if (g_menuscreen_w >= 480)
+ xoffs -= 50;
for (i = 0; desc[i]; i++) {
for (j = 0, key = &desc[i][j]; key->lower; j++, key++) {
int color = (key != hi ? PXMAKE(0xa0, 0xa0, 0xa0) :
PXMAKE(0xff, 0xff, 0xff));
char *text = (shift ? key->upper : key->lower);
+ if (g_menuscreen_w >= 480)
+ text_out16_(xoffs + key->xpos*me_mfont_w, yoffs + i*me_mfont_h, text, color);
+ else
smalltext_out16(xoffs + key->xpos*me_sfont_w, yoffs + i*me_sfont_h, text, color);
}
}
for (is_down = 1; is_down; )
kc = in_update_keycode(&bind_dev_id, &is_down, NULL, -1);
- in_bind_kbd_key(dev, bc, -1);
+ in_bind_kbd_key(dev, bc, 0);
in_bind_kbd_key(bind_dev_id, kc, kbd[keyy][keyx].key);
}
if (inp & PBTN_MA2) {
- in_bind_kbd_key(dev, bc, -1);
+ in_bind_kbd_key(dev, bc, 0);
}
}