Writing FCode 3.x Programs
|
|
Differences Between FCode 2.x and FCode 3.x
|
This appendix discusses the FCodes and macros that have changed between FCode 2.x and FCode 3.x. The 3.x tokenizer will still tokenize code correctly using FCode 2.x names (excepting old #>, # and #s). The function of each of the equivalent FCodes is unchanged. The existing tokenized FCode programs using 2.x FCodes will not be affected on 3.x OpenBoot PROMs. The only functional exception is in the FCode 2.x names #>, #, and #s. FCode 3.x has the same names associated with functionally different FCodes and different byte values. If you have tokenized FCode using the 2.x tokenizer with these FCodes (for instance, #), you will get the same response (since the operation of old # is equivalent to new u# and tokenized code has 0x99 as byte value for your old #).
TABLE D-1 FCode Names Changed in Version 3.x
FCode 2.x
|
FCode 3.x (equivalent)
|
Byte Value
|
not
|
invert
|
26
|
<<
|
lshift
|
27
|
>>
|
rshift
|
28
|
ca1+
|
char+
|
62
|
na1+
|
cell+
|
65
|
/c*
|
chars
|
66
|
/n*
|
cells
|
69
|
flip
|
wbflip
|
80
|
version
|
FCode-revision
|
37
|
b(is)
|
b(to)
|
C3
|
eval
|
evaluate
|
CD
|
u*x
|
um*
|
D4
|
xu/mod
|
um/mod
|
D5
|
x+
|
d+
|
D8
|
x-
|
d-
|
D9
|
attribute
|
property
|
0110
|
xdrint
|
encode-int
|
0111
|
xdr+
|
encode+
|
0112
|
xdrphys
|
encode-phys
|
0113
|
xdrstring
|
encode-string
|
0114
|
xdrbytes
|
encode-bytes
|
0115
|
decode-2int
|
parse-2int
|
011B
|
map-sbus
|
map-low
|
0130 (stack diag. enhanced)
|
get-my-attribute
|
get-my-property
|
021A
|
xdrtoint
|
decode-int
|
021B
|
xdrtostring
|
decode-string
|
021C
|
get-inherited-attribute
|
get-inherited-property
|
021D
|
delete-attribute
|
delete-property
|
021E
|
get-package-attribute
|
get-package-property
|
02 1F
|
wflips
|
wbflips
|
0236
|
lflips
|
lwflips
|
0237
|
is
|
to
|
|
Note - The following 2.x FCodes have changed names. The new 3.x FCodes with the same names function differently.
|
TABLE D-2 FCode 2.x Changed Names and Equivalent FCode 3.x Names
FCode 2.x
|
FCode 3.x (equivalent)
|
Byte Value
|
#>
|
u#>
|
97
|
#
|
u#
|
99
|
#s
|
u#s
|
9A
|
So if you are using the 3.x tokenizer to elicit the old response from #>, #, and #s, the source code must be changed so that the commands are replaced by u#>, u# and u#s, respectively. For code previously tokenized using the 2.x tokenizer, the result is the same on both OpenBoot 2.x and 3.x PROMs.
TABLE D-3 FCode 2.x Commands Deleted in FCode 3.x
FCode 2.x
|
Byte Value
|
4-byte-id
|
FE
|
dma-alloc
|
0101
|
memmap
|
0104
|
>physical
|
0106
|
my-params
|
010F
|
intr
|
0117
|
driver
|
0118
|
group-code
|
0123
|
processor-type
|
0210
|
firmware-version
|
0211
|
fcode-version
|
0212
|
probe
|
0238
|
probe-virtual
|
0239
|
To access the functionality provided by dma-alloc:
: my-dma-alloc ( size -- addr ) " dma-alloc" $call-parent ;
and use my-dma-alloc.
To access the functionality provided by memmap, use map-low appropriately.
To replace intr, create "intr" properties using property.
To access the functionality provided by firmware-version or fcode-version, use firmware-revision.
TABLE D-4 New FCodes Added in 3.x
FCode 3.x
|
Byte Value
|
unloop
|
89
|
get-token
|
DA
|
set-token
|
DB
|
state
|
DC
|
compile,
|
DD
|
behavior
|
DE
|
decode-phys
|
0128
|
push-package
|
0129
|
pop-package
|
012A
|
interpose
|
012B
|
lwflip
|
0226
|
lbflip
|
0227
|
lbflips
|
0228
|
next-property
|
023D
|
byte-load
|
023E
|
set-args
|
023F
|
TABLE D-5 Differently Functioning 3.x FCodes With Changed Byte Values
FCode 3.x
|
Byte Value
|
#
|
C7
|
#s
|
C8
|
#>
|
C9
|
TABLE D-6 3.x FCodes Related to 64-Bit Operations
3.x FCodes
|
Stack Diagrams
|
Byte Value
|
rx@
|
( oaddr -- o )
|
022E
|
rx!
|
( o oaddr -- )
|
022F
|
bxjoin
|
( b.lo b.2 b.3 b.4 b.5 b.6 b.7 b.hi -- o )
|
0241
|
<l@
|
( qaddr -- n )
|
0242
|
lxjoin
|
( quad.lo quad.hi -- o )
|
0243
|
wxjoin
|
( w.lo w.2 w.3 w.hi -- o )
|
0244
|
x,
|
( o -- )
|
0245
|
x@
|
( oaddr -- o )
|
0246
|
x!
|
( o oaddr -- )
|
0247
|
/x
|
( -- n )
|
0248
|
/x*
|
( nu1 -- nu2 )
|
0249
|
xa+
|
( addr1 index -- addr2 )
|
024A
|
xa1+
|
( addr1 -- addr2 )
|
024B
|
xbflip
|
( oct1 -- oct2 )
|
024C
|
xbflips
|
( oaddr len -- )
|
024D
|
xbsplit
|
( o -- b.lo b.2 b.3 b.4 b.5 b.6 b.7 b.hi )
|
024E
|
xlflip
|
( oct1 -- oct2 )
|
024F
|
xlflips
|
( oaddr len -- )
|
0250
|
xlsplit
|
( o -- quad.lo quad.hi )
|
0251
|
xwflip
|
( oct1 -- oct2 )
|
0252
|
xwflips
|
( oaddr len -- )
|
0253
|
xwsplit
|
( o -- w.lo w.2 w.3 w.hi )
|
0254
|
The following device-handling-related user interface commands have changed between OpenBoot 2.x and OpenBoot 3.x. Their functional behavior is the same. Determine your system's OpenBoot PROM version by entering .version at the ok> prompt, then using the appropriate commands from the following table.
TABLE D-7 Device-Related User Interface Commands Changed in 3.x
OpenBoot 2.x Command
|
OpenBoot 3.x Command
|
.attributes
|
.properties
|
cd
|
dev
|
reset (to reset full system)
|
reset-all
|
Writing FCode 3.x Programs
|
806-1379-10
|
|
Copyright © 2004, Sun Microsystems, Inc. All Rights Reserved.