META KERNEL
M
aubert
D
evelopment
G
roup
META KERNEL
Manual
ROM Version 2.30 – July. 1998
[Dec. 1998 - Cut-down version]
Credits
Jean-Yves Avenard
Cyrille de Brebisson
Christian Bourgeois
Etienne de Foras
Gérald Squelart
Thanks to
Jake Schwartz (without whom this English manual wouldn't exist!)
Paul Courbis (the 'Voyage' is our bible)
All at Maubert Electronic
Hewlett Packard (for the HP48 and the RPLMAN doc)
And in no particular order (alphabetic
J)
Victor Achiaga
Al Arduengo
Jonathan Aidan
Stephane Albi
Sébastien Casartelli
Jorge Costa
Stephane Doat
Damien Harper
Joe Horn
Stephen Janin
Christian Meland
Bernard Parisse
© 1996-1998 MDG Corp.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written
permission of MDG Corp.
Printed in France.
2
Contents
Meta Kernel
Contents
USING THE META KERNEL .................................................................................................................................................. 9
1
2
3
4
5
6
7
8
9
10
11
INSTALLATION ................................................................................................................................................................... 9
GENERAL PRESENTATION................................................................................................................................................... 9
STACK DISPLAY ................................................................................................................................................................. 9
CONFIGURATION .............................................................................................................................................................. 10
INTERACTIVE STACK ........................................................................................................................................................ 13
COMMAND LINE ............................................................................................................................................................... 13
COMMAND LIBRARY ........................................................................................................................................................ 16
EQUATION EDITOR ........................................................................................................................................................... 17
MATRIX EDITOR ............................................................................................................................................................... 23
GROB EDITOR (PICTURE2) ............................................................................................................................................... 24
FILER ............................................................................................................................................................................... 27
UTILITIES................................................................................................................................................................................. 31
1
2
3
4
FONT EDITOR (EDF)........................................................................................................................................................ 31
MACHINE LANGUAGE COMPILER (MASD)........................................................................................................................ 32
DISASSEMBLER ................................................................................................................................................................ 43
MISCELLANEOUS UTILITIES ............................................................................................................................................. 43
APPENDIXES............................................................................................................................................................................ 48
1
2
3
4
5
INTRODUCTION TO ASSEMBLY LANGUAGE ....................................................................................................................... 48
INTRODUCTION TO SYSTEM RPL ..................................................................................................................................... 48
TIPS AND TRICKS.............................................................................................................................................................. 48
THE MK FOR PROGRAMMERS ......................................................................................................................................... 50
METAKERNEL 3.0 : PREVIEW ............................................................................................................................... ........... 61
Meta Kernel
Contents
3
Table of Contents
USING THE META KERNEL .................................................................................................................................................. 9
1
2
3
INSTALLATION ................................................................................................................................................................... 9
GENERAL PRESENTATION................................................................................................................................................... 9
STACK DISPLAY ................................................................................................................................................................. 9
3.1
Display ....................................................................................................................................................................... 9
3.1.1
3.1.2
3.1.3
3.2
3.2.1
3.2.2
3.2.3
Status area ............................................................................................................................................................................... 9
Stack........................................................................................................................................................................................ 9
Menu labels ........................................................................................................................................................................... 10
Display configuration............................................................................................................................................... 10
Changing the display font...................................................................................................................................................... 10
Modifying the current font .................................................................................................................................................... 10
Changing the mini font.......................................................................................................................................................... 10
4
CONFIGURATION .............................................................................................................................................................. 10
MK variables ............................................................................................................................................................ 11
MK user and system flags (MKUF, MKSF).............................................................................................................. 11
5
INTERACTIVE STACK ........................................................................................................................................................ 13
6
COMMAND LINE ............................................................................................................................................................... 13
6.1
Generalities .............................................................................................................................................................. 13
6.2
Editing menu ............................................................................................................................................................ 13
4.1
4.2
6.2.1
6.2.2
6.2.3
6.2.4
6.3
6.3.1
6.3.2
6.3.3
6.3.4
6.4
6.4.1
6.4.2
6.4.3
6.4.4
Major options ........................................................................................................................................................................ 13
Operations on the selection ................................................................................................................................................... 14
Search operations .................................................................................................................................................................. 14
Miscellaneous........................................................................................................................................................................ 14
Styles......................................................................................................................................................................... 14
Generalities............................................................................................................................................................................ 14
Style menu............................................................................................................................................................................. 14
Using styles ........................................................................................................................................................................... 14
Using fonts ............................................................................................................................................................................ 14
Miscellaneous command line options....................................................................................................................... 15
Full screen mode ................................................................................................................................................................... 15
Auto-indent mode.................................................................................................................................................................. 15
Special keystrokes for System RPL....................................................................................................................................... 16
Big strings editing ................................................................................................................................................................. 16
6.5
7
8
Shortcuts................................................................................................................................................................... 16
COMMAND LIBRARY ........................................................................................................................................................ 16
EQUATION EDITOR ........................................................................................................................................................... 17
8.1
First view of EQW .................................................................................................................................................... 17
8.1.1
8.1.2
8.1.3
8.2
8.2.1
8.2.2
8.2.3
8.2.4
8.2.5
8.2.6
8.2.7
8.2.8
8.2.9
8.2.10
8.2.11
8.2.12
8.2.13
8.2.14
8.2.15
8.2.16
8.2.17
8.3
8.3.1
8.3.2
8.3.3
8.3.4
8.3.5
4
Introduction........................................................................................................................................................................... 17
Modes.................................................................................................................................................................................... 17
Editing................................................................................................................................................................................... 17
Creating equations ................................................................................................................................................... 18
Running EQW....................................................................................................................................................................... 18
Exiting EQW ......................................................................................................................................................................... 18
Numbers and names .............................................................................................................................................................. 18
Addition, subtraction, and multiplication.............................................................................................................................. 18
Complex numbers and expressions ....................................................................................................................................... 18
Moving in the equation ......................................................................................................................................................... 18
Divisions ............................................................................................................................................................................... 18
Exponents.............................................................................................................................................................................. 18
Square root ............................................................................................................................................................................ 18
Nth square root ..................................................................................................................................................................... 19
Parenthesized-argument functions ........................................................................................................................................ 19
User functions....................................................................................................................................................................... 19
Parenthesized terms .............................................................................................................................................................. 19
Differentiation....................................................................................................................................................................... 19
Integration............................................................................................................................................................................. 19
Summations .......................................................................................................................................................................... 19
Where function |.................................................................................................................................................................... 19
Manipulating equations............................................................................................................................................ 19
Modifying equations with EQW............................................................................................................................................ 19
Modifications ........................................................................................................................................................................ 19
Temporary exit to the stack ................................................................................................................................................... 19
Copy paste functions ............................................................................................................................................................. 19
Deletions ............................................................................................................................................................................... 20
Contents
Meta Kernel
8.3.6
8.3.7
8.4
Cursor mode ............................................................................................................................................................. 20
8.4.1
8.4.2
8.4.3
8.5
8.6
8.7
8.8
Menu use ............................................................................................................................................................................... 20
Zoom ..................................................................................................................................................................................... 20
-→Grob ................................................................................................................................................................................. 20
Error messages......................................................................................................................................................... 20
Examples .................................................................................................................................................................. 21
Key reference for EQW............................................................................................................................................. 21
8.8.1
8.8.2
8.8.3
8.8.4
9.1
9.2
9.3
Switching to cursor mode...................................................................................................................................................... 20
Movement.............................................................................................................................................................................. 20
Exiting cursor mode .............................................................................................................................................................. 20
Miscellaneous functions ........................................................................................................................................... 20
8.5.1
8.5.2
8.5.3
9
Evaluations............................................................................................................................................................................ 20
Custom program evaluation................................................................................................................................................... 20
Selection mode ...................................................................................................................................................................... 21
Edit mode .............................................................................................................................................................................. 22
Selection and edit mode - common keys ............................................................................................................................... 22
Cursor mode .......................................................................................................................................................................... 22
MATRIX EDITOR ............................................................................................................................................................... 23
Presentation.............................................................................................................................................................. 23
Usage........................................................................................................................................................................ 23
Reference .................................................................................................................................................................. 23
9.3.1
9.3.2
Keys....................................................................................................................................................................................... 23
Menu keys ............................................................................................................................................................................. 23
10 GROB EDITOR (PICTURE2) ............................................................................................................................................... 24
10.1 Usage........................................................................................................................................................................ 24
10.2 Reference .................................................................................................................................................................. 25
10.2.1
10.2.2
10.2.3
Commands ............................................................................................................................................................................ 25
Keys ...................................................................................................................................................................................... 26
ALPHA keys......................................................................................................................................................................... 26
11 FILER ............................................................................................................................................................................... 27
11.1 Ports and directories screen..................................................................................................................................... 27
11.2 File selection screen ................................................................................................................................................. 27
11.3 Menu......................................................................................................................................................................... 27
11.4 HEXA Editor............................................................................................................................................................. 28
11.4.1
11.4.2
11.4.3
Menu..................................................................................................................................................................................... 28
Keys ...................................................................................................................................................................................... 28
Edit mode.............................................................................................................................................................................. 29
UTILITIES................................................................................................................................................................................. 31
1
FONT EDITOR (EDF)........................................................................................................................................................ 31
Font editing .............................................................................................................................................................. 31
CHARS mode............................................................................................................................................................ 31
A session with CHARS.............................................................................................................................................. 31
2
MACHINE LANGUAGE COMPILER (MASD)........................................................................................................................ 32
2.1
Generalities on ML (Machine Language) ................................................................................................................ 32
2.2
Launching Masd ....................................................................................................................................................... 32
2.3
Generalities on Masd Syntax.................................................................................................................................... 32
2.4
Links ......................................................................................................................................................................... 32
2.5
Using labels.............................................................................................................................................................. 32
2.6
Using constants ........................................................................................................................................................ 33
2.7
Expressions............................................................................................................................................................... 33
2.8
Skips ......................................................................................................................................................................... 34
2.9
Macros...................................................................................................................................................................... 35
2.10 Filename conventions............................................................................................................................................... 35
2.11 Units ......................................................................................................................................................................... 35
2.12 Library creation ....................................................................................................................................................... 35
2.13 SysRPL mode............................................................................................................................................................ 36
1.1
1.2
1.3
2.13.1
a)
b)
c)
d)
e)
2.13.2
2.13.3
2.14
Meta Kernel
Instructions ........................................................................................................................................................................... 36
Constants ............................................................................................................................................................................... 36
External (in entry points table) .............................................................................................................................................. 36
Tokens ................................................................................................................................................................................... 36
Decimal value (System Binary) ............................................................................................................................................. 37
Unnamed local variables ....................................................................................................................................................... 37
Special keystrokes in the command line ............................................................................................................................... 37
Program example .................................................................................................................................................................. 38
SATURN instructions syntax .................................................................................................................................... 38
Contents
5
2.14.1
2.14.2
2.14.3
2.14.4
2.14.5
2.14.6
2.14.7
2.14.8
2.14.9
2.14.10
2.14.11
2.14.12
2.14.13
2.14.14
2.14.15
2.14.16
2.14.17
2.14.18
2.14.19
2.14.20
2.14.21
2.14.22
a)
b)
♦
♦
♦
♦
c)
2.14.23
a)
b)
c)
2.14.24
2.14.25
2.14.26
2.14.27
2.14.28
2.14.29
2.14.30
2.14.31
2.14.32
Assigning 0 to a register ....................................................................................................................................................... 38
Loading a value in A or C..................................................................................................................................................... 38
Loading a register value into another register ....................................................................................................................... 39
Exchange between two registers ........................................................................................................................................... 39
Addition ................................................................................................................................................................................ 39
Subtraction............................................................................................................................................................................ 39
Increment and decrement ...................................................................................................................................................... 39
Right nibbles shifting (divide by 16) .................................................................................................................................... 39
Left nibbles shifting (multiply by 16) ................................................................................................................................... 39
Right bit shifting (divide by 2) ........................................................................................................................................... 39
Right circular nibble shifting .............................................................................................................................................. 39
Left circular nibble shifting ................................................................................................................................................ 39
Logical AND ...................................................................................................................................................................... 39
Logical OR ......................................................................................................................................................................... 39
Logical NOT....................................................................................................................................................................... 39
Mathematical NOT ............................................................................................................................................................. 40
Loading value into a R Register ......................................................................................................................................... 40
Loading value into A or C from a R register ...................................................................................................................... 40
Exchange between A or C and a R register......................................................................................................................... 40
Memory write (POKE) ....................................................................................................................................................... 40
Memory read (PEEK) ......................................................................................................................................................... 40
D0 and D1 modifications.................................................................................................................................................... 40
Loading D0 and D1 ............................................................................................................................................................... 40
Exchanges between A or C and D0 or D1 ............................................................................................................................. 40
Loading A or C, field A, into D0 or D1............................................................................................................................... 40
Loading the four low nibbles of A or C into D0 or D1........................................................................................................ 40
Exchanging A or C, field A, and D0 or D1.......................................................................................................................... 40
Exchanging the 4 first nibbles of A or C and D0 or D1....................................................................................................... 40
Increment and decrement of D0 and D1................................................................................................................................ 40
Working registers tests........................................................................................................................................................ 41
Equality and inequality tests.................................................................................................................................................. 41
Lower and greater tests.......................................................................................................................................................... 41
Nullity tests ........................................................................................................................................................................... 41
Working with some bits of A or C register ......................................................................................................................... 41
Operations on PC................................................................................................................................................................ 41
Working with the Hardware Status Register....................................................................................................................... 41
Working with P................................................................................................................................................................... 41
Jump instructions................................................................................................................................................................ 41
Exchanges between C and RSTK ....................................................................................................................................... 42
Input / output instructions................................................................................................................................................... 42
Processor control instructions............................................................................................................................................. 42
New instructions of Masd................................................................................................................................................... 42
2.15 Masd directives......................................................................................................................................................... 42
2.16 Error messages......................................................................................................................................................... 43
3
DISASSEMBLER ................................................................................................................................................................ 43
4
MISCELLANEOUS UTILITIES ............................................................................................................................................. 43
4.1
- →H
................................................................................................................................................................ 43
4.2
H→
.................................................................................................................................................................. 43
4.3
S →H
................................................................................................................................................................ 43
4.4
H→S
................................................................................................................................................................ 44
4.5
CD→
............................................................................................................................................................... 44
4.6
-→CD
.............................................................................................................................................................. 44
4.7
- →A
................................................................................................................................................................. 44
4.8
A→
.................................................................................................................................................................. 44
4.9
PEEK
............................................................................................................................................................... 44
4.10 POKE
.............................................................................................................................................................. 44
4.11 SREV
............................................................................................................................................................... 44
4.12 PRG~LST
........................................................................................................................................................ 44
4.13 -→RAM
........................................................................................................................................................... 44
4.14 APEEK
............................................................................................................................................................ 44
4.15 R~SB
............................................................................................................................................................... 44
4.16 -→GROB2
....................................................................................................................................................... 44
4.17 -→HEADER
............................................................................................................................... ..................... 45
4.18 HEADER→
..................................................................................................................................................... 45
4.19 INPUT2
........................................................................................................................................................... 45
4.20 DISP2
.............................................................................................................................................................. 45
6
Contents
Meta Kernel
4.21
4.22
4.23
4.24
4.25
4.26
4.27
4.28
4.29
4.30
4.31
4.32
4.33
4.34
4.35
4.36
4.37
4.38
4.39
4.40
4.41
4.42
4.43
4.44
4.45
4.46
HALT2
............................................................................................................................................................. 45
-→S2
............................................................................................................................................................... 45
-→S4
............................................................................................................................................................... 45
CHOOSE2
....................................................................................................................................................... 45
EDIT
................................................................................................................................................................ 45
VISIT
............................................................................................................................................................... 45
EDITB
............................................................................................................................................................. 45
VISITB
............................................................................................................................................................. 45
EQW
................................................................................................................................................................ 45
.............................................................................................................................................................. 45
FILER
ASM
................................................................................................................................................................. 45
ER
.................................................................................................................................................................... 46
ASM→
............................................................................................................................................................. 46
-→NDISP
........................................................................................................................................................ 46
-→FONT
............................................................................................................................... .......................... 46
FONT→
.......................................................................................................................................................... 46
FONT8, FONT6
..................................................................................................................................... 46
KERNEL?
........................................................................................................................................................ 46
SF2, CF2, FS?2, FC?2, FS?C2, FC?C2, STOF2, RCLF2
............ 46
SREPL
............................................................................................................................................................. 46
AR~LST
........................................................................................................................................................... 46
DIMS
............................................................................................................................................................... 46
-→MINIFONT
................................................................................................................................................. 46
MINIFONT→
.................................................................................................................................................. 46
FNT2GRB.PRG ........................................................................................................................................................ 46
GRB2FNT.PRG ........................................................................................................................................................ 47
APPENDIXES............................................................................................................................................................................ 48
1
2
3
INTRODUCTION TO ASSEMBLY LANGUAGE ....................................................................................................................... 48
INTRODUCTION TO SYSTEM RPL ..................................................................................................................................... 48
TIPS AND TRICKS.............................................................................................................................................................. 48
3.1
Meta Kernel and UFL .............................................................................................................................................. 48
3.2
STARTED and EXITED examples............................................................................................................................ 48
3.2.1
3.2.2
3.3
3.3.1
4
Remove the header display.................................................................................................................................................... 48
Edit compressed files............................................................................................................................................................. 48
Meta Kernel and Erable ........................................................................................................................................... 49
STARTOFF and TOFF example ........................................................................................................................................... 50
THE MK FOR PROGRAMMERS ......................................................................................................................................... 50
4.1
Customizing the Filer ............................................................................................................................................... 50
4.1.1
4.1.2
4.1.3
a)
b)
c)
d)
e)
f)
g)
h)
4.2
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
4.2.9
4.2.10
4.2.11
4.2.12
4.2.13
Meta Kernel
Overview ............................................................................................................................................................................... 50
FILER.CUSTOM Format...................................................................................................................................................... 50
Explanation of each component ............................................................................................................................................ 50
System Binary 1 and GROB.................................................................................................................................................. 50
System binary 2 ..................................................................................................................................................................... 50
System binary 3 ..................................................................................................................................................................... 50
Internal calls .......................................................................................................................................................................... 51
Custom program .................................................................................................................................................................... 51
Explanation for the string of addresses.................................................................................................................................. 52
Explanations about the name................................................................................................................................................. 52
Warning and very important points ....................................................................................................................................... 52
Machine Language entry points list ......................................................................................................................... 52
MINI_DISP ........................................................................................................................................................................... 52
MINI_FONT_ADDRESS ..................................................................................................................................................... 52
DISPLAY_SBR .................................................................................................................................................................... 52
EDIT_SBR ............................................................................................................................................................................ 52
FILER.ADR .......................................................................................................................................................................... 53
SCAN_FONT........................................................................................................................................................................ 53
RECONFIG........................................................................................................................................................................... 53
DECONFIG........................................................................................................................................................................... 53
CMD_SIZE ........................................................................................................................................................................... 53
GET_PATH .......................................................................................................................................................................... 53
DECONFIG_RAM ............................................................................................................................................................... 53
RECONFIG_RAM ............................................................................................................................................................... 53
GET_FONT .......................................................................................................................................................................... 53
Contents
7
4.2.14
4.2.15
4.2.16
4.2.17
4.2.18
4.2.19
4.2.20
4.2.21
4.2.22
4.2.23
4.2.24
4.2.25
4.2.26
4.2.27
4.2.28
4.2.29
4.2.30
4.2.31
4.2.32
4.2.33
4.2.34
4.2.35
4.2.36
4.2.37
4.2.38
4.2.39
4.2.40
4.2.41
4.2.42
4.2.43
4.2.44
4.2.45
4.2.46
4.2.47
4.2.48
4.2.49
4.2.50
4.2.51
4.2.52
4.3
SysRPL entry points.................................................................................................................................................. 57
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
4.3.7
4.3.8
4.3.9
4.3.10
4.3.11
4.3.12
4.3.13
4.3.14
4.3.15
4.3.16
4.3.17
4.3.18
4.3.19
4.3.20
4.3.21
4.3.22
4.3.23
4.3.24
5
8
INIT_DISPLAY_LINE......................................................................................................................................................... 53
CHANGE_FLAG.................................................................................................................................................................. 53
GET_ASCII_KEY ................................................................................................................................................................ 54
GET_KEY ............................................................................................................................................................................ 54
RUN_KEY............................................................................................................................................................................ 54
MINI_DISP_VAL ................................................................................................................................................................ 54
MINI_DISP_AWP................................................................................................................................................................ 54
TRUP .................................................................................................................................................................................... 54
TRDN ................................................................................................................................................................................... 54
ZEROM ................................................................................................................................................................................ 54
SCAN_KEY ......................................................................................................................................................................... 54
NEW_ADR........................................................................................................................................................................... 54
RESIZE_PLUS ..................................................................................................................................................................... 54
C=IN3 ................................................................................................................................................................................... 55
A=IN3................................................................................................................................................................................... 55
OUT=C=IN3......................................................................................................................................................................... 55
OUT=CA=IN3 ...................................................................................................................................................................... 55
DISP_DEC............................................................................................................................................................................ 55
MULT_BAC......................................................................................................................................................................... 55
GREY?.................................................................................................................................................................................. 55
BEEP .................................................................................................................................................................................... 55
KEY_REPEAT ..................................................................................................................................................................... 55
KEY_NO .............................................................................................................................................................................. 55
HEX_DEC ............................................................................................................................................................................ 55
A_DIV_C.............................................................................................................................................................................. 55
SET_BIT............................................................................................................................................................................... 55
CLEAR_BIT......................................................................................................................................................................... 56
BIT? ...................................................................................................................................................................................... 56
BZU.SBR.............................................................................................................................................................................. 56
INV.ZONE ........................................................................................................................................................................... 56
OFF.SBR .............................................................................................................................................................................. 56
InitTable................................................................................................................................................................................ 56
GetAdr .................................................................................................................................................................................. 56
GetText ................................................................................................................................................................................. 56
GetFirst ................................................................................................................................................................................. 57
GetNext................................................................................................................................................................................. 57
GetFirstAdr ........................................................................................................................................................................... 57
GetNextAdr........................................................................................................................................................................... 57
RclPath ................................................................................................................................................................................. 57
GET.INDEX.......................................................................................................................................................................... 57
GET .Y.I................................................................................................................................................................................ 57
GET .X.Y.I ............................................................................................................................................................................ 58
PUT.X.Y ............................................................................................................................................................................... 58
DIMS..................................................................................................................................................................................... 58
FILER_FNAME.................................................................................................................................................................... 58
FILER_FRCL........................................................................................................................................................................ 58
FILER_NEXTADR............................................................................................................................................................... 58
SURPRISE ............................................................................................................................................................................ 58
INPUT .................................................................................................................................................................................. 58
CTRL_LOOP........................................................................................................................................................................ 59
INIT_CMD ........................................................................................................................................................................... 59
CMP_PLUS .......................................................................................................................................................................... 59
DISP_CALL ......................................................................................................................................................................... 59
BZU ...................................................................................................................................................................................... 59
KER_PARAM ...................................................................................................................................................................... 59
MINI_EDITOR..................................................................................................................................................................... 59
KEY_PARAM ...................................................................................................................................................................... 59
UPSTACK.ADR................................................................................................................................................................... 59
WAITKEY.ADR................................................................................................................................................................... 59
COMMANDLINE.ADR....................................................................................................................................................... 60
MATRIX.ADR ..................................................................................................................................................................... 60
SAVE.ARG........................................................................................................................................................................... 60
LOAD.ARG .......................................................................................................................................................................... 60
METAKERNEL 3.0 : PREVIEW ............................................................................................................................... ........... 61
Contents
Meta Kernel
Using the Meta Kernel
1 Installation
Switch off your calculator by pressing
.
Put the ROM card into the slot 1 of the HP48 (it must be the port 1)
Turn the HP48 on.
After a short time, the Meta Kernel is installed:
2 General presentation
The Meta Kernel is an application card that changes the standard environment. A good knowledge of the standard environment is
required, as the MK uses it, and adds several functions. Please read the HP48 GX User’s Guide about it.
With the new stack display and command line, new utilities are provided:
•
Equation editor (EQW) ...............................................Page 17
•
Matrix editor (MATR) ..................................................Page 23
•
Grob editor (PICTURE2) ............................................Page 24
•
File utility (FILER).......................................................Page 27
•
Symbolic assembler (MASD)......................................Page 32
•
Library maker .............................................................Page 35
•
System RPL Development Kit ............................ Pages 16, 36
3 Stack display
3.1
Display
The display is divided in three parts: (the command line belongs to the stack)
← Status area
← Stack
Command line →
← Menu
The stack and status area can be resized in height, see below.
3.1.1
Status area
The status area shows the current HP48 GX state.
Error messages, current path, calculator modes are displayed in this area.
Here are the new state flags:
: Degrees
: Radians
: Grads
: Rectangular coordinates
: Polar coordinates
: Spherical coordinates
: Algebraic entry mode
: Program entry mode
: Beeper
: A program has been halted
: User keyboard
: User keyboard for the next
keystroke
: Hexadecimal base
: Decimal base
: Octal base
: Binary base
: ROM or write-protected
RAM in port 2
: Read-write RAM card in
port 2
The status area occupies two text lines by default. Its height can be changed to one or zero lines with the MK command
consult Page 45.
3.1.2
+($'(5,
Stack
With the MK, up to nine lines can be viewed on the stack, as you can change the font height (6,7 or 8 pixels) and the status area
height.
The maximum number of lines displayed by objects can be changed with 1',63, consult Page 46.
More configuration capabilities are provided by the Meta Kernel system flags (MKSF), consult Page 11.
Algebraics and grobs may be displayed directly in the stack, use the MKSF to configure how and when they are displayed.
Meta Kernel
Using the Meta Kernel
9
3.1.3
Menu labels
Menu-label style depends on the type of the stored object:
Directory
Program, code
Grob
Real, complex, algebraic expression, matrix
List, variable, binary integer
Character string
By default, labels are written using the MK mini font. If the MK system flag -20 is set (with
instead:
3.2
6)), standard menu font is used
Display configuration
New display fonts can be created and used. The number of lines displayed on the stack differs with the font height.
With a font8 (8 pixels height), 5 to 7 lines may be viewed; with a font7, 6 to 8 lines ; with a font6, 7 to 9 lines.
3.2.1
Changing the display font
To use a different font, put it on the stack, and execute )217, consult Page 46.
Fonts are displayed on the stack like this:
Example: )WB6<67(0, this is the standard display font for the MK.
The first number () is the font height in pixels, the second number () is the id of the font, then the name (6<67(0).
Two examples with a font8 and a font6:
If the current font is a font6 (6 pixel-high), the MK system flags -8 and -9 force respectively the stack display and the command line
to use the mini font:
3.2.2
Modifying the current font
The current display font may be modified with the CHARS menu (
). Consult Page 31.
On the floppy disk, there are two programs, named GRB2FNT.PRG and FNT2GRB.PRG, which convert MK fonts to or from
common 8x2048 grobs. Consult Page 46.
3.2.3
Changing the mini font
It is possible to change the MK mini font, used in the status area and the menu labels.
Use the commands 0,1,)217 and 0,1,)217. A mini font is a /LEUDU\'DWD object. This format is very popular in the
HP48’s world, particularly with programs which use UFL (Universal Font Library). In order to know how to use the UFL with the
Meta Kernel check the column Tricks and Tips.
4 Configuration
10
Using the Meta Kernel
Meta Kernel
4.1
MK variables
67$5783
67$57('
Some programs can be executed on some events, in place of the default programs. They must be stored in the +20( directory.
...).
Executed at each reboot (
Executed just before entering in command line for editing an object. The object to be edited can be found on stack level 1.
This program must leave the object to be edited on the stack level 1.
Executed when the user stops the command line editing. Level 2 contains the object and level 1 758( if the user has
, or only )$/6( for
.
pressed
For example, these two programs can be used to change the display while editing (try 67$57('„+($'(5” and
(;,7('„+($'(5”).
Executed when the automatic OFF is called, after a certain amount of idle time (You can make a screen saver! But
remember, the HP48 GX works on batteries...).
Defines the amount of idle time before an automatic 2)) (or 67$572))). It must be a binary integer, in Ticks (1 s = 8192
Ticks).
Contains a string that is the path (using the MASD syntax) to the entries points list. Example:
(;,7('
67$572))
72))
67$57(;7
',57$%/((;7
# will refer to the table TABLE.EXT in Port 4, in the backup DIR1
67$576(1'
67$57(55
67$57(4:
),/(5&86720
4.2
For more details, please read page 36.
Used by the filer for file transfer. By default, Kermit is used. If 67$576(1' exists, it is called with the object on level 2 and
the name on level 1. Consult page 27.
Used for the error messages display. The error is found in two character strings on levels 2 and 1.
is pressed.
Called by EQW (equation editor) when
is pressed.
Called by the Filer when
MK user and system flags (MKUF, MKSF)
The Meta Kernel adds a new series of flags.
Use &), 6), )&", )6", )&"&, )6"& like the functions &), 6)...
By default, all flags are cleared.
MK System flags -1 to -64 are used by the MK to change parameters.
MK User flags 1 to 64 can be used by any program that runs under the MK.
Cleared (&))
Multiline for stack display at all levels.
Set (6))
No multiline for stack display (except level 1).
-2
Strings displayed on multiple lines.
Strings displayed on only one line.
-3
Digital clock in status area.
Analog clock in status area.
-4
-5
-6
-7
-8
No auto-indentation in command line editing.
Cursor can not go out of the text.
Strings take only one line for *52%.
$60 with addresses.
The current font is normally used in stack display.
Auto-indentation in command line editing.
Full page editing.
Multi-line strings for *52%.
$60 without the addresses (makes labels).
Mini-font in stack display (the current font must be a font6).
-9
The current font is normally used in command line editing.
Mini-font in command line editing (the current font must be a
font6).
-10
Rightmost stack display format.
Leftmost stack display format.
Flag
-1
Meta Kernel
Using the Meta Kernel
11
-11
-12
-13
-14
-15
Silent keystrokes.
No purge confirmation in the Filer.
(Reserved for internal use).
(Reserved for internal use).
On-stack algebraics display.
Keystrokes click.
Purge confirmation in the Filer.
-16
Current font for EQW stack display.
Mini-font for EQW stack display.
-17
-18
Current font for algebraic *52%.
Current font for algebraics editing in EQW.
Mini-font for algebraic *52%.
Mini-font for algebraics editing in EQW.
-19
On-stack grobs display.
Standard stack display for grobs.
-20
MK Mini-font menu labels.
Standard menu labels.
-21
Normal stack display
Display the stack using the HP SysRPL syntax
6 adds "12&2'(&5!53/&5!" at the beginning of
the source, and "#" at the end. Therefor it can be use directly by
MASD
The stack display is recursive. When an object contains a
reference to an other object, the stack displays it.
6 just convert an object into System RPL without adding any
header.
-22
-23
12
Standard stack display for algebraics.
The stack display is not recursive.
-24
Object display in the command line is not recursive.
Object display in the command line is recursive (See flag –23)
-25
In the normal stack display (-21 CF2), displays the addresses of
all the unknown objects:
If the address is in the entry point table, then use the mnemonic:
-26
The CHOOSE2 boxes use the current font
The CHOOSE2 boxes use the mini-font.
Using the Meta Kernel
Meta Kernel
-27
The symbolic matrix writer will give an ARRAY only for the array
of real and complex
-28
-29
MASD in assembly mode by default
Normal Header
When exiting an environment (Equation Writer, Matrix Writer,
EDG …), the result is put in LASTCMD
-31 à –64 Not used, reserved for future versions.
-30
Matrix Writer gives an array of ? for any object, each time the
matrix contains objects of the same type. But beware of memory
lost if you try to use a RPL command on it.
MASD in SystemRPL mode by default
Erable Header (shows the current mode of Erable :
complex/real; symbolic/approximate; content of the VX variable)
When exiting an environment (Equation Writer, Matrix Writer,
EDG …), the result is not put in LASTCMD
5 Interactive stack
The interactive stack works the same way as the standard one, but at a greater speed, and it is possible to edit many objects
simultaneously: in the command line editor, it is possible to go temporarily to the interactive stack, and to edit another object
recursively. It is also possible to +$/7 the editing environment.
Current stack level →
Interactive Stack Operations: (n indicates the current level)
Copies the current level object on the command line, at the cursor position.
Shows information about the current level object (size, CRC...).
Edits the current level object with the best environment ((',7%).
Edits the object whose name is on the current level, with the best environment (9,6,7%).
Equivalent to n 3,&..
Equivalent to n 52//.
Equivalent to n 52//'.
Equivalent to n O/,67.
Equivalent to n '831.
Equivalent to n '5231.
Puts the number of the current level on level 1.
Goes directly to a given level.
Clears all the levels upper than the current level (Therefore it KEEPs the first stack levels up to the current one).
Selects the cursor speed.
/
6 Command line
6.1
Generalities
The Meta Kernel improves editing with new functions: COPY/PASTE, FIND/REPLACE, text style (Bold, italic, underline, inverse).
Styles can only be used inside strings (they will be ignored and lost in any other object).
You can edit an object by pressing
after).
6.2
when the object is on stack level 1. There are other ways to edit an object (explained
Editing menu
There are four pages in the menu, plus the Style menu.
6.2.1
Major options
Goes to a given line number.
Goes to a given position (in number of characters from the beginning).
Displays the menu of the text, which is composed of every line that begins with the character , useful in assembly language.
Goes to the beginning of the selection.
Goes to the end of the selection.
Clears the current line.
/
Selects the cursor speed.
Displays information about the current text.
Edits the selection with the best environment ((',7%).
Meta Kernel
Using the Meta Kernel
13
6.2.2
Operations on the selection
ü Note: the selection marks are lost when the text is modified.
Sets the beginning of the selection.
Sets the end of the selection.
Copies the selection on the stack level 1, and clears it in the text.
Copies the selection on the stack level 1.
Puts the object on the stack level 1 into the text at the cursor position.
Puts the object on the stack level 1 into the text at the cursor position, and deletes it from the stack.
Clears the selection.
6.2.3
Search operations
Displays a screen where you can type the search string. When you press enter, this string is put on stack level 1. The
character " stands for any character. Then the selection is placed on the first occurrence of this string after the cursor position.
Displays a screen where you can type the search string and the replace string. The search string is put on stack level 1, and
the replace string on level 2. Then the selection is placed on the first occurrence of the search string. The change is not done
yet!
Selects the next occurrence of the search string (the string on stack level 1).
Replaces the selection by the replace string (the string on stack level 2).
Equivalent to
, then
. So it makes one change, and goes to the next occurrence of the search string.
Equivalent to
and
, repeated until the end of the text. So every occurrence of the search string is replaced by the
replace string, from the cursor position to the end of the text, without confirmation.
6.2.4
Miscellaneous
Goes to the beginning of the previous word.
Goes to the beginning of the next word.
Clears the text between the cursor and the beginning of the previous word.
Clears the text between the cursor and the beginning of the next word.
Displays the style menu.
Goes to the interactive stack. Consult Page 13.
(9$/uates the selection and replaces it with the result. E.g. if 6,1 is selected, it will be replaced by .
Equivalent to +$/7. The current editing is suspended, you can do what you want (except a reboot) and get back to the text with
.
6.3
6.3.1
Styles
Generalities
Styles can be used inside text strings. There are four styles: Bold, italic, underline, inverse.
Several styles can be used on the same portion of text.
More than one font can also be used in the same text (but they must have the same height).
6.3.2
Style menu
Sets/clears the bold style.
Sets/clears the italic style.
Sets/clears the underlined style.
Sets/clears the
style.
Displays the font list.
Gets back to the Edit menu.
6.3.3
Using styles
You can modify the style of the current selected text by pressing a style menu key. If there is no selection, the text you will then
type will be of the chosen style (If you move the cursor, the style will be the one under the cursor).
6.3.4
Using fonts
If you press the
menu key, a choose box shows all the fonts which have the same height as the current editing font.
If there is a selection, the font will be applied on this selection, otherwise it will be used for the text you will then type (If you move
the cursor, the font will be the one under the cursor).
14
Using the Meta Kernel
Meta Kernel
The Meta Kernel can use up to 247 fonts inside one text.
For a font to be recognized by the MK (so that it will appear in the FONT choose box), it just has to be saved in the HOME
directory, or in a port (0, 2 to 31)
If several fonts use the same ID, the MK only takes the first one, in the order of the search (HOME, then 0, 2 ... 31). ID 0 is
reserved for the system font. ID > 247 will be ignored.
Example:
Type the text: 7+,6,6$6,03/((;$03/(
Put the cursor on the 11th character (6 in 6,03/(). Press the menu key
Press
Go to the
six times. Press
menu and press
Now, select the word (;$03/(
Go to the
menu and press
(There may be other fonts than shown below)
Choose the font you want (here ROBOT 8) with the up and down arrows and press
6.4
6.4.1
.
Miscellaneous command line options
Full screen mode
By default, if you press the
key at the end of a line, the cursor will be placed on the first character of the next line. With the
MK, it is possible to go ‘out’ of the lines, with the MK system flag -5.
Type 6) to enable the full screen mode (if you like this mode, a good idea is to place a 6) in the program
67$5783).
If you go beyond the end of a line and press a character key, spaces will automatically be inserted before the character you type.
6.4.2
Auto-indent mode
By default, when you press
to insert a carriage return, the cursor is then always placed on the first column of the
display. The MK implements the auto-indent mode, so that when you type a carriage return, the cursor will be placed under the first
character of the upper line (Useful when programming).
Type 6) to enable auto-indent mode.
Meta Kernel
Using the Meta Kernel
15
6.4.3
Special keystrokes for System RPL
In the command line, some keystrokes help to type characters that are specific to System RPL, and also to easily find System RPL
commands only by typing the first letters of the command.
These keystrokes are detailed on page 37.
6.4.4
Big strings editing
As specified in the HP48 GX User’s Manual, you can not type character strings that are bigger than the half of the free memory.
The MK uses a new memory handler, so that when you edit strings (and only strings), you can have more characters than the half
of the free memory, and still press
, because the MK does not evaluate the string, but places it directly on the stack.
You will never get an Insufficient Memory when validating a character string.
For other objects types, the MK built-in 675 will usually works if there is more or less as much free memory as the object size, so
the object may be viewed. But when
is pressed, the 675 may have Insufficient Memory.
6.5
Shortcuts
The Shortcuts are available by pressing simultaneously a SHIFT key and another one.
Insert the character \
mode
Suspend the current environment
Page Up
Evaluate the current line and replace it with the result. Example:
Page Left
Page Down
Page Right
BEGIN
END
Select the current line
Extend/Reduce the selection to the left
Extend/Reduce the selection to the right
Insert and indent a SystemRPL program bloc (see the MASD chapter for more information)
Auto-Completion (see the MASD chapter for more information)
7 Command library
A command library is a special library which extends the
be typed on the command line and used in programs):
758(
)$/6(
ELQDU\
o+H[D
}ELQDU\
.QXPEHU
;/,%
/LE1XPEHU
3UJ1XPEHU
,1&/8'(
9DU1DPH
35*
~
352*
16
675O function. The MK command library adds new keywords (they can
External Boolean true.
External Boolean false.
External of the given address. E.g. K (external '83). To type , press
External of the given address. U is equivalent to K. To type o, press
System binary of the given number. To type , press
.
.
.
Character of the given ASCII code.
Program #PrgNumber of the library #LibNumber.
Includes a given variable content in the line.
External program beginning (''K), a (1' must close the program.
NoEval ((K), which causes the next object not to be evaluated. To type ~, press
~35* (To edit an external program, begin it with 352*, so it won’t be evaluated when
Using the Meta Kernel
.
is pressed).
Meta Kernel
&2'(+H[D
2%-+H[D
*5(< ; <
+H[D
n1DPH
Creates a CODE object with the following binary data. Length is calculated.
Creates an object with the following binary data.
Creates a four-grayscale grob XxY.
Puts the address of the corresponding name, if it exists in the entry points table. Consult page 36. To type n, press
.
8 Equation editor
The program EQW can easily create, edit and manipulate algebraic objets, in their hand-written style.
For example, here is a mathematical equation:
E=
1
X
∫ F (t ) dt
0
Here is how it usually appears on the stack:
( d;$%6)WW
And now, here is the same equation typed with EQW:
This EQW display is also used in the stack display:
8.1
First view of EQW
In this document, ‘equation’ stands for all algebraic objects.
8.1.1
Introduction
EQW is a special environment in which the keyboard is redefined and limited to specific operations.
8.1.2
Modes
EQW provides three modes of operation:
•
Selection mode
or
•
Editing mode
In most cases, selection and edit modes are used to enter equations.
•
8.1.3
Cursor mode, used to navigate rapidly through the equation.
Editing
During editing, keys behave in different ways, depending on the current mode.
In selection mode, a part of the equation is inverted or boxed. If a function key is pushed, the function is applied on the selection.
Meta Kernel
Using the Meta Kernel
17
In edit mode, a flashing cursor is ready to insert new characters.
The next sections explain how to enter and edit an equation.
8.2
8.2.1
Creating equations
Running EQW
Type
8.2.2
to run EQW with a new equation.
Exiting EQW
To validate the current equation on the stack, press
.
To get out of EQW, and lose all changes made on the equation, press
.
There may be some times when EQW can’t draw the equation as fast as you type, but all keystrokes are processed, none are lost.
In this case, EQW draws the equation only when there is enough time to do so.
8.2.3
Numbers and names
Type real numbers and names the same way as in the command line.
In edit mode (with the flashing cursor), the character ; is directly available by pressing
ü Note: in EQW, the
either hold
alpha mode.
8.2.4
.
key locks the alpha mode by pressing it once (corresponding to 6)). Therefore, to type a name,
and press the character keys, or press
once, then press the character keys and press
to unlock the
Addition, subtraction, and multiplication
To enter , and ‡, press
,
and
.
The operation is applied on the edited number or name, or the current selection.
To enter implicit multiply, do not press
8.2.5
. An implicit multiply is automatically inserted in the following cases:
•
A number followed by an alpha character or a prefix function (a function whose name is before arguments, for example
).
•
An alpha character followed by a prefix function.
Complex numbers and expressions
To enter a complex number or expression, type in the real part, then
and then the imaginary part.
A complex expression is considered as a two-argument function (equivalent to ).
A complex number is stored directly in the final equation, whereas a complex expression like $% is converted to $%L.
8.2.6
Moving in the equation
Before going further, here are the movement keys. In fact, entering an equation with EQW is not far from the RPN way: no
, then select ; by typing
, and
parenthesis are needed. For example, to type ;, press
. See the examples at the end of this chapter to handle more cases.
then type
Arrow keys move the selection. They behave different ways, depending on the type of selection.
Here are the movement keys when the selection is inverted:
•
selects the first argument of the current function, or if the selection is already a number or a name, then selection
becomes a box.
•
selects the upper function of the selection.
•
and
select the previous or next argument of the upper function.
Here are the movement keys when the selection is in a box:
•
•
goes back into inverted selection mode.
and
select the previous or next number or name, in hierarchical order. This keys are useful to rapidly move around
the whole equation.
To rapidly select a part of the equation, even far from the selection, use the cursor mode (see the Cursor Mode section).
8.2.7
Divisions
Press
to insert a division.
Division is applied on the edited object or the current selection.
To ‘go out’ of the division, use
8.2.8
or
until the whole division is selected.
Exponents
begins the exponent on the edited object or the selection.
Use
8.2.9
18
or
to go out of the exponent.
Square root
•
In selection mode,
•
In edit mode,
applies a square root on the selection.
inserts a square root, eventually with an implied multiply.
Using the Meta Kernel
Meta Kernel
8.2.10
8.2.11
8.2.12
Nth square root
•
In selection mode,
places the selection under the root. Press
arguments, read the Modifications section.
•
In edit mode,
inserts a root. Type the outside term. Press
and type the outside term. To exchange the two
and then type the inside expression.
Parenthesized-argument functions
•
In selection mode, press the function key to apply it on the selection. If the function needs more than one argument, the
selection is used as the first one. press
to go and type the next arguments.
•
In edit mode, press the function key or type its name followed by
, and then the arguments.
User functions
These functions are created by the user and are not handled directly by the HP 48GX.
Type the function name, press
To add an argument, press
8.2.13
and type the first argument.
.
Parenthesized terms
EQW draws equations with the fewest possible parentheses. To add explicit parentheses around the selection, press
8.2.14
.
Differentiation
•
In selection mode, press
to insert a differentiate sign, the selection is the function to be differentiated. Press
and type the variable of differentiation.
•
In edit mode, press
to be differentiated.
to insert a differentiate sign, type the variable of differentiation, press
and type the equation
See the Evaluations section to discover how to differentiate a function without exiting from EQW.
8.2.15
8.2.16
8.2.17
8.3
8.3.1
Integration
•
In selection mode, press
to add an integral sign. The current selection is the equation to be integrated. Press
and
to move around the integral arguments and type them.
•
In edit mode, press
to insert an integral sign. Type the arguments, press
Summations
•
In selection mode, press
to add a summation sign. The selection is the function to be summed. Press
to move around the arguments and type them.
•
In edit mode, press
to insert a summation sign. Type the arguments, press
In selection mode, press
to add a where function. The current selection is the base expression. Press
move to the next argument (the variable and its value).
•
In edit mode, press
to insert a where sign. Type the arguments, press
to
to move to the next one.
Manipulating equations
Modifying equations with EQW
when the equation is on level 1 of the stack.
Modifications
.
.
It can also be edited with HP’s EQUATION WRITER by typing
Temporary exit to the stack
It is possible to go temporarily to the stack by pressing
as before halting.
8.3.4
to move to the next one.
•
To edit a variable name or a bigger expression with the command line editor, select it and press
8.3.3
and
Where function |
To edit an equation with EQW, press
8.3.2
to move to the next one.
. Press
again to get back to EQW, in the same state
Copy paste functions
Copy and paste functions are available. SUB copies the selected expression on the stack. REPL pastes the expression on level 1
either onto the selection, or where the edit cursor is. These commands are accessible in the menu or on keyboard:
Meta Kernel
:
,
:
.
Using the Meta Kernel
19
8.3.5
Deletions
There are different ways to delete a part of an equation.
•
In selection mode, typing numbers or characters suppresses the current selection. To enter a new expression that does not
begin with a number or a name, pressing
8.3.6
deletes the selection and goes into edit mode.
•
To delete a one-argument function, just select this function and press
•
To delete one argument of a two-argument function, select it and press
•
Press
.
to delete all arguments but the one selected.
Evaluations
Selected expressions can be processed by RPL commands (9$/,
These commands are accessible through menus or on keyboard:
:
8.3.7
.
&2/&7
and
(;3$1.
The result replaces the old selection.
,
:
,
:
.
Custom program evaluation
An external program may be applied on the current selection. By pressing
, the program 67$57(4: situated in the HOMEDIR
is called, with the current selection on the stack level 1. This program must return the new expression on the stack level 1.
For example, the following program transforms all the INV functions by 1/ :
„^
,19;
;
`‘0$7&+'523”
8.4
8.4.1
Cursor mode
Switching to cursor mode
To get into cursor mode, press
8.4.2
.
Movement
Arrow keys direct the cursor movement. The movement is faster when
one arrow key.
is held. To go directly to a border, hold
and press
When the cursor stops, a box is drawn around the underlying expression.
8.4.3
Exiting cursor mode
There are two ways to return to selection mode.
returns to the same state prior to entering in cursor mode, whereas
makes the expression under the cursor (which
appears in a box) the new selection. This is a fast way to select a particular part of an equation.
8.5
8.5.1
Miscellaneous functions
Menu use
To show the menu, press a menu key, or
the menu is automatically hidden.
8.5.2
. The menu may be hidden by pressing
Zoom
EQW can draw the equation using the system mini-font, by pressing
keystroke returns to the stack font.
8.5.3
or
. This key can be used in any mode. A second
-→Grob
The current selection may be pushed onto the stack as a graphic object by pressing
the RPL command *52%.
8.6
. When switching to cursor mode,
or
. This function is the same as
Error messages
An error message remains displayed as long as a key is pressed, to keep from destroying the expression.
,QFRPSOHWH
([SUHVVLRQ
*OREDO([SHFWHG
)LUVW$UJXPHQW
0LVVLQJ
7ZR$UJXPHQWV
([SHFWHG
(GLW0RGH
$UJ)XQFWLRQ
1HHGHG
20
One cannot exit from EQW, or perform certain functions when the equation is not complete.
For some functions (e.g. differentiate, integrate), one of the arguments must be a variable name.
Two-argument functions must be typed after the first argument.
(One argument delete) must be applied on a two-arguments or user function.
RPL commands (EVAL, COLCT...) require selection mode.
must be used on a one-argument function like SIN.
Using the Meta Kernel
Meta Kernel
6HOHFW$Q
$UJXPHQW
$OJHEUDLF
([SHFWHG
7RR)HZ
$UJXPHQWV
&RPPDQG
)RUELGGHQ
8.7
can not be used on the whole equation.
To paste an expression, the first level of the stack must contain an algebraic object.
The stack is empty.
RPL commands like SWAP, DUP... are forbidden in equations.
Examples
E=
1
X
∫ F (t ) dt
0
Press:
( d
;
-
$%6
-
)7
G7
-
( d;$%6)77
∂x (
cos x
)
sin 2 x
Type the expression:
&26;
6,1;
A
h
Save it on the stack:
Differentiate it:
Simplify it:
Rebuild the expression:
Change ,19 into :
, move on the last ,19,
8.8
8.8.1
Key reference for EQW
Selection mode
Inverted selection
Previous argument.
Meta Kernel
Boxed selection
Previous variable or number.
Using the Meta Kernel
21
Next argument (if on last argument, go to upper Next variable or number (if on last argument, go to upper
function).
function).
Upper function.
Inverted selection.
First argument of the selected function.
First argument.
Last argument.
Argument left roll.
Argument right roll.
Whole equation selection.
First name or number of the selection, boxed selection.
68%, copies the selection to the stack.
(;3$1's the selection.
&2/&7s the selection.
(9$/uates the selection.
*52% on the selection.
Line command editing.
HP’s Equation Writer editing.
Adds/removes parentheses.
One-argument function deletion.
Argument deletion in a two-argument function or in a user function.
Deletes all but the selection.
Variable or name edition.
Clears selection, goes into edit mode.
,
...
,
,
Inserts a one-argument function.
Inserts a function, the selection becomes the first argument (except for
argument).
,
d and e where the selection becomes the main
,
...
Next argument, or create another argument in a user function.
Creates a complex number, selection is the real part.
Digit, character
8.8.2
Deletes the selection, starts editing.
Edit mode
Digit, character
Adds a character; a number followed by an alpha inserts an implicit multiply.
Fast access to the character ; (
not needed).
Creates user function.
Next argument, or creates another argument in a user function.
8.8.3
Selection and edit mode - common keys
Saves changes and exits.
Discards changes and exits.
+$/7, temporary exit, a second
2)).
returns to EQW, at the same place.
Switches between stack font and little font.
Display the first page of the menu.
Menu, next page.
Menu, previous page.
Turn off the menu.
5(3/aces the expression from the stack in the equation.
8.8.4
Cursor mode
Arrows
, and
Arrows with
Arrows with
,
, Movement.
Fast movement.
Border movement.
Back in selection mode, no changes to the selection.
Back in selection mode, the new selection is the part of the equation that is pointed to by the cursor.
Discards changes and exits.
22
Using the Meta Kernel
Meta Kernel
9 Matrix editor
The Matrix Editor is a matrix-oriented environment.
9.1
Presentation
The MK Matrix Editor can be used like the standard Matrix Writer, but it adds new features. Not only real and complex matrixes can
be edited, but also symbolic, character strings, program, etc., arrays.
For example, here is how the following symbolic matrix:
’A+B’
’B’
1
1
’A-B’
’B+C’
’A’
2
’C’
is represented on the stack as a list of lists:
^^
$%
$
`
^
%
$%
`
^
%&
&
``
To view and edit it under the Matrix Editor, press the down arrow
, or execute the command (',7%.
The symbolic Matrix Writer is powerful enough to manage any knid of datas. For example you can edit you contacts list.
With some external tools you can also transform the Symbolic Matrix Writer into a spreadsheet.
9.2
Usage
Two modes are available, one to create a new matrix, the other to edit an existing matrix.
To create a new matrix, press
. An empty matrix is displayed, where any object can be entered. When
is pressed, if all the elements in the matrix are of the same type, an $UUD\RIW\SH is pushed on the stack (the content is
displayed for real and complex numbers and strings), otherwise a list of list is created (this is a multi-typed array).
In the second mode, when an existing array is edited, if a new element is entered outside the matrix, the other empty cells will be
filled with "null" elements corresponding to the matrix type (0 for reals, for strings, 129$/ for multi-typed arrays, etc.).
PS: For some security reasons, only arrays of real and complex are created. If you want to create an array of an other type, set the
MK flag –27.
9.3
Reference
9.3.1
Keys
Arrows
, and
,
, Movement.
Arrows with
Page by page movement.
Arrows with
Border movement.
Clears the current cell (fills it with the "null" element).
9.3.2
Menu keys
Edits the current cell in the command line editor.
Edits the current cell in the best environment ((',7%).
Makes the cells narrower and displays one additional column.
Makes the cells wider and displays one less column.
/
If the box is visible, makes the cursor move to the next column after entry (on by default).
/
If the box is visible, makes the cursor move to the next row after entry.
/
Selects the cursor speed.
Inserts a row of "null" elements.
Deletes the current row.
Inserts a column of "null" elements.
Meta Kernel
Using the Meta Kernel
23
Deletes the current column.
Copies the current cell to stack level 1.
Copies the object on stack level 1, to the current cell.
Activates the interactive stack.
Set the selection’s upper left corner
Set the selection’s lower right corner
Copies the selection on the stack level 1 as a symbolic matrix
Copies the matrix on the stack level 1 to the current position
Erase the selection
10 Grob editor (Picture2)
PICTURE2 creates and modifies graphic objects, similar to PICTURE, but is more powerful for bitmap creation. Grobs can be in
two or four-level grayscale, and every drawing is made in real-time, with or without zoom.
10.1 Usage
In this part, basis functions will be used to create a sample grob. See the reference part for a complete list of functions.
First create a four-level grayscale grob. Type *5(<
The blank grob is displayed on the stack.
Then edit it. Press
There are two ways to use PICTURE2 functions.
•
Using the menu. To display the menu, press
•
With Shortcut keys. Hold
and press the first letter of a function to launch it. When you don't know the letter corresponding
to a function, search the function in the menu, the shortcut letter is displayed bold.
Now draw an ellipse, using the menu. Press
to hide the menu.
Press
To call an ellipse with the shortcut keys, hold
.
and
cycle through the menu pages.
to display the menu if necessary. The ellipse is called by the menu key
and press
.
(E for Ellipse, remember the bold E on the menu key).
The ellipse can be shaped, using the arrow keys.
Press
anytime to Zoom. Press
Press
to display the cursors coordinates.
a second time to get back to the normal view.
There are three coordinates shown: P1, P2 and P3. P1 is the current cursor position (it is underlined). To put the cursor on one
coordinate, press
,
or
. In the case of the ellipse, P3 is the center of the ellipse, and P1 is a corner of the
enclosing box. P2 is not used.
When the ellipse is correctly positioned (with P1 and P3), it is necessary to fix it on the grob. With no menu displayed, press:
to fix it in white,
to fix it in light gray (white for a two-level grayscale),
to fix it in dark gray (black for a two-level grayscale),
to fix it in black,
24
Using the Meta Kernel
Meta Kernel
to fix it in XOR mode (every pixel of the ellipse will be the opposite of the underlying pixel).
Or press
or
to cancel the ellipse.
These color keys are displayed in the third page of the menu:
The other simple shapes are: (with the
shortcut keys):
Circle. P3 is the center and P1 is a point of the circle.
Line. P1 and P3 are the two ends.
Box. P1 and P3 are two opposite corners.
Plan (filled box). P1 and P3 are two opposite corners.
Spline curve. P1 and P3 are the ends, P2 is the tangential point.
GXOR. Merges another grob, see the reference part (here with a /&'O grob).
A surface can be filled with a given color: Place the cursor on the surface to be filled, press
(Fill), and then, in case of
a four-level grayscale grob, the corresponding color key
,
,
or
. A pattern can be used to fill a surface, see
the reference part.
To leave a trail behind the cursor (like DOT+), press a color key
To change only one pixel, press
To exit, press
,
,
or
,
,
,
or
, corresponding to the color keys
. To stop the trail, press
,
,
,
.
.
, the modified grob will be put on the stack.
10.2 Reference
10.2.1
Commands
These commands can be typed in the command line, or called from RPL programs.
3,&785(
(',7%
3,&7
3,&7
"*5(<
*%/$1.
*5(<
Meta Kernel
The graphic editor which works with the PICT.
The graphic editor which works with the grob on stack level 1.
Stores the grob on stack level 1 in the PICT (like 3,&7672, but it also works the four-level grayscale grobs).
Puts the current PICT grob on the stack.
If the grob on stack level one is in four-level grayscale, returns 1, else 0.
Equivalent to %/$1., but creates a four-level grayscale grob.
Takes two B&W grobs on the stack and creates one four-level grayscale grob with them. The grob on level 2 defines the lowweighted bits (a pixel in this grob becomes a light gray pixel in the gray-grob, a pixel in the grob on level 1 becomes a dark gray
Using the Meta Kernel
25
pixel in the gray-grob; if both or set, they become a black pixel).
To convert a two-level grayscale grob into a four-level one, type '83*5(<.
Contrary of *5(<, takes a four-level grayscale grob and returns two B&W grobs.
*5(<
10.2.2
Keys
Exits PICTURE2.
Switches off the calculator.
Switches on or off the coordinates display.
Switches on or off the menu display.
Position the cursor at P1, and set P1 as the current cursor.
Stores the current cursor position in P1.
Position the cursor at P1.
Position the cursor at P2, and set P2 as the current cursor.
Stores the current cursor position in P2.
Position the cursor at P2.
Position the cursor at P3, and set P3 as the current cursor.
Stores the current cursor position in P3.
Position the cursor at P3.
Inverts the color of the pixel under the cursor.
Copies P1 coordinates in P3.
Switches between P1 and P3 as cursor (No effects if P2 is the current cursor).
Puts the cursor coordinates on the stack, as a complex number.
Puts the cursor coordinates on the stack, as a list of two binary numbers.
Does a SUB. The grob boxed between P1 and P3 is put on the stack, as a grob.
Cancels the current shape (line, circle...) and returns to normal cursor mode.
Clears the whole grob.
Arrows
,
Switches between the zoomed and the normal view.
Puts the current grob on the stack.
, Cursor movement.
and
+Arrows
+Arrows
Page by page cursor movement.
Position the cursor on a border.
Menu keys.
In cursor mode, DOT+ in white.
In shape mode, fixes the shape in white.
In cursor mode, DOT+ in light gray (white in B&W).
In shape mode, fixes the shape in light gray.
In cursor mode, DOT+ in dark gray (black in B&W).
In shape mode, fixes the shape in dark gray.
In cursor mode, DOT+ in black.
In shape mode, fixes the shape in black.
In cursor mode, DOT+ in XOR mode.
In shape mode, fixes the shape in XOR mode.
like
, but only inverses the high-weighted bit plan (try it!).
Cancels the current shape and returns to normal cursor mode.
Puts a white pixel.
Puts a light gray pixel (white in B&W).
Puts a dark gray pixel (black in B&W).
Puts a black pixel.
10.2.3
ALPHA keys
To use these keys, hold
down.
Suspends the current editing, and edits the grob found on stack level 1 (Useful to edit a pattern for a pattern fill). Press
return to the other grob editing.
Box. P1 and P3 are two opposite corners.
Circle. P3 is the center, P1 is a point on the circle.
Executes the program stored in '23,&7.
Ellipse. P3 is the center, P1 is a corner of the enclosing box.
Surface Fill. In B&W, inverses the surface color. In grayscale, the wanted color must be then defined with
,
,
. Press
or
to cancel.
Goes to the interactive stack. Press
to return to PICTURE2.
Line. P1 and P3 are the ends.
Pattern fill (Motif). The pattern must be a 8x8 grob found on the stack level 1, in B&W or in grayscale.
26
Using the Meta Kernel
to
, or
Meta Kernel
Filled box (Plan). P1 and P3 are two opposite corners.
REPL. Takes the grob on stack level 1. It may be positioned with the arrow keys. It is validated by pressing:
does a REPL and drops the grob.
does a GOR and drops the grob.
does a GXOR and drops the grob.
or
cancels.
Spline curve. P1 and P3 are the ends, P2 defines the tangent lines.
11 Filer
The Filer is a file utility that eases directory and port access.
to execute it. The first screen lets you choose the directory.
Press
11.1 Ports and directories screen
The tree screen shows a list of ports and directories.
Press
,
Press
,
Press
to go throughout the list.
or
or
to go in the selected location.
to exit to Filer.
11.2 File selection screen
On this screen are shown: the free memory, the total size of the selected files, a list of files and the menu.
Press
and
to move in the file list.
In each line, there are five fields: the selection number (if the object is selected), an icon depending on the file type, the name, the
type and the size of the file.
Press
to select or deselect a file.
Press
on a directory or a library to go into it.
Press
to go out of the current directory of library.
For all the commands that require a list of files, if there is no selection, the current line will be taken as the selection.
You can change the header in order to display the number of objects available and the working path (here port 0 home):
To hide the type and the size of every objects press
11.3 Menu
Some commands work only in a special mode, for example only in the HOME directory. When you try to run these commands in an
incorrect mode, a beep is produced.
Edits the current object.
Copies the selected objects. You define the destination with the tree screen: select the destination (a port or a directory)
Meta Kernel
Using the Meta Kernel
27
and press
or
.
Moves the selected objects to the destination you selects in the tree screen.
Puts the selected objects on the stack.
Gives information about the current object: Name, type, size, address, CRC.
To go to the tree screen.
Clears the selected objects. If the MK flag –12 is clear (default) you will be prompt for a confirmation
Renames the current object. This command is available only in the VAR
Orders the selected files in the order of the selection. The other files follow.
Evaluates the current object (Some programs that normally do not work in port 2, can work using this command).
Sends the selected files with KERMIT, with the current I/O settings. If the variable
directory, it is used to send the files (level 2: the object, level 1: the name).
67$576(1'
exists in the HOME
Suspend the Filer and return to the RPL stack
Goes to the hexadecimal editor, at the beginning of the current object.
Views the current file if it is a string.
Edits the current object with the best environment.
Starts the custom mode if the FILER.CUSTOM is defined
By default, the Filer displays the memory available and the selected objet’s number. It can display the number of objects
and the working path
11.4 HEXA Editor
The screen shows 64 nibbles and their ASCII value. Each line represents 16 nibbles (separated by 8).
On the bottom of the screen are written the assembly instruction, and the RPL object at the current address.
Press
11.4.1
and
to go one nibble backward or forward. Press
and
to move by 16 nibbles.
Menu
Searches an hexadecimal string
Searches the next occurrence.
Goes to a given address.
Pushes the current object on the RPL stack. This command is very useful to recover data from a corrupted card
((,QYDOLG&DUG'DWD)
Pushes the current address on the RPL stack as a binary integer
Exits the Hexa Editor.
11.4.2
Keys
Jumps to the next assembly instruction.
Jumps to the next RPL object.
Goes in edit mode.
28
Using the Meta Kernel
Meta Kernel
11.4.3
Edit mode
Very dangerous, use at your own risk !
Use the arrow keys to move, press a hexadecimal key from 0 to F to put the digit at the cursor position. Press
exit the Edit Mode.
Meta Kernel
Using the Meta Kernel
again to
29
Utilities
1 Font Editor (EDF)
EDF is a font editor. It is accessed through the CHARS menu, where the current font can be edited. Any font can be edited by
pushing it on the stack and pressing
.
1.1
Font editing
When EDF is launched, scan mode is active, the font is displayed on the screen and the cursor is moved by the arrow keys. The
current character number is displayed on the bottom of the screen (here 67: &).
Switches to edit mode. On the left of the screen, the character is displayed eight times bigger, on the right in its normal size.
gets back to the CHARS mode.
The cursor is in the big character view, on the left. It is moved with the arrow keys, and
1.2
inverts the pixel under it.
CHARS mode
The chars mode is the default mode when EDF is launched. The cursor is moved by the arrow keys.
pushes the current character on the command line. Press
to exit.
pushes the current character on the command line and exits to the command line.
1.3
A session with CHARS
We will add a point inside the character &.
Press
Press
to enter in CHARS. Use the arrows to move to the & character:
to edit it:
Use the arrows to move to the center of the character, press
Press
Meta Kernel
to put a point:
to return to the stack display. See how the & characters have changed.
Utilities
31
ü
Note that this only affects the current font. The next
and store the changed font.
)217 will destroy the changes. To make them permanent, do a )217
2 Machine Language Compiler (Masd)
2.1
Generalities on ML (Machine Language)
As the Saturn processor directly executes ML, the operating system can not control what a ML program is doing.
On the HP 48 calculator, user data are stored in the same area as temporary data. When there is a bug in a ML program, you have
best chance to lost your data’s. So be very careful when programming in ML.
ML is a processor dependent language, so what you will learn on the HP 48 will not be useful on other processor. On the other
hand, the programming techniques you will acquire are not dependent of the hardware and then will be reusable.
2.2
Launching Masd
To compile a program, put the string on the top of the stack and type $60 or use the $60 menu of the 0'*. library.
2.3
Generalities on Masd Syntax
Masd expects a character string (called source) on the top of the stack.
A source is a set of instructions, comments, and separation characters and ends with a carriage return and an # sign.
Masd is case sensitive, so be careful, as « ERXFOH » and « %28&/( » are two different labels.
Separation characters are those with an ASCII number below 32. They include spaces, tabs, line feed and carriage return.
Some instructions need a parameter, called field. Separation characters between an instruction and the field, are spaces, tabs, and
points. Therefore $%$ can be used instead of $%$.
Comments can be placed everywhere between two instructions. They begin with or and finish at the end of the current line.
Directives change the way Masd interprets your source. Theses instructions begin with a and will be explained later.
While Masd is working, it displays messages on the screen to explain what is processed.
/LQNLQJ)LOH1DPH
8SOLQN
&RPSLO*ODE
&RPSLO([S
*DUEDJH
*KRVW/DEHO1DPH
Compiles the FileName file. The main file is called Main.
Ends the compilation of a file.
Compiles global jumps.
Calculates expressions.
Reconfigures the memory.
Detects an unused label.
If Masd detects one or more syntax error, it will push a list describing all errors on the stack. This list is used by
location of errors, and let the user correct them.
(5
to find the
Errors may be notified at the wrong place. For example if a label is not correctly defined, the errors will be located on the calling
instructions.
2.4
Links
Links are source files that can be linked during compile time (equivalent to the {$I} directive in PASCAL and #include in C).
When a link call is encountered, Masd stops compiling the current link, compiles the new one and then continues compiling the first
one.
Syntax:
)LOH1DPH
links the file called FileName.
Note 1: A link can call other links.
Note 2: You can not use more than 256 links in your project.
Note 3: To know how Masd looks for files, see the File search section.
Note 4: Links are useful to cut projects in independent parts to allow fast and easy access to source code.
2.5
Using labels
A label is a marker in the program. The principal use of labels is to determine jump destinations.
A label is a set of less than 128 characters different from space, ‘’, ‘‘, ‘’ and ‘’. A label begins with a star ‘’ and ends with a
separation character.
%LJ/RRS
is the BigLoop label declaration.
Be careful about upper and lower cases!
Three types of labels can be used:
32
Utilities
Meta Kernel
•
Global labels
A global label is a label that can be used everywhere in the project, like global variables in Pascal or C.
•
Local labels
A Local lab is a label that is only accessible in a local section like local variables in Pascal or C.
A local section starts at the beginning of a source, after a global label, after a link (see link section) or after a /2&$/ directive.
A local section finishes at the end of a source, before a link, before a global label or before a /2&$/ directive.
A local label is identified by a ‘’ as the first character.
•
Link labels
A link label is a label that exists only in the link where it is declared, like a private clause in Object Pascal.
A link label is identified by a ‘B’ as the first character.
Note 1: In projects, using less global labels is better because a global label is longer to compile and because it gives a better
program structure. A good habit is to use global labels to cut the program in subroutines, and to use local labels inside these
subroutines.
Note 2: The Meta Kernel command line is able to find labels in a source. Press blue shift *272.
2.6
Using constants
It is possible to define constants. It is useful to identify a memory address by a name, rather by the address itself.
For example, instead of typing ' every time it is needed, it is better to declare
the project and then to type ' 5HVXOW when needed.
'&5HVXOW at the beginning of
Constant declaration:
'&(&VW1DPH([SUHVVLRQ or
(48(&VW1DPH([SUHVVLRQ or
'(),1(&VW1DPH([SUHVVLRQ
'&&VW1DPH&VW9DOXH or (48&VW1DPH&VW9DOXH
CstValue is a hexadecimal number. A decimal number can be typed with a leading character.
'&)RR is same as '&)RR
Note 1: A constant cannot be given the same name as a declared label.
Note 2: The name of a constant follows the same rules as the name of a label.
Note 3: A constant value is always stored on 5 nibbles.
Masd introduces a ‘programming register’ called CP (Constant Pointer) which helps to define constants. CP is defined by:
&3 &VW or &3( ([SUHVVLRQ
CP is defined on 5 nibbles, its initial value is 80100.
'&&3,QFUHPHQW&RQVWDQW1DPH
declares a constant with the current CP value and then increase CP by Increment.
Note: Increment is a hexadecimal value, to use a decimal value, put a leading .
For example, if CP equals to $10
'&&3)RR
defines a Foo constant with a value of $10 and then change the value of CP to $15.
Several constants can be defined, starting from CP.
,QF&VW1DPH&VW1DPH...&VW1DPH1
defines N constants CstNamex with a value of CP+x*Inc and then changes the CP value to CP+N*Inc.
By default, Inc is a decimal number. It can be typed in hexadecimal, with a leading .
2.7
Expressions
An expression is a mathematical operation that is calculated while compiling.
Terms of this operation are hexadecimal or decimal values, constants or labels.
An expression stops on a separation character.
'&&3#'DWD
...
' #'DWD' '83/&'83
are correct expressions.
Notes:
•
A hexadecimal value must begin with a and a decimal value must begin with a .
•
The character equals to the address of the current instruction in absolute mode, or to the offset of the current instruction in
standard mode (This value has no meaning in itself, but may be used to calculate the distance between a label and the current
instruction).
•
The value of a label is the address of the label in absolute mode, or the offset of the label in the program in normal mode (This
value has no meaning in itself, but may be used to calculate the distance between a label and the current instruction).
Meta Kernel
Utilities
33
2.8
•
Entries from the STARTEXT table may be used. In an ambiguous case ('83 may either be an addition
‘'83‘), add around the word: '83.
'83 + 5, or an entry
•
There is no priority (precedence) in operations. $1+$2*$3=$9 instead of $7. Use parentheses to set priorities.
•
You can’t use more than three level of parenthesis.
•
Calculations are done on 64 bits.
•
X divide by 0 = $FFFFFFFFFFFFFFFF.
•
By default, expressions are calculated at the end of the compilation of the project.
•
Masd can be forced to compile expressions using the &203(;3 directive. But be careful, if an expression uses a label that is not
already declared, this will cause an error on the expression and not on the !COMPEXP directive.
•
Masd can be forced to compile the last expression using the &203(; directive with the same remarks than for !COMPEXP. This
can be useful when local labs are used in an expression.
Skips
Skips are a first step from ML to a third generation language, even if they are only another way to write SATURN instructions.
The basement of Skips is the Block structure.
A block is enclosed in ^ and `, and can be inside another block.
The following instructions deal with blocks.
SKIPS instructions
6.,3^...`
6.,3/^...`
6.,3&^...`
6.&^...`
6.,31&^...`
6.1&^...`
Test 6.,3<(6^...`
Test ^...`
Test ^...`
6.8%^...`
6.8%/^...`
^...`
675,1*^...`
&2'(^...`
6752%-352/2*^ ...
`
Equivalents
*2726...6
*272/6...6
*2&6...6
*2&6...6
*21&6...6
*21&6...6
Test *2<(66...6
Test *2<(66...6
/Test *2<(66...6
*268%6...6
*268%/6...6
Defines a block (generates no code)
$&*2,16...6 (to create a character string)
'&&*2,16...6 (to create a code object)
352/2**2,16 ...6 (to create a ‘prolog – length’
object)
/Test is the opposite of Test. For example if Test is "$&$, /Test is "$!
register ("+67 , "03 , "65 , ";0 and "6% ) cannot be inverted.
&$. The test instructions dealing with the hardware
Once blocks are defined, special instructions can be used in them. These instructions called EXIT and UP allow to jump to the end
or to the beginning of a block.
These instructions
^
(;,7
(;,7&
(;,71&
"$ $(;,7
83
83&
831&
"$ $83
`
are equivalent to
%HJLQQLQJ
*272(QG
*2&(QG
*21&(QG
"$ $(QG
*272%HJLQQLQJ
*2&%HJLQQLQJ
*21&%HJLQQLQJ
"$ $%HJLQQLQJ
(QG
Note: do not make confusion between EXIT and UP instructions, which are GOTOs, and EXIT and UP after a test, which are
GOYES’s.
EXIT and UP can jump to the beginning or to the end of an upper-level block by specifying the number of blocks to exit, after the
UP or EXIT instructions.
These instructions
^
^
^
83
83
(;,7
(;,7
`
`
`
Are equivalent to
%HJ
%HJ
%HJ
*272%HJ
*272%HJ
*272(QG
*272(QG
(QG
(QG
(QG
Note: EXIT1 is equivalent to EXIT, and UP1 is equivalent to UP.
Using SKIPELSE, SKEC or SKENC instructions, two blocks create an IFNOT-THEN-ELSE structure.
These instructions
"$ $6.,3<(6
34
Are equivalent to
"$ $*2<(6%HJ
Or in high-level language
,)127$ 7+(1
Utilities
Meta Kernel
%HJ
*272(QG and not End1
*272%HJ
(QG
*272(QG
%HJ
$$
*272(QG
*272%HJ
(QG
^
(;,7
83
`
6.(/6(
^
$$
(;,7
83
`
2.9
%(*,1
(1'
(/6(
%(*,1
(1'
Macros
If data are to be included in a project, they can be entered in a source file, using .
But a simpler way is to include data from an external file, which is a macro. The macro file must be a character string, a graphic, a
code object or a list.
In case of a string or a code, Masd includes only the data part (after the length)
In case of a graphic, only the graphic data will be included (no length, no dimensions).
In case of a list, only the first object of the list will be included following the previous rules.
The syntax is:
)LOH1DPH
Note: To know how Masd looks for the FileName file, see the following section.
2.10 Filename conventions
Masd sometimes needs to find a file in the HP 48 memory.
The file can be found either by specifying the complete file name and location, or only the file name to be search in the search path
list.
The initial search path list contains the current directory, the upper directory and so on to the HOME directory.
Note: You can add a directory in the search path list using
the full pathname rules, explained below.
3$7+5HS1DPH where RepName identifies a directory name using
To specify a full path, use
+ to specify HOMEDIR as the root.
[, where x is a port number, to specify a port as root.
This root is followed by a list of directories, ending with the name of the file.
72727,7,7878 specifies the TUTU file in the TITI directory, stored in the TOTO backup of the fourth port.
+0(<28 specifies the YOU file in the ME directory, in the HOMEDIR.
2.11 Units
A unit is a part of a project, which can be compiled separately and stored in a file. The generated unit code can then be included in
the project final code, without recompiling it.
A unit can use labels and constants defined in the calling program, and the calling program can use labels and constants defined in
the unit.
Any source can be changed into a unit by placing a 81,7 directive in the source.
In the calling source file, type 86(6)LOH1DPH to include a unit.
Note 1: A unit is smaller in memory than the source file it comes from.
Note 2: Using a unit is a very fast operation, faster than compiling the source.
Note 3: Tools libraries can be created and distributed without sharing the source code.
2.12 Library creation
Libraries can be created with Masd using the following instructions:
LIB, MESSAGE, VISIBLE, HIDDEN and LCONFIG.
Here is a source producing a library:
Meta Kernel
12&2'(
/,%
^OLEUDU\QDPH
0(66$*(
^0HVVDJH
0HVVDJH
`
9,6,%/(
^9LVLEOH1DPH
9LVLEOH1DPH
`
+,''(1
^+LGGHQ1DPH
+LGGHQ1DPH
`
QRFRGHSURORJ'&&
EHJLQQLQJRIOLE
OLEUDU\WLWOH
OLEUDU\URPLGLQGHFLPDO
PHVVDJHWDEOH
YLVLEOHOLVW
1DPHRI)LOH1DPHVFRQWDLQLQJ
YLVLEOHREMHFWV
KLGGHQOLVW
1DPHRI)LOH1DPHVFRQWDLQLQJ
KLGGHQREMHFWV
Utilities
35
/&21),*&RQILJ1DPH
1DPHRIWKHILOHFRQWDLQLQJ
WKH&RQILJ2EMHFW
`
HQGRIOLE
#
2.13 SysRPL mode
Masd can switch to SysRPL mode (also called System RPL or External) using the
changing.
53/ directive. In RPL mode, lots of things are
Separation characters don’t change (Characters of ASCII number below 32).
Comments begin with and end at the end of the line, or begin with ‘‘ and end with ‘’.
2.13.1
Instructions
In RPL mode, Masd interprets instructions in the following order.
a) Constants
If a constant exists with the same name, the constant value is used on 5 nibbles.
Example:
(487272(&)
...
7272
will produce
)&(
b) External (in entry points table)
If an entry in the external table exists with the same name, the value associated with this entry is used.
%=8([W
will produce
'%&
Note 1: Use the TableCreator program on your PC to create the table.
Note 2: This table can be stored anywhere in the HP 48 memory. Create a
of the External table on the first line and a # on the second line.
67$57(;7 text file in the HOMEDIR with the file name
Example of a STARTEXT file for a table stored in the Table backup to the fourth port:
7DEOH
#
Note 3: Using an external table is much faster than using constants. On the other hand, constants are project dependant, which is
not the case of an external table.
c) Tokens
^
`
6<0%2/,&
81,7
FVW
FVW
FVW
FVW
375FVW
$&375FVWFVW
520375/LE12EM1
UHDO
UHDO
&UHDOUHDO
&UHDOUHDO
...
+;66L]H'DWD
Program prolog $02D9D
List, Program or Algebraic end $0312B
List prolog $02A74
List end $0312B
Algebraic prolog $02AB8
Unit prolog $02ADA
System Binary of cst value, given in hexadecimal.
System Binary of cst value, given in decimal.
System Binary (hexadecimal value). If the SB exists in ROM, its address is used.
System Binary (decimal value). If the SB exists in ROM, its address is used.
Address. 375(&) generates )&(.
Extended pointer.
XLIB.
Real number.
Long real number.
Complex number.
Long complex number.
Character string. Special characters can be included by typing ? and the ASCII value on two hexadecimal
characters.
Global name.
Local name.
Tagged object.
XLIB identified by its name. If it is a standard HP48 command (like ['83), the address is used instead of an XLIB
object.
Binary integer ($02A4E), Size is in hexadecimal and Data is a set of hexadecimal characters. Example: +;6
*52%6L]H'DWD
/,%'$76L]H'DWD
%$.6L]H'DWD
/,%6L]H'DWD
(;76L]H'DWD
(;76L]H'DWD
(;76L]H'DWD
(;76L]H'DWD
$55$<6L]H'DWD
GROB ($02B1E).
Library data ($02B88).
Backup ($02B62).
Library ($02B40).
Extended1 ($02BAA).
Extended2 ($02BCC).
Extended3 ($02BEE).
Extended4 ($02C01).
Array ($029E8).
,'QDPH
/$0QDPH
7$*FKUV
[[OLE1DPH
36
))$
Utilities
Meta Kernel
/1.$55$<6L]H
'DWD
&2'(6L]H'DWD
1,%%6L]H'DWD or
1,%+(;'DWD or
&216L]H([SU
&+5[
,1&/2%)LOH1DPH
,1&/8'()LOH1DPH
/$%(/ODEHO
(48&VW1DPH&VW or
(48(&VW1DPH([S or
'(),1(&VW1DP([S
(48&3,QWHUOHDYH
&VW1DPH
Linked Array ($02A0A).
Code object ($02DCC).
Includes directly hexadecimal data (no prolog).
Character object.
Includes the content of the file FileName.
Includes the source of the file FileName to be compiled (Like in ASM mode).
Defines a label (like in ASM mode).
Defines a constant (Like DC in ASM mode).
Defines a constant (Like DCCP in ASM mode).
Note: A constant can be defined in ASM or RPL mode, and may be used in both modes.
d) Decimal value (System Binary)
If the instruction is not yet recognized, and if it is a decimal value, Masd generates a system binary.
e) Unnamed local variables
Then, Masd tries to match the instruction with declared local variables.
A local environment is set using:
^^YDUYDU...YDU1``
with N<23
These variables have names during compile time, but they are implemented as unnamed local variables, which are faster to
access than named local variables.
A local variable is recalled by typing its name
Data can be stored in a local variable by typing its name, with a leading or .
Note 1: Local variable are available until the next local definition.
Note 2: The local environment is not closed automatically, use $%1' or other provided words.
Example:
^^ODEHOODEHOODEHO1`` will become :
18///$01!1'831'2%,1' (or /$0%,1' if there is only one variable)
And:
ODEHO →*(7/$0
ODEHO→387/$0
ODEHO→387/$0
Program example
18///$07:21'831'2%,1'
*(7/$0387/$0
$%1'
^^$%``
%$
$%1'
Notes on RPL mode.
Masd switches back to ASM mode using the $60 directive.
2.13.2
Special keystrokes in the command line
In the command line editor, some keystrokes help to enter characters that are specific to System RPL, and also to easily find a
command (auto-completion).
displays a comma .
followed by
maintained and
displays a semicolon .
In alpha mode,
followed by
In alpha mode,
maintained and
displays a vertical bar _.
displays an anti-slash ?.
Auto-completion works as follow:
Type the first characters of the command, for example '8.
Press
Use
Press
Meta Kernel
and maintain it. Press
and
once. The screen will now display all the commands that begin with
'8: '803.
to travel in the list.
to insert the command in the text.
Utilities
37
To cancel the search without inserting a command, press
.
Inserting a bloc program:
then
maintained and
will:
If no Command Line exists: create one with:
ASSEMBLY MODE:
12&2'(
53/
B
#
SystemRPL MODE:
B
#
B is the position of the cursor.
If a Command Line exits insert and indent a SystemRPL program bloc :
B
2.13.3
Program example
To find or understand the syntax of a particular object, use 6 to produces an Masd syntax-source
As in ASM mode, a RPL source must end with a #.
12&2'(
53/
21(0\ILUVWSURJUDP
$60
7XUQLQWR$60PRGH
&2'(^6$9(/2$'53/`
53/ 7XUQLQWR6\V53/PRGH
7:2
#
2.14 SATURN instructions syntax
In this section:
x is an integer number between 1 and 16.
h is a hexadecimal digit.
a is a 1 to 16 or a 0 to 15 number depending of the current mode (0-15 or 1-16)
f is a field A, B, X, XS, P, WP, M or S.
Reg is a working register A, B, C or D.
SReg is a save register R0, R1, R2, R3 or R4.
Exp is an expression.
Cst is a constant. The value is given in hexadecimal or decimal using a leading or respectively.
DReg is a pointer register D0 or D1.
Data is memory data pointed by D0 or D1. It means '$7 or '$7.
Note: For instructions that use two working registers, only the pairs A-B, B-C, C-D and A-C are available.
For instructions like Reg1=Reg1… you can write only Reg1… Example: $
2.14.1
$&$ is the same as $&$.
Assigning 0 to a register
Syntax: Reg=0.f
Example: $
2.14.2
0
Loading a value in A or C
LC and LA instructions allow to load a constant value into A or C register.
/&KKK...KK loads x nibbles into C.
/$KKK...KK loads x nibbles into A.
Example: /&
Note: LC #12 allow to load 12 decimal into the 3 first nibbles of C. The number of nibbles used is the number of characters
necessary to write the value (including the ). So #12 will take three nibbles.
38
Utilities
Meta Kernel
/&$6&[&KDUDFWHUV loads
the hexadecimal value of x characters into C. x must be between 1 and 8.
counterpart for A.
/$$6&[
if the
Example: /&$6&+3B0$6'
/&[([S or /$[([S load the result of an expression into C or A, using x nibbles.
Example: /&#%XIIHU'DWD2IIVHW
2.14.3
Loading a register value into another register
Syntax: Reg1=Reg2.f
Example: $
2.14.4
%;
Exchange between two registers
Syntax: Reg1Reg2EX.f
Example: &'(;:
2.14.5
Addition
Syntax: Reg1=Reg1+Reg2.f
or
Example: &
&$$
&$$
or
Reg1+Reg2.f
Note if Reg1 and Reg2 are same, this cause to multiply the register by two.
2.14.6
Subtraction
Syntax: Reg1=Reg1-Reg2.f or
Reg1-Reg2.f
Example: &
&%$
&%$
or
Note: The following instructions are also available:
$ %$I
2.14.7
% &%I
& $&I
' &'I
Increment and decrement
Syntax: Reg=Reg+Cst.f or Reg+Cst.f Reg=Reg-Cst.f or Reg-Cst.f
Example: $
$$
or $$
$ $$ or $$
Note 1: The Saturn processor is not able to add a constant greater than 16 to a register but if cst is greater than 16, Masd will
generate as many instructions as needed.
Note 2: Even if adding constants to a register is very useful, big constants should be avoided because this will slow down
execution, and generate a big program.
Note 3: Adding a constant greater than 1 to a P, WP, XS or S field is a bugged SATURN instruction (problem with carry
propagation). Use these instructions with care.
Note 4: After adding a constant greater than 16 to a register, the carry should not be tested.
2.14.8
Right nibbles shifting (divide by 16)
Syntax: RegSR.f
Example: $65:
2.14.9
Left nibbles shifting (multiply by 16)
Syntax: RegSL.f
Example: $6/:
2.14.10 Right bit shifting (divide by 2)
Syntax: RegSRB.f
Example: $65%:
2.14.11 Right circular nibble shifting
Syntax: RegSRC.f
Example: $65&:
2.14.12 Left circular nibble shifting
Syntax: RegSLC.f
Example: $6/&:
2.14.13 Logical AND
Syntax: Reg1=Reg1&Reg2.f
or
Example: &
&%$
&%$
or
Reg1&Reg2.f
2.14.14 Logical OR
Syntax: Reg1=Reg1 ! Reg2.f
or
Example: &
&%$
&%$
or
Reg1 ! Reg2.f
2.14.15 Logical NOT
Syntax: Reg1=-Reg1-1.f
Meta Kernel
Utilities
39
Example: &
&$
2.14.16 Mathematical NOT
Syntax: Reg1=-Reg1.f
Example: &
&$
2.14.17 Loading value into a R Register
Syntax: RReg=Reg.f
Example: 5
$:
Note: Reg can only be A or C.
2.14.18 Loading value into A or C from a R register
Syntax: Reg=RReg.f
Example: $
5;
Note: Reg can only be A or C.
2.14.19 Exchange between A or C and a R register
Syntax: RegRRegEX.f
Example: $5(;;
Note: Reg can only be A or C.
2.14.20 Memory write (POKE)
Theses instructions write the value of A or C at the address pointed to by D0 or D1.
Syntax: Data=Reg.f
or
Data=Reg.x
Example: '$7
or
'$7 $
&$
Note: Reg can only be A or C.
2.14.21 Memory read (PEEK)
Theses instructions load into A or C the data pointed to by D0 or D1.
Syntax: Reg=Data.f
or
Reg=Data.x
Example: &
or
$ '$7
'$7$
Note: Reg can only be A or C.
2.14.22 D0 and D1 modifications
a) Loading D0 and D1
Syntax: DReg=hh or
DReg=hhhh
DReg=(2)Exp
Example: ' )) '
or
DReg=hhhhh
or
DReg=(4)Exp
or
or
DReg=(5)Exp
' WRWR
b) Exchanges between A or C and D0 or D1
♦
Loading A or C, field A, into D0 or D1
Syntax: DReg=Reg
Example: '
$
Note: Reg can only be A or C.
♦
Loading the four low nibbles of A or C into D0 or D1
Syntax: DReg=RegS
Example: '
$6
Note: Reg can only be A or C.
♦
Exchanging A or C, field A, and D0 or D1.
Syntax: RegDRegEX
Example: $'(;
Note: Reg can only be A or C.
♦
Exchanging the 4 first nibbles of A or C and D0 or D1
Syntax: RegDRegXS
Example: $';6
Note: Reg can only be A or C.
c) Increment and decrement of D0 and D1
Syntax: DReg=DReg+Cst or
DReg+Cst
Syntax: DReg=DReg-Cst
or
DReg-Cst
Example: '
'
'
Note 1: The Saturn processor is not able to add a constant greater than 16 to a register but if cst is greater than 16, Masd will
generate as many instructions as needed.
40
Utilities
Meta Kernel
Note 2: Even if adding constants to a register is very useful, big constants should be avoided because this will slow down
execution, and generate a big program.
Note 3: After adding a constant greater than 16, the carry should not be tested.
2.14.23 Working registers tests
Notes:
A test is always followed by 571<(6, *2<(6, 6.,3<(6, (;,7, 83, *272, *272/, *29/1*, *268%, *268%/ or *26%9/.
•
57< is the same as 571<(6.
•
An arrow () may be followed by a label name, then replacing *2<(6, or may be followed by a skip block, which is equivalent to
the inverse of the test followed by SKIPYES, to reproduce a IF-THEN structure. Example: "$ &$  ^ ` is the same as
"$&$^`.
•
6.,3<(6 may be omitted if followed by a skip block (^`).
*268%, *268%/ or *26%9/, Masd compiles the inverse
&$*272% is the same as "$&$^*272%`.
*272, *272/, *29/1*, *268%, *268%/, *26%9/ or ^ cannot be used after a HST test.
A label name must follow a *2<(6, *272, *272/, *29/1*, *268%, *268%/ or *26%9/.
•
If the test if followed by a *272, *272/, *29/1*,
reproduce a GOYES with a larger range. Example: "$
•
•
•
of the test, to
a) Equality and inequality tests
Syntax: ?Reg1=Reg2.f
?Reg1#Reg2.f
Example: "$
"&'$
&%
Note: The HP inequality character may be used.
b) Lower and greater tests
Syntax: ?Reg1<Reg2.f
?Reg1<=Reg2.f
Example: "$&%
"&! '$
Note: The HP lower or equal and greater or equal characters may be used.
c) Nullity tests
Syntax: ?Reg=0.f
?Reg#0.f
Example: "$
"&;6
%
Note: The HP inequality character may be used.
2.14.24 Working with some bits of A or C register
RegBIT=v.a
?RegBIT=v.a where Reg is A or C, v is 0 or 1 (reset or set), and a is the bit number.
Examples: $%,7 , "&%,7 *2<(67272
2.14.25 Operations on PC
$ 3& & 3&
3& $
3& &
$3&(; &3&(;3& $3& &
2.14.26 Working with the Hardware Status Register
6% ;0 65 03 +67 D
"6% ";0 "65 "03 "+67 D
2.14.27 Working with P
3 D
3 333 33
"3 D"3D
3 &D& 3D&3(;D
& &3&3
2.14.28 Jump instructions
*272ODEHO
*272/ODEHOor*2/21*ODEHO
Cst is an hexadecimal number.
*29/1*&VW
*29/1* ODEHO
label is a constant, or a label in absolute mode
*29/1* &200$1' Command is an entry in the STARTEXT table.
*268%ODEHO
*268%/ODEHO
*26%9/&VW
Cst is a hexadecimal number.
*26%9/ ODEHO
label is a constant, or a label in absolute mode.
*26%9/ &200$1' COMMAND is an entry in the STARTEXT table.
*2&ODEHO
*21&ODEHO
*272&ODEHO same as 6.,31&^*272ODEHO`
*2721&ODEHOsame as 6.,3&^*272ODEHO`
5715716;0571&&5716&57,
Meta Kernel
Utilities
41
571&5711&
571<(6 or 57< after a test.
2.14.29 Exchanges between C and RSTK
& 567. and 567. & instructions allow to push to or pop data from the Saturn return stack.
2.14.30 Input / output instructions
287 &6, 287 &, $ ,1 and & ,1
,1 and & ,1 instructions are bugged (they only work on even addresses). So use $ ,1 and & ,1, which are ROM
,1 and & ,1 instructions.
Note 2: if the beginning of ROM is not usable (because it is recovered by RAM), use $ ,1 and & ,1, which are calls to $ ,1
and & ,1 instructions in the Meta Kernel Card.
Note 3: 287 & ,1 is a ROM call that does 287 && ,1.
Note 4: 287 & ,1 is the same, but in the Meta Kernel card (works even if lower ROM is recovered).
Note 1: $
calls to $
2.14.31 Processor control instructions
Working mode modification
6(7'(&6(7+(;
other instructions
81&1*)&21),*5(6(7& ,'
6+87'1,1721,172))56,
65(4"
%86&%%86&&%86&'
2.14.32 New instructions of Masd
*2,1&ODEHO
*2,1$ODEHO
„ and ”
~
$ODEHO
%ODEHO
KKKK...KKK or
1,%+(;KKKK…KKK
KKKK...KKK
[([S or
&21[([S or
(;3[([S
{$VFLL
,1&/8'()LOH1DPH
o&VW
}FVW
}FVW
*2,1ODE*ODE
*2,1ODE*ODE
*2,1ODE*ODE
*2,1ODE*ODE
6$9(
/2$'
53/
/2$'53/
,172))
,1721
(5525B&
5(6675
5(65220
>[email protected]]H
Equivalent to /&ODEHO. (& is the address of the instruction)
Equivalent to /$ODEHO. (& is the address of the instruction)
Program prolog 02D9D and epilog 0312B.
Noeval
In absolute mode, places the address of the label.
In absolute mode, places the address of the label+5.
Includes hexadecimal data. Example: $&'%.
Includes hexadecimal data in reverse order. Example: $%& is equivalent to &%$.
Places the value of Exp in the code, on x nibbles.
Includes ASCII data. The end of the string is the next { or carriage return. Example: {Hello{. To output a
character, put it twice.
Includes directly the specified file as data.
Includes the value of Cst on 5 nibbles. o is equivalent to .
Includes a system binary of value Cst.
Includes a system binary of value Cst. If this number already exists in ROM, its address is used instead.
Same as [ODEHO with x=5, 4, 3 or 2. Useful to create a jump table.
{
Equivalent to *26%9/%
Equivalent to *26%9/'
Equivalent to $ '$7$'3& $
Equivalent to *29/1*%
Equivalent to *26%9/
Equivalent to *26%9/(
Equivalent to *26%9/)
Equivalent to *26%9/%'
Equivalent to *26%9/%(
Makes the code inside the brackets fit the given size, by adding zeros if necessary. Only three levels of brackets can
be used.
2.15 Masd directives
3$7+'LU1DPH
/,1.FKU
2))
/2&$/FKU
',63PHVVDJH
81,7
:$52))
12&2'(
53/
$60
)/ D
42
Add the specified directory in the search path list.
Change the char identifying link labs to chr.
Shut down the screen. This speeds up the HP48 by 13%.
Change the char identifying local labs to chr.
Display the message on the screen.
The output file will be a unit.
Masd will not display ghost labels.
Masd will not generate a $02DCC prolog but will directly output the data.
Switch to 1-16 mode.
Switch to 0-15 mode.
Switch to RPL mode.
Switch to ASM mode.
Clear the a compilation flag.
Utilities
Meta Kernel
)/ D
")/ D
")/ D
$%62/87$GGU
$%6$'5$GGU
(9(1
$'5
&203(;3
&203(;
Set the a compilation flag.
Compile the end of the line if flag a is set.
Compile the end of the line if flag a is clear.
Switch to absolute mode. The program begins at the address Addr. Note: Masd always consider the prolog $02DCC
and code length to be the beginning of the program even if !NO CODE is set.
If in absolute mode, add whites nibbles to continue at the specified address. If not possible, errors.
In absolute mode, cause an error if the directive is not on an even address.
Masd will generate a source defining all constants and labels used in the program instead of the program.
Cause Masd to calculate all previous expressions.
Cause Masd to calculate last expression.
2.16 Error messages
,QYDOLG)LOH
7RRPDQ\OLQNV
8QNQRZQ,QVWU
%DG)LHOG
([SHFWHG
([SHFWHG
(UURU6WDFN6L]H
6L]H7RR6PDOO
&ORVH6L]H
/DEHO([SHFWHG
&RQVW([SHFWHG
&DQ
W)LQG
/DE$OUHDG\'HF
1HHG^
1HHG`
)RUELGGHQ
%DG([SUHVVLRQ
-XPSWRR/RQJ
The file is not a source or a macro. (must end with a #)
Only 256 links are supported. May be due to a recursion.
Unknown instruction.
Incorrect field.
An integer between 0 and 15 is expected.
An integer between 1 and 16 is expected.
You use more than three brackets.
Program between brackets is too big.
There are more @ than >.
A label name is expected.
A hexadecimal number is expected.
Can’t find the label or the file.
A label or a constant is already declared with the same name.
An opening ^ was expected.
A closing ` was expected.
Operation not allowed.
Error in expression.
No comments.
3 Disassembler
The disassembler converts binary code into a source string. There are two ways to use it: with a Code on the stack level 1 or with
two addresses (in binary) that point to the beginning and the end of the code to be disassembled.
The syntax used is Masd syntax, in mode 0-15.
Each line contains an address and an instruction.
If the MK system flag -7 is set (with 6)), addresses are not shown, except for the destinations of jumps. In this case, the
resulting source may be then reassembled if needed.
Example:
&) (default)
$(*26%9/%
$(%/&
$(&$$
$(*21&$(
$(*29/1*%
*26%9/%
/&
$(
&$$
*21&$(
*29/1*%
6)
4 Miscellaneous Utilities
These utilities are found in the MDGKER library.
Some of the following commands are marked Dangerous!, which means that incorrect use of them can corrupt memory. Use them
at your own risk!
4.1
-→H
Returns a character string containing the hexadecimal numbers that form the object on stack level 1 in memory.
Example: $
+ returns (
4.2
H→
Inverse of →H, it converts a hexadecimal character string to the objects coded in it. Dangerous!
Example: $&$%+ returns ^`
4.3
S→H
Converts a character string into its hexadecimal form (every character is converted to two characters).
Example: +,6+ returns Meta Kernel
Utilities
43
4.4
H→S
Inverse of S→H. Every couple of hexadecimal characters gives an ASCII character.
Example: +6 returns +3
4.5
CD→
Does a →H on the content of a Code object.
4.6
-→CD
Inverse of CD→. A hexadecimal string is placed inside a Code object.
4.7
-→A
Returns the memory address of the object on stack level 1.
Example: $ returns $&K (address of the real number 1)
4.8
A→
Puts the object pointed to by the given address on stack. 'DQJHURXV
Example: %$FK$ returns 6,1
4.9
PEEK
Reads memory. Level 2 contains the starting address (a binary number), level 1 gives the number of nibbles to be read (a binary
number). A hexadecimal string is returned on the stack.
Example: G3((. returns %'$
4.10 POKE
Writes memory. Level 1 contains the hexadecimal string, level 1 the start address. 'DQJHURXV
Example: K&32.( changes the contrast.
4.11 SREV
Reverses the order of the characters in a string.
Example: +365(9 returns 3+
4.12 PRG~LST
Transforms a program to a list and vice-versa.
Example: ^6:$3'523`35*~/67 returns 35*6:$3'523(1'.
4.13 -→RAM
Creates a new copy of the object in memory, equivalent to 1(:2%, but it also works with ROM objects.
Example: ~'835$0 returns 35*U$$U(1' (the'83 program in ROM).
4.14 APEEK
Reads the address at a given address (binary number on stack level 1).
Example: K$3((. returns 'K
4.15 R~SB
Transforms a real number to a system binary and vice-versa.
Example: 5~6% returns }K
4.16 -→GROB2
Transforms an object to its graphical representation.
The object is on stack level 2. A real number at level 1 gives the desired height:
44
•
1: Mini-font
•
2: Stack font
•
3: Big font
Utilities
Meta Kernel
•
0: Big font, but if the object is an algebraic, the MK equation editor is used to draw it.
If the system flag2 -6 is set, the carriage returns in a string are used to draw multiple lines, otherwise if this flag -6 is cleared, the
string will only be drawn on one line.
Example: 6,1;
*52% returns *UDSKLF°
4.17 -→HEADER
Defines the number of lines of the status area, 0, 1 or 2.
4.18 HEADER→
Returns the current status area height.
4.19 INPUT2
Works like ,1387, but uses the Meta Kernel environment.
4.20 DISP2
Works like ',63, but uses the current system font (defined with )217), so that up to 9 lines can be written.
4.21 HALT2
Works like +$/7, but returns to the Meta Kernel stack (+$/7 returns to the standard HP stack).
ü Note: '(%8*, 667 and 1(;7 in the PRG-RUN menu have been rewritten to work under the Meta Kernel.
4.22 -→S2
Converts an object into a character string in Masd format, in RPL mode.
4.23 -→S4
Converts an object into a character string, like the standard 675. (',7 uses it.
4.24 CHOOSE2
Works like &+226(, but uses the current system font.
4.25 EDIT
Starts editing the object on stack level 1, with the command line editor.
4.26 VISIT
Starts editing the object stored in the given variable name, with the command line editor.
4.27 EDITB
Equivalent to
object type.
(',7, but uses the best adapted environment (command line, equation editor, graphic editor...), depending on the
4.28 VISITB
Equivalent to
object type.
9,6,7, but uses the best adapted environment (command line, equation editor, graphic editor...), depending on the
4.29 EQW
Launches the equation editor with the expression given on stack level 1.
4.30 FILER
Launches the filer.
4.31 ASM
Launches the assembler with the source string on stack.
Meta Kernel
Utilities
45
4.32 ER
Edits the error after assembling. There must be a string at level 2 and the errors list at level 1.
4.33 ASM→
Starts the disassembler. Consult Page 43.
4.34 -→NDISP
Defines the maximum number of lines taken by an object displayed on stack (including grobs and algebraics).
4.35 -→FONT
Sets the font object on stack level 1 as the system font.
4.36 FONT→
Returns the current system font on the stack.
4.37 FONT8, FONT6
Returns the standard Meta Kernel fonts 6 and 8.
ü Note: there is a FONT7 in the MDG menu, but it is empty (Not enough space left !).
4.38 KERNEL?
Returns nothing. It is used to test if the Meta Kernel is present, if a program needs it.
4.39 SF2, CF2, FS?2, FC?2, FS?C2, FC?C2, STOF2, RCLF2
Equivalent to 6), &), )6", )&", )6"&, )&"&, 5&/) and 672), with the new Meta Kernel flags. Consult Page 11.
4.40 SREPL
Does a find/replace in a character string. The main string is at level 3, the find string at level 2 and the replace string at level 1.
Every occurrence of the find string in the main string will be replaced by the replace string. The find and replace strings may have
different lengths.
4.41 AR~LST
Converts an array into a list of lists and vice-versa.
E.g. >>@>@@ ← $5~/67 → ^^`^``.
ü Note: All the objects must be of the same type.
4.42 DIMS
Puts the size of the array contained in a list of lists on stack level 2 and 1 on stack level one. If it is not an array, returns 0.
^^``',06 → ^^
$
$%&`
^129$/``',06 → ^`
4.43 -→MINIFONT
Sets the mini-font object on stack level 1 as the system mini-font.
4.44 MINIFONT→
Returns the current system mini-font on the stack.
4.45 FNT2GRB.PRG
Converts an MK font to a grob font (common 6,7 or 8 x 2048 grob).
This program is on the floppy disk.
46
Utilities
Meta Kernel
4.46 GRB2FNT.PRG
Converts a grob font to an MK font. The grob in at level 3, the name is a character string at level 2 and the identifier a real number
at level 1.
This program is on the floppy disk.
Meta Kernel
Utilities
47
Appendixes
1 Introduction to assembly language
[in complete documentation]
2 Introduction to System RPL
[in complete documentation]
3 Tips and tricks
3.1
Meta Kernel and UFL
UFL (Universal Font Library) is an attempt to normalize the use of fonts in HP48 programs. The idea is to allow all programs to
share the same fonts, instead of having as many fonts as software. UFL is a standard library. It provides two different fonts, the
normal font or the mini-font. The Meta Kernel is able to work only with the last one, since the MK provides many more powerful
features in font management, such as more than 240 different fonts at the same time, while UFL can manage only one. Also, you
can change the system font, without restarting your HP48 with an ON-C.
You will find more information about the UFL at this URL:
http://www.engr.uvic.ca/~aschoorl/ufl/
The Meta Kernel uses its own mini-font, but may use the UFL mini-font. Just execute these few lines, or add them in the
STARTUP file:
)170,1,)217
3.2
3.2.1
STARTED and EXITED examples
Remove the header display
When you edit files, it may be useful to have the whole screen available. Using the STARTED and EXITED capabilities, it is very
easy to remove the header while editing, and restore it after.
67$57('
„
+($'(5
”
(;,7('
„
+($'(5
”
3.2.2
Edit compressed files
When you are short in memory, it may be useful to compress some files. BZ was written by Mika Heiskanen
(http://www.hut.fi/~mheiskan/) it is a very efficient and very fast compressor.
You will find the BZPlus package on http://www.hpcalc.org/utils/compress/.
The problem with the compressor, is that if you want to edit the file, you must uncompress the file manually, edit it, compress it
again, then store it.
With STARTED and EXITED, you won’t have to do that anymore. The idea is to check if a file is a compressed file with STARTED,
if yes uncompress it, and when leaving the command line, compress it with EXITED.
The main difficulty is that the Meta Kernel can edit more than one text at the same time. Then you must save the history of the
edited files, in order to know if the file was compressed or not. The history will be saved in the HOME directory with the name
CHECK.BZ
STARTED is called by the Meta Kernel just before editing an object, and finds the object on the first stack level. Sometimes the
MK calls STARTED without any valid object, in this case, you find the object NULL$ on the stack.
EXITED is called by the Meta Kernel just after exiting the command line by pressing ENTER or ON. When the user press ENTER,
the MK pushes two objects on the stacks as follow:
2: Object
1: TRUE
If the user has pressed ON, only FALSE is pushed on the first stack level.
The following STARTED and EXITED use both System RPL and User RPL, they may be enhanced very easily by using only
System RPL. Anyway, it is a good example of how to use the MASD in RPL mode.
12&2'(
53/
['8318//(4
"6.,3
Meta Kernel
(Check if it’s the NULL$ object)
(If yes do nothing)
Utilities
48
#
[3$7+[+20([6:$3
(Save the working directory)
[,)[%="
(Is it a compressed file?)
[7+(1
[%=8
(If yes, uncompress it)
[(/6(
[,)(1'
[,)(55
(Check if the history file exists)
,'&+(&.%=[5&/
[(557+(1
(If not, create it with a null list)
['523^`
,'&+(&.%=[672
[,)(1'
['523
(Save the history entry)
,'&+(&.%=[672
[6:$3[(9$/
(Go to the previous directory)
(;,7('
12&2'(
53/
[3$7+[6:$3[+20(
(Save the working directory)
,7(
(If the user pressed ENTER)
[6:$3
(Get the entry in the history file)
,'&+(&.%=
[,)[+($'
[7+(1
(If it was a compressed file)
(Compress it again)
[,)(55[%=&[(557+(1[,)(1'
[,)(1'
[6:$3758(
)$/6(
,'&+(&.%=
(Remove the entry in the history)
[7$,/
,'&+(&.%=[672
[6:$3[(9$/
(Go to the previous directory)
#
3.3
Meta Kernel and Erable
Erable is a very powerful Algebra system for the HP48GX. Combined with the Meta Kernel, you will get one of the best handheld
computer algebra system (far better than the TI-92). Here is an example of an STARTEQW file, which allow to use all Erable’s
.
functions from the Equation Writer, by pressing
This STARTEQW was written by Erable’s author: Bernard Parisse
You will find more information about Erable at:
http://www-fourier.ujf-grenoble.fr/pp/parisse/english.html
Meta Kernel
67$57(4:
„(5$%/(
^6,0375,*,17'(5(;(&
3/27&)*$5,7`
&+226(
,)7+(1
'83
^
^(;3$&2/&(;3/,16,1&267(;3$/1&2/&76,03
^%$&.67$57(4:``
^75,*/,175,*&2675,*6,17$16&7$16&+$/)7$1
^%$&.67$57(4:`
`
^GHU5,6&+3)/$3,/$3^%$&.67$57(4:``
^
^1(:9;„'83
9;
672”`
^5(3/$&(„5(3/$&(^
; $/*9`
,1387675(;(&”`
^&200$1'„&200$1'^$/*9`
,1387675(9$/”`
^,62/9;„9;(;(&”`
^%$&.67$57(4:`
`
^
^(5$6($1'3/27„(5$6('8367(4
%K/,%(9$/”`
^$''723/27„(4'837<3(
,)7+(129(5(/6(29(5/,67(1'
67(4%K/,%(9$/”`
^3/270(18„%K/,%(9$/”`
^%$&.67$57(4:`
`
Utilities
49
^
^&203/(;02'(„6)”`
^5($/02'(„&)”`
^,17(*(5$5,7„6)”`
^32/<1$5,7„&)”`
^%$&.67$57(4:`
`
^&+6UHLPFRQM^%$&.67$57(4:``
`
6:$3
68%675*(7&+226(
,)7+(1(9$/(1'
(1'
”
3.3.1
STARTOFF and TOFF example
Here is a completely useless program. But like all completely useless programs, it is completely essential.
This is a screen saver program, it will displays points in the screen until you press a key.
If you want the Meta Kernel to run this program after two minutes of idle time, put G in the ‘TOFF’ file.
67$572))
„
3,&7/&'3,&7^`39,(:
'2
5$1'5%
5$1'5%
/,673,;21
817,/.(<(1''523
7(;73,&7
”
4 The MK for Programmers
4.1
4.1.1
Customizing the Filer
Overview
The filer is completely customizable. You can run your own programs from inside the filer. These programs can utilize all of the
functionality of the filer, which the internal functions use. You can also access all internal functions. This customization is
accomplished using a custom menu that displays labels for each of your custom programs. In the filer, if you press CST or
CUSTOM in the built-in menu, the filer will try to find the file 'FILER.CUSTOM'. This file is used to create your custom menu.
4.1.2
FILER.CUSTOM Format
FILER.CUSTOM is a list with the following arguments :
^
*52%Q
6\VWHP%LQDU\
^
6\VWHPELQDU\
6\VWHPELQDU\
>[email protected]
>6\VWHPELQDU\@
`
^
`
`
4.1.3
This is the GROB that will be displayed in the menu area when you press
use a program that gives a GROB as a result.
Number of pages for the menu
. You can also
Execution Type
Exit type
Program which will be run by the filer
Shortcut-key for the program
....An entry just as above for each custom program
Explanation of each component
a) System Binary 1 and GROB
This is an integer that tells the FILER how many pages the menu will use. For example, if you want two pages (12 labels) then
GROB 131*n would be a 131*16 GROB and SB1 would be 2.
b) System binary 2
This integer allows you to control when the program will be started.
There are 5 possibilities:
SB
0
1
2
3
4
Program Control
You can run the program everywhere (VAR,PORT,BACKUP,LIB)
Only when you are in VAR
Won't run if you are in a library
Won't run if you are in a backup
Will run only in port (home of the port)
c) System binary 3
This integer tells the filer how the associated program will be run. This also allows you to access all the filer's internal subroutines.
There are two categories of custom programs: internal calls, and custom calls.
NOTE: You can use a Binary integer instead of System Binary (it is easier to manage with the User-RPL compiler).
50
Utilities
Meta Kernel
d) Internal calls
The internal calls are included so that you can access the built-in functionalities of the filer from inside your custom menu. For
these calls, you don’t need to put a program in the file unless you want to allow a shortkey (Ex Left-Shift 2). If you use a shortkey
then add any program you want because it won’t be run at all. You should use the smallest possible program (ex: TakeOver
$40788) internal empty program).
SB
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
18
19
1A
1B
1C
1D
1E
1F
20
21
22
23
Operation
Bip
Info
Hexa
View
Arbo
Up
MaxUp
Down
Maxdown
Select (same as ENTER)
Updir
Downdir
Previous menu
Next menu
EVAL
Swap header
Display or remove file’s details (Type& size)
EDIT
COPY
MOVE
RCL
PURGE
RENAME
CRDIR
ORDER
SEND
HALT2
EDITB
e) Custom program
If you are going to run a custom program there are 7 ways to call the program. Every time, the filer will place the working path on
the stack.
Examples:
^`
QE^`
^)22',5`
for HOME
for a port
if you are working in port 2 in the backup FOO.DIR
If you launch the program in the VAR, then your program will start in the current directory. The possible calls are: (1: ect is the
resulting stack that will appear just before your program is run)
SB
10
11
12
13
14
15
16
Type of call
Recalls only the path:
1: Path
Recalls the name and the object for the currently selected object:
3: Path
2: Object
1: Name
Multiple objects selected
n: Path
...
5: Object 2
4: Name 2
3: Object 1
2: Name 1
1: Number of objects (System Binary)
The FILER will call your program after each object. The FILER will place the
following on the stack each time and call your program for each object selected.
3: Path
2: Object 1
1: Name 1
Recalls the name of the current object only
2: Path
1: Name
Recalls all the names selected
n: path
...
3: Name2
2: Name1
1: Number of names selected (System Binary)
Recalls the current object only in a string of addresses
2: Path
1: String
Meta Kernel
Utilities
51
17
Recalls the selected objects in a string of addresses
2: Path
1: String
f)
Explanation for the string of addresses
This string recalled by the filer is a list of addresses. You can use it only in ML or with FILER_FRCL, FILER_FNAME and
FILER_NXTADR, for SysRPL use:
FILER_FRCL (C030F): Takes a String of addresses, and recalls the first object. FILER_FNAME (C030A): Same thing but recalls
the first name object, FILER_NXTADR (C0314): Takes a string of addresses, and removes the first addresses. And FALSE if there
are some addresses left. TRUE if not.
The string format is:
Prolog (02A2C) Size AdrName1 AdrObject1 AdrName2 AdrObject2 ...
Each address is on 5 nibbles.
g) Explanations about the name
For all calls except 14 and 15, the name is the real filename. If you call the program from a library, then the name will be the name
of the library itself (Like ’6WUZUWYF’). However, for 14 and 15, if you have selected a library, the name will be a real
number that is the library number. For 13, if the object is a library, then the name will be a ’L’ plus the Id number.
Example: For Library 1303, the name will be: ’L1303’
NOTE: You can browse every library, but can only run your programs from an attached library.
h) Warning and very important points
In order to save room, we used list of addresses. So, if you modify the directory structural in your programs (using STO, PURGE,
etc.), then NEVER USE CALL 13. And if you are a very experienced programmer, you can use calls 16 and 17.
4.2
Machine Language entry points list
Here is a list of entry points inside the Meta Kernel. They can be used by experienced programmers for programs to take
advantage of the MK. Of course, if these entry points are used, the program won’t run without the MK.
Call a routine with *26%9/&[[[.
Rf means the R register with the field f. Example: Ca describes the register C, field A.
Input and output registers are described in the ‘In’ and ‘out’ sections.
4.2.1
MINI_DISP
&
Address
Description
Displays a Mini-font character string
In
Ca
= number of characters
D1
= string address
D0
= display starting address (in a 131*x grob)
ST11 = inversion (white on black)
4.2.2
MINI_FONT_ADDRESS
&
Address
Description
Mini-font address in the card
E.g. ' &$ '$7$
4.2.3
DISPLAY_SBR
&&
Address
Description
Main display routine
Call INIT_DISPLAY_LINE before using this routine.
In
R0b
= font identifier
R1s
= (font height) * 2 - 1
D0
= starting display address in a grob
D1
= string address
Da
= number of characters
R2a
= display grob width in nibbles
Ba
= left margin in characters
Ca
= right margin in characters
ST4
= display left shift
ST5
= display right shift
ST0,1,2,3 = text attributes (bold, italic, underline, inverse)
ST8
= display carriage returns as characters if set
ST9
= mini-font display
Out
D0
= next line address in the grob
Aa
= last written character address
Da
= number of remaining characters
ST8
= set if a CR has been read
D1
= end of displayed text in the grob
4.2.4
EDIT_SBR
Address
&
in the command line)
Description
Mini-edit (used by
Call INIT_DISPLAY_LINE before using this routine.
52
Utilities
Meta Kernel
In
R4a
Ca
D1
ST9
Out
Carry
4.2.5
= screen address
= maximum number of characters
= buffer address
= mini-font display
FILER.ADR
Address
Description
4.2.6
has been pressed, clear exit by
= set if
&
Address of the main FILER program
SCAN_FONT
&$
Address
Description
Rebuild the font table
This function forces the MK to search through all ports to build the font table.
4.2.7
RECONFIG
&$
Address
Description
Reconfigures the second card
After a DECONFIG, this routine reconfigures the second port card at
).
4.2.8
& (hidden by the MK card), and the bank
switcher at
DECONFIG
&$
Address
Description
Deconfigures the second card
This routine is used to gain direct access to the second card, without deconfiguring the MK.
The second port card is moved from & (where it is hidden by the MK card) to . The bank switcher is moved from
) to ).
4.2.9
CMD_SIZE
&%(
Address
Description
Computes the command line size
Out
Aa
= number of characters.
4.2.10
GET_PATH
&&
Address
Description
Finds the relative path of a directory
In
D1
= buffer address
Ca
= maximum length
If ST2 = 0, the path is taken from the HOME directory to the current directory
if ST2 = 1, D0 = starting directory address, Da = ending directory address
4.2.11
DECONFIG_RAM
&&&
Address
Description
Moves the RAM from to Useful if you plan to make your own interrupt handler. If your RAM based program call this entry point, the return address (RTN) will
be recalculated
4.2.12
RECONFIG_RAM
Address
Description
4.2.13
&'
Moves the RAM from
back to GET_FONT
&'$
Address
Description
Returns the address of a given font
Call SCAN_FONT once before using this routine.
In
Ab
= font id
Out
R0a
= font address
4.2.14
INIT_DISPLAY_LINE
&(
Address
Description
Initializes the display routines
This routine initializes the registers necessary for the MK display routines.
In
Ca
= screen width in nibbles
4.2.15
CHANGE_FLAG
Address
&(
Description
Updates the ST flags 0 to 3 and R0 for the display routine
Computes some parameters for the display routines, when special characters are encountered (font control characters...)
Meta Kernel
Utilities
53
4.2.16
GET_ASCII_KEY
&)
Address
Description
Keyboard handler
Gets an ASCII character or a key number if not in ALPHA mode. This routine handles the shifts and alpha displays.
Out
ST0
= 0 if ASCII
ST0
= 1 if key number.
4.2.17
GET_KEY
&)'
Address
Description
Keyboard handler
Out
Carry = set if no character in the keyboard buffer.
Aa
= key code (if carry cleared)
4.2.18
RUN_KEY
&
Address
Description
Key assignment
This routine associates an assembly code with a key.
Syntax:
*26%9/ 581B.(<
*2,112B.(<B5287,1(
*2,1.(<B$ 01 is the A key code
[[*2,1.(<B[ [[ key code (same as in External)
*2,1127B+$1'/('B.(< a bip routine for example
4.2.19
MINI_DISP_VAL
&%
Address
Description
Displays a hexa value in mini-font
In
D0
= screen address
Bw
= number to be displayed
Ca
= number of digits to be displayed
ST11 = inverse (white on black)
ST10 = 1 to display leading zeros
4.2.20
MINI_DISP_AWP
&
Address
Description
Displays a hexadecimal value in mini-font
In
D0
= screen address
Awp
= number to be displayed
P
= (number of digits) - 1
ST11 = inverse (white on black)
ST10 = 1 to display leading zeros
4.2.21
TRUP
&
Address
Description
Copy up
Equivalent to %, but works even after a DECONFIG_RAM (when RAM is at )
4.2.22
TRDN
&
Address
Description
Copy down
Equivalent to &, but works even after a DECONFIG_RAM (when RAM is at )
4.2.23
ZEROM
&
Address
Description
Resets a memory zone to 0
In
D1
= zone starting address
Ca
= number of nibbles to blank
4.2.24
SCAN_KEY
&(
Address
Description
Keyboard handler
Does a keyboard scan, updates the keyboard buffer and the keystate. Use it when interrupts are disabled.
4.2.25
NEW_ADR
&
Address
Description
Moves an object at the end of the temporary zone
Moves an object in the temporary RAM at the end of this zone, so that
it.
4.2.26
RESIZE_PLUS
Address
Description
54
(object resize) and RESIZE_PLUS can be used on
&&
Resize up a character string
Utilities
Meta Kernel
Resize up the last character string in the temporary RAM.
In
R0a
= string address
D0
= new end of the character string
4.2.27
C=IN3
Address
Description
4.2.28
A=IN3
Address
Description
4.2.29
&()
Equivalent to OUT=C=IN, but in the MK card
OUT=CA=IN3
Address
Description
4.2.31
&)$
Equivalent to A=IN2, but in the MK card
OUT=C=IN3
Address
Description
4.2.30
&)
Equivalent to C=IN2, but in the MK card
&)
Equivalent OUT=C A=IN, but in the MK card
DISP_DEC
&
Address
Description
Displays a decimal number
In
D0
= screen address
Ca
= number to be displayed
ST11 = inverse (white on black)
ST10 = 1 to display leading zeros
4.2.32
MULT_BAC
Address
Description
4.2.33
&$
Ba = Ca * Aa
GREY?
&
Address
Description
Tests if a grob is in grayscale
In
D1
= grob address
Out
Carry = set if grob is in grayscale
4.2.34
BEEP
Address
Description
4.2.35
&
Do a beep if the system flag –56 is clear
KEY_REPEAT
&&
Address
Description
Keyboard handler routine
Repeats a routine associated with a key.
Syntax:
*26%9/ .(<B5(3($7
NH\PDVN in/out mask, e.g. $/02040 for Q (OUT=040, IN=02)
*272.(<B5(3($7B5287,1(
*272(1'B.(<B5(3($7
4.2.36
KEY_NO
Address
Description
4.2.37
&
Waits for all keys to be released
HEX_DEC
&
Address
Description
Hexa to decimal conversion
In
Ca
= hexa to be converted
Out
Aa
= decimal result
4.2.38
A_DIV_C
Address
Description
4.2.39
&
Ba = Aa / Ca
SET_BIT
&&
Address
Description
Sets a bit in a bit field
In
D1
= bit field address
Aa
= bit number (to be set to 1)
Meta Kernel
Utilities
55
4.2.40
CLEAR_BIT
)(&)
Address
Description
Clears a bit in a bit field
In
D1
= bit field address
Aa
= bit number (to be clear)
4.2.41
BIT?
&
Address
Description
Tests a bit in a bit field
In
D1
= bit field address
Aa
= bit number (to be tested)
Out
Carry = set to the value of the tested bit
4.2.42
BZU.SBR
&$
Address
Description
BZU (BZ Uncompression)
Uncompress data using Mika Heiskanen algorithm in his program BZ.
In
D0
= Address of the object to decompress (strings without the B prolog %=).
D1
= Address where you want to uncompress.
4.2.43
INV.ZONE
&
Address
Description
Invert a memory zone
In
D0
= Address zone.
Ca
= Size in nibbles to inverse
4.2.44
OFF.SBR
&
Address
Description
Turns off the machine (real Off)
OFF in ML, doesn’t reboot if libraries have changed.
4.2.45
InitTable
)(&$
Address
Description
Initializes memory zones for SysRPL-table routines
Initializes pointers used by the following routines, which deal with the System RPL entry point table.
There are examples on the floppy disk, in the file EXAMPLES2.DIR.
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
Out
Carry set if no table has been found.
Uses RSTK(5) Aw Cw Ba D0 D1 Da, plus the following memory zones:
(b=bytes, n=nibbles)
%($
DC #5HV=RQH
% on 256b, table name
DC 1E([WHUQDOV %(
% on 5n, number of entries
DC #7DEOH7H[W %(
% on 5n, address of the first entry
DC #7DEOH+DVK %(&
% on 5n, address of the hash table
%(
DC #7DEOH#
% on 5n, address of the pointers table, sorted by addresses
%(
DC 7DEOH3RUW
% on 2n, port number of the table
%($)
DC 5FO3RUW
% on 2n, port number of the table
4.2.46
GetAdr
)(&$&
Address
Description
Returns the address associated with a name
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
In
DO = Address of the text to find, followed by a separation character
Out
Carry = Set if name not found
Ca = Address
Uses Aw, Cw, Ba, Da, D0, D1, RSTK(5).
DC #5HV=RQH%($ % on 256b, name saved
4.2.47
GetText
)(&$
Address
Description
Returns a pointer to the name associated to an address
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
In
Ca = Address
Out
Carry = Set if address not found
D1 = Address of the text (2n for the length, followed by the characters)
Uses Aa, Ba, Ca, Da, D0, D1, RSTK(2).
56
Utilities
Meta Kernel
4.2.48
GetFirst
)(&%
Address
Description
Finds the first name beginning with the given text
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
In
DO = Address of the text to find, followed by a separation character
Out
Carry = Set if no name found
D1 = Address of the text (2n for the length, followed by the characters)
Uses Aw, Ba, Cw, RSTK(4), D0, D1, Da
DC #5HV=RQH %($ % saving of the name to find (on 256 bytes)
4.2.49
GetNext
)(&%
Address
Description
Finds the next name beginning with the given text
Use GetFirst first, values of Bb, Da and D1 must be preserved.
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
In
DO = Address of the text to find, followed by a separation character
Out
Carry = Set if no name found
D1 = Address of the text (2n for the length, followed by the characters)
Uses Aw, Ba, Cw, RSTK4, D0, D1, Da
DC #5HV=RQH %($ % saving of the name to find (on 256 bytes)
4.2.50
GetFirstAdr
)(&%(
Address
Description
Returns a pointer to the first table entry
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
Out
D0 = Address of an entry structure:
Address (5n), name length (2n), name.
Uses D0, D1, Aa, Da, Ca, RSTK(2).
4.2.51
GetNextAdr
)(&&
Address
Description
Returns a pointer to the next table entry
Use GetFirstAdr first, values of Da and D1 must be preserved.
The table is sorted by addresses.
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
Out
Carry = Set if no more entries
D0 = Address of an entry structure (see GetFirstAdr)
Uses D0, D1, Aa, Da, Ca, RSTK(2).
4.2.52
RclPath
)(&
Address
Description
Finds the address of a file
Warning: Port 2 must be at address 40000. Use the DECONFIG and RECONFIG routines.
In
DC #5HV=RQH%($ % on 256b, filename (Masd syntax, ends with an ASCII 0)
Out
Carry = Set if no file found
D1 = Address of the file
Uses Aw, Ba, Cw, RSTK4, D0, D1
4.3
SysRPL entry points
Here is a list of entry points inside the Meta Kernel. They can be used by programmers for programs to take advantage of the MK.
Of course, if these entry points are used, the program won’t run without the MK.
Call a routine with 375[[[[[ in MASD, or with o[[[[[
4.3.1
GET.INDEX
)(&
Address
Description
Create an index for a fast access
In
1 : Matrix (List of list)
Out
2 : Matrix (list of list)
1 : Index (Strings)
4.3.2
GET .Y.I
&$
Address
Description
Recall a row from a matrix
In
3 : Matrix (List of list)
2 : Index (String)
Meta Kernel
Utilities
57
1 : Row nb (System Binary)
Out
3 : Matrix (List of list)
2 : Index (String)
1 : List
4.3.3
GET .X.Y.I
&
Address
Description
Recall a cell
In
4 : Matrix (List of list)
3 : Index (String)
2 : X (System Binary)
1 : Y (System Binary)
Out
3 : Matrix (List of list)
2 : Index (String)
1 : Object
4.3.4
PUT.X.Y
)(&
Address
Description
Put an object into a cell
The matrix has to be split using INNERCOMP ($ 54AF) ex :
{ { 1 2 3 } { 4 5 6 } } INNERCOMP :
3:{123}
2:{456}
1 : <2>
In
N : First row
...
5 : Row n
4 : Number of rows (System Binary)
3 : X (System Binary)
2 : Y (System Binary)
1 : Object
Out
N : First row
...
2 : Row n
1 : Number of rows (System Binary)
4.3.5
DIMS
)(&%
Address
Description
Give the dimensions of a matrix
In
1 : Matrix (list of lists)
Out
If it’s a matrix
4 : Matrix
3 : X (System Binary)
2 : Y (System Binary)
1 : TRUE
or
1 : FALSE
4.3.6
FILER_FNAME
Address
Description
4.3.7
FILER_FRCL
Address
Description
4.3.8
&
See page 52
SURPRISE
Address
Description
4.3.10
&)
See page 52
FILER_NEXTADR
Address
Description
4.3.9
&$
See page 52
&(
Just try!
INPUT
Address
&
Description
SysRPL INPUT, works like ,QSXW/LQH)
This INPUT command takes 10 arguments. [more in complete documentation].
58
Utilities
Meta Kernel
4.3.11
CTRL_LOOP
&
Address
Description
Parameterized outer loop, like 3DU2XWHU/RRS
Takes 9 arguments. [more in complete documentation].
4.3.12
INIT_CMD
Address
Description
4.3.13
CMP_PLUS
Address
Description
4.3.14
&$
Initializes the command line
&
Adds a character to the command line string
DISP_CALL
&
Address
Description
Text display
In
2: Character string
1: 758( if carriage returns are to be interpreted
4.3.15
BZU
&'
Address
Description
Uncompress with BZU
Uncompress the compressed strings using Mika Heiskanen’s algorithm from his BZ program.
In
1 : Strings (without its BZ prolog).
Out
1 : Object
4.3.16
KER_PARAM
&
Address
Description
OuterLoop
Internal version of the ParOuterLoop. This program doesn’t create a local environment to save the menus, therefore you can use
unnamed local variables.
4.3.17
MINI_EDITOR
&
Address
Description
Mini editor on one screen line
In
3:
String (if boolean on level 2 is TRUE)
2:
Boolean
1:
Line number, where the command line has to be put.
Out
2:
String
1:
Boolean (TRUE if line validated by ENTER, else FALSE)
If the boolean is TRUE, the editor is initialised with the character string on level 2.
4.3.18
KEY_PARAM
)(&
Address
Description
Recall a program associated to a key
Assigns a program to key. Recalls the corresponding program.
In
3: Key code
2: Shift code
1: program list (string)
The list is as follow in MASD format :
675,1*^
D[[o[[[[[
a is 1 if in alpha mode, else 0. xx is the code of the key, plus the ML shift code: RightShift=C0 ; LeftShift=40. For example for
the LeftShift+ENTER, run the internal command
DUP :
(;3'83
at the end
`
Out
If the key is in the list :
2: program
1: TRUE
Otherwise
1: FALSE
4.3.19
UPSTACK.ADR
)(&
Address
Description
Internal programs list
Recalls the programs list used by the Interactive Stack. See KEY_PARAM.
Out
1: String
4.3.20
WAITKEY.ADR
Address
Meta Kernel
)(&(
Utilities
59
Description
Internal programs list
Recalls the programs list used by the Kernel. See KEY_PARAM.
Out
1 : String
4.3.21
COMMANDLINE.ADR
)(&
Address
Description
Internal programs list
Recalls the programs list used by the command line editor. See KEY_PARAM.
Out
1 : String
4.3.22
MATRIX.ADR
)(&
Address
Description
Internal programs list
Recalls the programs list used by the Matrix Writer. See KEY_PARAM.
Out
1 : String
4.3.23
SAVE.ARG
)(&
Address
Description
Save the LASTARG
This program is very useful, while you want to run a User RPL command, and you don’t want this program to save the last arg. See
LOAD.ARG too
Ex :
12&2'(
53/
(48 6$9($5*)(&
(48 /2$'$5*)(&'
6$9($5*
['83
/2$'$5*
#
In case of errors, the program will restore the good stack.
4.3.24
LOAD.ARG
Address
Description
See above
60
)(&'
Restore the LASTARG saved by SAVE.ARG
Utilities
Meta Kernel
5 MetaKernel 3.0 : Preview
Here are some screens shot. Juste pour le plaisir des yeux
Pretty Print on numerical matrices
Symbolic matrices
Symbolic Expressions
Units in pretty print
Erable results in pretty print
View big objects directly on the stack
Multi-Tasking: Switch between applications on the fly
Algebraic Mode
And…
Equation Writer 3: Edit symbolic matrices, unit objects
INFORM2: Speed up every menus of the HP48GX by up to 500 times
Modular: Select exactly what you want to use in the MetaKernel
Meta Kernel
Utilities
61
And MUCH MORE ….
Coming Soon…
62
Utilities
Meta Kernel
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement