RCA REB1200 ebook reader

The RCA REB1200 is an ebook reader that reads content that is either downloaded from Gemstar or copied onto its compact flash card. Softbook Publisher creates content by converting Microsoft Word documents. An alternate method for creating content is to use the program below to convert OEB files. OEB is a standard based on HTML and XML defined by the Open eBook Forum

REB1200 Publisher

This program converts an OEB package file (.opf) to an OEB format file (.oeb) compatible with SoftBook Personal Publisher. Combines the files of a REB1200 ebook (.RES directory) into a Softbook ebook (.imp file) for easier backup. If the REB1200 ebook is not encrypted then the Softbook ebook can be read on your computer. Creates an OEB package file from an HTML file (.odf, .htm, .html) extracting the required metadata using the same tags used in creating a RocketEdtion ebook (.rb file). Creates a list of books grouped by category. Create your own personal online bookshelf that enables you to use a web server and download books using the ethernet connection.

Metadata elements
<meta name="author" content="the author" />
<meta name="genre" content="the category" />

Download: rebpub.msi
Version: 1.2.5
System Requirements: RCA REB1200 ebook reader with Viewer version 2.0 or 2.1

Comments and assistance for this project would be greatly appreciated. Source code is available on request.

Jeffrey Kraus-yao
Email: krausyaoj@ameritech.net

Book sources

Web sites that have books that can be loaded onto your REB1200 through its compact flash card.

Resources

Format of SoftBook .imp files

An .imp file consists of a header, book properties, name of .RES directory, table of contents, and the contents of each file. Version 1 is created by Softbook Publisher 1.0. Version 2 is created by Softbook Publisher 1.5. The header is the same for both versions except for the value of the version field. The versions differ in their table of contents.

Header which totals 48 bytes
offset 0x00: 2 bytes, version
offset 0x02: 8 bytes, constant "BOOKDOUG"
offset 0x0A: 8 bytes, unknown
offset 0x12: 2 bytes, count of included files
offset 0x14: 2 bytes, length of directory name
offset 0x16: 2 bytes, count of bytes remaining for header and book properties
offset 0x18: 4 bytes, unknown
offset 0x1C: 4 bytes, unknown
offset 0x20: 4 bytes, compression off=0, on=1
offset 0x24: 4 bytes, encryption plain=0, encrypted=2
offset 0x28: 4 bytes, zoom state, both=0, small=1, large=2
offset 0x2C: 4 bytes, unknown

Book properties start at offset 0x30
ID: null terminated C string
Bookshelf Category: null terminated C string
Subcategory: null terminated C string, not displayed on REB1200
Title: null terminated C string
Last name: null terminated C string
Middle name: null terminated C string
First name: null terminated C string

Note: Name fields are displayed in order "first middle last". Most REB1200 eBooks place the entire name in First.

Name of .RES directory

Offset to start of table of contents is 48 plus length of directory name and length of book properties. Files are included in the same order in the table of contents as the contents of the files following the table of contents. A file name of four spaces (0x20) becomes "DATA.FRK" when the .imp file is expanded into a .RES directory. The 12 bytes following "BOOKDOUG" are removed from the header and the book properties are appended and become the "RSRC.INF" file.

Version 1

Table of contents for each included file except RSRC.INF:
4 bytes: file name
2 bytes: 0x0000 or 0x0001
4 bytes: file size

For each included file except RSRC.INF
4 bytes: file name
2 bytes: 0x0000 or 0x0001
4 bytes: file size
variable: contents of files

Version 2

Table of contents for each included file except RSRC.INF:
4 bytes: file name
4 bytes: 0x00000000
4 bytes: file size
4 bytes: file type
4 bytes: 0x00000000

For each included file except RSRC.INF:
4 bytes: file name
4 bytes: 0x00000000
4 bytes: file size
4 bytes: file type
4 bytes: 0x00000000
variable: contents of files

RSRC.INF File

This file is composed of the header and book properties sections of the .imp file with 12 bytes removed after the constant "BOOKDOUG". The identifer comes from the <dc:Identifier> element after the <dc:Identifier> element whose id attribute equals the unique-identifier attribute of the package element. If this element is not present the identifier will be a null string and the category and title of the Settings command will be changed to those of this ebook.

