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
|
osGbpakReadIdSyntax#include <ultra64.h>
Explanation
This function should always be called after N64 Game Boy Pak is initialized and before reading or writing data. The function uses osGbpakGetStatus() to check the status of the Game Boy Pak and osGbpakPower() to turn on the power. Thus, it is not necessary to call these functions. The OSpfs structure pfs is the N64 Game Boy Pak control structure. It must first be initialized by osGbpakInit(). Registration data in ROM are stored in the OSGbpakId structure *id. The elements of the OSGbpakId structure are as follows. For more information, see references such as Submitting Game Boy Master ROM. typedef struct { u16 fixed1; /* Fixed data (0x00, 0xc3) */ u16 start_address; /* Program start address */ u8 nintendo_chr[0x30]; /* "Nintendo" character data */ u8 game_title[16]; /* Game title */ u16 company_code; /* Company code */ u8 body_code; /* Body code */ u8 cart_type; /* Game pak type */ u8 rom_size; /* ROM size */ u8 ram_size; /* RAM size */ u8 country_code; /* country code */ u8 fixed_data; /* fixed data(0x33) */ u8 version; /* Mask ROM version number */ u8 isum; /* Complement check */ u16 sum; /* Sum check */ } OSGbpakId; The N64 Game Boy Pak status is returned to *status. Please refer to osGbpakGetStatus() for additional information. The following processes are performed internally in osGbpakReadId() function. First, the N64 Game Boy Pak status is examined and the value is returned to "status." Next, the status is checked, and if things are normal, then power is turned ON to the Game Boy game pak. The function then checks whether the Game Boy cartridge data are read normally. It reads the registration area data and checks whether the "Nintendo" character data area and the complement check are correct. When proper reading of the data is confirmed, the registration data in ROM are stored in *id. If there is an error in reading, the PFS_ERR_CONTRFAIL error is returned. After this function is called, the inserted Game Boy cartridge should always be confirmed to be one supported by the application. This should usually be checked by examining both the manufacturer code (company_code) and the game title (game_title). This is necessary because developers can give a game any name they desire, so more than one game may have the same game title. Note that the Game Boy cartridges that were first sold did not contain a manufacturer code. 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
PFS_ERR_DEVICE PFS_ERR_CONTRFAIL If this error is issued, display a message such as the following to the screen: The Game Boy cartridge connection is abnormal. Please turn off power to the 64 unit and refer to the 64GB User's Manual. PFS_ERR_NO_GBCART
See Also
|