#include "game_types.h"

/* Object_Reset @ 0x08019DA4 (real 92B) -- SVC-driven descending table init. Mirrors src/matched/Object_Reset.c. */
/* Runs SVC 0xAB service 1 twice over a 3-word arg block, publishes the
   first result at 0x0200150C, fills table 0x02001510 top-down in steps of 8
   with (0x08CA03A0 - 2), then links the table head. Stores reusing
   SVC-clobbered registers follow the observed flow; see the matched twin. */
extern int SWI_AB(int service, void *arg); /* swi #0xab */

void Object_Reset(void)
{
    int stk[3];
    int r, i;
    int *tab = (int *)0x02001510;
    stk[0] = 0x08CA03A0;
    stk[1] = 0;
    stk[2] = 3;
    r = SWI_AB(1, stk);
    *(int *)0x0200150C = r;
    stk[1] = 4;
    for (i = 152; i >= 0; i -= 8)
        tab[i / 4] = 0x08CA03A0 - 2;
    tab[0] = *(int *)0x0200150C;
    tab[1] = 0;
    tab[2] = r;
    tab[3] = 0;
    SWI_AB(1, stk);
}