This file is modified after download by a number of Set-Cookie HTTP headers. The values of cookies SOURCE_ID and SOURCE_TYPE are prepended to the BOOK_ID. The bytes following first name are added including cookies ISSUE_NUMBER and CONTENT_FEED. SOURCE_ID is usually "3" and SOURCE_TYPE is usually "B".

32 byte header
offset 0x00: 2 bytes, version constant 0x001
offset 0x02: 8 bytes, signature constant "BOOKDOUG"
offset 0x0A: 2 byte offset 12 bytes before end of file
4 bytes, unknown
4 bytes, unknown
offset 0x14: 4 bytes, compression off=0, on=1
offset 0x18: 4 bytes, encryption plain=0, encrypted=2
offset 0x1C: 4 bytes, zoom state, both=0, small=1, large=2
offset 0x20: 4 bytes, unknown
C string: identifier, format SOURCE_ID:SOURCE_TYPE:BOOK_ID
C string: category
C string: subcategory (not used on REB1200), always 0x00
C string: title
C string: last name
C string: middle name
C string: first name (usually entire name in this field on REB1200)
padding bytes so next record is 4-byte aligned
4 bytes: constant 0x00000002
4 bytes: constant 0xFFFFFFFF for books, ISSUE_NUMBER for issues of periodicals
C string: null string for books, CONTENT_FEED for issues of periodicals,
C string: SOURCE_ID:SOURCE_TYPE:None
4 bytes: unknown

DATA.FRK File

Element text is extracted and placed in this file. Elements tags are replaced with control characters. This file can be compressed and encrypted with compression occuring before encryption. This file is compressed when the element <meta name="x-SBP-compress" content="on"/> is included in the <x-metadata> element of the package file. The compression algorithm used is LZSS. This file is encrypted when the element <meta name="x-SBP-encrypt" content="on"/> is included in the <x-metadata> element of the package file. The encryption algorithm used is DES. The 8 byte encryption key is in the SoftBook Edition Encryption Key File (.key) at offset 0x0C.

Resource Files

A Softbook Edition file (.imp) is split into the files of a .RES directory for loading onto an REB1200 using its compact flash card. These files are named RSRC.INF, DATA.FRK and a number of files with names of four (4) uppercase letters.

Many of the file types follow a common pattern of having a 32 byte header, a variable length data section, followed by an index. A 4 byte pointer at offset 0x0A of the header points to the start of the index. The index entries point to the data in the variable length section in reverse order. Each index entry has an offset to the beginning of its data and the length of that data.

offset 0x00: 2 bytes, file version, currently version 0x0001.
offset 0x02: 4 bytes, file type
offset 0x06: 4 bytes, null
offset 0x0A: 4 bytes, offset to start of index
offset 0x0E: 18 bytes, null
offset 0x20: start of variable length data

offset 0x00: 2 bytes resource ID
offset 0x02: 4 bytes length of resource
offset 0x06: 4 bytes offset to start of resource
offset 0x0A: 2 bytes constant 0x0000

File types

Each of the files whose name is four characters have a file type in them at offset 0x02 that is 4 bytes long. The minimal set of file types for a plain text file are: !!cm, !!sw, AncT, BGcl, BPgz, BPgZ, ESts, Mrgn, pInf, PPic, StRn, Styl

These types include the following:
!!cm: related to compression
!!ky: encryption key container
!!sw
AncT: anchor <a> elements
Ano2: annotations
AtTp
BGcl: background color
BPgz
BPgZ
BPos
Clos
Dict
eLnk: external links containing the href attributes of the <a> elements
ESts
Glos
HfPz
HfPZ
Hyp2
ImRn: image run?
Lnks: internal and external links
MASK
Mrgn: margin?
MRPs: markups?
Offs
Pcz0
PcZ0
PcZ1
PNG: PNG images
PIC2
PICT
pInf
PPic
SKtb
StR2
StRn: string runs linking element text to styles
STR#
Styl: styles
Tabl
TagS
TCel
TGNt
TRow

!!cm format

Present only in compressed files.

standard header, 32 bytes
offset 0x00: constant 0x0001 version
offset 0x02: constant "!!cm" file type
offset 0x0A: offset to start of index

Content, 2 records
record 1, variable length
record 2, 0x0A bytes

standard index, 2 index entries
2 bytes: index
4 bytes: record length
4 bytes: offset to start of record
2 bytes: constant 0x0000

!!ky format

