feat(bios): decode Huffman streams through ARM instructions

Implement SWI 0x13 for 4-bit and 8-bit symbols. Traverse forward-offset trees using MSB-first input words and pack symbols into complete output words. Validate visited edges, leaf widths, alignment, output lengths, and address bounds.

Add 21 regression tests with independent tree serialization and path encoding, deep/max-size trees, word-boundary refills, malformed input, partial failures, caller state, and DMA/IRQ progress. Validate 656 default and 645 core-only tests in debug and release, plus all 10 native Darwin ARM64 window smoke tests.
This commit is contained in:
0xrsydn 2026-10-05 14:14:10 +07:00
commit f0e5240d44
5 changed files with 621 additions and 11 deletions

View file

@ -1,6 +1,6 @@
//! Original, optional ARM BIOS replacement. No Nintendo firmware is included.
//! Supports interrupt waits, integer arithmetic, memory copy/fill, bit unpacking,
//! LZ77/run-length decoding, and differential filters.
//! LZ77/run-length/Huffman decoding, and differential filters.
//! This is a functional subset, not a complete boot ROM or a timing-compatible BIOS.
use std::collections::BTreeMap;
@ -9,6 +9,7 @@ mod arithmetic;
mod bit_unpack;
mod decompression;
mod differential;
mod huffman;
mod lz77;
mod run_length;
@ -125,6 +126,7 @@ pub fn image() -> Vec<u8> {
(0x10, "bit_unpack"),
(0x11, "lz_wram"),
(0x12, "lz_vram"),
(0x13, "huffman"),
(0x14, "rl_wram"),
(0x15, "rl_vram"),
(0x16, "diff8_wram"),
@ -226,6 +228,7 @@ pub fn image() -> Vec<u8> {
lz77::emit(&mut a);
run_length::emit(&mut a);
differential::emit(&mut a);
huffman::emit(&mut a);
decompression::emit_writer(&mut a);
a.label("return");