http://hp.giesselink.com/emu48.htm
- Code: Select all
EmuXY and KML 2.0
Introduction
This document explains in detail the KML 2.0 scripting files. KML, Keyboard Mapping Language, started as a script that Emu48 used to map keyboard buttons with buttons of the emulator, now it has become much more. KML 2.0, also used by Emu10, Emu28, Emu42 and Emu71, now makes it possible to change many advanced options of the way the emulator looks.
The description of Emu32 has been removed from this document. The development of Emu32 has quit, the emulated calculators are now emulated by Emu42. So Emu42 now emulates two quite different hardware platforms, the High End Pioneer and Clamshell series with a dot matrix display which base on the Lewis chip and the Mid Range Pioneer series with a semi dot matrix display which base on the Sacajawea chip. To distinguish both emulation platforms I use, if necessary, Emu42 (Lewis) and Emu42 (Sacajawea) in the further text.
Index
Basics Page 1
Global Page 2
Background Page 5
LCD Page 6
Digit Page 9
Annunciator Page 10
Button Page 11
OutIn Codes Page 13
Locale Page 22
Scancode Page 24
Conclusion Page 27
Basics
A KML script file is a text file that the emulators use to set its screen layout and keyboard layout. A custom bitmap file can be created to be the “faceplate” of the calculator. KML defines the size and position of the screen, buttons, annunciators, and the emulator window. The “#” character can be used to add remarks to a line. The following sections describe each main block of the KML script.
Global
The global section of the KML file tells the bitmap, title of the KML, and the Calculator hardware and the model. The following is the syntax.
Global
Title STRING
Author STRING
Hardware STRING
Model STRING
Class INTEGER
Rom STRING
Patch STRING
Bitmap STRING
Color INTEGER INTEGER INTEGER INTEGER
Print STRING
Debug INTEGER
End
Title is the title of the KML file that the emulator will use. This is not the filename.
Example:
Title “John’s Gx”
Author is the author of the KML file.
Example:
Author “John Doe”
Hardware is the emulated calculator hardware. This definition is optional on Emu48. The parameter is necessary to separate the KML scripts from each emulator. Valid entries are
Emu10:
Hardware “Bert”
Emu28:
Hardware “Centipede”
Emu42:
Hardware “Lewis”
Emu48:
Hardware “Yorke”
Emu71:
Hardware “Saturn”
Model is the model of your emulated calculator inside the hardware family. The model entries differ from hardware to hardware. This setting groups KML files of the same hardware and ROM together. When switching between KML scripts, it is the first character of the parameter that is checked against the type of the current document (which was set by the Model command in the KML file with which the document was created). Valid entries are:
Emu10:
“E” = HP10B
“F” = HP20S
“M” = HP21S
Emu28:
“P” = HP28C
Emu42:
“I” = HP14B
“T” = HP17B
“U” = HP17BII
“Y” = HP19BII
“M” = HP27S
“O” = HP28S
“N” = HP32SII
“D” = HP42S
Emu48:
“6” = HP38G (64KB RAM)
“A” = HP38G
“E” = HP39G or HP40G
“G” = HP48G, HP48G+ or HP48GX
“S” = HP48S or HP48SX
“X” = HP49G
Emu71:
“T” = HP71B
Example:
Model “G”
Class is used for different calculators base on the same ROM for further distinction. For other models than listed below this argument can be omitted. Valid entries are:
Emu42:
“32” = HP42S with 32KB RAM
Emu48:
“39” = HP39G
“40” = HP40G
Example:
Class 39
Rom is the name of your ROM file.
Example:
Rom “ROM.48G”
Patch is the name of a ROM patch file. Any file with correct syntax can be used as a patch file. Multiple Patch lines can be used, and all files will be loaded in the order in which they are declared. Important: They must appear after the Rom command.
Example:
Patch “BEEP.48”
Bitmap is the bitmap file that will be the “faceplate”. All emulator versions are supporting the BMP file format, the latest versions also the Graphics Interchange Format (GIF).
Example:
Bitmap “mygx.bmp”
Color is an optional setting to define the transparency color of the background bitmap. It takes effect only when both, title bar and menu bar are not shown. The first integer specifies the maximum tolerance between bitmap pixel and reference for color matching followed by three integers defining the RGB numbers (Red, Green and Blue) of the transparency reference color. Each RGB number range from 0 to 255. The difference between the actual pixel and the transparency color is calculated by the formula:
Difference = |ΔR| + |ΔG| + |ΔB| where the Δ are the count differences between the color parts of the pixel and the transparency reference color. The given tolerance value must be greater or equal to the calculated difference to handle this background bitmap position as transparent. Because of setting the bitmap position to transparent it’s quite important that the display area in the background bitmap is not set to transparent, else the complete display area will be transparent even if the colors of the display pixel don’t match with the transparency reference color.
Example:
Color 0 255 0 0
Print will display a string when the KML file is loaded. You can have as many of these as necessary. They are more effective if you put them before the other settings.
Example:
Print “My homepage is at http://hp.giesselink.com/”
Debug sets the emulator to return an information message box telling the scancode number of the keyboard key pressed when the scancode number isn’t defined. Valid entries are 0 or 1. One is on and Zero is off.
Example:
Debug 1
Background
This section sets where the background bitmap will be placed and the size of the emulator window.
Background
Vga INTEGER
Topbar INTEGER
Menubar INTEGER
Offset INTEGER INTEGER
Size INTEGER INTEGER
End
Offset is how far the top left corner of the bitmap will be offset in the window. Most of the time you should set this to 0 0. The first integer is the amount of pixels to the right and the second is that amount of pixels down.
Example:
Offset 0 0
Size sets the size of the emulator window in pixels. The first integer is the width and the second is the height. This is the width of the window, not the bitmap. It is usually smaller than the bitmap size because the bitmap normally contain the annunciator symbols.
Example:
Size 302 485
Vga is a special command only for the Pocket PC versions of Emu42 and Emu48 to enable/disable the use of VGA screen resolution on a VGA capable Pocket PC. Valid entries are 0 or 1. One is the VGA mode with 640x480 pixel and Zero is the QVGA mode with 320x240 pixel.
Example:
Vga 1
Topbar is a special command only for the Pocket PC versions of Emu42 and Emu48 to enable/disable the top bar of the screen. Valid entries are 0 or 1. One is enabled and Zero is disabled.
Example:
Topbar 0
Menubar is a special command only for the Pocket PC versions of Emu42 and Emu48 to enable/disable the menu bar of the screen. If the menu bar is disabled you can get the menu over the context menu gesture on a display area isn’t covered by virtual key buttons. Valid entries are 0 or 1. One is enabled and Zero is disabled.
Example:
Menubar 0
LCD
This section set the size, position and contrast setting of the LCD screen.
Lcd
Zoom INTEGER
Zoomxy INTEGER INTEGER
Vertical INTEGER
Offset INTEGER INTEGER
Color INTEGER INTEGER INTEGER INTEGER
End
Zoom is the size of the pixels in the LCD screen. This command is only valid for Emu28, Emu42 (Lewis) Emu48 and Emu71 and will be ignored on Emu10 and Emu42 (Sacajawea). Valid entries are 1, 2, 3 or 4. Zoom factor two is usually used by the dot matrix LCD types emulated by Emu28, Emu42 (Lewis), Emu48 and Emu71.
Example:
Zoom 2
Zoomxy is a variant of the Zoom command only valid for Emu42 (Lewis). On Emu42 (Lewis) the High-End-Pioneer calculator series has originally a non quadratic rectangle as display pixel. The height of the pixel is normally bound to the zoom factor. But in some circumstances it’s useful to adjust the height of the pixel separately from the width. The first integer is the width and the second integer is the height of the dot matrix pixel. The width integer is still limited to 1, 2, 3 or 4, but the height integer can be any positive integer number.
Example:
Zoomxy 2 3
Offset sets the position of the LCD screen. The first integer is the amount of pixels right and the second is the amount of pixels down.
Example:
Offset 20 20
Color sets the color of the LCD display for different contrast settings. The first Integer is the contrast setting value. The number of setting values depends on the hardware type.
Emu10:
0-7 = 0 is lightest, 7 is darkest
Emu42 (Sacajawea), Emu71:
0-15 = foreground colors (Pixel on), 0 is lightest, 15 is darkest
16-31 = background colors (Pixel off), 16 corresponds to 0, 17 to 1, …
Emu28, Emu42 (Lewis):
0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest
32-63 = background colors (Pixel off), 32 corresponds to 0, 33 to 1, …
Emu48:
0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest
32-63 = background colors (Pixel off), 32 corresponds to 0, 33 to 1, …
unused value at background color = use color defined by setting 0
You should include one line for every foreground color setting. The other three integers are the RGB numbers (Red, Green, Blue). The RGB numbers range from 0 to 255. The background color number for the corresponding foreground color is always calculated by adding the first background number setting to the color value. At Emu42 for Pocket PC and Emu48 an undefined foreground color value 0 mean “white” else “black”, an undefined background color means using foreground color 0. At Emu10, Emu28, Emu42 (Sacajawea), Emu42 (Lewis) and Emu71 undefined contrast settings mean transparent mode showing the background image.
Example:
Color 0 255 255 255
Color 1 220 220 220
…
Color 30 10 10 10
Color 31 0 0 0
Color 32 255 255 255 # optional background color for contrast setting
But the calculator ROM bounds the contrast setting with the keyboard to useful values for each calculator model. The easiest way to generate reasonable contrast settings is to put the calculator to lowest possible darkness value by keyboard and enter the corresponding RGB values to your KML script at the lowest possible setting by ROM (background = pixel off color, foreground = near to background color). In the next step put the calculator to highest possible darkness value by keyboard and enter the corresponding RGB values to your KML script at the highest possible setting by ROM (background = pixel on color, foreground = near to background color). Next important point is the darkness reset value of the Rom because this should be the point of best contrast between fore- and background color. So in the first range between lowest darkness and reset point, use the pixel off color for all background colors and calculated RGB values by a nearly equal distance algorithm for each color part for the foreground colors. For the second range between reset point and highest darkness use the foreground pixel color of the reset point for all foreground colors and calculated RGB values by a nearly equal distance algorithm for each color part for the background colors.
The contrast settings outside these areas (accessible by hardware so it’s not useless) can be calculated by the distance between each color channel with saturation to no contrast at pixel off on one side, and pixel on the other side.
Contrast setting for each calculator model:
Emulator Range Reset Min Max
HP10B Emu10 0-7 4 2 6
HP14B Emu42 0-15 6 0 15
HP17B Emu42 0-31 22 15 31
HP17BII Emu42 0-31 22 15 31
HP19BII Emu42 0-31 22 16 31
HP20S Emu10 0-7 4 2 6
HP21S Emu10 0-7 4 2 6
HP27S Emu42 0-31 22 15 31
HP28C Emu28 0-31 26 20 31
HP28S Emu42 0-31 22 16 31
HP32SII Emu42 0-15 6 0 15
HP38G Emu48 0-31 14 9 24
HP39G Emu48 0-31 12 9 24
HP40G Emu48 0-31 12 9 24
HP42S Emu42 0-31 22 15 31
HP48SX Emu48 0-31 11 3 19
HP48GX Emu48 0-31 14 9 24
HP49G Emu48 0-31 14 9 24
HP71B Emu71 0-15 9 0 15
Range : hardware range (accessible by assembler)
Reset : contrast value after calculator reset
Min : min. adjustable contrast value by keyboard
Max : max. adjustable contrast value by keyboard
On Emu28 and Emu42 (Lewis) the contrast setting of the annunciators depends on the current main display contrast setting and the contrast setting of each annunciator. In normal operation the annunciator color of an on annunciator is exactly the pixel on color of the current contrast. Modifying the annunciator contrast from the default setting will choose a color below or above the current pixel on contrast setting. To avoid any misbehaviors fill the complete display color table of the emulator with reasonable values please.
Vertical is a special command only for the Pocket PC versions of Emu42 (Lewis) and Emu48 to rotate the display by 90˚ clock or anticlockwise to allow skins in landscape mode. Valid entries are 0 for portrait, 1 for anticlockwise and 2 for clockwise rotated landscape mode. The default setting is portrait mode.
Example:
Vertical 1
Digit
This section is only valid for Emu10 and Emu42 (Sacajawea) and describes the (alpha-) numeric part of the LCD screen. Emu10 and Emu42 (Sacajawea) are using different methods for creating a numeric value.
Digit
Offset INTEGER INTEGER
Size INTEGER INTEGER
Distance INTEGER
Bitmap STRING
End
Emu10:
The low-end Pioneer series use a classic 7 segment LCD. With the first nine annunciators (segments ‘a’ to ‘g’, ‘dp’ and ‘cm’) one digit is described.
The commands Offset and Size are unused.
Distance is the distance in pixel between the beginnings of each digit, so only one description for a digit is necessary.
Example:
Distance 18 # distance between digits
Bitmap is an optional command for including an external annunciator bitmap instead of using the annunciators in the background bitmap.
Example:
Bitmap “mylcd.bmp”
Emu42 (Sacajawea):
The Mid Range Pioneer series use a 5x7 pixel dot matrix for each digit.
Size is the size of one pixel in the LCD screen. Width Height.
Example:
Size 3 4 # size of LCD pixel
Offset is the position of the first digit inside the display area.
Example:
Offset 17 13 # position of 1st digit
Distance set the distance in pixel between the beginnings of each digit.
Example:
Distance 21 # distance between digits
Bitmap is an optional command for including an external annunciator bitmap instead of using the annunciators in the background bitmap.
Example:
Bitmap “mylcd.bmp”
Annunciator
Annunciators are the 23 (Emu10), 60 (Emu42 (Sacajawea)), six (Emu48), seven (Emu28, Emu42 (Lewis)) and 32 (Emu71) status icons on the screen. You must specify one of these blocks for each annunciator.
Annunciator INTEGER
Size INTEGER INTEGER
Offset INTEGER INTEGER
Down INTEGER INTEGER
End
Annunciator tells which annunciator you are setting. Valid entries are emulator depending and can vary from 1 through 6, 7, 23, 32 or 60. The annunciator symbol itself depends on the specific LCD of the calculator. Refer to existing KML scripts for getting the symbol of each annunciator.
Example:
Annunciator 1
Size is the size of the annunciator in pixels. Width Height.
Example:
Size 16 11
Offset is the position that the annunciator will be displayed. This is the blank part.
Example:
Offset 61 4
Down is the position of the annunciator in the bitmap when it is on. There are some restrictions on the different emulators. On Emu10 and Emu42 (Sacajawea) the annunciators must draw in black on a white background. On Emu28 and Emu42 (Lewis) and Emu71 the pixel at the Down position must contain the background color, this is necessary for masking operation. Emu48 don’t mask the background color, here the annunciator must have the background color of the target area.
Example:
Down 16 485
Button
Button sets the position of the button and what the button does.
Button INTEGER
Type INTEGER
Size INTEGER INTEGER
Offset INTEGER INTEGER
Down INTEGER INTEGER
OutIn INTEGER INTEGER
Virtual
NoHold
OnUp
<Commands>
End
OnDown
<Commands>
End
End
Button tells the number of the button you are creating. This can be any number. Most times the number is chosen representing the row and column number of the button. Any number can be used, but only 256 buttons can be declared. If more buttons are declared, only the first 256 will be used, and the others will be ignored.
Example:
Button 11
Type tells how the button will behave when it is pressed. Valid entries are 0, 1, 2, 3, 4, or 5.
Type 0 (default) is copying a part of the background bitmap with the dimension Size from the source position Down to the target position Offset.
Type 1 is copying an inner part of the background bitmap with the dimension Size from the source position Offset to the target position Offset one pixel right down. The resulting button gets a new black and white border. This is a default button effect for special designed background bitmaps.
Type 2 does nothing.
Type 3 is drawing a part of the background bitmap with the dimension Size at the target position Offset with inverted colors. This type can be used for a button inside the LCD screen area. The effect on the LCD screen depends on the emulator.
Type 4 is copying a part of the background bitmap with the dimension Size from the source position Offset to the target position Offset showing the background bitmap behind the LCD screen while the key pressed. This type is only useful in Emu48 with disabled option "Enable Virtual LCD Delay". On all other emulators this type isn’t working.
Type 5 is drawing a transparent circle inside the rectangle given by Size into the middle of the button area given by target position Offset and the dimension Size.
All other Type values are drawing a black rectangle with the dimension Size at the target position Offset. Remember that this behavior can change on introducing a new type. So don’t use this type in public scripts.
Example:
Type 0
Size sets the size of the button. Width height.
Example:
Size 36 25
Offset sets the position of the button. This is when it is not pressed. Pixels right and pixels down.
Example:
Offset 8 158
Down sets the picture of the down button. This is only needed if type 0 is set. Pixels right and pixels down.
Example:
Down 302 25
OutIn tells the emulator which button is being pressed. Tables of OutIn codes are on the next pages of this document.
Example:
OutIn 1 16
Virtual mode should be used for buttons that duplicate the function of a calculator button. This type of button cannot be held down. A OnDown event is generated when the button pressed. A OnUp event is generated when the button is released.
Example:
Virtual
NoHold will keep a button from sticking in the down position. It only generates an OnUp event.
Example:
NoHold
OnDown and OnUp are used to carryout scancode commands when you press a button. Any Scancode command (see page 21) can be used. OnDown is when the button is pressed down. OnUp is when the button is released.
Example:
OnDown
Press 81
Press 63
End
OnUp
Release 63
Release 81
End
OutIn Codes HP10B
Key
OutIn
N I/YR PV PMT FV SUM+
5 64 4 64 3 64 2 64 1 64 0 64
% RCL CFj CST PRC MAR
5 32 4 32 3 32 2 32 1 32 0 32
INPUT ->M RM M+ <-
4 16 3 16 2 16 1 16 0 16
+/- 7 8 9 /
5 8 3 8 2 8 1 8 0 8
K 4 5 6 *
5 4 3 4 2 4 1 4 0 4
SHIFT 1 2 3 -
5 2 3 2 2 2 1 2 0 2
C 0 . = +
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP14B
Key
OutIn
N I/YR PV PMT FV SUM+
0 16 1 16 2 16 5 16 4 16 3 16
STO RCL CST PRC MAR STAT
0 1 1 1 2 1 5 1 4 1 3 1
INPUT +/- ( ) <-
1 4 2 4 5 4 4 4 3 4
% 7 8 9 /
0 2 2 2 5 2 4 2 3 2
v 4 5 6 *
0 8 2 8 5 8 4 8 3 8
SHIFT 1 2 3 -
0 32 2 32 5 32 4 32 3 32
C 0 . = +
0 32768 2 64 5 64 4 64 3 64
OutIn Codes HP17B / HP17BII
Key
OutIn
^ ^ ^ ^ ^ ^
5 64 4 64 3 64 2 64 1 64 0 64
STO RCL % DSP PRT EXIT
5 32 4 32 3 32 2 32 1 32 0 32
INPUT +/- ( ) <-
4 16 3 16 2 16 1 16 0 16
^ 7 8 9 /
5 8 3 8 2 8 1 8 0 8
v 4 5 6 *
5 4 3 4 2 4 1 4 0 4
SHIFT 1 2 3 -
5 2 3 2 2 2 1 2 0 2
C 0 . = +
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP19BII
Key
OutIn
A B C D E F
6 256 6 2048 6 64 6 32 6 1 6 1024
G H I J K L
5 256 5 2048 5 64 5 32 5 1 5 1024
M N O P Q R
4 256 4 2048 4 64 4 32 4 1 4 1024
S T U V W X
3 256 3 2048 3 64 4 32 4 1 4 1024
Y Z ? $ # :
2 256 2 2048 2 64 2 32 2 1 2 1024
SPACE INS DEL <- ->
1 2048 1 64 1 32 1 1 1 1024
Key
OutIn
7 2 7 128 7 512 7 4 7 8 7 16
SHIFT STO RCL DISP PRNT EXIT
6 2 6 128 6 512 6 4 6 8 6 16
INPUT +/- ( ) <-
6 128 5 512 5 4 5 8 5 16
^ 7 8 9 /
4 2 4 128 4 512 4 4 4 8
v 4 5 6 *
3 2 3 128 3 512 3 4 3 8
% 1 2 3 -
5 2 3 2 2 2 1 2 0 2
ON O . = +
0 32768 1 128 1 512 1 4 1 8
OutIn Codes HP20S / HP21S
Key
OutIn
SQR(X) e^X LN Y^X 1/X SUM+
5 64 4 64 3 64 2 64 1 64 0 64
STO RCL SIN COS TAN R/S
5 32 4 32 3 32 2 32 1 32 0 32
INPUT +/- ( ) <-
4 16 3 16 2 16 1 16 0 16
XEQ 7 8 9 /
5 8 3 8 2 8 1 8 0 8
<-\ 4 5 6 *
5 4 3 4 2 4 1 4 0 4
/-> 1 2 3 -
5 2 3 2 2 2 1 2 0 2
C 0 . = +
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP27S
Key
OutIn
^ ^ ^ ^ ^ ^
5 64 4 64 3 64 2 64 1 64 0 64
STO RCL SIN COS TAN EXIT
5 32 4 32 3 32 2 32 1 32 0 32
INPUT +/- ( ) <-
4 16 3 16 2 16 1 16 0 16
^ 7 8 9 /
5 8 3 8 2 8 1 8 0 8
v 4 5 6 *
5 4 3 4 2 4 1 4 0 4
SHIFT 1 2 3 -
5 2 3 2 2 2 1 2 0 2
C 0 . = +
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP28C
Key
OutIn
A B C D E F
6 16 6 32 6 2048 6 1024 6 512 6 128
G H I J K L
5 16 5 32 5 2048 5 1024 5 512 5 128
M N O P Q R
4 16 4 32 4 2048 4 1024 4 512 4 128
S T U V W X
3 16 3 32 3 2048 3 1024 3 512 3 128
Y Z # { [ (
2 16 2 32 2 2048 2 1024 2 512 2 128
SPACE << = LC ALPHA
1 32 1 2048 1 1024 1 512 1 128
Key
OutIn
INS DEL ^ v < >
7 256 7 64 7 8 7 1 7 2 7 4
SHIFT <^v> TRIG SOLV USER NEXT
6 256 6 64 6 8 6 1 6 2 6 4
ENTER CHS EEX DROP <-
5 64 5 8 5 1 5 2 5 4
' 7 8 9 /
4 256 4 64 4 8 4 1 4 2
STO 4 5 6 *
3 256 3 64 3 8 3 1 3 2
EVAL 1 2 3 -
2 256 2 64 2 8 2 1 2 2
ON O . , +
0 32768 1 64 1 8 1 1 1 2
OutIn Codes HP28S
Key
OutIn
A B C D E F
6 256 6 2048 6 64 6 32 6 1 6 1024
G H I J K L
5 256 5 2048 5 64 5 32 5 1 5 1024
M N O P Q R
4 256 4 2048 4 64 4 32 4 1 4 1024
S T U V W X
3 256 3 2048 3 64 4 32 4 1 4 1024
Y Z # { [ (
2 256 2 2048 2 64 2 32 2 1 2 1024
SPACE << = LC ALPHA
1 2048 1 64 1 32 1 1 1 1024
Key
OutIn
INS DEL ^ v < >
7 2 7 128 7 512 7 4 7 8 7 16
SHIFT <^v> TRIG SOLV USER NEXT
6 2 6 128 6 512 6 4 6 8 6 16
ENTER CHS EEX DROP <-
6 128 5 512 5 4 5 8 5 16
' 7 8 9 /
4 2 4 128 4 512 4 4 4 8
STO 4 5 6 *
3 2 3 128 3 512 3 4 3 8
EVAL 1 2 3 -
2 2 2 128 2 512 2 4 2 8
ON O . , +
0 32768 1 128 1 512 1 4 1 8
OutIn Codes HP32SII
Key
OutIn
SQr(X) e^X LN Y^X 1/X SUM+
5 64 4 64 3 64 2 64 1 64 0 64
STO RCL Rv SIN COS TAN
5 32 4 32 3 32 2 32 1 32 0 32
ENTER X<>Y +/- E <-
4 1 3 1 2 1 1 1 0 1
XEQ 7 8 9 /
5 8 3 8 2 8 1 8 0 8
<-\ 4 5 6 *
5 16 3 16 2 16 1 16 0 16
/-> 1 2 3 -
5 4 3 4 2 4 1 4 0 4
EXIT 0 . R/S +
0 32768 3 2 2 2 1 2 0 2
OutIn Codes HP42S
Key
OutIn
SUM+ 1/X SQR(X) LOG LN XEQ
5 64 4 64 3 64 2 64 1 64 0 64
STO RCL Rv SIN COS TAN
5 32 4 32 3 32 2 32 1 32 0 32
ENTER X<>Y +/- E <-
4 16 3 16 2 16 1 16 0 16
^ 7 8 9 /
5 8 3 8 2 8 1 8 0 8
v 4 5 6 *
5 4 3 4 2 4 1 4 0 4
SHIFT 1 2 3 -
5 2 3 2 2 2 1 2 0 2
EXIT 0 . R/S +
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP48SX (HP48GX / HP38G)
Key
OutIn
A B C D E F
1 16 8 16 8 8 8 4 8 2 8 1
G H I J K L
2 16 7 16 7 8 7 4 7 2 7 1
M N O P Q R
0 16 6 16 6 8 6 4 6 2 6 1
S T U V W X
3 16 5 16 5 8 5 4 5 2 5 1
ENTER Y Z DEL DROP
4 16 4 8 4 4 4 2 4 1
A 7 8 9 /
3 32 3 8 3 4 3 2 3 1
<-\ 4 5 6 *
2 32 2 8 2 4 2 2 2 1
/-> 1 2 3 -
1 32 1 8 1 4 1 2 1 1
ON 0 . SPC +
0 32768 0 8 0 4 0 2 0 1
OutIn Codes HP49G (HP39G / HP40G)
Key
OutIn
A B C D E F
5 1 5 2 5 4 5 8 5 16 5 32
G H I ^
5 128 4 128 3 128 6 8
J K L < v >
2 128 1 128 0 128 6 4 6 2 6 1
M N O P DEL
4 64 3 64 2 64 1 64 0 64
Q R S T U
4 32 3 32 2 32 1 32 0 32
V W X Y Z
4 16 3 16 2 16 1 16 0 16
ALPHA 7 8 9 *
7 8 3 8 2 8 1 8 0 8
<-\ 4 5 6 -
7 4 3 4 2 4 1 4 0 4
/-.> 1 2 3 +
7 2 3 2 2 2 1 2 0 2
ON 0 . SPC ENTER
0 32768 3 1 2 1 1 1 0 1
OutIn Codes HP71B
Key
OutIn
Q W E R T Y U I O P
3 1 3 2 3 4 3 8 3 16 3 32 3 64 3 128 3 256 3 512
A S D F G H J K L =
2 1 2 2 2 4 2 8 2 16 2 32 2 64 2 128 2 256 2 512
Z X C V B N M ( ) END
1 1 1 2 1 4 1 8 1 16 1 32 1 64 1 128 1 256
ON F G RUN < > SPC LINE
0 32769 0 2 0 4 0 8 0 16 0 32 0 64 0 128 0 256 1 512
7 8 9 /
3 1024 3 2048 3 4096 3 8192
4 5 6 *
2 1024 2 2048 2 4096 2 8192
1 2 3 -
1 1024 1 2048 1 4096 1 8192
0 . , +
0 1024 0 2048 0 4096 0 8192
Locale
With the Locale command you can bind Scancode definitions to a keyboard Input Locale ID. An Input Locale ID, also known a Language Identifier Constant, is a 16 bit decimal number consists of a 10 bit primary language and a 6 bit sublanguage identifier.
Locale INTEGER
<Scancode blocks>
End
For example the Primary Language ID for English is 9, the Sublanguage ID for United States (US) is 1 and the Sublanguage ID for United Kingdom (UK) is 2.
With the formula:
Locale ID = 1024 * Sublanguage ID + Primary Language ID
Locale ID English(US) = 1024 * 1 + 9 = 1033
Locale ID English(UK) = 1024 * 2 + 9 = 2057
A special case is the value “0” for the Primary Language ID and the Sublanguage ID. “0” is standing for Neutral. So if you want to select all English keyboards to one case the Locale ID is
Locale ID English(Neutral) = 1024 * 0 + 9 = 9
or for selecting all keyboards the Locale ID is
Locale ID Neutral(Neutral) = 1024 * 0 + 0 = 0
The interpreter now chooses the first matching Locale in the file and ignoring all following Locale definitions. With this knowledge you can write a decoder selecting a block for English(US), English(UK), English(Neutral) and Default.
Example:
Locale 2057 # English(UK)
<Scancode blocks for English UK keyboard>
End
Locale 1033 # English(US)
<Scancode blocks for English US keyboard>
End
Locale 7 # English(Neutral)
<Scancode blocks for all other English keyboards>
End
Locale 0 # Neutral(Neutral)
<Scancode blocks for all other keyboards>
End
Instead of writing the Scancode blocks directly inside the Locale block, it’s sometimes more readable to include them by using the Include command:
Example:
Locale 1033 # English(US)
Include “kbd-us.kmi”
End
Scancode
The Scancode defines what the emulator will do when a certain key on the keyboard is pressed. Pressing a key that has no scancode defined will (only if debug mode is on) display a message box with the key's scancode number, so that you can write a Scancode block. The commands in the Scancode block are executed twice, first when the key is pressed and a second time when the key is released. Flags can help to transfer information (for example can be set to show that a shift key is pressed) from one Scancode block to another. Valid flags are 0-31.
Scancode INTEGER
<COMMANDS>
End
Valid Commands
Map INTEGER INTEGER
or
Press INTEGER
or
Release INTEGER
or
IfPressed INTEGER
<COMMANDS>
Else
<COMMANDS>
End
Or
IfMem INTEGER INTEGER INTEGER
<COMMANDS>
Else
<COMMANDS>
End
or
SetFlag INTEGER
or
ResetFlag INTEGER
or
NotFlag INTEGER
or
IfFlag INTEGER
<COMMANDS>
Else
<COMMANDS>
End
or
MenuItem INTEGER
or
SysItem INTEGER
Map <SCANCODE> <BUTTON> will map the state (pressed or released) of the key <SCANCODE> (defined by the "Scancode <SCANCODE>" block) to the button <BUTTON> (defined by the "Button <BUTTON>" block). This means when Map is called in the key pressing state the Button is pressed else, when Map is called in the key releasing state, the Button is released.
Example:
Map 51 11
Press <BUTTON> will press the button defined by the "Button <BUTTON>" block.
Example:
Press 11
Release <BUTTON> will release the button defined by the "Button <BUTTON>" block.
Example:
Release 11
IfPressed <SCANCODE> tests if Scancode block is called by a key press or a key release. If the block is called by a key press, the command lines behind IfPressed are executed until a Else or End command is reached. If the block is called by a key release, all command lines between Else and the corresponding End are executed.
Example:
IfPressed 51
Map 51 11
Else
Map 51 12
End
IfMem <MEMADDR> <ANDMASK> <RESULT> tests if the content of the calculator memory address <MEMADDR> masked by an AND operation with the value <ANDMASK> is equal to the value <RESULT>. If the result is equal, the command lines behind IfMem are executed until a Else or End command is reached. If the result is not equal, all command lines between Else and the corresponding End are executed.
Example:
IfMem 267 4 0 # =ANNCTRL 48SX/GX & alpha annunciator
Press 61 # press/release alpha button
Release61
End
SetFlag <FLAGNO> will set an internal flag.
Example:
SetFlag 1
ResetFlag <FLAGNO> will clear an internal flag.
Example:
ResetFlag 1
NotFlag <FLAGNO> will invert the state of an internal flag.
Example:
NotFlag 1
IfFlag <FLAGNO> tests the state of the flag. If the Flag is set, the command lines behind IfFlag are executed until a Else or End command is reached. If the Flag is not set, all command lines between Else and the corresponding End are executed.
Example:
IfFlag 1
Map 51 11
Else
Map 51 12
End
MenuItem will open a menu (only if it’s supported). The following values are accepted:
FILE_NEW 1
FILE_OPEN 2
FILE_SAVE 3
FILE_SAVEAS 4
FILE_EXIT 5
EDIT_COPY_SCREEN 6
FILE_SETTINGS 7
EDIT_RESET 8
EDIT_LOAD_OBJECT 9
EDIT_SAVE_OBJECT 10
HELP_ABOUT 11
HELP_TOPICS 12
FILE_CLOSE 13
EDIT_BACKUP_SAVE 14
EDIT_BACKUP_RESTORE 15
EDIT_BACKUP_DELETE 16
VIEW_SCRIPT 17
EDIT_PORT_CONFIGURATION 18
EDIT_COPY_STRING 19
EDIT_PASTE_STRING 20
TOOL_DISASM 21
TOOL_DEBUG 22
TOOL_MACRO_RECORD 23
TOOL_MACRO_PLAY 24
TOOL_MACRO_STOP 25
TOOL_MACRO_SETTINGS 26
SysItem allows to call SYSCOMMAND messages. SYSCOMMAND messages are normally generated by the system or control menu. Interesting as commands inside the KML script are:
SC_MOVE 61456
SC_MINIMIZE 61472
SC_CLOSE 61536
where SC_MOVE enabling the window to move by the keyboard, SC_MINIMIZE minimizing and SC_CLOSE closing the program window.
Example:
SysItem 61536 # SC_CLOSE
Conclusion
This document was originally written by Casey Patterson for the Keyboard Macro Language made by Sébastien Carlier and is now maintained by Christoph Gießelink.
I’m sorry, the authors can’t give any individual support, try the forum at http://www.hpmuseum.org/ please.
The latest updates are available at:
Christoph Gießelink
c.giesselink@gmx.de
Christoph Giesselink Main Page
http://hp.giesselink.com/
Release 18: May 18th, 2015
example KML
- Code: Select all
Global
Print "======================================================="
Print "KML script by Christoph Giesselink, c.giesselink@gmx.de"
Print "http://hp.giesselink.com/"
Print "Wombat3 base on the design of Wombat2 by"
Print "Victor Chow & Pete Wilson"
Print "======================================================="
Title "Wombat3 48Gx"
Author "Christoph Giesselink"
Hardware "Yorke"
Model "G"
Rom "ROM.48G"
Patch "beep.48"
Bitmap "Wombat3 48GX.bmp"
Debug 0
End
Background
Vga 1
Offset 0 0
Size 480 536
End
Lcd
Zoom 3
Offset 20 9
Color 0 255 255 255 # character color table
Color 1 255 255 255
Color 2 255 255 255
Color 3 255 255 255
Color 4 255 255 255
Color 5 255 255 255
Color 6 255 255 255
Color 7 255 255 255
Color 8 255 255 255
Color 9 223 223 223
Color 10 179 171 171
Color 11 135 135 135
Color 12 91 91 91
Color 13 47 47 47
Color 14 0 0 0
Color 15 0 0 0
Color 16 0 0 0
Color 17 0 0 0
Color 18 0 0 0
Color 19 0 0 0
Color 20 0 0 0
Color 21 0 0 0
Color 22 0 0 0
Color 23 0 0 0
Color 24 0 0 0
Color 25 0 0 0
Color 26 0 0 0
Color 27 0 0 0
Color 28 0 0 0
Color 29 0 0 0
Color 30 0 0 0
Color 31 0 0 0
Color 32 255 255 255 # background color table
Color 33 255 255 255
Color 34 255 255 255
Color 35 255 255 255
Color 36 255 255 255
Color 37 255 255 255
Color 38 255 255 255
Color 39 255 255 255
Color 40 255 255 255
Color 41 255 255 255
Color 42 255 255 255
Color 43 255 255 255
Color 44 255 255 255
Color 45 255 255 255
Color 46 255 255 255
Color 47 232 232 232
Color 48 209 209 209
Color 49 186 186 186
Color 50 163 163 163
Color 51 140 140 140
Color 52 117 117 117
Color 53 94 94 94
Color 54 71 71 71
Color 55 48 48 48
Color 56 25 25 25
Color 57 2 2 2
Color 58 0 0 0
Color 59 0 0 0
Color 60 0 0 0
Color 61 0 0 0
Color 62 0 0 0
Color 63 0 0 0
End
Annunciator 1
Size 30 22
Offset 424 17
Down 1 537
End
Annunciator 2
Size 30 22
Offset 424 50
Down 36 537
End
Annunciator 3
Size 22 22
Offset 427 83
Down 73 537
End
Annunciator 4
Size 20 16
Offset 429 115
Down 104 537
End
Annunciator 5
Size 18 20
Offset 430 141
Down 130 537
End
Annunciator 6
Size 23 18
Offset 428 172
Down 155 537
End
Button 01 # LCD "button" 1
Type 3
Size 63 21
Offset 20 180
OutIn 1 16
End
Button 02 # LCD "button" 2
Type 3
Size 63 21
Offset 86 180
OutIn 8 16
End
Button 03 # LCD "button" 3
Type 3
Size 63 21
Offset 152 180
OutIn 8 8
End
Button 04 # LCD "button" 4
Type 3
Size 63 21
Offset 218 180
OutIn 8 4
End
Button 05 # LCD "button" 5
Type 3
Size 63 21
Offset 284 180
OutIn 8 2
End
Button 06 # LCD "button" 6
Type 3
Size 63 21
Offset 350 180
OutIn 8 1
End
Button 91 # ON, should be the first defined key
Type 3
Size 86 33
Offset 18 495
OutIn 0 32768
End
Button 11
Type 3
Size 72 33
Offset 18 215
OutIn 1 16
End
Button 12
Type 3
Size 72 33
Offset 92 215
OutIn 8 16
End
Button 13
Type 3
Size 72 33
Offset 166 215
OutIn 8 8
End
Button 14
Type 3
Size 72 33
Offset 240 215
OutIn 8 4
End
Button 15
Type 3
Size 72 33
Offset 314 215
OutIn 8 2
End
Button 16
Type 3
Size 72 33
Offset 388 215
OutIn 8 1
End
Button 21
Type 3
Size 72 33
Offset 18 250
OutIn 2 16
End
Button 22
Type 3
Size 72 33
Offset 92 250
OutIn 7 16
End
Button 23
Type 3
Size 72 33
Offset 166 250
OutIn 7 8
End
Button 24
Type 3
Size 72 33
Offset 240 250
OutIn 7 4
End
Button 25
Type 3
Size 72 33
Offset 314 250
OutIn 7 2
End
Button 26
Type 3
Size 72 33
Offset 388 250
OutIn 7 1
End
Button 31
Type 3
Size 72 33
Offset 18 285
OutIn 0 16
End
Button 32
Type 3
Size 72 33
Offset 92 285
OutIn 6 16
End
Button 33
Type 3
Size 72 33
Offset 166 285
OutIn 6 8
End
Button 34
Type 3
Size 72 33
Offset 240 285
OutIn 6 4
End
Button 35
Type 3
Size 72 33
Offset 314 285
OutIn 6 2
End
Button 36
Type 3
Size 72 33
Offset 388 285
OutIn 6 1
End
Button 41
Type 3
Size 72 33
Offset 18 320
OutIn 3 16
End
Button 42
Type 3
Size 72 33
Offset 92 320
OutIn 5 16
End
Button 43
Type 3
Size 72 33
Offset 166 320
OutIn 5 8
End
Button 44
Type 3
Size 72 33
Offset 240 320
OutIn 5 4
End
Button 45
Type 3
Size 72 33
Offset 314 320
OutIn 5 2
End
Button 46
Type 3
Size 72 33
Offset 388 320
OutIn 5 1
End
Button 51
Type 3
Size 146 33
Offset 18 355
OutIn 4 16
End
Button 52
Type 3
Size 72 33
Offset 166 355
OutIn 4 8
End
Button 53
Type 3
Size 72 33
Offset 240 355
OutIn 4 4
End
Button 54
Type 3
Size 72 33
Offset 314 355
OutIn 4 2
End
Button 55
Type 3
Size 72 33
Offset 388 355
OutIn 4 1
End
Button 61
Type 3
Size 86 33
Offset 18 390
OutIn 3 32
End
Button 62
Type 3
Size 86 33
Offset 110 390
OutIn 3 8
End
Button 63
Type 3
Size 86 33
Offset 198 390
OutIn 3 4
End
Button 64
Type 3
Size 86 33
Offset 286 390
OutIn 3 2
End
Button 65
Type 3
Size 86 33
Offset 374 390
OutIn 3 1
End
Button 71
Type 3
Size 86 33
Offset 18 425
OutIn 2 32
End
Button 72
Type 3
Size 86 33
Offset 110 425
OutIn 2 8
End
Button 73
Type 3
Size 86 33
Offset 198 425
OutIn 2 4
End
Button 74
Type 3
Size 86 33
Offset 286 425
OutIn 2 2
End
Button 75
Type 3
Size 86 33
Offset 374 425
OutIn 2 1
End
Button 81
Type 3
Size 86 33
Offset 18 460
OutIn 1 32
End
Button 82
Type 3
Size 86 33
Offset 110 460
OutIn 1 8
End
Button 83
Type 3
Size 86 33
Offset 198 460
OutIn 1 4
End
Button 84
Type 3
Size 86 33
Offset 286 460
OutIn 1 2
End
Button 85
Type 3
Size 86 33
Offset 374 460
OutIn 1 1
End
Button 92
Type 3
Size 86 33
Offset 110 495
OutIn 0 8
End
Button 93
Type 3
Size 86 33
Offset 198 495
OutIn 0 4
End
Button 94
Type 3
Size 86 33
Offset 286 495
OutIn 0 2
End
Button 95
Type 3
Size 86 33
Offset 374 495
OutIn 0 1
End
Include "Keyboard.kmi"