From c80610747a09dfc6359e98aec97c7bf7d03e9b5a Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 25 Jun 2026 03:23:34 -0500 Subject: [PATCH] Migrating from ORCA/C to Clang for the IIgs. --- AGI-SESSION-HANDOFF.md | 9 ++++----- agi.c | 3 --- agiObj.c | 1 - agiPic.c | 3 +-- agiRes.c | 5 ++--- agiText.c | 1 - agiView.c | 2 -- agiVm.c | 1 - 8 files changed, 7 insertions(+), 18 deletions(-) diff --git a/AGI-SESSION-HANDOFF.md b/AGI-SESSION-HANDOFF.md index b2d4485..28bb0c6 100644 --- a/AGI-SESSION-HANDOFF.md +++ b/AGI-SESSION-HANDOFF.md @@ -189,7 +189,7 @@ The user should pick which to prioritize. The repo's auto-memory at `~/.claude/projects/-home-scott-claude-joeylib/memory/` includes -JoeyLib-wide context (CMake quirks, ORCA-C gotchas, perf +JoeyLib-wide context (CMake quirks, IIgs toolchain gotchas, perf constraints) plus `project_joeylib_agi_plan.md` which describes the overall AGI port plan. All persist into the next session automatically; no need to reload. @@ -197,9 +197,8 @@ automatically; no need to reload. Specifically relevant to the AGI port: - `project_joeylib_agi_plan.md` — overall plan, 3-4 month estimate -- `feedback_orca_c_atoi_segment.md` — don't use atoi in AGI code - (it pushes the IIgs ORCA-C stdio cluster past 64 KB; we use a - manual parseArgU8 instead) +- AGI code uses a manual `parseArgU8` instead of atoi to keep the + IIgs link budget small. - `project_perf_directive.md` — IIgs is the perf floor; every other target must match or beat it - `feedback_iigs_speed.md` — IIgs must be absolute fastest @@ -213,6 +212,6 @@ Specifically relevant to the AGI port: `feedback_git.md`). - Always `source toolchains/env.sh` before any `make` -- the user has added that to .claude/settings.local.json allow list. -- DJGPP / ORCA / vasm / m68k-atari-mint paths come from env.sh. +- DJGPP / llvm-mos / vasm / m68k-atari-mint paths come from env.sh. - The user does NOT need hand-holding -- they're an expert C dev. Skip excessive explanation; describe what was done and move on. diff --git a/agi.c b/agi.c index ebd1300..51ec225 100644 --- a/agi.c +++ b/agi.c @@ -307,7 +307,6 @@ static uint32_t gAgiV11SubTickAccum; // counts AGI ticks toward next #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIMAIN"; #endif // ----- Internal helpers (alphabetical) ----- @@ -1687,7 +1686,6 @@ static void updateEgoFromInput(void) { #ifdef JOEYLIB_PLATFORM_IIGS -segment ""; #endif // ----- Entry point ----- @@ -1703,7 +1701,6 @@ int main(int argc, char **argv) { bool vmReady; cfg.codegenBytes = 0u; // no sprites needed -- backdrop-restore path is direct memcpy - cfg.maxSurfaces = 4u; // stage + backdrop (2 used) // AGI sound is software-synthesized PSG squarewaves pushed // through the Sound Blaster auto-init DMA path (see agiSynthFill // and src/port/dos/audio.c). The audio pool covers the 4 KB diff --git a/agiObj.c b/agiObj.c index 2401df9..747ac3b 100644 --- a/agiObj.c +++ b/agiObj.c @@ -24,7 +24,6 @@ #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIOBJ"; #endif diff --git a/agiPic.c b/agiPic.c index 518ca3c..9da1796 100644 --- a/agiPic.c +++ b/agiPic.c @@ -81,7 +81,6 @@ static void plot(AgiPicT *pic, const PicStateT *state, int16_t x, int16_t y) #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIPIC"; #endif // ----- Internal helpers (alphabetical) ----- @@ -122,7 +121,7 @@ static void drawCorner(AgiPicT *pic, const PicStateT *state, const uint8_t *data // the minor axis is linearly interpolated with round-half-away-from- // zero. All math stays in 16-bit -- AGI coordinates are 8-bit so the // worst product (dy * i = 167 * 167 = 27889) fits in int16, and the -// 65816 build avoids ORCA-C's long-arithmetic helpers entirely. +// 65816 build avoids long-arithmetic helpers entirely. static void drawLine(AgiPicT *pic, const PicStateT *state, int16_t x0, int16_t y0, int16_t x1, int16_t y1) { int16_t dx; int16_t dy; diff --git a/agiRes.c b/agiRes.c index 78ac34b..ab9fe32 100644 --- a/agiRes.c +++ b/agiRes.c @@ -48,9 +48,8 @@ // IIgs 64 KB code-bank rule: park this TU in its own load segment // so it doesn't pile onto _ROOT (which still holds main() and the -// ORCA-C startup). Cross-platform builds ignore this pragma. +// runtime startup). Cross-platform builds ignore this pragma. #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIRES"; #endif @@ -154,7 +153,7 @@ static bool loadDirectory(AgiGameT *game, AgiResTypeE type, const char *gameDir, } volNibble = (uint8_t)(buf[0] >> 4); - // 20-bit offset, cast to uint32_t before shift so ORCA-C's + // 20-bit offset, cast to uint32_t before shift so a // 16-bit int doesn't truncate the (& 0x0F) << 16 term. offset = ((uint32_t)(buf[0] & 0x0F) << 16) | ((uint32_t)buf[1] << 8) | (uint32_t)buf[2]; diff --git a/agiText.c b/agiText.c index 8621cc5..80bdc97 100644 --- a/agiText.c +++ b/agiText.c @@ -23,7 +23,6 @@ #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGITXT"; #endif diff --git a/agiView.c b/agiView.c index 31cee78..f81513f 100644 --- a/agiView.c +++ b/agiView.c @@ -40,7 +40,6 @@ #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIVIEW"; #endif @@ -143,7 +142,6 @@ uint8_t agiActorPriorityForY(int16_t y) { #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIDRAW"; #endif void agiViewDraw(const AgiViewT *view, uint8_t loopIdx, uint8_t celIdx, diff --git a/agiVm.c b/agiVm.c index 5a4fe1e..c51cf19 100644 --- a/agiVm.c +++ b/agiVm.c @@ -273,7 +273,6 @@ #ifdef JOEYLIB_PLATFORM_IIGS -segment "AGIVM"; #endif