29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

=================================================<br />

| |<br />

| TYPE DATA AREA |<br />

| ---- ---------------------------------- |<br />

| 01 Object code load block |<br />

| 02 Transfer address |<br />

| 04 End of partitioned data set member |<br />

| 05 Load module header |<br />

| 06 Partitioned data set header |<br />

| 07 Patch name header |<br />

| 08 ISAM direc<strong>to</strong>ry entry |<br />

| 0A End of ISAM direc<strong>to</strong>ry |<br />

| 0C PDS direc<strong>to</strong>ry entry |<br />

| 0E End of PDS direc<strong>to</strong>ry |<br />

| 10 Yanked load block |<br />

| 1F Copyright block |<br />

| |<br />

=================================================<br />

Figure 8-1: Load Module TYPE Codes<br />

Any code above X'1F' is invalid as a record type. In addition, any code not listed in<br />

figure 8-1 is reserved for future use.<br />

Let's look at a sample file. Start by listing the first sec<strong>to</strong>r of the FLOPPY/DCT utility<br />

via the command: LIST FLOPPY/DCT (H). Notice that it starts out with:<br />

05 06 46 4C 4F 50 50 59 1F 2A 43 6F ...<br />

. . F L O P P Y . . C o ...<br />

stretched across the screen. What you have here is a load module header (TYPE=05). <strong>The</strong><br />

length byte (LENGTH=06) follows the TYPE code. <strong>The</strong> 6-byte DATA AREA field is the header<br />

name. All records follow this "fielding" order. A record is organized with a TYPE,<br />

LENGTH, DATA sequence. <strong>The</strong> X'1F' begins the second record. It happens <strong>to</strong> be a copyright<br />

record with a LENGTH of X'2A' or 42 decimal bytes. Incidentally, the TYPE=1F record is<br />

generated au<strong>to</strong>matically by the "COM" pseudo-op in PRO-CREATE, the assembler used <strong>to</strong><br />

develop and maintain the operating system.<br />

Note that each record begins with the TYPE code and the first byte following the end of a<br />

record is always the TYPE code of the next record. <strong>The</strong> only exception is when a TYPE code<br />

indicates the end of a file. If you look further in the record displayed at relative<br />

position X'34', or if you count 42 bytes down from the "C" of "Copyright", you will see:<br />

01 02 00 2C D5 ...<br />

<strong>The</strong> record TYPE is a load block (TYPE=01), and the length of the data area is X'02', or<br />

258 data bytes. Yes, we previously stated that the length ranged up <strong>to</strong> 256 and here we<br />

have 258! This TYPE-01 record is a special case. <strong>The</strong> two-byte field following the LENGTH<br />

is the starting load address for the rest of the field. Since the LENGTH value includes<br />

the 2-byte load address, a length of X'03' would indicate only one load byte. A length of<br />

X'04' would indicate two load bytes. A length of X'FF' would indicate 253 load bytes. A<br />

length of X'00' would indicate 254 load bytes. To be able <strong>to</strong> have a data area with up <strong>to</strong><br />

256 bytes of loadable data, the LENGTH values of X'01' and X'02' are indicative of 255<br />

and 256 load bytes respectfully. This is accomplished by having the system loader<br />

decrement the length value by two when reading a load address. <strong>The</strong> resultant value<br />

becomes the true length of the loadable data.<br />

If you let the program listing proceed <strong>to</strong> the end of the file, the last four bytes should<br />

appear as:<br />

8-6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!