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

## osReadHost

Syntax

    #include <ultra64.h>
        void osReadHost(void *vAddr, s32 nbytes);
        void osWriteHost(void *vAddr, s32 nbytes);
        s32 osTestHost(void);

* The osTestHost routine is not supported.

* osAckRamromRead and osAckRamromWrite had been used to associate uhReadRamrom and uhWriteRamrom but are no longer necessary (ignored).

Explanation
These routines are used for passing data between a 64 game and the host application. They are entered in the 64 program and function in tandem with the uh** functions declared in the host application <ultrahost.h>.

The osReadHost routine passes nbytes of data sent by the host function uhWriteGame to vAddr in RDRAM.

The osWriteHost routine passes nbytes of data from vAddr in RDRAM to uhReadGame.

For proper synchronization, the number of bytes transferred should be reliably matched for the function pairs osReadHost/uhWriteGame and osWriteHost/uhReadGame.

When both sides have correctly made the corresponding procedure call, the transfer will take place and the blocking side will proceed.
If the read is attempted from the game side before the host has executed the write, the game thread will block. Conversely, if the write is attempted from the host side before the game has executed a read, the host process will block.

Arguments

- vAddr is the pointer to the DRAM virtual address; it should be 8-byte (64-bit) aligned
- nbytes is the transfer size; due to a host restriction, it must be a multiple of 4

If data sent from a host program on an Intel machine is used by the 64 program, or conversely, if data sent by the 64 program is used by a host program on an Intel machine, caution should be used to avoid endian errors.

Items to note

- These routines use features of the 64 development environment, so the debug library must always be linked at compile time ( -l**_d ).

- Restrictions with PARTNER:
  The PTN64 definition should be added as a compile option in the makefile (-DPTN64).

- Before using these routines with the PC version of PARTNER, osCreateViManager must be executed. This is required so that the timer can be used by the functions internally.

See uhOpenGame for an example that shows how to correctly initiate and use a connection from the host.
See Also
osWriteHost
uhOpenGame
uhCloseGame
uhReadGame
uhWriteGame

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