Writing FCode 3.x Programs
  Cerca solo questo libro
Scarica il manuale in formato PDF

Differences Between FCode 2.x and 3.x

D

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 2.xFCode 3.x (equivalent)Byte Value
notinvert26
<<lshift27
>>rshift28
ca1+char+62
na1+cell+65
/c*chars66
/n*cells69
flipwbflip80
versionFCode-revision37
Table D-1 (Continued)
FCode 2.xFCode 3.x (equivalent)Byte Value
b(is)b(to)C3
evalevaluateCD
u*xum*D4
xu/modum/modD5
x+d+D8
x-d-D9
attributeproperty0110
xdrintencode-int0111
xdr+encode+0112
xdrphysencode-phys0113
xdrstringencode-string0114
xdrbytesencode-bytes0115
decode-2intparse-2int011B
map-sbusmap-low0130 (stack diag. enhanced)
get-my-attributeget-my-property021A
xdrtointdecode-int021B
xdrtostringdecode-string021C
get-inherited-attributeget-inherited-property021D
delete-attributedelete-property021E
get-package-attributeget-package-property02 1F
wflipswbflips0236
lflipslwflips0237
isto

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.xFCode 3.x (equivalent)Byte Value
#>u#>97
#u#99
#su#s9A
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.xByte Value
4-byte-idFE
dma-alloc0101
memmap0104
>physical0106
my-params010F
intr0117
driver0118
group-code0123
processor-type0210
firmware-version0211
fcode-version0212
probe0238
probe-virtual0239
To access the functionality provided by dma-alloc, do:
: 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
FCode 3.xByteValue
unloop89
get-tokenDA
set-tokenDB
stateDC
compile,DD
behaviorDE
decode-phys0128
push-package0129
pop-package012A
interpose012B
lwflip0226
lbflip0227
lbflips0228
next-property023D
byte-load023E
set-args023F
Table D-5
FCode 3.x Byte Value
#C7
#sC8
#>C9
Table D-6
3.x FCodesStack DiagramsByte 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
OpenBoot 2.x CommandOpenBoot 3.x Command
.attributes.properties
cddev
reset (to reset full system)reset-all