N64® Functions Menu
|
al - Audio Library Functions
etc - String Manipulation 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
|
|
LeoByteToLBA
LeoLBAToByte
Syntax
#include <leo.h>
s32 LeoByteToLBA(s32 startlba, u32 nbytes, s32 *lbas);
s32 LeoLBAToByte(s32 startlba, u32 nlbas, s32 *bytes);
Explanation
They convert between a logical block address (LBA) and a physical byte address. The size of one block is different from other blocks for the N64 Disk Drive, so
you need to make a conversion by calling these functions. To learn more about block size, LBAs, and disk types, see the "Hardware Specifications" section of the N64 Disk Drive Programmer's Guide
Caution
The LeoByteToLBA and LeoLBAToByte functions makes expedient use of Leo Manager�s internal variables. As a result, LBA calculations depend on the disk type. If the disk is swapped with another disk of a different type immediately before you call the LeoByteToLBA or LeoLBAToByte function, the resulting LBA size will not be correct for the for the currently inserted disk. You need to exercise caution because a DISK_MAY_HAVE_CHANGED error is not returned by these functions. Therefore, if you use a calculated value for a disk read, write, or seek operation and a DISK_MAY_HAVE_CHANGED error is returned, plan to re-run your code from the LBA-to-byte conversion to make sure you have the correct value. For more detailed information on this, see the "Error-Handling Sequences" section of your N64 Disk Drive Programmer's Guide.
The LeoByteToLBA function converts from a byte size into an LBA size. It calculates the number of LBAs in the nbytes from the start of the block specified by startlba and returns this to the location pointed to by the lbas argument.
The LeoLBAToByte function converts from an LBA size into a byte size. It calculates the number of bytes in the nlbas blocks from the start of the block specified by startlba and returns this to the location pointed to by the bytes argument.
The returned values are:
- -1 means Leo Manager has not started. The conversion refers to
the current disk type that is in use, therefore, make
sure these functions are called after starting Leo Manager.
- LEO_ERROR_LBA_OUT_OF_RANGE means the specified LBA or resulting LBA is out of range.
- LEO_ERROR_GOOD means normal execution occurred.
See Also
Leo
byte2lba
lba2byte
LeoCreateLeoManager
LeoCACreateLeoManager
LeoCJCreateLeoManager
LeoReadWrite
LeoSeek
LeoSpdlMotor
LeoInquiry
LeoTestUnitReady
LeoRezero
LeoClearQueue
LeoReadDiskID
LeoReadCapacity
LeoModeSelect
|
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 April, 1999
|
|