This is an old revision of the document!
Table of Contents
BIOS Functions
The Loopy's built-in ROM provides code for common operations such as drawing graphics, playing music, and operating the printer.
This page is intended to list and categorize these functions with brief descriptions. Workflows like adding music and graphics to your homebrew game will be their own separate pages.
This google sheet was adapted as the starting point.
Uncategorized
TODO categorize these
BiosDefaultInterrupt
Offset: 0x0604
void BiosDefaultInterrupt(void)
Default interrupt handler, turns off printer? and halts
BiosVdpMode
Offset: 0x0668
void BiosVdpMode(uchar controllerScanMode, uchar videoHeight240)
Sets VDP controller scanning mode and video height
controllerScanMode: bitfield, 1=mouse, 2=gamepad
BiosGetSealType
Offset: 0x115C
uint BiosGetSealType(void)
Detect inserted seal cartridge type from sense switches
BiosDecompress4bit
Offset: 0x437C
??? BiosDecompress4bit(void* decompressInfo, void* output)
Decompresses 4-bit graphical data, algo unknown
BiosInitSoundTransmission
Offset: 0x613C
void BiosInitSoundTransmission(void)
Initializes sound timer and serial port
BiosPlayBgm
Offset: 0x61A0
void BiosPlayBgm(void* soundState, uchar unk, ushort trackIndex, void** trackList)
Play a music track from a list
BiosPlaySfx
Offset: 0x61B8
void BiosPlaySfx(void* soundState, uchar unk, ushort sfxIndex, void** sfxList)
Play a sound effect from a list
BiosUpdateBgm
Offset: 0x6238
void BiosUpdateBgm(void* soundState, uint unk)
Update music playback (call on timer0 interrupt)
Unk param might be maximum data transfer size
BiosDma
Offset: 0x66D0
void BiosDma(void* dmaList, int hwChannel)
Trigger a chain of DMA transfers
BiosVsyncIfDma
Offset: 0x6A0E
void BiosVsyncIfDma(void* dmaList)
Only vsyncs if the DMA list is valid
BiosVsyncDma
Offset: 0x6A48
void BiosVsyncDma(void* dmaList)
Calls BiosVsync and BiosDma(param, 3)
BiosVsync
Offset: 0x6A5A
void BiosVsync(void)
Wait for vsync, read controller register to memory
BiosSoundChannels
Offset: 0x6AC0
void BiosSoundChannels(uint channelMode)
Sets sound channel configuration
mode 0: 4ch, 1: 3ch + rhythm, 2: 3ch, others: 1ch
BiosSoundVolume
Offset: 0x6B50
void BiosSoundVolume(uint vol23, uint vol4)
Sets sound channel volume control
volume for ch2/3 and ch4; 0: -4dB, 1: -2dB, 2: 0dB. ch1 always 0dB.
BiosSoundDemo
Offset: 0x6B86
void BiosSoundDemo(void)
Toggles built-in demo music
BiosUnknownDecomp?
Offset: 0x7D96
??? BiosUnknownDecomp?(???)
Some kind of decompression function
Interrupt Handlers
BiosAutoUpdateBgm
Offset: 0x648C
void BiosAutoUpdateBgm(void)
Auto call BiosUpdateBgm with pointer at biosAutoSoundState
Use as alternative to creating your own interrupt handler.
Math Functions
BiosColorInverseGray
Offset: 0x2D68
ushort BiosColorInverseGray(ushort color)
Compute 5bit grayscale from inverse of 15bit RGB
Unknown why it's the inverse. Preserves MSB.
BiosValueBlendQuarter
Offset: 0x2DC6
uchar BiosValueBlendQuarter(uchar valueA, uchar valueB)
Blend 3/4 of value A with 1/4 of value B (bytes)
BiosColorBlendQuarter
Offset: 0x2DE0
ushort BiosColorBlendQuarter(ushort colorA, ushort colorB)
Blend 3/4 of color A with 1/4 of color B
BiosMulS16
Offset: 0x2E68
int BiosMulS16(short a, short b)
Signed 16bit multiply, 32bit result
BiosMulU16
Offset: 0x2E72
uint BiosMulU16(ushort a, ushort b)
Unsigned 16bit multiply, 32bit result
BiosDivU16
Offset: 0x2E7C
ushort BiosDivU16(ushort a, ushort b)
Unsigned 16bit divide, 16bit result
BiosDivS16
Offset: 0x2EA6
short BiosDivS16(short a, short b)
Signed 16bit divide, 16bit result
BiosDivS32
Offset: 0x2EDE
int BiosDivS32(int a, int b)
Signed 32bit divide, 32bit result
Graphics
BiosPlotLines
Offset: 0x37A0
void BiosPlotLines(short data[], uchar colors[], uchar buf[], short bufW, short bufH, bool bufFmt)
Plots a set of colored vertices joined by lines
BiosPlotPolygons?
Offset: 0x39AC
??? BiosPlotPolygons?(???)
Plots polygons?
Internal Use
_B_PrintOp1
Offset: 0x06D4
??? _B_PrintOp1(???)
Print operation
_B_PlotPointInBuffer
Offset: 0x394E
??? _B_PlotPointInBuffer(???)
Plots a point following some rules
_B_PlotPointSpecial
Offset: 0x3C76
??? _B_PlotPointSpecial(???)
Plots a 4bpp point with some special modes?
_B_PlayBgmPointer
Offset: 0x61D8
void _B_PlayBgmPointer(void* soundState, uchar unk, void* track, void** trackList)
Play a music track by pointer
_B_PlaySfxPointer
Offset: 0x6374
void _B_PlaySfxPointer(void* soundState, uchar unk, void* sfx)
Play a sound effect by pointer
Not yet analyzed
- 0x069C
- 0x0FD6
- 0x101C
- 0x1064
- 0x10AC
- 0x10F4
- 0x1140
- 0x1174
- 0x1198
- 0x1248
- 0x128E
- 0x134C
- 0x13B0
- 0x1408
- 0x1464
- 0x157E
- 0x15D4
- 0x15F2
- 0x15FE
- 0x162C
- 0x1652
- 0x1662
- 0x1690
- 0x17F4
- 0x19BC
- 0x1A0C
- 0x1B76
- 0x1B9C
- 0x1C04
- 0x1C2C
- 0x1CA0
- 0x1CF4
- 0x1DDE
- 0x1E1C
- 0x1F5E
- 0x2038
- 0x20EC
- 0x212E
- 0x2148
- 0x2382
- 0x2598
- 0x2798
- 0x2A24
- 0x2AD0
- 0x2B0E
- 0x2B48
- 0x2F74
- 0x3088
- 0x3560
- 0x35E6
- 0x36BA
- 0x3736
- 0x3E64
- 0x3E9C
- 0x3EF0
- 0x3F48
- 0x3FD8
- 0x40DC
- 0x4186
- 0x429C
- 0x436A
- 0x445C
- 0x452C
- 0x4640
- 0x47A4
- 0x49A4
- 0x4B20
- 0x4BA8
- 0x4C38
- 0x4CDE
- 0x4D22
- 0x4E34
- 0x4FE4
- 0x5060
- 0x5098
- 0x5138
- 0x51C8
- 0x542E
- 0x544C
- 0x5474
- 0x54B8
- 0x5574
- 0x55B8
- 0x55FC