When a Softbook Edition file (.imp) is encrypted only the DATA.FRK file is encrypted. When the same ebook is downloaded to two different REB1200 ebook readers only the 8 bytes at offset 0x02C are different. These 8 bytes are not the encryption key for the file.

32 bytes: standard header
offset 0x00: 2 bytes constant 0x0001 version
offset 0x02: 4 bytes constant "!!ky" file type
offset 0x0A: 4 bytes offset to start of index

4 bytes: constant 0x00000001
4 bytes: constant 0x00000000
4 bytes: constant 0x00000002
8 bytes: device specific key
16 bytes: book specific key

12 bytes: standard index

9 bytes: constant "Data fork"

!!sw format

Standard header, 32 bytes
offset 0x00: constant 0x0001
offset 0x02: constant "!!sw"
offset 0x0A: offset to beginning of index

Content

Index, each entry is 16 bytes long
2 bytes: sequence number
4 bytes: length of item
4 bytes: offset to beginning of item
2 bytes: constant 0x0004
4 bytes: file type

AncT format

These are the targets of <a> tags and can be any element that has an id property. They are in the stored in order. They are repeated twice, perhaps for each of the two page sizes?

Standard header, 32 bytes
offset 0x00: constant 0x0001
offset 0x02: constant "AncT"
offset 0x0A: 4 bytes offset to beginning of index

four bytes: count of anchor tags
for each anchor tag:
four bytes: offset of control character for anchor tag in DATA.FRK
four bytes: page number of anchor tag

four bytes: count of anchor tags
for each anchor tag:
four bytes: offset of control character for anchor tag in DATA.FRK
four bytes: page number of anchor tag

Standard index, each entry is 12 bytes
2 bytes: sequence number
4 bytes: length of item
4 bytes: offset to beginning of item
2 bytes: constant 0x0000

BGcl format

Background color using CMYK colors. When offsets 0x02 and 0x04 are set to 0x00 then color is blue, when offsets 0x04 and 0x06 are set to 0x00 then color is red, and when offsets 0x02 and 0x06 are set to 0x00 then green. When all three are set to 0xFF then background color is white. When all three are set to 0x00 then background color is black.

32 bytes: standard header
offset 0x00: constant 0x0001
offset 0x02: constant "BGcl"
offset 0x0A: offset to start of index

8 bytes: content
offset 0x02: cyan when set to 0x00 and others set to 0xFF
offset 0x04: magenta when set to 0x00 and others set to 0xFF
offset 0x06: yellow when set to 0x00 and others set to 0xFF

12 bytes: standard index
2 bytes: constant 0x0080
4 bytes: length of data
4 bytes: offset to start of data
2 bytes: constant 0x0000

PBgz and PBgZ formats

These may be book page information for the two sizes. There is one record but this record appears to start with an index and then one subrecord for each page. This file type is changed by oeb-column-number.

standard header, 32 bytes

content, a single record with subrecords for each page
offset 0x0C: 2 bytes, column width?

standard index for a single record

BPos format

standard header, 32 bytes
offset 0x00: constant 0x0001
offset 0x02: constant "BPos"
offset 0x06: offset to start of record A
offset 0x0A: offset to index

Record A, variable length

Record B, usually 0x0A bytes long
offset 0x00: 2 bytes current page

standard index
2 bytes: constant 0x0080
4 bytes: length of record B, usually 0x0A
4 bytes: offset to start of record B
2 bytes: constant 0x000

eLnk format

Links to external sites are stored in "eLnk" files. This file has the standard header, the contents of the href attribute of <a> elements in reverse order and an index table. Each item in the index table is twelve (12) bytes long.

Standard header, 32 bytes

Content
Text of href attributes of <a> elements without delimiters. Each attribute has a corresponding index entry.

Standard index, each entry is 12 bytes
2 bytes: ID used by Lnks, offset 0x1A
4 bytes: offset to the href attribute value
4 bytes: length
2 bytes: constant 0x0000

ESts format

Compressing the ebook did not have any effect on this file therefore their are no offsets into DATA.FRK in this file type.

standard header, 32 bytes
offset 0x00: 2 bytes, version constant 0x0001
offset 0x02: 4 bytes, file type constant "ESts"
offset 0x0A: 4 bytes, offset to start of index

Content
record 1, 10 bytes
record 2, 10 bytes
record 3, remainder of content

