LeoModeSelectAsync LeoModeSelectAsync (function)

Alters the wait-time specified for changes between the N64 Disk Drive modes

Syntax

#include <PR/leo.h>     /* leo.h */

s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby,
                       u32 sleep, OSMesgQueue *mq)); 

Description

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 "Chapter 12: Programming Restrictions and Cautions" in the N64 Disk Drive Programming Manual for more information about this.

The N64 Disk Drive has the following three modes concerning the motor and the head:

Mode State of Motor State of Head
Active mode Spinning Not parked
Standby mode Spinning Parked
Sleep mode Stopped Parked

With the drive in active mode, if one of the mode-changing functions is not issued within a certain time (the default is 3 seconds), then the state automatically changes to standby mode in order to conserve power and protect the drive. Similarly, the state automatically changes from standby mode to sleep mode if a function is not issued within a default time of 1 second. (The functions LeoReadWrite, LeoSeek, LeoRezero, and LeoReadDiskID change the state to active mode upon execution, while LeoSpdlMotor forces the change when issued.)

The LeoModeSelectAsync function alters the wait-time (3 and 1 seconds by default) specified for changes between active, standby, and sleep modes to meet the needs of the game.

Both times can be modified in 1-second intervals to specify a time of anywhere from 0 seconds to 10 seconds. To modify the times, call the function and specify in the standby argument the number of seconds to wait before going from active mode to standby mode, and specify in the sleep argument the number of seconds to wait before going from standby mode to sleep mode.

Note: If the revised wait time is set to a long period, you could shorten the service life of the user's N64 Disk Drive. Please use the default times if possible. There is no problem if you want to set the wait times shorter than the defaults. This function is related to internal processes, so call it only once at the time in your game when you make the initial settings.

Nothing needs to be set for the command block specified by the cmdBlock argument. When this function's processing finishes, an error code is returned to the mq queue. An error could arise, so the programmer needs to check this error code.

For more information about the errors that may be returned, their causes and ways to deal with them, see "Chapter 10: Error-Handling Sequences" in the N64 Disk Drive Programming Manual.

The return value is -1 if Leo Manager has not been created, and 0 if it has. Normally, it is not necessary to check the return value.

Example

LEOCmd cmdBlock;
u32 error;
.....
LeoModeSelectAsync(&cmdBlock, 4, 1, &diskQ);
osRecvMesg(&diskQ, (OSMesg *)&error, OS_MESG_BLOCK);

See Also

Leo*CreateLeoManager, LeoSpdlMotor

Revision History

04/30/1999 Changed Format