# START END CLASS NOTE (hex VRAM, END exclusive). Reviewed assembly that is not
# recoverable game C: PsyQ SDK library objects and original hand-written code.
# The SDK range is the library link region after the game objects; objects were
# identified with tools/psyq_signatures.py (PsyQ 3.x-4.x library signatures),
# and the few unmatched members inside it were inspected by hand. Data ranges
# (generated subsegments kept from the original image) are the embedded disc
# data and TMD model (asset), the libraries' data and their uninitialized
# variables (sdk; NOLOAD, so no image bytes). included NAME:
# library strings that several SDK functions share, which splat therefore
# leaves to INCLUDE_RODATA in their unit's rodata.
80010000 80018080 asset Disc file data copied ahead of the code (rodatabins disc_mode/disc_files/disc_directories, disc2_* on Disc 2; it is the only part that differs between SLUS_006.64 and SLUS_006.69): s32 -1 at 80010000 (read through mode_disc_mode_pointer and by the kernel menu), the file index of disc sectors 24-38 at 80010004 (7-byte records: 24-bit start sector, signed 32-bit size, negative for a directory and its file count; the format tools/extraction/disc_files.py reads from sector 24), zero fill with one halfword at 80018002, and the 0x7c-byte directory table of disc sector 40 (u16 first file of each directory) at 80018004
80018ce4 80018e28 included libcd_command_and_interrupt_names libcd command and interrupt names ("none", "CdlReadS" ... "NoIntr"), read by CdComstr and CdIntstr and the libcd SYS name tables (800564d0-8005656c)
80018e28 80018e38 included libcd_timeout_message libcd "CD timeout: ", read by CD_sync, CD_ready, CD_cw and CD_datasync
80018e38 80018e54 included libcd_sync_ready_format libcd "%s:(%s) Sync=%s, Ready=%s\n", read by CD_sync, CD_ready, CD_cw and CD_datasync
80018f88 80018fa0 included libgpu_tpage_format libgpu "tpage: (%d,%d,%d,%d)\n", read by libgpu_dump_tpage and libgpu_dump_draw_env
80019180 8001918c included libgpu_clear_image_name libgpu "ClearImage", read by ClearImage and ClearImage2
8001946c 8001947c included libspu_timeout_format libspu "SPU:T/O [%s]\n", read by _spu_init and _spu_FwriteByIO
80019524 80019578 handwritten Entry point: clears BSS 800592b8-8006faec, sets $sp 0x80200000/$fp/$gp (80019548, also used by the mode dispatcher to reset the stack), and a word-clear loop (80019560) with the same pre-increment form
8001c76c 8001c8dc asset PlayStation TMD model model_slot_ring_tmd embedded in .text (0x170 bytes), not effect-VM bytecode: header id 0x41, flags 0 (table offsets count from the object entry) and one object; the 0x1c-byte object entry at 8001c778 gives the primitive table (8 at +0x1c), vertex table (6 SVECTOR at +0xcc), normal table (13 at +0xfc) and scale 3; each primitive is olen (GPU packet words), ilen (data words), flag and mode bytes then ilen words: here 2 flat and 6 Gouraud unlit triangles (mode 0x21/0x31, flag 1) with their colours and vertex indices. Read only by the battle overlay for the slot-highlight ring (src/decomp/include/battle/highlight.h): battle_slot_ring_create sizes and builds its packets (battle_tmd_get_object object entry, battle_tmd_get_packet_size packet bytes, battle_tmd_build_packets packet builder) and battle_slot_ring_draw draws it (battle_tmd_draw_object); battle/effect_script.h calls the format an effect script file
80026f44 8002709c handwritten GTE colour scaling and blending loops over 15-bit pixels (mtc2/gpf, addi/add)
8002e010 8003014c handwritten GTE model primitive renderers (rtpt/nclip/avsz3 loops): no frame, $s registers saved below $sp, several entry points per routine selecting the packet size and code, and branches between routines into shared loop bodies and the common exit at 8002e1f4
80030750 80030a30 handwritten environment-mapped GTE renderer (texture coordinates from rotated vertex normals) and its patcher 80030988, which rewrites shift and offset fields of instructions inside 80030750 (self-modifying code); saves below $sp, add/sub pseudo-ops, exits through 8002e1f4
800315a0 80031894 handwritten ordering-table link helpers: $t0 and $at macro expansions of 32-bit and/or immediates
80032e88 80032f54 handwritten packed-data (LZSS) decoder and its allocate-and-decode entry, which branches into it; leaf code in $t registers
800379b4 800379d0 handwritten store to mode_arena_task through $t0 and the default report output, a tail jump to 8003700c
8003f738 8003f8e8 handwritten rotation matrix from the sin/cos table rcossin_tbl and the table sin/cos lookups; $t registers, neg/add/sub pseudo-ops
8003f8e8 8004eaa0 sdk PsyQ libc/libc2/libapi/libcd/libds/libgpu/libgte/libetc/libspu/libcard/libsn; ends with LIBCARD END.OBJ, whose .text holds the three words _ExitCard copies into the kernel and its end label (8004ea88-8004eaa0, signature labels text_68/text_74)
8004eabc 8004f2bc asset Packed boot logo in main.c's data (INCLUDE_ASSET from the user's image): unpacked size word, then the LZSS stream of a 6209-byte 16-colour TIM; decoded by 80032e88 (tools/analysis/packed.py decode_block) and shown by 80019d48
8004fbd8 8004fcc0 asset Packed image in sprite.c's data (INCLUDE_ASSET): unpacked size (664 bytes) and LZSS stream, decoded by 80032e88 and uploaded by 8001fab4
800501d0 800501e6 asset Font glyph text_special_glyph_rows in text_windows_and_pads.c's data (INCLUDE_ASSET), the glyph of character pair 0xFF 0xFF: eleven u16 rows of 12 pixels (bits 7-0, then 15-12), the 22-byte glyph format of the font block installed by 80033558; drawn by 80034ffc, which takes it in place of a font glyph (a ring with an X inside)
80050240 80050594 asset Packed built-in console font in console_and_sound_driver.c's data (INCLUDE_ASSET): unpacked size and LZSS stream decoded by 80032e88 for the debug console (800374e8)
80050910 800509b0 asset Built-in error sound in sound.c's data (INCLUDE_ASSET): a "seds" effect bank used in place as SoundBank id 0x7f04 (0x30 bytes) and its "wds " wave bank with ADPCM samples (0x70 bytes), played by 8003f6b0
800563f0 80059170 sdk PsyQ library .data in the libraries' link order, each block referenced only from the SDK range above: libc2 SPRINTF (800563f0), libapi COUNTER/PAD, libcd SYS/BIOS (command names and state, 80056420-800567c0), libc2 CTYPE (_ctype table 800567c0), libcd CDREAD, libgpu SYS (80056888-800569f0), libgte MSC00/MSC01 (square root table)/MSC02/MTX_006 (matrix stack)/RATAN (arctangent table 80057030), libetc VSYNC/INTR/INTR_VB/INTR_DMA/VMODE (8005783c-8005899c), libspu S_INI/SPU/S_M_INIT/S_CRWA and the reverb tables of S_SRMT (80058e70, 80058ec0-80059168); 80059168-80059170 is unreferenced
800593a4 80059404 sdk PsyQ library small statics in the BSS (generated psyq_sbss, NOLOAD), after the game units' own: libapi's controller patch state of _patch_pad, EnablePAD, DesablePAD, _send_pad, _SendPAD and _remove_ChgclrPAD (800593a4-800593d4), libgte's _patch_gte and libcard's _patch_card, _patch_card2, StopCARD and _ExitCard (800593d4-80059404)
8005a1fc 8005a39c sdk PsyQ library statics in the BSS (generated psyq_bss, NOLOAD), after the game units' larger ones: libc rand/srand (8005a1fc), libapi SetPatchPad/RemovePatchPad (8005a200-8005a210), libcd CD_cw/CD_sync/CD_ready/CD_datasync/getintr/callback (8005a210-8005a234), libc putchar (8005a234), libgpu _clr/_ctl/_getctl/_reset (8005a238-8005a37c), libgpu OpenTIM/ReadTIM/OpenTMD/ReadTMD (8005a37c-8005a39c)
8005a4c8 8005a4dc sdk PsyQ libspu commons the linker placed among the game's (generated psyq_spu_commons, NOLOAD), read by _spu_init
80062640 80062648 sdk PsyQ libds commons among the game's (generated psyq_ds_commons, NOLOAD): the callbacks DsSyncCallback and DsReadyCallback install
8006be34 8006d634 sdk PsyQ libgpu commons among the game's (generated psyq_gpu_commons, NOLOAD): the command queue of _addque2, _exeque and _reset; nothing addresses its end
