3.1 makedisk (NW only)

When a game which uses a Game Pak is compiled, makerom is used to combine the various seqments into a single rom image. With disk games, however, makedisk is used for this purpose. The tasks performed by makedisk are broadly categorized into the following three types.

  1. Segment linking based on the specifications in the spec file.
  2. Creation of the batch file gwrite.
  3. Generation of symbols for disk use.

The first task is exactly the same as for makerom but with the addition of the specification lba. This specifies to which disk LBA the segment is written (For more information on the LBA, see Chapter 11: 64DD Hardware Specifications. An example is shown below.

..... 
beginseg 
	name "road" 
	lba 100 
	flags OBJECT 
	number TEXTURE_SEGMENT 
	include "road.o" 
endseg 
.....

An lba for a segment stored on the disk must be specified in the spec file. An error results if lba is specified for a segment not stored on the disk. Segments considered to be stored on disk are those which have a non-zero size in the ROM image. The boot segment is one such segment. However, a segment consisting of a color frame buffer and z-buffer is reserved only in RDRAM; no ROM area is reserved. Thus, such a segment is not stored on the disk.

The syntax of the lba specification is as follows.

lba numeral

Write the segment beginning at the LBA expressed by numeral.

lba RAMSTART [+numeral]

Write the segment beginning from the LBA expressed by the start of the RAM area + numeral. Because the LBA of the start of the RAM area depends on the disk type, this notation is convenient. For information on RAM areas and disk types, please see "Chapter 11, 64DD Hardware Specifications." Note that a space must be present on either side of the + sign.

lba after segment name

Place the segment after the segment expressed by segment name. For example, when lba after code is specified, if the code segment is LBA 0-LBA100, the segment is positioned from LBA 101 onward. The segment expressed by segment name must be defined before the segment to be written.

gwrite mentioned in task 2. is a batch file that writes the results the compiled results to disk. Further details are given in section 3.3 gwrite.

The disk symbols of task 3. are described next.

For the sake of simplicity, makerom is considered first.

For example, when a texture is to be transferred from the Game Pak ROM to RDRAM, it is not known until compile time where in ROM this segment is stored. However, the programmer can enter the following beforehand.

..... 
extern char _textureSegmentRomStart[],_textureSegmentRomEnd[] 
..... 
(Transfer the contents between _textureSegmentRomStart and _textureSegmentRomEnd-1 to . . . of RDRAM by DMA.) 

_textureSegmentRomStart, _textureSegmentRomEnd

In this case, makerom defines the symbols _textureSegmentRomStart and _textureSegmentRomEnd by calculation. For more information, see also "makerom Online Manual." Thus, a data transfer program can be written without the bother of compiling a second time. In this way, makerom outputs as symbols information that is not defined until linking, such as the starting and ending locations of a segment stored in the Game Pak ROM, allowing the programmer to reference this information in the program.

The same is true with a disk. In this case, data are accessed using a logically assigned sequential number, the LBA. However, the questions of which segments are stored beginning from what LBA and spanning how many blocks are not answered until linking.

Using the preceding texture segment as an example, however, if the programmer writes the follow program beforehand, makedisk resolves the symbols _textureSegmentDiskStart and _textureSegmentDiskEnd, enabling the desired transfer.

..... 
extern char _textureSegmentDiskStart[],_textureSegmentDiskEnd[] 
..... 
(Transfer the contents between _textureSegmentDiskStart and _textureSegmentDiskEnd-1 to . . . of RDRAM by DMA.) 

In addition to outputting the symbols that makerom outputs, makedisk outputs information describing from which block to which block on a disk a segment is stored.

Note: SegmentDiskEnd expresses the last storage block + 1. For example, if _textureSegmentDiskStart = 20 and _textureSegmentDiskEnd = 30, the segment texture is stored from LBA 20 to LBA 29. Please keep this in mind.

All read/write operations to the 64DD are performed in units of blocks. For information on blocks, please see "Chapter 11, 64DD Hardward Specifications."