Writing FCode 3.x Programs
  Sök endast i den här boken
Ladda ner denna bok i 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 99 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
attributeproperty01 10
xdrintencode-int01 11
xdr+encode+01 12
xdrphysencode-phys01 13
xdrstringencode-string01 14
xdrbytesencode-bytes01 15
decode-2intparse-2int01 1B
map-sbusmap-low01 30 (stack diag. enhanced)
get-my-attributeget-my-property02 1A
xdrtointdecode-int02 1B
xdrtostringdecode-string02 1C
get-inherited-attributeget-inherited-property02 1D
delete-attributedelete-property02 1E
get-package-attributeget-package-property02 1F
wflipswbflips02 36
lflipslwflips02 37
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.xPROMs .
Table D-3
FCode 2.xByte Value
4-byte-idFE
dma-alloc01 01
memmap01 04
>physical01 06
my-params01 0F
intr01 17
driver01 18
group-code01 23
processor-type02 10
firmware-version02 11
fcode-version02 12
probe02 38
probe-virtual02 39
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 " interrupts" and " 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-phys01 28
push-package01 29
pop-package01 2A
interpose01 2B
lwflip02 26
lbflip02 27
lbflips02 28
next-property02 3D
byte-load02 3E
set-args02 3F
Table D-5
FCode 3.x Byte Value
#C7
#sC8
#>C9
Table D-6
3.x FCodesStack DiagramsByte Value
rx@( oaddr -- o )02 2E
rx!( o oaddr -- )02 2F
bxjoin( b.lo b.2 b.3 b.4 b.5 b.6 b.7 b.hi -- o )02 41
<l@( qaddr -- n )02 42
lxjoin( quad.lo quad.hi -- o )02 43
wxjoin( w.lo w.2 w.3 w.hi -- o )02 44
x,( o -- )02 45
x@ ( oaddr -- o )02 46
x! ( o oaddr -- )02 47
/x ( -- n )02 48
/x* ( nu1 -- nu2 )02 49
xa+ ( addr1 index -- addr2 )02 4A
xa1+ ( addr1 -- addr2 )02 4B
xbflip ( oct1 -- oct2 )02 4C
xbflips( oaddr len -- )02 4D
xbsplit ( o -- b.lo b.2 b.3 b.4 b.5 b.6 b.7 b.hi )02 4E
xlflip ( oct1 -- oct2 )02 4F
xlflips( oaddr len -- )02 50
xlsplit( o -- quad.lo quad.hi )02 51
xwflip( oct1 -- oct2 )02 52
xwflips ( oaddr len -- )02 53
xwsplit( o -- w.lo w.2 w.3 w.hi )02 54
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