DE
games/alis / src / Alis / fn / storenames_v6.php · commit 9c722cf
<?phpnamespace App\Alis;// Port of alis/src/storenames.c (MIT, Olivier Huguenot, Vadim Kindl): the v6 (version >= 60) store// handlers and the storenames_v6 override table.function sdirb_v6(): void{    $offset = s16(script_read16());    xwrite32(Alis::$script->vram_org + $offset, Alis::$varD7);}function sdirw_v6(): void{    $offset = script_read16() & 0xffff;    $addr = v6_tabcell(Alis::$script->vram_org + $offset, 2);    Alis::$varD7 = hread32(Alis::$acc);    Alis::$acc += 4;    xwrite32($addr, Alis::$varD7);}function sdirp_v6(): void{    $offset = script_read16() & 0xffff;    xwrite32(Alis::$basemain + $offset, Alis::$varD7);}function sdirtp_v6(): void{    $offset = script_read16() & 0xffff;    $addr = v6_tabcell(Alis::$basemain + $offset, 2);    Alis::$varD7 = hread32(Alis::$acc);    Alis::$acc += 4;    xwrite32($addr, Alis::$varD7);}function sdirtc_v6(): void{    $offset = script_read16() & 0xffff;    $ent = xread16(Alis::$script->vram_org + $offset);    $vram = xread32(Alis::$atent + $ent);    $offset2 = script_read16() & 0xffff;    if ($vram <= 0) {        return;    }    xwrite32($vram + $offset2, Alis::$varD7);}function sdirti_v6(): void{    $celloff = script_read16() & 0xffff;    $entoff = script_read16() & 0xffff;    $ent = xread16(Alis::$script->vram_org + $entoff);    $vram = xread32(Alis::$atent + $ent);    $addr = v6_tabcell(s32($vram + $celloff), 1);    Alis::$varD7 = hread32(Alis::$acc);    Alis::$acc += 4;    xwrite32($addr, Alis::$varD7);}function shimp_v6(): void{    $offset = s16(script_read16());    $ent = xread16(Alis::$script->vram_org + $offset);    $vram = xread32(Alis::$atent + $ent);    $offset2 = s16(script_read16());    mem_strcpy($vram + $offset2, Alis::$oldsd7);}function shimtp_v6(): void{    $celloff = script_read16() & 0xffff;    $entoff = script_read16() & 0xffff;    $ent = xread16(Alis::$script->vram_org + $entoff);    $vram = xread32(Alis::$atent + $ent);    $addr = tabstring(s32($vram + $celloff));    mem_strcpy($addr, Alis::$oldsd7);}function shimtc_v6(): void{    $celloff = s16(script_read16());    $entoff = script_read16() & 0xffff;    $ent = xread16(Alis::$script->vram_org + $entoff);    $vram = xread32(Alis::$atent + $ent);    $addr = v6_tabcell(s32($vram + $celloff), 0);    Alis::$varD7 = hread32(Alis::$acc);    Alis::$acc += 4;    xwrite8($addr, Alis::$varD7 & 0xff);}function shimti_v6(): void{    $celloff = script_read16() & 0xffff;    $entoff = script_read16() & 0xffff;    $ent = xread16(Alis::$script->vram_org + $entoff);    $vram = xread32(Alis::$atent + $ent);    $addr = v6_tabcell(s32($vram + $celloff), 1);    Alis::$varD7 = hread32(Alis::$acc);    Alis::$acc += 4;    xwrite32($addr, Alis::$varD7);}// ============================================================================// v6.0+ store table: v6 additionally MERGES the add block into this table at 0x3c (DOS JTAB_STORES// @0x56914 is one byte*2-indexed table covering 0x00..0x76), see alis_tab_storenames().// C: static const sAlisOpcode storenames_v6_ov[] — code => [callable, name]function table_storenames_v6_ov(): array{    return [        0x12 => [sdirb_v6(...),  'sdirb_v6'],     // v6: store local long (slocl)        0x14 => [sdirw_v6(...),  'sdirw_v6'],     // v6: store loctab long        0x16 => [sdirp_v6(...),  'sdirp_v6'],     // v6: store main long        0x18 => [sdirtp_v6(...), 'sdirtp_v6'],    // v6: store maintab long        0x1a => [sdirtc_v6(...), 'sdirtc_v6'],    // v6: store maintab char        0x1c => [sdirti_v6(...), 'sdirti_v6'],    // v6: store maintab int        0x2e => [shimp_v6(...),  'shimp_v6'],     // v6: store him string        0x30 => [shimtp_v6(...), 'shimtp_v6'],    // v6: store himtab long        0x32 => [shimtc_v6(...), 'shimtc_v6'],    // v6: store himtab char        0x34 => [shimti_v6(...), 'shimti_v6'],    // v6: store himtab int    ];}