Skip to content
Permalink
Browse files

Entermice mouse mode, can be set/query via :XEP command

  • Loading branch information
lgblgblgb committed Mar 10, 2016
1 parent f942616 commit db5fa219951a182313a2b7170e8541dcb444d92d
Showing with 34 additions and 3 deletions.
  1. +17 −0 emu_rom_interface.c
  2. +15 −3 input.c
  3. +1 −0 main.c
  4. +1 −0 xepem.h
@@ -133,13 +133,30 @@ static void cmd_exit ( void )
}


static void cmd_entermice ( void )
{
switch (*carg) {
case '0':
case '1':
mouse_entermice(*carg - '0');
break;
case 0:
break;
default:
sprintf(COBUF, "*** Give 0 or 1 to set/clear EnterMice mode, or no parameter for query.\r\n");
return;
}
sprintf(COBUF, "Mouse mode is %s\r\n", mouse_entermice(-1) ? "EnterMice" : "BoxSoft");
}


static void cmd_help ( void );

static const struct commands_st commands[] = {
{ "cpu", "Set/query CPU type/clock", cmd_cpu },
{ "ram", "Set RAM size/report", cmd_ram },
{ "emu", "Emulation info", cmd_emu },
{ "emice", "Set on/off and query entermice mode", cmd_entermice },
{ "help", "This help screen", cmd_help },
{ "exit", "Exit Xep128", cmd_exit },
{ NULL, NULL, NULL }
18 input.c
@@ -22,6 +22,7 @@ static int _mouse_dx, _mouse_dy, _mouse_grab = 0;
static Uint8 _mouse_data_byte, _mouse_data_half, _mouse_last_shift, _mouse_read_state, _mouse_button_state;
static int _mouse_pulse = 0; // try to detect SymbOS or other simllar tests
static int _mouse_wait_warn = 1;
static int _mouse_entermice = 0;


int mouse_is_enabled ( void )
@@ -83,9 +84,9 @@ void mouse_reset(void)

Uint8 mouse_read(void)
{
Uint8 data = _mouse_button_state ? 0 : 4;
Uint8 data = _mouse_button_state ? 0 : (_mouse_entermice ? 2 : 4);
if (kbd_selector > 0 && kbd_selector < 5)
data |= (_mouse_data_half >> (kbd_selector - 1)) & 1;
data |= (_mouse_data_half >> (kbd_selector - 1)) & (_mouse_entermice ? 2 : 1);
_mouse_pulse = 0;
return data;
}
@@ -113,8 +114,19 @@ void mouse_check_data_shift(Uint8 val)
case 3:
_mouse_data_half = _mouse_data_byte & 15;
break;
default:
_mouse_data_half = 0; // for EnterMice, having 8 nibbles, but 0 for the last four ones
break;
}
_mouse_read_state = (_mouse_read_state + 1) & 3;
_mouse_read_state = (_mouse_read_state + 1) & (_mouse_entermice ? 7 : 3); // 4 or 8 nibble protocol
}


int mouse_entermice ( int entermice )
{
if (entermice >= 0)
_mouse_entermice = entermice;
return _mouse_entermice;
}


1 main.c
@@ -371,6 +371,7 @@ int main (int argc, char *argv[])
fprintf(stderr, "XEP ROM segment will be %02Xh @ %06Xh\n", xep_rom_seg, xep_rom_addr);
rom_size += 0x4000;
set_ep_ramsize(1024);
mouse_entermice(0); // 1=Entermice protocol (8 nibbles), 0=boxsoft (4 nibbles), also different lines
ep_reset();
kbd_matrix_reset();
#ifdef CONFIG_SDEXT_SUPPORT
@@ -148,6 +148,7 @@ void emu_mouse_motion(int dx, int dy);
Uint8 mouse_read(void);
void mouse_check_data_shift(Uint8 val);
void mouse_reset(void);
int mouse_entermice ( int entermice );

time_t emu_getunixtime(void);

0 comments on commit db5fa21

Please sign in to comment.
You can’t perform that action at this time.