N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## makedisk

Syntax

    makedisk [-D name[=def]] [-l dir] [-U name]
             [-d] [-m] [-o] [-b bootstrap filename]
             [-h header filename] [-s romsize]
             [-f filldata] [-C clockrate] [-t type]
             [-p pif2 bootstrap filename]
             [-f romfile] specfile

Explanation
It creates the N64 Disk Drive disk image and its related ELF object file. Specifically, makedisk is used in place of makerom when you are creating disk games instead of Game Paks.
The makedisk tool performs the following operations:

- Specifies the media for each segment in the spec file
- Links segments based on the spec file specifications
- Creates the gwrite batch file
- Generates the disk-use symbols
- Segment mapping

These operations are explained in detail below.

1. Media Specification

   The media specification specifies the media for each segment in the spec file, defining whether that segment is stored on the disk or in the game pak.

   A segment specified as

   > media CART

   is stored in the game pak, while a segment specified as

   > media DISK

   is stored on the disk. When no media is specified, it is assumed that that segment is stored on the disk.

   Segments with the game pak specification are packaged by default in the file with the name "rom." That file is called the "ROM image." The name "rom" can be changed using the -r option. In the same way, segments with the disk specification are packaged by default in the file with the name "disk." That file is called the "disk image." The name "disk" can be changed using the -R option.

   If all segments are specified in the game pak, then makedisk operates just like makerom. That is, you can use makedisk to package the game as a game pak game. If all segments are specified on the disk, or if nothing is specified for any of the segments, then the game is packaged as a disk-boot game. If some segments are specified on the game pack and the rest are specified on the disk, then the game is packaged as a disk game that boots from a game pak. In this last case, the boot segment must be located on the game pak side.

2. Linking Segments Based on the spec File Specifications
   The makedisk tool differs from makerom in two ways concerning the spec file specifications:
   - In makedisk there is no romAlign to specify the alignment of the storage address in the ROM image.
   - In makedisk there is an lba specification to specify the disk LBA in which the segment is stored.
   Otherwise, makedisk is the same as makerom in terms of both the spec file specifications and the command actions.
   The following example shows how the lba specification is used.

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

   The lba specification only specifies segments stored on the disk. A "segment stored on the disk" is a segment of non-zero size in the ROM image. For example, segments from the color frame buffer and the Z-Buffer are only maintained in RDRAM, so no space is secured in ROM. Therefore, if this type of segment were specified with lba an error would be returned. Conversely, an error would arise if a ROM image segment of non-zero size were not specified with lba.
   The lba specification specifies which LBA to write the segment to on the disk. The format can be any of these:

- lba (number) Writes the segment beginning from the LBA number specified by number.

- lba RAMSTART [ + (number)] Writes the segment beginning from the LBA number expressed by the disk’s RAM region header + number. The number of LBAs in the RAM region header differs depending on the disk type, so this notation is convenient to use. For details about RAM regions and disk types, please see Chapter 11, "Hardware Specifications," in the N64 Disk Drive Programmer's Guide. Be sure you put one space on either side of the plus (+) symbol.

- lba after (segment name) Writes the segment after the segment specified by segment name. For example, if the formula reads ‘lba after code’ and ‘code’ is a segment written using LBA 0 to LBA 100, then the segment in question is written from LBA 101. The segment specified with segment name must be defined in advance.

- lba none The segment will not be located anywhere on the disk.

3. Creating the gwrite Batch File
   The gwrite file is the batch file for writing games to the disk. It can be executed using the < instruction in the Partner command window. (The < instruction executes the commands written in a specified file.)
4. Generating Disk-Use Symbols
   makedisk outputs a number of symbols so that it is possible on the program side to find out which block in a disk a given segment is stored.

   For example, to know the storage LBA for the texture segment on the disk, write the following into the program to have makedisk resolve the symbols:
   extern char_textureSegmentRomStart[ ], _textureSegmentRomEnd[]
   These will be displayed respectively as [texture segment starting LBA] and [texture segment ending LBA + 1].

5. Segment Mapping
   makedisk will output the information on which segment was located in where on the disk, to the standard error output. The format is as follows:

                       DISK IMAGE MAP

       Segment   Size(bytes)  Lba usage    Occupied(bytes) Rest(bytes)
       code        341216      18(0-17)        354960        13744
       dummy       742544      46(1418-1463)   750720         817
       dummy2      223600       none
       _____________________________________________________________
       Total      1307360       64 blocks             21920

From left-to right, the format represents a segment name, segment size, the number of blocks that are used (none is a segment that specified lba NONE, and numbers in parentheses are LBA that are used), and the capacity of the block used (the number of bytes in the area the segment occupies). The column at far right is the capacity of empty area that was calculated by (Occupies - Size).

The above example shows that the code segment has a byte size of 341216, and uses 18 blocks of LBA 0 - 17. LBA 17 has a capacity of 13744 bytes, as the capacity of these 18 blocks is 354960 bytes. (all areas of LBA 0 - 16 are used.) Command Line Options
The meaning of each option is explained below.

- -t type Specifies the disk type

- -i idfile Specifies an ID file. When this is specified, makedisk will output gwrite (which writes the first 32 bytes of idfile on the disk as the ID.)

- -B 0 Creates an "activating" game.

- -B 0 Creates an "activated" game. For details about activating and activated games, see Chapter 15.1 "Reboot" in the N64 Disk Drive Programming Manual.

- -R name Specifies the file name of the disk image. The default name is "disk." To change the ROM image file name, please use the -r option. For details about disk images and ROM images, see "Media Specification," below.

- -S name Specifies the name of the virtual file for writing the disk image to the disk. The default name is "gwrite."

The other options are the same as for makerom.

Notes
makedisk does not have romAlign, which specifies the alignment of storage addresses in a ROM image.

In Partner, the "l" command does not work well if there is no file named "rom" in the current directory. Therefore, when you create a disk-boot game with makedisk, please use the -R option to change the name of the disk image file to "rom" (i.e., -R rom).

In Partner, the "l" command switches between operating for use with a disk or for use with a game pak depending on whether or not a file named "gwrite" resides in the current directory. Accordingly, it is best not to change the name of gwrite with the -S option when creating disk-boot games. Conversely, you should use the -S option and change the name of gwrite when creating games that use both game paks and disks.
Revision History
1/22/99
Made major changes to explanations in 1 ~ 5
Added "Notes"

1/21/99
Deleted the -C option

10/27/98
In "Generating Disk-use Symbols" changed RomStart[],RomEnd[] to DiskStart[],DiskEnd[].

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999