Copyright © 2005 International Business
Machines®,
All Rights Reserved.
Licensed under the Common Public
License (CPL) version 1.0
\ Demo program for DeTokenizer output format display.
tokenizer[
h# 17d5 \ Vendor ID: 0x17d5
h# 5417 \ Device ID: 0x5417
h# 020000 \ Class Code: 0x020000 (Ethernet)
h# f2ed \ Rev-Level
]tokenizer
SET-REV-LEVEL
pci-header
fcode-version2
headers
hex
: hello/goodbye ( hello? -- )
if
." Hello, you big beautiful world!"
else
." Goodbye, cruel world. Gggga-a-a-ackkkkk!"
then
;
: I-say-hello true hello/goodbye ;
: You-say-goodbye false hello/goodbye ;
fcode-end
\ PCI Header identified
\ Offset to Data Structure = 0x001c (28)
\ PCI Data Structure identified
\ Data Structure Length = 0x0018 (24)
\ Vendor ID: 0x17d5
\ Device ID: 0x5417
\ Class Code: 0x020000 (Ethernet controller)
\ Image Revision: 0xf2ed
\ Code Type: 0x01 (Open Firmware)
\ Image Length: 0x0001 blocks (512 bytes)
\ Last PCI Image.
start1 ( 16-bit offsets)
format: 0x08
checksum: 0x33d5 (Ok)
len: 0x009e ( 158 bytes)
named-token hello/goodbye 0x800
b(:)
b?branch 0x0028 ( =dec 40)
b(") ( len=0x1f [31 bytes] )
" Hello, you big beautiful world!"
type
bbranch 0x0030 ( =dec 48)
b(>resolve)
b(") ( len=0x29 [41 bytes] )
" Goodbye, cruel world. Gggga-a-a-ackkkkk!"
type
b(>resolve)
b(;)
named-token I-say-hello 0x801
b(:)
-1
hello/goodbye
b(;)
named-token You-say-goodbye 0x802
b(:)
0
hello/goodbye
b(;)
end0
\ Detokenization finished normally after 158 bytes.
\ PCI Image padded with 302 bytes of zero
\ Welcome to the OpenBIOS detokenizer v0.6.1
\ detok Copyright(c) 2001-2005 by Stefan Reinauer.
\ Written by Stefan Reinauer, <stepan@openbios.org>
\ This program is free software; you may redistribute it under the terms of
\ the GNU General Public License. This program has absolutely no warranty.
\
\ (C) Copyright 2005 IBM Corporation. All Rights Reserved.
\ PCI Header identified
\ Offset to Data Structure = 0x001c (28)
\ PCI Data Structure identified
\ Data Structure Length = 0x0018 (24)
\ Vendor ID: 0x17d5
\ Device ID: 0x5417
\ Class Code: 0x020000 (Ethernet controller)
\ Image Revision: 0xf2ed
\ Code Type: 0x01 (Open Firmware)
\ Image Length: 0x0001 blocks (512 bytes)
\ Last PCI Image.
start1 ( 0x0f1 ) ( 16-bit offsets)
format: 0x08
checksum: 0x33d5 (Ok)
len: 0x009e ( 158 bytes)
named-token ( 0x0b6 ) hello/goodbye 0x800
b(:) ( 0x0b7 )
b?branch ( 0x014 ) 0x0028 ( =dec 40)
b(") ( 0x012 ) ( len=0x1f [31 bytes] )
" Hello, you big beautiful world!"
type ( 0x090 )
bbranch ( 0x013 ) 0x0030 ( =dec 48)
b(>resolve) ( 0x0b2 )
b(") ( 0x012 ) ( len=0x29 [41 bytes] )
" Goodbye, cruel world. Gggga-a-a-ackkkkk!"
type ( 0x090 )
b(>resolve) ( 0x0b2 )
b(;) ( 0x0c2 )
named-token ( 0x0b6 ) I-say-hello 0x801
b(:) ( 0x0b7 )
-1 ( 0x0a4 )
hello/goodbye ( 0x800 )
b(;) ( 0x0c2 )
named-token ( 0x0b6 ) You-say-goodbye 0x802
b(:) ( 0x0b7 )
0 ( 0x0a5 )
hello/goodbye ( 0x800 )
b(;) ( 0x0c2 )
end0 ( 0x000 )
\ Detokenization finished normally after 158 bytes.
\ PCI Image padded with 302 bytes of zero
Without the "verbose" option, i.e., with just the "offsets" option by itself, the DeTokenizer output looks like this:
\ PCI Header identified
\ Offset to Data Structure = 0x001c (28)
\ PCI Data Structure identified
\ Data Structure Length = 0x0018 (24)
\ Vendor ID: 0x17d5
\ Device ID: 0x5417
\ Class Code: 0x020000 (Ethernet controller)
\ Image Revision: 0xf2ed
\ Code Type: 0x01 (Open Firmware)
\ Image Length: 0x0001 blocks (512 bytes)
\ Last PCI Image.
0: start1 ( 16-bit offsets)
1: format: 0x08
2: checksum: 0x33d5 (Ok)
4: len: 0x009e ( 158 bytes)
8: named-token hello/goodbye 0x800
25: b(:)
26: b?branch 0x0028 ( =dec 40 dest = 67 )
29: b(") ( len=0x1f [31 bytes] )
" Hello, you big beautiful world!"
62: type
63: bbranch 0x0030 ( =dec 48 dest = 112 )
66: b(>resolve)
67: b(") ( len=0x29 [41 bytes] )
" Goodbye, cruel world. Gggga-a-a-ackkkkk!"
110: type
111: b(>resolve)
112: b(;)
113: named-token I-say-hello 0x801
128: b(:)
129: -1
130: hello/goodbye
132: b(;)
133: named-token You-say-goodbye 0x802
152: b(:)
153: 0
154: hello/goodbye
156: b(;)
157: end0
\ Detokenization finished normally after 158 bytes.
\ PCI Image padded with 302 bytes of zero
\ Welcome to the OpenBIOS detokenizer v0.6.1
\ detok Copyright(c) 2001-2005 by Stefan Reinauer.
\ Written by Stefan Reinauer, <stepan@openbios.org>
\ This program is free software; you may redistribute it under the terms of
\ the GNU General Public License. This program has absolutely no warranty.
\
\ (C) Copyright 2005 IBM Corporation. All Rights Reserved.
\ PCI Header identified
\ Offset to Data Structure = 0x001c (28)
\ PCI Data Structure identified
\ Data Structure Length = 0x0018 (24)
\ Vendor ID: 0x17d5
\ Device ID: 0x5417
\ Class Code: 0x020000 (Ethernet controller)
\ Image Revision: 0xf2ed
\ Code Type: 0x01 (Open Firmware)
\ Image Length: 0x0001 blocks (512 bytes)
\ Last PCI Image.
0: start1 ( 0x0f1 ) ( 16-bit offsets)
1: format: 0x08
2: checksum: 0x33d5 (Ok)
4: len: 0x009e ( 158 bytes)
8: named-token ( 0x0b6 ) hello/goodbye 0x800
25: b(:) ( 0x0b7 )
26: b?branch ( 0x014 ) 0x0028 ( =dec 40 dest = 67 )
29: b(") ( 0x012 ) ( len=0x1f [31 bytes] )
" Hello, you big beautiful world!"
62: type ( 0x090 )
63: bbranch ( 0x013 ) 0x0030 ( =dec 48 dest = 112 )
66: b(>resolve) ( 0x0b2 )
67: b(") ( 0x012 ) ( len=0x29 [41 bytes] )
" Goodbye, cruel world. Gggga-a-a-ackkkkk!"
110: type ( 0x090 )
111: b(>resolve) ( 0x0b2 )
112: b(;) ( 0x0c2 )
113: named-token ( 0x0b6 ) I-say-hello 0x801
128: b(:) ( 0x0b7 )
129: -1 ( 0x0a4 )
130: hello/goodbye ( 0x800 )
132: b(;) ( 0x0c2 )
133: named-token ( 0x0b6 ) You-say-goodbye 0x802
152: b(:) ( 0x0b7 )
153: 0 ( 0x0a5 )
154: hello/goodbye ( 0x800 )
156: b(;) ( 0x0c2 )
157: end0 ( 0x000 )
\ Detokenization finished normally after 158 bytes.
\ PCI Image padded with 302 bytes of zero
Note that the combination of the Verbose and Offsets options yields the maximum amount of useful information.
Note that the -n and -o options are mutually exclusive; if both are specified, -o will be favoured.
The format of the file is as follows:
If the file cannot be read, that will be regarded as an immediate
failure and cause the program to exit.
Adding to the list of Special Function names, and associating a
new behavior with the added function, requires modifying the
DeTokenizer code, but the infrastructure that is already in place
should make this a manageable task for even a modestly skilled
programmer.
At the present writing, only one such Special Function name is supported, and that one is, of course, double(lit)
Its associated special behavior is to collect the next eight bytes
from the FCode input stream and display them as a double-length literal.
If you modify the DeTokenizer to recognize additional Special Function names, please update this document to list them and describe their special behaviors. Thank you.