Skip to main content

Remapping Keys in AnzioWin

Introduction

It is possible through AnzioWin, Anzio for DOS and AnzioNet to remap the various key sequences sent to the host from your PC keyboard. This is done through the "define" command given to Anzio. While Anzio Lite does not support defined keys, it can, in almost all cases, send the redefined key by using the same "kys" file. See also our page on User-defined macros with Anzio as they are set up the same as keyboard remapping.

Many applications are designed to work with a specific terminal type or are expecting a specific key code to come from the terminal or terminal emulation package to represent special keys. Also, since many "dumb" terminals do not have the same keyboard layout that a PC does, there are keys on one, not found on the other, and vise versa.

Before you start remapping keys, make sure you understand what is happening first:

  1. the terminal emulation type you are running has certain keys defined to match its specifications
  2. the host application may utilize keys found on a "dumb" terminal that are not found on a PC keyboard
  3. the user may want to utilize a PC key, such as Home or End, that does not exist on the particular terminal keyboard Anzio is emulating.

It is important to know when you are going to mess keymapping up, rather than make it better.

Anzio 'Macros' menu item

Within AnzioWin, macros can be recorded, edited, executed and displayed through the Macros menu item.

Record

When you select this menu item, AnzioWin actually records the macro as it is happening. This is a great way to learn how macros can be written. Select this menu item, do what you need to and the reselect the menu item to turn off "record" mode. When you do, it will ask what macro key or special key you wish to assign the macro to. You can then look under the Macro : Edit macro menu item to see what is produced.

Edit

You can edit a macro through the Macro : Edit menu item. First select a letter or number to assign the macro to, or press the special key you wish to remap. Then enter the macro strings (see the Anzio documentation for more information on macro commands).

Run

Macros that are assigned to a function or special key can be ran by just pressing that key when in AnzioWin. Macros that have been assigned to a letter or a number, can be ran by first typing Ctrl-Shift-F1, or by going through the Macros menu item "Run macro".

Display

Display will display a list of keys in your key file and what they do, including any user defined macros.

 

Anzio 'keys' files

The Anzio keys files have the extension ".kys" and contain all special key definitions for the particular terminal type you are working with. Also any user-defined macros are found in this same file (user macros are associated with a single keystroke normally).

Reviewing the current key file

Depending on your default terminal type and the setting in the default parameters file, a key file will be loaded at start up. By going under the File menu and doing a  Read Keys  command, you can load a different keys file in to memory. You can review the current defined keys file by doing:

Ctrl-Shift-f 

Press the control, the shift and "f" to bring up the Function line at the bottom of the screen
keys This displays the current keymap file
Defining the key

To define a key do the   Ctrl-Shift-f   followed by the "define" command and it's definition. As an example, if we want to program the F10 key to do an escape-left bracket-tilde-1, do the following:

Ctrl-Shift-f 

Press control, shift and "f" to bring up the Function line
define F10 1B[~1  Type "define", space, F10, space, Ctrl-P, ESC, [, ~, 1

In the above example, you would press the necessary keys from the keyboard for the special keys. There are some exceptions to this, i.e. the escape key, which needs to be prefaced or substituted for (see notes below).

Another trick to redefining a key that is already defined is to enter a question mark after the special key. This will retrieve the current key definition for you to change:

Ctrl-Shift-f 

Press control, shift and "f" to bring up the Function line
define F10?  Type "define", space, F10, ?
Special key handling

Within the Anzio and the Windows environment, certain keystrokes are either intercepted by Windows or by AnzioWin. These keystrokes must either be prefaced by a special character sequence or substituted for.

The special character sequence Anzio uses is a Ctrl-P. As an example, when you need to enter an escape, do a  Ctrl-P followed by the ESC key.

Another important keystroke that must be substituted for, enter a vertical bar, "|",  to represent a carriage return. Additional information and examples can be found in the pages on user-defined macros.

Handling the 'keys' files

For each terminal type that Anzio supports, there is a pre-defined set of keyboard mappings. AnzioWin can redefine these keys and add others to them through the "define" function addressed above. However, it is important to remember that until this key file is saved, the key definitions are only stored in memory.

Under the File menu are the Save Keys and Read Keys menu items which allow you to read in to memory and save to disk certain keymap files. Care should be taken with the Save Keys in the file name chosen, to not write over a default file.

The key file name is saved in the defaults file so that the next time you call up a particular session of Anzio, it will retrieve the same key file.

All key files are usable by AnzioWin, Anzio for DOS and AnzioNet. Anzio Lite can also handle most all key files with the exception of some user-defined macros where a command may not be available to the Lite version.

In AnzioWin there is also the added feature that allows a user to merge another key file on top of the current key file. If keys are defined that are being merged in, they will overwrite what was already present in memory, so again, care should be taken.

Memory model within Anzio

There is one additional item to discuss here. Anzio temporarily stores the keys file in memory whenever a key file is read. However, there are a couple of things that can influence the keys file that you need to be aware of, such as programmable keys being loaded from the host, or user key remappings, or read/merge of keys. The example below demonstrates the sequence of events that can occur:

  1. At startup, Anzio loads its default keys file. The user gets logged in to their host.
  2. The user redefines the F1 key. This overwrite the F1 definition in memory.
  3. The user does a Merge with another key file. If this file contains an F1 definition, it overwrite what's in memory again.
  4. The user runs a host application that downloads programmable keys. If an F1 is included in this download, it overwrites the F1 definition in memory yet again.

And it can go on and on. It is important to know what influences what where keyboard definitions are involved in case something goes wrong along the way.

Copyright © 2024 Rasmussen Software, Inc. Legal Information & Privacy Policy
Send comments and suggestions to rsi@anzio.com