Skip to content

Commit

Permalink
Trigger matrix mode directly #140
Browse files Browse the repository at this point in the history
The problem: I've triggered matrix mode with keypress by emitting a
hypervisor trap for that functionality. Which works fine, unless you're
already in hypervisor mode (boot process, trying to debug situation when
stuck there!). In hypervisor mode, surely it's not possible to cause a
trap. Thus my idea, is to control matrix mode directly bypassing the
trap part. Seems to work fine so far ...
  • Loading branch information
lgblgblgb committed Jan 12, 2022
1 parent 29ee6fb commit 88d5134
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion targets/mega65/hypervisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define TRAP_FREEZER_USER_CALL 0x3F
#define TRAP_RESET 0x40
#define TRAP_FREEZER_RESTORE_PRESS 0x42
#define TRAP_ALTTAB 0x43
#define TRAP_MATRIX 0x43

extern int in_hypervisor;
extern int hickup_is_overriden;
Expand Down
15 changes: 12 additions & 3 deletions targets/mega65/input_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "xemu/cpu65.h"
#include "hypervisor.h"
#include "ui.h"
#include "matrix_mode.h"


#define DEBUGKBD(...) DEBUG(__VA_ARGS__)
Expand Down Expand Up @@ -266,12 +267,20 @@ static void kbd_trigger_alttab_trap ( void )
KBD_RELEASE_KEY(TAB_KEY_POS);
//KBD_RELEASE_KEY(ALT_KEY_POS);
//hwa_kbd.modifiers &= ~MODKEY_ALT;
matrix_mode_toggle(!in_the_matrix);
// TODO: remove the #if 0 part, if we're sure:
#if 0
// It would trigger matrix-mode via hypervisor call, but it has the problem that
// it won't work if you're already in hypervisor mode. So I reverted back to the
// direct method above. If it does not cause problem on longer term, let's remove this
// section.
if (!in_hypervisor) {
DEBUGPRINT("KBD: ALT-TAB trap has been triggered." NL);
hypervisor_enter(TRAP_ALTTAB);
DEBUGPRINT("KBD: MATRIX trap has been triggered." NL);
hypervisor_enter(TRAP_MATRIX);
} else {
DEBUGPRINT("KBD: *IGNORING* ALT-TAB trap trigger, already in hypervisor mode!" NL);
DEBUGPRINT("KBD: *IGNORING* MATRIX trap trigger, already in hypervisor mode!" NL);
}
#endif
}


Expand Down

0 comments on commit 88d5134

Please sign in to comment.