TUTORIAL 2: HP48 Objects and variables
What are objects?
An object is simply anything that can be put onto the stack.
Object types
- Numbers
- Alphabetical strings
Delimited by " "
- Programs
Delimited by << >>
- Lists
Delimited by { }
- Vectors & Matrices (arrays)
Delimited by [ ]
- Algebraic terms
Delimited by ' '
- Names of objects
Also delimited by ' '
Where to store objects
Data (objects) can be stored in memory in three main ways
- The stack
Objects(e.g. numbers) can be left on the stack and manipulated by various stack
manipulation commands (see later..)
- Global variables
An object can be stored in a "variable" for later retrieval.
Variables are shown in the menu bar by pressing [VAR]
These are called GLOBAL variables.
- Local variables
An object only used temporarily within a program ( i.e. not saved )
is called a local variable. After the program has run, local
variables are cleared.
Manipulating the stack
Manipulation of the stack, ensures that a program will
run at maximum speed, and economise on memory at the same time.
DROP & SWAP commands are on the keyboard. Other stack commands
are shown by pressing [L-S][Cursor-up].
Stack commands
- DROP
Deletes level one of the stack
- SWAP
Swaps levels and 1 & 2
- OVER
Copies level 2 into level 1, pushing old level 1 to 2
- ROT
Moves level 3 to level 1, pushing up the stack
- ROLL
Moves a specified level to level 1
( e.g. 4 ROLL will move level 4 to level 1 )
- ROLLD
Moves level 1 to a specified level
( e.g. 7 ROLLD will move level 1 to level 7 )
- PICK
Copies a specified level to level 1
( e.g. 5 PICK will copy level 5 to level 1 )
- DEPTH
Counts the number of active levels in the stack
placing the number on level 1
- DUP
Copies level 1 ( i.e. levels 1 & 2 are the same )
- DUP2
Copies levels 1 & 2 ( i.e. levels 3 & 4 will be the same as 1 & 2)
- DUPN
Copies a specified number of levels again
(e.g. 6 DUPN will copy the first six levels of the stack again)
- DROP2
deletes levels 1 & 2
- DRPN
a specified number of levels are deleted
( e.g. 4 DRPN will delete levels 1 to 4 )
Memory management
To check the available memory of the calculator
[L-S] [VAR] (MEMORY) |MEM|
To check the size of an object
Put the name of the object on level one.
[L-S] [VAR] (MEMORY) |BYTES|
Variable management
The HOME directory is the "Root" directory of the
calculator. Sub-directories are indicated by a little bar
above the menu label.
the current path
The directory path leading to the current directory is
shown in the message area of the display within
{ HOME ........ }
To get to the HOME directory, from anywhere
Press [R-S] ['] (HOME)
To move up a directory level
Press [L-S] ['] (UPDIR)
To view variables in the current directory
Press [VAR]
If there are more than 6 objects in the directory:
Press [NXT] to scroll across the selection.
To scroll in reverse
Press [L-S] [NXT] (PREV)
To delete (purge) an object
Put the name of the object on level 1
Press [L-S] [EEX] (PURGE)
To create a Sub-directory
Press [alpha] [alpha] Name of subdirectory [ENTER]
Then either: [L-S] [VAR] (MEMORY) |DIR| |CRDIR|
or [alpha] [alpha] CRDIR
To remove a sub-directory Be careful !
Put the name of the sub-directory on level one
then: [L-S] [VAR] (MEMORY) |DIR| |PGDIR|
To copy an object or sub-directory to another directory
Put the name of the object on level, press [ENTER] to duplicate it
Press [R-S] [STO] (RCL) to recall the object to the stack
Get into the destination directory
Press [Right-cursor] to swap
Press [STO]
To move an object to another directory
Follow the same steps for copying and purge the old object.
To rename an object or sub-directory
Put the name of the object on level, press [ENTER] to duplicate it
Press [R-S] [STO] (RCL) to recall the object to the stack
Press [alpha] [alpha] NEWNAME [ENTER] [STO]
Purge the object OLDNAME
To change the ORDER of objects in the varaible menu
Press [L-S] [+] ({})
Press the menu keys of each object in the desired order you wish
them to appear in the menu display.
Press [ENTER]
Press [L-S] [VAR] |DIR| |ORDER|
To edit an object (including programs)
Put the name of the object on level 1
Press [L-S] [+/-] (EDIT)
After editing the object press [ENTER] to save changes
Go to next tutorial
Return to
Tutorial page|
Programming tips|
Quickclose Homepage|
QUICKCLOSE
ABN 68 801 812 834
PO Box 1035 LEICHHARDT NSW 2040 AUSTRALIA
Tel/Fax +61 +2 9550 0010
EMAIL :
quickclose@quickclose.com.au
Last Update: 18th March 2001
Richard Stanaway