Add ID message and keyboard test for apple2 kbds

This commit is contained in:
Dave 2021-12-04 23:10:33 -06:00
parent 116455ea61
commit 3a7e279453
6 changed files with 48 additions and 8 deletions

View File

@ -29,6 +29,7 @@
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_apple2_add_map.h"
#include "asdf_keymap_apple2.h"
// PROCEDURE:
// INPUTS:
@ -44,16 +45,24 @@
//
// COMPLEXITY:
//
void apple2_id_message(void) {
asdf_print("[Keymap: Apple 2 (u/l case)]");
}
void setup_apple2_keymap(void)
{
asdf_set_print_delay(APPLE2_PRINT_DELAY);
asdf_print("[Keymap: Apple 2 (u/l case)]");
apple_add_map(APPLE_PLAIN_MAP, MOD_PLAIN_MAP);
apple_add_map(APPLE_CAPS_MAP, MOD_CAPS_MAP);
apple_add_map(APPLE_SHIFT_MAP, MOD_SHIFT_MAP);
apple_add_map(APPLE_CTRL_MAP, MOD_CTRL_MAP);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST, applesoft_keyboard_test);
asdf_hook_assign(APPLE2_ID_MESSAGE, apple2_id_message);
asdf_virtual_init();

View File

@ -39,11 +39,11 @@
#if !defined(ASDF_KEYMAP_DEFS_APPLE2_H)
#define ASDF_KEYMAP_DEFS_APPLE2_H
// include DIP switch definitions
#include "asdf_keymap_defs_dipswitch.h"
#define APPLESOFT_KEYBOARD_TEST ASDF_HOOK_USER_9
#define APPLE2_ID_MESSAGE ASDF_HOOK_USER_10
#define APPLE2_PRINT_DELAY 40 // msec
// Edit the number of rows and columns used in this map. If the number is less
// than the maxium, the unused elements will be initialized to 0.
#endif /* !defined (ASDF_KEYMAP_DEFS_APPLE2_H) */

View File

@ -25,6 +25,7 @@
#include "asdf_arch.h"
#include "asdf.h"
#include "asdf_print.h"
#include "asdf_ascii.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_apple2_add_map.h"
@ -149,7 +150,18 @@ static const apple_keycode_matrix_t *apple_maps[] = {
[APPLE_CAPS_SHIFT_MAP] = &apple_caps_shift_matrix
};
void apple_add_map(const apple_map_index_t map_index,
void applesoft_keyboard_test(void)
{
asdf_print("10 GET A$\r");
asdf_print("20 A = ASC(A$)\r");
asdf_print("30 IF A < 32 THEN A$=\"CTL+\"+CHR$(A + 64)\r");
asdf_print("40 ?\"'\";A$;\"' = \";A:\r");
asdf_print("50 IF A <> 3 GOTO 10\r");
asdf_print("60 END\rRUN\r");
}
void apple_add_map(const apple_map_index_t map_index,
modifier_index_t modifier_index)
{

View File

@ -70,6 +70,8 @@ typedef enum {
// function prototypes
void applesoft_keyboard_test(void);
void apple_add_map(const apple_map_index_t map_index, modifier_index_t modifier_index);
#endif /* !defined (ASDF_KEYMAP_APPLE_ADD_MAP_H) */

View File

@ -29,6 +29,11 @@
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_apple2_add_map.h"
#include "asdf_keymap_apple2_caps.h"
void apple2_caps_id_message(void) {
asdf_print("[Keymap: Apple 2 CAPS]");
}
// PROCEDURE: setup_apple2_caps_keymap
// INPUTS: none
@ -46,14 +51,16 @@
//
void setup_apple2_caps_keymap(void)
{
asdf_print("[Keymap: Apple 2 CAPS]");
asdf_set_print_delay(APPLE2_PRINT_DELAY);
apple_add_map(APPLE_CAPS_MAP, MOD_PLAIN_MAP);
apple_add_map(APPLE_CAPS_MAP, MOD_CAPS_MAP);
apple_add_map(APPLE_CAPS_SHIFT_MAP, MOD_SHIFT_MAP);
apple_add_map(APPLE_CTRL_MAP, MOD_CTRL_MAP);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST, applesoft_keyboard_test);
asdf_hook_assign(APPLE2_CAPS_ID_MESSAGE, apple2_caps_id_message);
asdf_virtual_init();

View File

@ -32,6 +32,16 @@ typedef enum {
ASDF_HOOK_SCANNER,
ASDF_HOOK_OUTPUT,
ASDF_HOOK_EACH_SCAN,
ASDF_HOOK_USER_1,
ASDF_HOOK_USER_2,
ASDF_HOOK_USER_3,
ASDF_HOOK_USER_4,
ASDF_HOOK_USER_5,
ASDF_HOOK_USER_6,
ASDF_HOOK_USER_7,
ASDF_HOOK_USER_8,
ASDF_HOOK_USER_9,
ASDF_HOOK_USER_10,
ASDF_NUM_HOOKS,
} asdf_hook_id_t;