x Quick Reference
Sun Microsystems Computer Corporation A Sun Microsystems, Inc. Business 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. 415 960-1300 FAX 415 969-9131 Part No: 802-3240-10 Revision A,November 1995
Syntax
Enter commands at the ok prompt. They are executed left-to-right after a carriage-return. Separate all commands by one or more spaces.
Help Commands
help help category help command List main help categories. Show help for all commands in the category. Use only the rst word of the category description. Show help for individual command (where available).
words
] [lename
[options ]
-a - Prompt interactively for the device and name of the boot le. -h - Halt after loading the program. .) (OS-specic options may differ from system to system
] test-all [device-specier
watch-clock watch-net
( -- ) ( adr -- ) ( -- )
( -- ) ( -- )
Initialize to execute a binary le. Load data from specied device into memory at the address given by load-base. (See boot format.) Address at which load places the data it reads from a device.
load-base
( -- adr )
( window# -- )
( -- ) ( -- ) ( -- ) ( -- )
Formatted display of the processor state register. Formatted display of the version register. Formatted display of the ccr register. Display trap-related registers.
Breakpoint Commands
+bp -bp --bp .bp .breakpoint ( adr -- ) ( adr -- ) ( -- ) ( -- ) ( -- ) Add a breakpoint at the given address. Remove the breakpoint at the given address. Remove the most-recently-set breakpoint. Display all currently set breakpoints. Perform a specied action when a breakpoint occurs (Example, [] .registers to .breakpoint). Display the address, opcode for the lastencountered breakpoint. Perform a specied action when a single step occurs (see .breakpoint). Remove all breakpoints. Execute until the end of this loop. Continue from a breakpoint. This can be used to go to an arbitrary address by setting up the processors program counter before issuing go. Execute go n times. (Like the step command.) Treats a subroutine call as a single instruction. Execute hop n times. Execute until the end of this subroutine. Execute until the end of this leaf subroutine. Skip (do not execute) the current instruction. Single-step one instruction. Execute step n times. Execute until the given address is encountered. Equivalent to +bp go.
( -- ) ( -- ) ( -- ) ( -- ) ( -- )
( n -- ) ( -- ) ( n -- ) ( -- ) ( -- ) ( -- ) ( -- ) ( n -- ) ( adr -- )
Disassembler Commands
+dis dis ( -- ) ( adr -- ) Continue disassembling where the last disassembly left off. Begin disassembling at the given address.
Miscellaneous Operations
eject-floppy firmwareversion ftrace get-msecs ms reset-all ( -- ) (-- n ) ( -- ) ( -- ms ) ( n -- ) ( -- ) Eject the diskette from the drive. Return major/minor CPU rmware version (that is, 0x00020001 = rmware version 2.1). Show calling sequence when exception occurred. Return the approximate current time in milliseconds. Delay for n milliseconds. Resolution is 1 millisecond. Reset the entire system (similar to a power cycle).
sync
( -- )
Call the operating system to write any pending information to the hard disk.
If true, OS does not assert DTR and RTS on TTYA. If true, OS does not assert DTR and RTS on TTYB. If true, execute commands in NVRAMRC during system start-up. If true, reboot after watchdog reset.
nvedit
nvquit nvrecover
nvstore
nvunalias alias
Beg. Line
^A ^U
Prev. Word
escB ^W
Prev. Char
^B Del
Next Char
^F ^D
Next Word
escF escD
End Line
^E ^K
Next Line
^N
Re-type line Show all lines Paste after ^-K Complete command Show all matches
^R ^L ^Y ^ space ^/ or ^?}
esc = Press and release Escape key first; ^ = Press and hold Control key
(enable NVRAMRC )
0 = false; any other value = true (usually -1). 32-bit value. Normal signed values. Unsigned, positive values. Physical address (actual hardware address). Packed string (adr len means unpacked string). Virtual address (address used by software). 16-bit value. Execution token.
Copy +n-th stack item (1 pick = over). Move a return stack item to the stack. Copy the top of the return stack to the stack. Rotate +n stack items (2 roll = rot). Rotate three stack items. Exchange the top two stack items. Copy the top stack item below the second item.
Arithmetic Functions
* + / lshift rshift >>a abs and bounds bljoin bwjoin lbsplit lwsplit max min mod negate invert or wbsplit wljoin xor ( n1 n2 -- n3 ) ( n1 n2 -- n3 ) ( n1 n2 -- n3 ) ( n1 n2 -- quot ) ( n1 +n -- n2 ) ( n1 +n -- n2 ) ( n1 +n -- n2 ) ( n -- u ) ( n1 n2 -- n3 ) ( startadr len -- endadr startadr ) ( b.low b2 b3 b.hi -- long ) ( b.low b.hi -- word ) ( long -- b.low b2 b3 b.hi ) ( long -- w.low w.hi ) ( n1 n2 -- n3 ) ( n1 n2 -- n3 ) ( n1 n2 -- rem ) ( n1 -- n2 ) ( n1 -- n2 ) ( n1 n2 -- n3 ) ( word -- b.low b.hi ) ( w.low w.hi -- long ) ( n1 n2 -- n3 ) Multiply n1 * n2. Add n1 + n2. Subtract n1 - n2 Divide n1 / n2; remainder is discarded. Left-shift n1 by +n bits. Right-shift n1 by +n bits. Arithmetic right-shift n1 by +n bits. Absolute value. Bitwise logical AND. Convert startadr len to endadr startadr for do loop. Join four bytes to form a 32-bit value. Join two bytes to form a 16-bit value. Split a 32-bit value into four bytes. Split a 32-bit value into two 16bit words. n3 is maximum of n1 and n2. n3 is minimum of n1 and n2. Remainder of n1 / n2. Change the sign of n1. Bitwise ones complement. Bitwise logical OR. Split 16-bit value into two bytes. Join two 16-bit values to form a 32-bit value. Bitwise exclusive OR.
cpoke
comp
( adr len -- ) ( adr size byte -- ) ( n adr32 -- ) ( adr32 -- long ) ( adr1 adr2 u -- ) ( n adr16 -- ) ( adr16 -- word )
memmap
Defining Words
: ; buffer: name constant name create name defer name value name variable name
name
( -- ) Usage: ( ??? -- ? ) ( -- ) ( size -- ) Usage: ( -- adr64 ) ( n -- ) Usage: ( -- n ) ( -- ) Usage: ( -- adr16 ) ( -- ) Usage: ( ??? -- ? ) ( n -- ) Usage: ( -- n ) ( -- ) Usage: ( -- adr16 )
Start creating a new colon denition. Finish creating a new colon denition. Create a named array in temporary storage. Dene a constant (for example, 3 constant bar). Generic dening word. Dene forward reference or execution vector. Create a changeable, named 32-bit quantity. Dene a variable.
[] name .calls
( -- xt ) ( xt -- )
$find
words
( -- )
key?
( -- ag )
Redirecting I/O
input io output ( device -- ) ( device -- ) ( device -- ) Select device (ttya, ttyb, keyboard, or " devicespecier ") for subsequent input. Select device for subsequent input and output. Select device (ttya, ttyb, screen, or " devicespecier ") for subsequent output.
Comparison Commands
< <= <> = > >= between u< u<= u> u>= within ( n1 n2 -- ag ) ( n1 n2 -- ag ) ( n1 n2 -- ag ) ( n1 n2 -- ag ) ( n1 n2 -- ag ) ( n1 n2 -- ag ) ( n min max -- ag ) ( u1 u2 -- ag ) ( u1 u2 -- ag ) ( u1 u2 -- ag ) ( u1 u2 -- ag ) ( n min max -- ag ) True if n1 < n2. True if n1 <= n2. True if n1 <> n2. True if n1 = n2. True if n1 > n2. True if n1 >= n2. True if min <= n <= max. True if u1 < u2, unsigned. True if u1 <= u2, unsigned. True if u1 > u2, unsigned. True if u1 >= u2, unsigned. True if min <= n < max.
if-else-then Commands
else if then ( -- ) ( ag -- ) ( -- ) Execute the following code if if failed. Execute the following code if ag is true. Terminate if...else...then.
?do
( end start -- )
do
( end start -- )
i j leave loop
( -- n ) ( -- n ) ( -- ) ( -- )
case Statement
( value ) case 2 of ." it was two" endof 0 of ." it was zero" endof ." it was " dup . (optional default clause ) endcase
( adr asi -- long ) ( word adr asi -- ) ( adr asi -- word ) ( x adr asi -- ) ( adr asi -- x )
Fetch the 32-bit word from asi and address. Store the 16-bit word at asi and address. Fetch the 16-bit word from asi and address. Store the 64-bit word at asi and address. Fetch the 64-bit word from asi and address.
Multiprocessor Commands
switch-cpu ( cpu# -- ) Switch to indicated CPU.