Skip to content

ApolloLib in toolchain/apollolib/, with its known bugs - #19

Merged
WDrijver merged 4 commits into
mainfrom
content-apollolib
Nov 4, 2026
Merged

WDrijver merged 4 commits into
mainfrom
content-apollolib

Conversation

@WDrijver

@WDrijver WDrijver commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Describes ApolloLib in AKB. Stacked on #18: its links point to core/saga-registers/ and the library best practice. When #18 is merged, this PR moves to main by itself.

Source: ApolloCrossDev Projects/ApolloLib at commit 639e195 (2026-11-04). That is after the merge of the two versions (ApolloCrossDev #16), the warning fixes (#17) and the bug fixes found while writing this PR (#18). The copy in ApolloClaude docs/toolchain/_ApolloLib is stale and not used: AKB is the evolution of ApolloClaude.

New files (draft, ai-assisted, basis source-code, owner WDrijver)

File Content
toolchain/apollolib/index.md What ApolloLib is, how a project compiles it in, files, areas, return codes, the header mismatch
toolchain/apollolib/sound.md struct ApolloSound, load/play/stop/volume/fade, the older channel API
toolchain/apollolib/picture.md struct ApolloPicture, BMP/DDS loading, ApolloShowPicture and its modes, PIP on/off, the 32x32 pointer
toolchain/apollolib/input.md Mouse (with pointer), USB joypad, keyboard (OS-takeover)
toolchain/apollolib/memory-and-blit.md Copy, fill, endian swap and alpha-blit routines, with chunk sizes and remainders
toolchain/apollolib/system-and-timing.md ApolloWaitVBL, ApolloCPUTick/Delay, ApolloTimer, the takeover helpers and how to restore at exit
toolchain/apollolib/debug.md Serial debug output, the AD/ADX and Debug_* macro sets
toolchain/pitfalls/apollolib-known-bugs.md Everything reading the code found

Bugs found and fixed

Reading the code found bugs, and ApolloCrossDev #18 fixed them:

  • ApolloShowPicture: the 320-pixel modes fell through into the 480 case, and the 8-bit palette was converted twice.
  • ApolloTimer: its VBlank server was never removed. New: ApolloTimerStop.
  • Takeover: no way back. New: ApolloRelease, ApolloPermit, ApolloEnable.
  • ApolloCPUDelay: assumed 92 MHz, and its overflow check couldn't work.
  • Endian swap: the long-buffer swap reversed words, not bytes.
  • Sound: always played 16-bit stereo, and ApolloPlayFile applied its offset twice.
  • Mouse: the "middle button" was the wheel counter.
  • Smaller: file handles leaked on errors, the BMP palette offset was fixed at 54, the header declared the wrong PiP functions.

toolchain/pitfalls/apollolib-known-bugs.md lists what was fixed in 639e195 and the limits that remain:

  • 8-bit stereo can't play, and 8-bit WAV samples aren't converted to signed;
  • the free-channel search starts at channel 1;
  • the unexplained - 32 sample pairs in ApolloPlay/ApolloPlayFile.

None of the fixes is tested on V4 hardware yet.

Other changes

  • toolchain/index.md: lists ApolloLib.
  • toolchain/project-makefile.md: links to the new folder.
  • core/best-practices/prefer-library-calls-for-saga-chips.md: links to the new folder and its known bugs.
  • .github/CODEOWNERS: regenerated.

Knowledge base files relied on

🤖 Generated with Claude Code

Describe ApolloLib (ApolloCrossDev Projects/ApolloLib, commit ce1fcbf,
after the merge of the two versions in ApolloCrossDev #16 and #17): how a
project uses it, sound on Arne, pictures, PIP and the pointer, input,
memory and blit routines, system and timing, and the serial debug output.
toolchain/pitfalls/apollolib-known-bugs.md lists what reading the code
found, among them the 320-pixel fall-through in ApolloShowPicture, the
VBlank server of ApolloTimer that is never removed, and the takeover
helpers without restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver
WDrijver requested a review from TuKo1982 as a code owner November 4, 2026 14:12
WDrijver and others added 2 commits November 4, 2026 17:27
…Dev #18

ApolloCrossDev #18 fixed the bugs listed in apollolib-known-bugs.md and
added ApolloTimerStop, ApolloRelease, ApolloPermit and ApolloEnable.
Describe that version: the pitfall now lists what was fixed and the limits
that remain; sound, picture, input, memory and system files follow the
fixes, and the restore table names the new functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WDrijver added a commit that referenced this pull request Nov 4, 2026
ApolloCrossDev #19 made ApolloShowPiP1/2 load the 8-bit palette and fixed
the SAGAPiP example. The example page now calls ApolloShowPiP1 without its
own palette loop, and its "full example" section lists what #19 changed.
The PIP palette moves from the remaining limits to the fixed bugs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver
WDrijver deleted the branch intake-saga-registers November 4, 2026 15:00
@WDrijver WDrijver closed this Nov 4, 2026
@WDrijver WDrijver reopened this Nov 4, 2026
@WDrijver
WDrijver changed the base branch from intake-saga-registers to main November 4, 2026 15:40
@WDrijver
WDrijver merged commit 477727f into main Nov 4, 2026
2 checks passed
@WDrijver
WDrijver deleted the content-apollolib branch November 4, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant