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





osGbpakReadWrite

Syntax
#include <ultra64.h>
s32 osGbpakReadWrite(OSPfs *pfs, u16 flag, u16 address, u8 *buffer, u16 size);

Explanation
osGbpakReadWrite() function reads/writes to Game Boy Pak. It can be used to access the game pak memory when a Game Boy game pak is inserted in the N64 Game Boy Pak.

Before calling osGbpakReadWrite(), 64GB Pak must be initialized by osGbpakInit(), the Game Boy ROM registration area must be read and the power turned on and the manufacturer code and game title must be checked by osGbpakReadId(). In addition, the connector must be checked by osGbpakCheckConnector().

The OSpfs structure pfs must be initialized by osGbpakInit(). Specify in "flag" either OS_READ or OS_WRITE. When OS_READ is specified, data is read from the Game Boy game pak, while OS_WRITE specifies writing data to the Game Boy game pak. Specify in "address" the value of the Game Boy game pak's CPU address (0x0000 ~ 0xbfff). The number of bytes to read or write is specifed by size. address and size must be multiples of 32. buffer is a pointer to the buffer in RDRAM where the read or write is performed.

Caution is required when dealing with the returned values. This function cannot determine whether the Game Boy game pak has been pulled out, or whether Game Boy game paks have been exchanged. That is to say, a "0" (normal termination) is returned even if the Game Boy game pak has been removed during function operations. Before and after this function is called, osGbpakGetStatus() or osGbpakReadId() should be called for a status check. It should also be confirmed that the Game Boy cartridge has not been removed and reinserted.

Return 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_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.

When the Game Boy cartridge is not accessed for some time after reading or writing with osGbpakReadWrite(), the Game Boy cartridge power should always be turned off using osGbpakPower().

See Also
osContInit (3P)
osGbpakInit (3P)
osGbpakGetStatus (3P)
osGbpakPower (3P)
osGbpakReadId (3P)
osGbpakCheckConnector (3P)




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