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