standard index, each entry 12 bytes long
offset 0x00: 2 bytes, index
offset 0x02: 4 bytes, record length
offset 0x06: 4 bytes, offset to start of record
offset 0x0A: 2 bytes, constant 0x0000

ImRn format

This format shares a lot of data with format Pcz0.

standard header, 32 bytes
offset 0x00: constant 0x0001
offset 0x02: constant "ImRn"
offset 0x0A: 4 bytes offset to index

records, each 0x20 bytes long
offset 0x08: 2 bytes image width
offset 0x0A: 2 bytes image height
offset 0x1A: 4 bytes image type either "PNG " or "GIF "
offset 0x1E: 2 bytes image ID

standard index, 12 bytes
2 bytes: constant 0x0080
4 bytes: length of records section
4 bytes: offset to start of records section
2 bytes: constant 0x0000

Lnks format

Internal links each 0x22 bytes. In the same order as the <a> elements.

32 bytes, standard header
offset 0x00: constant 0x0001
offset 0x02: constant "Lnks"
offset 0x0A: offset to start of index

Data: variable number of link records each 34 bytes long
u_long start; start of the link in the data.frk file
u_long end; end of the link in the DATA.FRK file
u_long unk1; internal 0xFFFFFFFF, external 0xFFFFFFFC
u_long unk2; normally 0 */
u_long anchor; location link points to in DATA.FRK file which is also the offset of the anchor target in AncT
u_long unk3; normally 0
u_int: unknown
u_int: internal 0x0000, external ID from file type eLnk
u_long unk4; normally 0
u_int unk6; normally 0

12 bytes, standard index
2 bytes: constant 0x0080
4 bytes: length of data
4 bytes: offset to start of data
2 bytes: constant 0x0000

Mrgn format

This format may have been for margins, but changing any of the four bytes from 0xFF to 0x00 and even deleting the file has no visible impact on the ebook.

standard header, 32 bytes

records, each 0x02 bytes long, two records

standard index, 12 bytes each entry, two entries

Pcz0 and PcZ0 formats

These resources may be related to positioning of images. The resource with "z" for small view and "Z" for large view.

32 bytes: standard header

image position record each 0x2E bytes long
4 bytes at offset 0x00: constant "imgp"
4 bytes at offset 0x04: horizontal offset
4 bytes at offset 0x08: vertical offset
4 bytes at offset 0x0C: image width
4 bytes at offset 0x10: image height
4 bytes at offset 0x16: offset into DATA.FRK of the image placeholder character 0x0F for this image
4 bytes at offset 0x1E: type of image
2 bytes at offset 0x26: image ID from file type PIC2 or other image type file

index: each index entry is 12 bytes
2 bytes: 00 00
4 bytes: length of record
4 bytes: offset to beginning of record
2 bytes: 00 00

PIC2 format

One or more images in PNG format.

32 bytes: standard header with location of index at offset 0x0A.
variable length data: one image for each index entry
index: each index entry is 12 bytes long.
2 bytes: ID of picture
4 bytes: length of image
4 bytes: offset to beginning of image
2 bytes: 00 00

pInf format

Page information with two 10 bytes records. The first record is for the small font view and the second record is for the large font view.

standard header, 32 bytes
offset 0x00: constant 0x0001
offset 0x02: constant "pInf"
offset 0x0A: offset to index

2 page information records each 10 (0x0A) bytes long
offset 0x04: two bytes, last page number

standard index, 12 bytes
2 bytes: ID of index, either 0 or 1
4 bytes: length of record, 0x0A for this format
4 bytes: offset to start of record
2 bytes: constant 0x0000

PPic format

Text only documents have 0x03 for the first 2 bytes and the rest are zero. The two records have the same values.

Adding an image changed two bytes at offsets 0x0D and 0x11.

standard header, 32 bytes

content, 2 records each 0x12 bytes
2 bytes
4 bytes
4 bytes
4 bytes: count of images
4 bytes

standard index, each 12 bytes
two index entries

StRn format

Links element text and the styles applied to that text. Styl 0 is the body style, Styl 1 and 2 appear unused. Styl 3 is the first user defined Styl.

standard header, 32 bytes
offset 0x00: constant 0x0001 version
offset 0x02: constant "StRn" file type
offset 0x0A: 4 bytes offset to start of index

single record composed of 8 byte subrecords
4 bytes: offset into DATA.FRK of start of string
4 bytes: index into Styl table

standard index, 12 bytes
1 index record

Styl format

