HP-28C Reference the first RPL calculator · 1987 · 248 commands, and both keyboards

The clamshell that started RPL: fold it open and there is an alphabet on the left, a calculator on the right, and between them a language in which numbers, formulas, programs and matrices are all just objects on one unlimited stack. This sheet draws both keyboards, explains the ideas the 28C introduced — objects and delimiters, the command line, menus on the alpha keys, local variables, algebraics you can differentiate and solve — and then indexes every command by menu, with its type and Reference Manual page. The red is the one shift key.

Command Function (usable in algebraics) Analytic (has a derivative) Operation
Sources: HP-28C Getting Started Manual, Ed. 3 (HP, March 1987) — keyboards, entry modes, Menu Map, Key Index; HP-28C Reference Manual (HP, 1987) — the Dictionary and the Operation Index the command list is parsed from; HP-28C Programming Examples (HP, June 1987) — the worked example. Page numbers are Reference Manual pages.
Colour keythe machineentry, stack & displayprogrammingmathematicsdata objectssymbolic, solvers & financevariables & memoryinput, output & interfaceplotting & graphicsreference & system

The Keyboards

the case folds open · left half is the alphabet and, shifted, every menu · right half is numbers, arithmetic and the six menu keys under the display
Object Type · Symbol · ExampleReal number 1.23456E-25Complex number( )(123.45,678.90)String" ""RESULT"Real vector / matrix[ ][1.23 4.56 7.89]Complex vector / matrix[ ][(1,2) (3,4)]List{ }{1.23 "ABC" #45}Name' ''CALC'Program« »« DUP + SWAP »Algebraic' ''X+Z·Y=Z'Binary integer##123AB
PROGRAM
ARRAYA
BINARYB
CMPLXC
STRINGD
LISTE
REALF
STACKG
STOREH
 I
ALGEBRAJ
 K
PRINTL
CTRLM
BRANCHN
TESTO
 P
CATALOGQ
UNITSR
S
T
U
ΣV
°W
μX
<Y
>Z
"#
}{
][
)(
NEWLINESPACE
»«
=
?LC
α LOCKα
hp28C
○ ⤴ α ((•)) ▭ (2π) ⊟4:3:2:381:.5SIN ASIN COS ACOS TAN ATAN
 
MODE◀▶
LOGSTRIG
STATSOLV
PLOTUSER
PREVNEXT
EDITENTER
VIEW▲CHS
VIEW▼EEX
ROLLDROP
SWAP◀─
VISIT'
COMMAND7
UNDO8
LAST9
1/x÷
RCLSTO
PURGE4
5
d/dx6
^×
→NUMEVAL
CONT1
%2
%CH3
OFFON
CLEAR0
π·
CONVERT,
+
red label above a key — reached with the shift key the six blank keys take whichever menu is showing; shifted, they are the cursor menu (INS, DEL, arrows)letters need α (alpha mode); LC for lower case

HP-28C Guide

the machine, and the language it introduced

Anatomy four things the two keyboards do not tell you

Everything is an object

RPL has no separate worlds for numbers, text, programs and formulas. The stack holds objects, and there are exactly ten kinds — the label printed inside the lid lists them, and TYPE returns the number. What tells the calculator which kind you are typing is the delimiter you open with.

0Real number 1.23456E-25
1Complex number( )(123.45,678.90)
2String" ""RESULT"
3Real vector / matrix[ ][1.23 4.56 7.89]
4Complex vector / matrix[ ][(1,2) (3,4)]
5List{ }{1.23 "ABC" #45}
6Name' ''CALC'
7Local name→ name→ n « … »
8Program« »« DUP + SWAP »
9Algebraic' ''X+Z·Y=Z'
10Binary integer##123AB

The two that matter most are the quotes. 'X+1' is an algebraic — a formula kept as a formula, which is what the ALGEBRA menu, the solver and d/dx operate on. « DUP + » is a program — a sequence of objects and commands waiting to run. Both are data until you EVAL them, and a name in quotes is the name itself, while the same name unquoted evaluates whatever is stored under it.

The command line is not the stack

You type into a command line at the bottom of the display; nothing reaches the stack until ENTER parses it. That is why ENTER is one key and why pressing an operator with something still in the command line does two things at once.

15 ENTER
4:
3:
2:
1:15
15 parsed and pushed
23 ENTER
4:
3:
2:15
1:23
stack lifts
+
4:
3:
2:
1:38
both consumed, one result
30 SIN
4:
3:
2:38
1:.5
SIN parsed the line first

The stack is unlimited (until memory runs out), so there is no T register to lose things off the top and no LAST X — instead LAST returns the arguments of the last command, and UNDO the whole previous stack. The display shows four levels; VIEW▲ scrolls to the rest.

One line, 23 characters: key more and it scrolls. The cursor keys along the top of the right keyboard edit it, and COMMAND brings back the last four lines you entered.

The left keyboard is the menu system

Thirty-nine keys on the left half are the alphabet — but their shifted labels are the menus. STACK puts six commands on the six blank keys under the display; NEXT shows the next row of six; the command names come from the Menu Map at the back of the Getting Started manual.

STACK — row 1 of 3 on the six menu keysDUPOVERDUP2DROP2ROTLIST→NEXT for the next six, PREV to go back

A command you cannot find on a menu can always be typed: alpha mode (α) turns the left keyboard into a typewriter, and CATALOG walks every command in the machine alphabetically. USER is the menu of your own variables — store a program under a name and it appears there as a key.

2048 bytes, and what that means

The 28C has 2048 bytes of user memory, of which about 400 are reserved for the system — so roughly 1,650 bytes for everything you store. The 28S, a year later, has 32 KB and is otherwise the same machine.

2048 bytessystem ≈400yours ≈1,650 bytesvariables · programs · stack · working space

The Reference Manual is blunt about it: the machine is for interactive problem solving, not for storing libraries. Even parsing the command line takes memory, and COLCT, EXPAN and TAYLR eat it fast on a long expression. Keep a few hundred bytes free — MEM tells you — or you will meet Low Memory mid-calculation.

A memory reset is ON + INS, then DEL, release INS then ON; the display says Memory Lost. Reference Manual p. 21 (Low Memory), Getting Started p. 18.

The machine

The HP-28C of 1987 is the first RPL calculator and the ancestor of the 48 and 50g. It is a clamshell: the case folds open to two keyboards, a full alphabet on the left and the numeric keys on the right, under a four-line display. Inside is a Saturn CPU, the same family as the 48.

2048 bytes RAMabout 1,650 usable — the 28S of 1988 has 32 KB32 × 137 pixel LCDfour rows of 23 characters, or a plotten object typesreals, complex, strings, arrays, lists, names, programs, algebraics, binariessymbolic algebraCOLCT, EXPAN, ISOL, QUAD, TAYLR, d/dx and ∫solver and plotterROOT on any expression; DRAW to the LCDinfrared printer portfor the HP 82240A, and nothing else — no I/O3 × N cellsand the memory goes when they do

The RPL here is the language itself, minus what the 48 added later: no directories, no units as objects, no graphics objects, no libraries or cards. The ideas — objects, the unlimited stack, « », local variables, algebraics — are all present.

Two keyboards

The right half is a calculator. The left half is a keyboard, and its red shifted labels are the way into everything else.

STACKa menu: six commands appear on the blank keysNEXT · PREVthe next and previous row of sixαalpha mode — the left keys type letters into the command line CATALOGevery command, alphabetically, with its stack diagram USERyour own variables as a menuONalso ATTN: aborts a program, clears the line, leaves a catalog

The red square on the right keyboard is the single shift key; there is no second colour. The delimiters — « », ' ', [ ], { }, " ", # — have keys of their own on the bottom rows of the left half.

Three entry modes

What the command line does with your keystrokes depends on a mode the cursor shows you.

immediatethe default: a command key runs at once, a digit starts a number' algebraicopened by the quote: keys build an expression instead of runningα alphathe left keyboard types; commands go in as text and run on ENTERENTERparses the whole line into objects and pushes them

In algebraic entry you can key 'X^2+3*X' and have it stay a formula; in immediate entry the same keys would try to compute it. Most confusion on the 28C is one of these three modes being on when you expected another.

The stack and its commands

Unlimited depth, numbered from level 1 at the bottom. Everything you would expect from RPN, plus the tools an object stack needs.

DUP · DROP · SWAPthe basics; DUP2, DROP2, DUPN, DROPN for pairs and groupsROT · ROLL · ROLLDrotate three, or roll n levelsOVER · PICK · DEPTHcopy level 2, copy level n, count the stack→LIST · LIST→gather n objects into a list, and back LASTthe arguments of the last command UNDOthe whole stack as it was before the last command CLEARempty it

There is no LAST X; there is LAST, which recovers however many arguments the command took. Enable it in the MODE menu — it costs memory.

Variables and the USER menu

Storage is by name. 'R' STO stores level 2 under R; typing R unquoted evaluates it, which for a number just recalls it and for a program runs it.

'NAME' STOstore level 2 under the nameNAMEevaluate — recall a value, run a program'NAME' RCLrecall unevaluated, even a program'NAME' PURGEdelete; a list of names purges severalSTO+ STO− STO× STO÷arithmetic straight into a variable USERthe variables, newest first, as menu keysCLUSRdelete every user variable

A variable holding a program is a command. That is the whole extension mechanism: write a program, store it, and it sits in USER next to the built-ins.

Algebraics: formulas as objects

An expression in quotes is data. You can store it, put it on the stack, differentiate it, solve it, plot it — and only when you EVAL or →NUM it does it become a number.

COLCTcollect like termsEXPANexpand productsISOLisolate a variable — solve symbolicallyQUADthe quadratic formula, as an expressionTAYLRTaylor series to a given orderd/dxderivative, symbolic, of the expression in level 2integrate — symbolically if it can, numerically if you give limitsFORMrearrange by hand, rule by rule

Names inside an expression that have values stored are substituted on EVAL; names without values stay symbolic. That is how one formula serves as both a function and an equation.

The Solver

Store an equation, and the SOLVE menu turns its variables into keys. Give each a value and press the one you want found.

'A*X^2+B*X+C=0' STEQstore the current equation SOLVthe variables appear on the menu keysvalue Xpressing a variable key stores into it Xshifted, it solves for that oneROOTthe same thing as a command: expression, name, guessRCEQrecall the equation

It is an iterative root-finder, so a guess matters when there is more than one root, and it reports how it finished — Zero, Sign Reversal, or Extremum — because a converged answer is not always a root.

Writing a program

A program is a list of objects between « and ». Run it and each object is evaluated in turn: numbers push, commands execute, names recall or call.

« … »the delimiters; the key is next to SPACE on the left half'NAME' STOstore it — it is now a command in USER→ a b c « … »local variables: take three objects off the stack, name them→ n 'expr'a user function: the body is an algebraic, usable inside other formulasHALT · CONTstop for the user, carry on EDIT · VISITedit level 1, or a stored variable, in the command line

Local variables are the idiom that separates 28C code from calculator-style stack juggling. → h w l pulls three values off the stack and the following program can use them by name — and a function written that way works in RPN and inside algebraics alike.

Branching and looping

Structured control flow, in the BRANCH menu. Tests leave a flag on the stack; the structures consume it.

IF … THEN … ENDand IF … THEN … ELSE … ENDIFT · IFTEthe same as commands: flag and one or two objectsSTART … NEXTrepeat, from a to b, no counter visibleFOR i … NEXTthe same with i as a local variable; … STEP for a strideDO … UNTIL … ENDtest at the bottomWHILE … REPEAT … ENDtest at the topIFERR … THEN … ENDtrap an error instead of stoppingSF · CF · FS? · FC?64 user flags

Comparisons — <, , ==, , SAME — are in the TEST menu, with AND OR XOR NOT. == compares; = builds an equation.

Arrays, complex and binary

Vectors and matrices are single objects and take the arithmetic keys directly.

[1 2 3] [[1 2] [3 4]]vector, matrix — real or complex+ − × ÷matrix arithmetic; ÷ solves a linear systemINV · DET · TRNinverse, determinant, transposeCROSS · DOT · RSDand the residual for refining a solution(1,2)a complex number; R→C, C→R, RE, IM, ARG, CONJ#FFa binary integer; BIN OCT DEC HEX, STWS wordsize 1–64RL RR SL SR ASRrotates and shifts; AND OR XOR NOTUNITS · CONVERTa conversion catalog of 120 units — not unit objects

Statistics and plotting

Data points go into a matrix named ΣDAT; the STAT menu works on it. Plots go to the LCD, 137 pixels wide.

Σ+ · Σ−add or remove a row of dataMEAN · SDEV · VAR · TOTper columnCOLΣ · CORR · COV · LR · PREDVchoose columns, then regressionUTPN · UTPT · UTPC · UTPFupper-tail probabilities'expr' STEQ DRAWplot the current equationPMIN · PMAX · CENTR · *W · *Hthe windowDRWΣ · SCLΣscatter plot of the dataPRLCDsend the picture to the printer

Display and modes

Number formats, angle mode and the radix are in the MODE menu, along with the two that surprise people.

STD · FIX · SCI · ENGdisplay formatsDEG · RADno GRADRDX. · RDX,the decimal markML · MULTImulti-line display of long objectsCMD · UNDO · LASTeach costs memory, each can be switched off VIEW▲ ▼scroll the stack windowPRMDprint the current modes

When it complains

Errors show as a message on the top line and stop the program; ERRN and ERRM recover the number and text, and IFERR traps them.

Low Memorythe one you will meet — free something and carry on
Memory Lostafter a reset, or dead batteries; everything is gone
Too Few Argumentsthe stack did not have what the command needed
Bad Argument Typeright count, wrong object type
Infinite Result · Overflowflags decide whether these stop you
Undefined Namean unquoted name with nothing stored under it, in a place that needed a value

ATTN (the ON key) aborts anything. KILL clears every suspended program if HALT has left several waiting.

Where to read more

Two manuals, and the second is the one to keep open.

Getting Startedthe tutorial, with the Menu Map and Key Index at the backReference Manualthe Dictionary: every command with its stack diagram, by menuOperation Indexevery command alphabetically, with its menu and page — the source of the index belowProgramming Examplestwenty short programs, each with a stack diagram and the techniques it shows

Everything on this sheet is drawn from those; the 28S manuals describe the same language with more room.

Command Index

248 commands, grouped by the menu that holds them · hover for the full name, type and page

Keyboard & Basic

19
+Add.
-Subtract.
CHSChanges the sign of a number in the command line or
DELDeletes character at cursor; digitizes point. o
EEXEnters exponent in command line.
EVALEvaluates an object.
INVInverse.
LASTReturns last arguments.
NEGNegate.
PURGEPurges one or more variables. C
RCLRecalls the contents of a variable, unevaluated.
SQSquare.
STOStores an object in a variable.
SYSEVALExecutes a system object.
^Power.
×Multiply.
÷Divide.
Backspace.
→NUMEvaluates an object in numerical mode.

STACK

14
CLEARClears the stack.
DEPTHCounts the objects on the stack.
DROPDrops one object from the stack. O O
DROP2Drops two objects from the stack. O
DROPNDrops n+1 objects from the stack. O
DUPDuplicates one object on the stack. O «
DUP2Duplicates two objects on the stack. O <
DUPNDuplicates n objects on the stack. O
OVERDuplicates the object in level 2.
PICKDuplicates the nth object. n+1
ROLLMoves the level n+1 object to level 1. O n+1 <
ROLLDMoves the level 2 object to level n. O
ROTMoves the level 3 object to level 1.
SWAPSwaps the objects in levels 1 and 2.

STORE

7
SCONJConjugates the contents of a variable.
SINVInverts the contents of a variable.
SNEGNegates the contents of variable.
STO+Storage arithmetic add. AN
STO/Storage arithmetic divide. N
STO×Store Times.
STO−Storage arithmetic subtract. AN

MODE

7
DEGSets degrees mode. O
ENGSets engineering display format.
FIXSets FIX display format.
PRMDPrints and displays current modes.
RADSets radians mode.
SCIScientific.
STDStandard.

REAL

17
%Percent.
%CHPercent change.
%TPercent of total.
ABSAbsolute Value.
CEILNext greater integer.
FLOORNext smaller integer.
FPFractional part.
IPInteger part.
MANTMantissa.
MAXMaximum.
MAXRMaximum Real.
MINReturns the minimum of two numbers. w
MODModulo.
RANDReturns a random number.
RDZSets the random number seed.
RNDRounds according to real number display mode. L
XPONReturns the exponent of a number.

TRIG

12
ACOSArc cosine.
ASINArc sine.
ATANArc tangent.
COSCosine. <«
D→RDegrees-to-radians conversion.
HMS+Adds in HMS format.
HMS→Converts from HMS format.
HMS−Subtracts in HMS format.
R→DRadians-to-degrees conversion.
SINSine.
TANTangent. <«
→HMSConverts a number to HMS format.

LOGS

11
ACOSHArc hyperbolic cosine.
ALOGAntilogarithm (10 to a power).
ASINHArc hyperbolic sine.
ATANHArc hyperbolic tangent.
COSHHyperbolic cosine. «
EXPExponential.
LNNatural logarithm.
LNP1Natural logarithm of (argument+1).
LOGCommon (base 10) logarithm.
SINHHyperbolic sine.
TANHHyperbolic tangent. <«

COMPLEX

5
ARGArgument.
IMImaginary Part.
P→RPolar-to-rectangular conversion. F 1 1
R→PRectangular-to-polar conversion.
SIGNSign of a number.

BINARY

21
ANDLogical or binary AND.
ASRArithmetic shift right.
BINSets binary base.
B→RBinary-to-real conversion.
DECSets decimal base. O
HEXSets hexadecimal base.
NOTLogical or binary NOT.
OCTSets octal base.
ORLogical or binary OR.
RCWSRecalls the binary integer wordsize.
RLRotates left by one bit. O o
RLBRotates left by one byte. O -
RRRotates right by one bit.
RRBRotates right by one byte.
R→BReal-to-binary conversion.
SLShifts left by one bit.
SLBShifts left by one byte.
SRShifts right by one bit.
SRBShifts right by one byte.
STWSSets the binary integer wordsize.
XORLogical or binary XOR.

ARRAY

20
ARRY→Replaces an array with its elements as separate stack
CNRMComputes a column norm.
CONCreates a constant matrix.
CONJComplex conjugate.
CROSSCross-product of three-element vectors. O
C→RComplex-to-real conversion.
DETDeterminant of a matrix.
DOTDot product of two vectors. O AN
GETGets an element from an object.
GETIGets an element from an object and increments the
IDNCreates an identity matrix.
PUTPut an element into an array or list. C o >~
PUTIPut an element into an array or list, and increment the C 3 2
RDMRedimensions an array.
REReturns the real part of a complex number or array.
RNRMComputes the row norm of an array. O
RSDComputes a correction to the solution of a system of
R→CReal-to-complex conversion.
TRNTransposes a matrix. 0, 1
→ARRYCombines numbers into an array.

LIST

3
LIST→List to Stack.
SUBExtracts a portion of a list or string.
→LISTCombines objects into a list.

STRING

5
CHRMakes a one-character string.
NUMReturns character code.
POSFinds an substring in a string.
STR→Parses and evaluates the commands defined by a string.
→STRConverts an object to a string.

ALGEBRA

15
=Equals operator.
COLCTCollects like terms.
EXGETGets a subexpression.
EXPANExpand Products.
EXSUBExpression Substitute.
FORMChanges the form of an algebraic.
ISOLSolves an expression or equation.
MINRSymbolic constant minimum real. uw
OBGETExtracts an object from an algebraic.
OBSUBSubstitutes an object into an algebraic.
QUADSolves a quadratic polynomial. C 2 1
SHOWResolves all references to a name implicit in an
SIZEFinds the dimensions ofa list, array, string, or algebraic.
TAYLRComputes a Taylor series approximation.
Differentiate.

ALGEBRA (FORM)

4
AFAdds fractions.
DINVDouble inverts.
DNEGDouble negates.
Commutes arguments.

SOLVE

1
ROOTFinds a numerical root.

PLOT

23
*HMultiply Height.
*WMultiply Width.
AXESSets intersection of axes.
CENTRSets center of plot display.
CLLCDBlanks the display.
CLMFClears the system message flag.
COLΣSelects statistics matrix columns.
DISPDisplays an object.
DRAWCreates a mathematical function plot. O O
DRAXDraws axes. O
DRWΣCreates a statistics scatter plot. O
INDEPSelects the plot independent variable.
PIXELTurns on a display pixel.
PMAXSets the upper-right plot coordinates.
PMINPlot Minima.
PPARRecall Plot Parameters.
PRLCDPrints an image of the display.
RCEQRecalls the current equation.
RCLΣRecalls the current statistics matrix.
RESSets the plot resolution. O ~—
SCLΣScale Sigma.
STEQStores the current equation.
STOΣStores the current statistics matrix.

STAT

18
CLΣPurges the statistics matrix.
CORRCorrelation coefficient.
COVCovariance. O
LRComputes a linear regression.
MAXΣFinds the maximum coordinate values in the statistics
MEANComputes statistical means. O
MINΣFinds the minimum coordinate values in the statistics
Returns the number of data points in the statistics
PREDVPredicted value.
SDEVComputes standard deviations.
TOTSums the coordinate values in the statistics matrix.
UTPCUpper-tail Chi-Square distribution .
UTPFUpper-tail F-distribution.
UTPNUpper-tail normal distribution.
UTPTUpper-tail t-distribution.
VARVariance.
Σ+Sigma Plus.
Σ−Sigma Minus.

PROGRAM BRANCH

13
DOPart of DO...UNTIL...END. O-+
ELSEBegins ELSE clause.
ENDEnds program structures.
FORBegins definite loop.
IFERRBegins IF ERROR clause. Ct O
IFTIf-then command. AN
IFTEIf-then-else function. ™M
NEXTEnds definite loop.
REPEATPart of WHILE. . .REPEAT.. .END.
STARTBegins definite loop.
THENBegins THEN clause.
UNTILPart of BEGIN...UNTIL...END.
WHILEBegins WHILE. . .REPEAT .. .END.

PROGRAM TEST

15
<Less Than.
==Equal.
>Greater-than comparison.
CFClears a user flag.
FS?Tests a user flag.
FS?CTests and clears a user flag.
RCLFReturns a binary integer representing the user flags.
SAMESame.
SFSets a user flag.
STOFSets all user flags according to the value of a binary
TYPEReturns the type of an object.
Less-than comparison. Ft
Equality comparison.
Not-equal comparison.
Greater-than-or-equal comparison.

PROGRAM CONTROL

8
ABORTAbort Program.
BEEPSounds a beep.
ERRMReturns the last error message.
ERRNReturns the last error number.
HALTSuspends program execution.
KEYReturns a key string.
KILLAborts all suspended programs.
WAITPauses program execution.

UNITS

1
CONVERTPerforms a unit conversion.

USER

3
CLUSRClears all user variables.
MEMReturns available memory. O
ORDERRearranges the user menu.

PRINT

6
CRPrints a carriage-right.
PR1Prints the level 1 object. C
PRSTPrints the stack. C o
PRSTCPrints the stack in compact format. C o
PRUSRPrints a list of variables. C o
PRVARPrints the contents of a variable. C 1

Worked Example — a Fibonacci loop

fourteen objects, and every RPL idea the 28C introduced
«begin the program
→ ntake n from the stack into a local variable
«the defining program, where n is visible
IF n 1 ≤is n ≤ 1? — the test leaves a flag on the stack
THEN nF₀ = 0 and F₁ = 1, so the answer is n itself
ELSE
0 1seed the stack with F₀ and F₁
2 n STARTrepeat, once for each of F₂ … Fₙ
DUPcopy the newest F
ROTbring the previous F back to level 1
+and add: the next F
NEXTend of the loop body
SWAP DROPdiscard Fₙ₋₁, leaving Fₙ
ENDend of the conditional
»end of the defining program
»end of the program
'FIB2' STOput it on the stack and store it as FIB2

FIB2 as listed in HP's Programming Examples booklet, p. 17. Typed in alpha mode, or built from the menus; the structure words are on the BRANCH menu.

Fₙ, the n-th Fibonacci number, is the classic first program because it needs a conditional, a loop and some stack discipline — and on the 28C those are three ideas the machine introduced to calculators. The booklet gives two versions; this is the loop one, which it notes is the fast one.

Line 2 is the important line. → n takes the top of the stack into a local variable called n, visible inside the program that follows. Everything after it can say n instead of shuffling the stack to reach the argument — which is what makes RPL programs readable where keystroke programs were not. Locals vanish when the program ends.

The test. n 1 ≤ leaves a flag; IF … THEN … ELSE … END consumes it. F₀ = 0 and F₁ = 1, so for n ≤ 1 the answer is n and the program just leaves it there.

The loop. 0 1 seeds the stack with F₀ and F₁. 2 n START repeats the body n − 1 times, no counter needed, and the body is three stack words:

start
4:
3:
2:F₀
1:F₁
previous, latest
DUP
4:
3:F₀
2:F₁
1:F₁
copy the latest
ROT
4:
3:F₁
2:F₁
1:F₀
previous to level 1
+
4:
3:
2:F₁
1:F₂
next: two on the stack again

Each pass leaves the two newest numbers in levels 2 and 1, so the loop invariant is visible in the stack. SWAP DROP at the end discards Fₙ₋₁ and leaves Fₙ.

6 FIB2810 FIB255'FIB2(10)' EVAL55 — a stored program is callable inside an algebraic too

The recursive version in the same booklet, FIB1, is a one-line user function — → n 'IFTE(n≤1, n, FIB1(n−1)+FIB1(n−2))' — and takes exponentially longer, which the booklet uses to explain why.