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

## osGbpakGetStatus

Syntax

    #include <ultra64.h>

    s32 osGbpakGetStatus(OSPfs *pfs, u8 *status);

Explanation
The osGbpakGetStatus() function is used to detect the status of the N64 Game Boy Pak.

OSPfs structure pfs must be initialized first with osGbpakInit(3P) function.

The detected result is returned to "status." Determines the status according to whether the following bits are set.

OS_GBPAK_GBCART_ON
This bit indicates that a Game Boy game pak is inserted. It is returned when a Game Boy game pak is inserted in the N64 Game Boy Pak.

OS_GBPAK_GBCART_PULL

This bit indicates that removal of a Game Boy game pak has been detected. It is returned once the Game Boy game pak has been removed.

When there is a Game Boy game pak in the N64 Game Boy Pak and the osGbpakGetStatus() or osGbpakReadId(3P) function is called, this bit becomes 0.

OS_GBPAK_POWER
This bit indicates the state of power supply to the Game Boy game pak. When this bit is 1, power is ON; when this bit is 0, power is OFF.

Note that this only checks for power on the software side, and does not confirm that the hardware has a stable power supply. The status of the latter cannot be checked on the software side. For details, please refer to osGbpakPower(3P).

OS_GBPAK_RSTB_DETECTION
This bit indicates that the Reset signal has been detected. When the Game Boy game pak is reset, this bit becomes 1. If either the osGbpakGetStatus() or the osGbpakReadId () function is called when a Game Boy game pak is inserted, this bit returns to 0. Because this bit becomes 1 when the power is turned on, you need to clear it back to 0 after the power is turned on by calling the osGbpakGetStatus() or the osGbpakReadId () function so the bit status can be used to detect a Reset signal.

Retrun value is an error code. If the function terminates normally, a value of 0 is returned. If an error occurs, one of the following error codes is returned:

PFS_ERR_NOPACK
Nothing is inserted in the specified controller.

PFS_ERR_DEVICE
A device other than the N64 Game Boy Pak is inserted in the controller.

PFS_ERR_CONTRFAIL
Data transfers with the controller have failed. The controller may not be connected correctly, or there may be some problem with the N64 Game Boy Pak or the controller connector.

PFS_ERR_NO_GBCART
No Game Boy game cartridge is inserted in the N64 Game Boy Pak.

PFS_ERR_NEW_GBCART
A Game Boy game pak has been removed and reinserted. A different Game Boy cartridge may have been inserted.

If you remove and reinsert a Game Boy game pak and then reset N64, the flag for insertion and removal of the Game Boy game pak will remain up. Therefore you need to be careful, because a PFS_ERR_NEW_GBCART error will be returned if osGbpakInit() and then osGbpakGetStatus() are executed after resetting N64.

If osGbpakReadId(3P) is called instead of osGbpakGetStatus(), the PFS_ERR_NEW_GBCART error will not be issued. Thus, osGbpakReadId(3P) should be used to check the status of the 64GB Pak after initialization.

See Also
osGbpakInit (3P)
osGbpakPower (3P)
osGbpakReadWrite (3P)
osGbpakReadId (3P)
osGbpakCheckConnector (3P)

Revision History
10/29/1998
Added OS_GBPAK_RSTB_DETECTION to the detected statuses.

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 1998