32 bytes standard header
offset 0x00: 2 bytes version, constant 0x0001
offset 0x02: 4 bytes file type, constant "Styl"
offset 0x0A: 4 bytes offset to start of index

Content
46 (0x2E) bytes: for each style used. Styles defined but not used are not included. The styles are in the order they occur in the text file.
offset 0x02: 2 bytes "text-decoration:line-through"=2
offset 0x06: 2 bytes font-family
offset 0x08: 2 bytes style, "font-weight:bold"=1, "font-style:italic"=2, "font-weight:bold; font-style:italic"=3; "text-decoration:underline"=4, "font-weight:bold;text-decoration:underline"=5, "font-style:italic;text-decoration:underline"=6
offset 0x0A: 2 bytes font-size
offset 0x0C: 2 bytes text-align: none=0000, left=FFFE, right=FFFF,center=0001, justify=FFFD
offset 0x0E: 3 bytes text color, RRGGBB. Softbook Publisher supports only numbered colors
offset 0x16: 2 bytes, text-indent
offset 0x18: 2 bytes, margin-right
offset 0x1A: 2 bytes, margin-left
offset 0x1E: 2 bytes, oeb-column-number

12 bytes standard index
2 bytes: constant 0x0080
4 bytes: length of content
4 bytes: offset to start of content
4 bytes: constant 0x0000

font-family: serif=14, sans-serif=15, smallfont=3, monospace=4
font-size: xx-small=1, x-small=2, small=3, medium=4, large=5, x-large=6, xx-large=7

The default font-size is x-small. If all the values of a style equal those of the default style a record is not created for that style.

Changing style margin-left of the <body> element changed only files of type BPgz, BPgZ, and Styl. This changed offsets 23 and 27 of the style records except for the first three. Style records are created for elements html, head, and title. A separate style record is not created for the body element.

Tabl format

Standard header
offset 0x00: constant 0x0001
offset 0x02: constant "Tabl"
offset 0x0A: offset to index

Content
Each record is 0x18 bytes
offset 0x14: 4 bytes, ol=0x00004E70 ol style="list-style-type:lower-alpha"=0xFFCA2F, ol style="list-style-type:upper-alpha"=0xFFBE0E, ul=0x00002D75
Index, one entry
2 bytes: constant 0x0080
4 bytes: length of data
4 bytes: offset to start of data
2 bytes: constant 0x0000

TCel format

Each record is 0x34 bytes long.

32 bytes standard header
offset 0x00: constant 0x0001
offset 0x02: constant "TCel"
offset 0x0A: offset to index

Contents, 0x34 bytes for each record

Standard index, each index entry is 12 bytes long
2 bytes: ID, not sequential
4 bytes: length of record which for this type is 0x34
4 bytes: offset to start of record
2 bytes: constant 0x0000

TRow format

Each index entry points to a group of one or more 16 byte records. Each list item is included as a record. Each list has its own index entry that groups all of the list items.

32 bytes standard header
offset 0x00: constant 0x0001
offset 0x02: constant "TRow"
offset 0x0A: offset to start of index

Contents
Each TRow record is 16 (0x10) bytes long

Standard index, each index entry is 12 bytes long
2 bytes: ID number, not sequential
4 bytes: length of record group
4 bytes: offset to beginning of record group
2 bytes: constant 0x0000

Online Bookshelf

The online bookshelf is built when the REB1200 sends an HTTP GET request to address bookshelf.softbook.net/bookshelf/default.asp. It is sent back a list of books in an HTTP response. The format of this list has Content-Type of text/x-booklist. Each line of the list is terminated by a line feed. The first line of the list is "1", which may be format version. The last line is empty so the list ends with two line feeds. The items of the list are separated by tabs

SOURCE_ID ":" SOURCE_TYPE ":" BOOK_ID
Title
Author
Category
Size of .imp file in bytes
Download URL
Constant 1
File type: 17 for books and 21 for issues of periodicals

Example
3:B:0-7410-0284-1&#9;Random House Webster's Pocket American Dictionary&#9;Random House&#9;General Interest&#9;3357685&#9;http://bookshelf.softbook.net/bookshelf/default.asp?BOOK%5FID=0%2D7410%2D0284%2D1&SOURCE%5FID=3&SOURCE%5FTYPE=B&#9;1&#9;17

Note: &#9; is the entity for the tab character.

Valid XHTML 1.0!