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

   

LeoReadDiskID

Format
#include <leo.h>;

s32 LeoReadDiskID(LEOCmd *cmdBlock,
   LEODiskID *id, OSMesgQueue *mq);

typedef struct
{
     u8 pad;
     u8 yearhi;
     u8 yearlo;
     u8 month;
     u8 day;
     u8 hour;
     u8 minute;
     u8 second;
} LEODiskTime;

typedef struct
{
     u64 lineNumber;
     LEODiskTime time;
}    LEOSerialNum;

typedef struct
{
     u8 gameName [4];
     u8 gameVersion;
     u8 diskNumber;
     u16 diskUsage;
     LEOSerialNum serialNumber;
     u64 reserve;
}    LEODiskID;
Note
None of the N64 Disk Drive-related instructions involve ROM DMA (including DMA to ROM in the drive). In fact, the instructions are designed on the assumption that ROM DMA will not be carried out. Please see the "Programming Cautions" section of the N64 Disk Drive Programmer's Guide to learn more about this.

What This Function Does
It gets the disk ID of the current N64 Disk Drive disk from the system area of the disk. Each disk has its own personal number. For details, please see the "Disk ID" section of the N64 Disk Drive Programmer's Guide.

Whenever a MEDIUM_MAY_HAVE_CHANGED error is returned upon execution of any function, you must call the LeoReadDiskID function to check the disk ID. For details about the processing sequence, please the "Error-Handling" section of the N64 Disk Drive Programmer's Guide.

Nothing needs to be set for the command block (cmdBlock) argument. When processing of this function ends, an error code is returned to the message queue. An error could arise, so the programmer needs to check this error code. The following are some possible errors, their causes, and the actions that should be taken:
  • LEO_ERROR_QUEUE_FULL - There is no space in the command queue. The queue size should be enlarged. Refer to LeoCreateLeoManager for details.
  • LEO_ERROR_COMMAND_TERMINATED - The LeoClearQueue or LeoReset function was issued, so this function (LeoReadDiskID) did not execute.
  • LEO_ERROR_DEVICE_COMMUNICATION_FAILURE - The main reason for this error is an improper physical connection, however, there is a possibility that the drive itself is not functioning.
  • LEO_ERROR_COMMAND_PHASE_ERROR This error occurs when the N64 Disk Drive status is not good.
  • LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED This error appears when the drive is reset. The possible cause is that the connector was reconnected after it had been out of place. This makes subsequent N64 Disk Drive actions unstable, so you should advise the users to reset the drive.
  • LEO_ERROR_MEDIUM_NOT_PRESENT - The disk has not been inserted.
  • LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED - A disk was inserted after being removed once. It is uncertain if the game should be continued by using the newly inserted disk. If this error occurs, call LeoReadDiskID and check the newly inserted disk to find out what it is.
  • LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED - This error occurs when a disk that has an unsupported type is inserted. This error is quite unlikely.
  • LEO_ERROR_DRIVE_NOT_READY - This error occurs when the disk is not operating or when it is not stable.
  • LEO_ERROR_NO_REFERENCE_POSITION_FOUND - This error occurs when the servo data cannot be read or when an abnormality is found.
  • LEO_ERROR_DIAGNOSTIC_FAILURE - This error occurs when an abnormality is found on the drive or when the track cannot be traced.
  • LEO_ERROR_NO_SEEK_COMPLETE - This error occurs when seeking cannot be done due to seeking time out or on-track time out.
  • LEO_ERROR_DATA_PHASE_ERROR - This error occurs when data transmission did not finish in the provided time.
  • LEO_ERROR_UNRECOVERED_READ_ERROR - This error occurs when the data could not be read clearly because of a flaw on the disk.
  • LEO_ERROR_TRACK_FOLLOWING_ERROR - This error occurs when the drive head slips off the track while reading.
For more information about the errors that may be returned, their causes, and ways to deal with them, please see the "Error-Handling" section of the N64 Disk Drive Programmer's Guide. The return value is -1 if Leo Manager has not been created, and 0 if it has. Usually no check is necessary.

Example
LEOCmd cmdBlock;
LEODiskID diskID;
u32 error;
�..
LeoReadDiskID (&cmdBlock, &diskID, &diskQ);
osRecvMesg(&diskQ, (OSMesg *)&error,
   OS_MESG_BLOCK);
See Also
Leo
LeoCreateLeoManager
LeoReadWrite
LeoSeek
LeoSpdlMotor
LeoByteToLBA
LeoLBAToByte
LeoInquiry
LeoTestUnitReady
LeoRezero
LeoClearQueue
LeoReadCapacity



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 January 1998