#define POPT_DIS_FM_SSGEG (1<<23)\r
#define POPT_EN_FM_DAC (1<<24) //x00 0000\r
#define POPT_EN_FM_FILTER (1<<25)\r
+#define POPT_EN_PICO_KBD (1<<26)\r
\r
#define PAHW_MCD (1<<0)\r
#define PAHW_32X (1<<1)\r
uint64_t time_keydown;\r
uint8_t key_state;\r
uint8_t shift_state;\r
+ uint8_t active;\r
} picohw_kb;\r
typedef struct\r
{\r
unsigned int reserved[3];\r
unsigned char xpcm_buffer[XPCM_BUFFER_SIZE+4];\r
unsigned char *xpcm_ptr;\r
- int is_kb_active;\r
- int inp_mode;\r
picohw_kb kb;\r
} picohw_state;\r
extern picohw_state PicoPicohw;\r
case 0x08: d = (PicoPicohw.pen_pos[1] >> 8); break;
case 0x0a: d = PicoPicohw.pen_pos[1] & 0xff; break;
case 0x0c: d = (1 << (PicoPicohw.page & 7)) - 1;
- if (PicoPicohw.page == 7) {
- d = 0x2a; // 0b00101010
- } else {
- d = ((1 << (PicoPicohw.page & 7)) - 1);
- }
+ if (PicoPicohw.page == 7) d = 0x2a; // 0b00101010
break;
case 0x10: d = (PicoPicohw.fifo_bytes > 0x3f) ? 0 : (0x3f - PicoPicohw.fifo_bytes); break;
case 0x12: d = (PicoPicohw.fifo_bytes | !PicoPicoPCMBusyN()) ? 0 : 0x8000;
PicoPicohw.fifo_bytes = 0;
PicoPicoPCMResetN(1);
}
- // other bits used in software: 0x3f00.
+ // TODO: other bits used in software: 0x3f00.
}
else
elprintf(EL_UIO, "m68k unmapped w16 [%06x] %04x @%06x", a, d & 0xffff, SekPc);
static u32 PicoRead8_pico_kb(u32 a)
{
u32 d = 0;
- if (PicoPicohw.is_kb_active == 0) {
+ if (!(PicoIn.opt & POPT_EN_PICO_KBD)) {
elprintf(EL_PICOHW, "kb: r @%06X %04X = %04X\n", SekPc, a, d);
return d;
}
case 0x6: d = 0; // l&kbtype
break;
case 0x7: // cap/num/scr
- if (PicoPicohw.inp_mode == 3) {
+ if (PicoPicohw.kb.active) {
if (key == PEVB_PICO_PS2_CAPSLOCK && PicoPicohw.kb.has_caps_lock == 1) {
PicoPicohw.kb.caps_lock = PicoPicohw.kb.caps_lock == 4 ? 0 : 4;
PicoPicohw.kb.has_caps_lock = 0;
break;
case 0x8:
d = 6;
- if (PicoPicohw.inp_mode == 3) {
+ if (PicoPicohw.kb.active) {
if (key) {
PicoPicohw.kb.key_state = KEY_DOWN;
}
}\r
if (events & PEV_PICO_PAD) {\r
if (pico_inp_mode == 2) {\r
- pico_inp_mode = (PicoPicohw.is_kb_active ? 3 : 0);\r
+ pico_inp_mode = (PicoIn.opt & POPT_EN_PICO_KBD ? 3 : 0);\r
emu_status_msg("Input: %s", pico_inp_mode ? "Keyboard" : "D-Pad");\r
} else if (pico_inp_mode == 3) {\r
pico_inp_mode = 0;\r
emu_status_msg("Pen %s", PicoPicohw.pen_pos[0] & 0x8000 ? "Up" : "Down");\r
}\r
\r
- if ((currentConfig.EmuOpt & EOPT_PICO_PEN) &&\r
- (PicoIn.pad[0]&0x20) && pico_inp_mode && pico_overlay) {\r
+ if (((currentConfig.EmuOpt & EOPT_PICO_PEN) &&\r
+ (PicoIn.pad[0]&0x20) && pico_inp_mode && pico_overlay) ||\r
+ (!(PicoIn.opt & POPT_EN_PICO_KBD) && pico_inp_mode == 3)) {\r
pico_inp_mode = 0;\r
emu_status_msg("Input: D-Pad");\r
}\r
- if (events & PEV_PICO_SWPS2) {\r
- PicoPicohw.is_kb_active = !PicoPicohw.is_kb_active;\r
- if (pico_inp_mode == 3) pico_inp_mode = 0;\r
- emu_status_msg("Keyboard %sconnected", PicoPicohw.is_kb_active ? "" : "dis");\r
- }\r
\r
- PicoPicohw.inp_mode = pico_inp_mode;\r
+ PicoPicohw.kb.active = pico_inp_mode == 3;\r
\r
if (pico_inp_mode == 0 || pico_inp_mode == 3)\r
return;\r
#define PEVB_PICO_STORY 19
#define PEVB_PICO_PAD 18
#define PEVB_PICO_PENST 17
-#define PEVB_PICO_SWPS2 16
-#define PEVB_RESET 15
+#define PEVB_RESET 16
#define PEV_VOL_DOWN (1 << PEVB_VOL_DOWN)
#define PEV_VOL_UP (1 << PEVB_VOL_UP)
#define PEV_PICO_STORY (1 << PEVB_PICO_STORY)
#define PEV_PICO_PAD (1 << PEVB_PICO_PAD)
#define PEV_PICO_PENST (1 << PEVB_PICO_PENST)
-#define PEV_PICO_SWPS2 (1 << PEVB_PICO_SWPS2)
#define PEV_RESET (1 << PEVB_RESET)
-#define PEV_MASK 0x7fff8000
+#define PEV_MASK 0x7fff0000
/* Keyboard Pico */
{ SDLK_F8, IN_BINDTYPE_EMU, PEVB_PICO_STORY },
{ SDLK_F9, IN_BINDTYPE_EMU, PEVB_PICO_PAD },
{ SDLK_F10, IN_BINDTYPE_EMU, PEVB_PICO_PENST },
- { SDLK_F12, IN_BINDTYPE_EMU, PEVB_PICO_SWPS2 },
{ SDLK_BACKSPACE, IN_BINDTYPE_EMU, PEVB_FF },
{ 0, 0, 0 }
{ "Pico Storyware ", PEV_PICO_STORY },
{ "Pico Pad ", PEV_PICO_PAD },
{ "Pico Pen state ", PEV_PICO_PENST },
- { "Pico Keyboard ", PEV_PICO_SWPS2 },
{ NULL, 0 }
};
mee_onoff_h ("FM filter", MA_OPT_FM_FILTER, PicoIn.opt, POPT_EN_FM_FILTER, h_fmfilter),
mee_onoff_h ("FM DAC noise", MA_OPT2_ENABLE_YM_DAC, PicoIn.opt, POPT_EN_FM_DAC, h_dacnoise),
mee_onoff_h ("Pen button shows screen", MA_OPT_PICO_PEN, currentConfig.EmuOpt, EOPT_PICO_PEN, h_picopen),
+ mee_onoff ("Pico Keyboard", MA_OPT_PICO_KBD, PicoIn.opt, POPT_EN_PICO_KBD),
mee_end,
};
MA_OPT_SOUND_ALPHA,
MA_OPT_FM_FILTER,
MA_OPT_PICO_PEN,
+ MA_OPT_PICO_KBD,
MA_OPT2_GAMMA,
MA_OPT2_A_SN_GAMMA,
MA_OPT2_DBLBUFF, /* giz */