The ALIS scripting language

Silmarils' games (Robinson's Requiem, Ishar, Transarctica, Targhan…) are programs for a virtual machine, ALIS: each .io file of a game is a compiled script (byte code, the variables it reserves, its pictures, sounds and 3D models). This port of the machine to PHP comes with a decompiler and a compiler: every script becomes a text in the ALIS source language, and the engine compiles that text back when it loads the script.

Silmarils' own sources were never published, so the syntax is a reconstruction: the names of the instructions and expression items are the machine's own (cput, cscmov, oimmb, oadd…), and the structures follow the habits of the original compiler, read from the byte code (one pass, left-to-right expressions, the same code for every if … else and while). The 109 scripts of Robinson's Requiem (46,886 lines) compile back byte for byte, and the game started from the sources shows exactly the same pictures as the original.

L0049:
    putnat 108, 0, 137, 5 + vb[0x52], 1
    if vw[0x54] {
        call L010d
    }
    table inkey(), -187
        goto L00b0
        goto L00bf
    end

The full guide is in French: le langage ALIS, l'éditeur. Below: every instruction of the machine and its operands.

Reference

La documentation technique de la machine décrit, pour chaque instruction, ce que l'exécutable d'origine en fait.

Instructions

CodeInstructionOpérandes
0x00cnulnul
0x01cesc1esc1 (voir les échappements)
0x02cesc2esc2 octet
0x03cesc3esc3 octet
0x04cbreakptbreakpt
0x05cjsr8call étiquette
0x06cjsr16call étiquette
0x07cjsr24call étiquette
0x08cjmp8goto étiquette
0x09cjmp16goto étiquette
0x0acjmp24goto étiquette

Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 24 Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 23 Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 24 Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 24 Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 23 Warning: Uninitialized string offset 0 in /workspace/games/alis/tools/lang/reference.php on line 23

0x0bcjsrabsjsrabs
0x0dcjsrind16jsrind16
0x0ecjsrind24jsrind24
0x0fcjmpind16jmpind16
0x10cjmpind24jmpind24
0x11cretret
0x12cbz8ifz goto étiquette, ou ifnot expr goto étiquette
0x13cbz16ifz goto étiquette, ou ifnot expr goto étiquette
0x14cbz24ifz goto étiquette, ou ifnot expr goto étiquette
0x15cbnz8ifnz goto étiquette, ou if expr goto étiquette
0x16cbnz16ifnz goto étiquette, ou if expr goto étiquette
0x17cbnz24ifnz goto étiquette, ou if expr goto étiquette
0x18cbeq8ifeq goto étiquette
0x19cbeq16ifeq goto étiquette
0x1acbeq24ifeq goto étiquette
0x1bcbne8ifne goto étiquette
0x1ccbne16ifne goto étiquette
0x1dcbne24ifne goto étiquette
0x1ecstorecible = expr
0x1fcevaleval expr
0x20caddcible += expr
0x21csubcible -= expr
0x22cmulmul
0x23cdivdiv
0x24cvprintvprint expr
0x25csprintisprinti "texte"
0x26csprintasprinta expr
0x27clocatelocate expr, expr
0x28ctabtab expr
0x29cdimdim offset, compteur, taille, [valeurs]
0x2acrandomrandom expr
0x2bcloop8loop cible goto étiquette
0x2ccloop16loop cible goto étiquette
0x2dcloop24loop cible goto étiquette
0x2ecswitch1switch expr … end
0x2fcswitch2table expr, base … end
0x30cstart8start étiquette
0x31cstart16start étiquette
0x32cstart24start étiquette
0x33cleaveleave
0x34cprotectprotect expr
0x35casleepasleep expr
0x36cclockclock expr
0x37canimanim
0x38cscmovscmov expr, expr, expr
0x39cscsetscset expr, expr, expr
0x3acclippingclipping
0x3bcswitchingswitching
0x3ccwlivewlive expr, mot, cible
0x3dcunloadunload mot
0x3ecwakeupwakeup expr
0x3fcsleepsleep
0x40clivelive mot, cible
0x41ckillkill expr
0x42cstopstop
0x43cstopretstopret
0x44cexitexit
0x45cloadload id, "fichier"expr
0x46cdefscdefsc mot, octet, hex"(32 octets)"
0x47cscreenscreen mot
0x48cputput expr
0x49cputnatputnat expr, expr, expr, expr, expr
0x4aceraseerase
0x4bcerasenerasen expr
0x4ccsetset expr, expr, expr
0x4dcmovmov expr, expr, expr
0x4ecopenscopensc mot
0x4fcclosescclosesc mot
0x50cerasallerasall
0x51cformeforme expr
0x52cdelformedelforme
0x53ctstmovtstmov expr, expr, expr, expr, cible
0x54ctstsettstset
0x55cftstmovftstmov expr, expr, expr, expr, expr, cible
0x56cftstsetftstset expr, expr, expr, expr, expr, cible
0x57csuccentsuccent cible
0x58cpredentpredent cible
0x59cnearentnearent expr, expr, cible
0x5acneartypneartyp expr, mot, cible
0x5bcnearmatnearmat expr, expr, cible
0x5ccviewentviewent expr, expr, expr, cible
0x5dcviewtypviewtyp expr, expr, mot, cible
0x5ecviewmatviewmat expr, expr, expr, cible
0x5fcorientorient expr
0x60crstentrstent cible
0x61csendsend entité, valeur, …
0x62cscanonscanon
0x63cscanoffscanoff
0x64cinteroninteron
0x65cinteroffinteroff
0x66cscanclrscanclr
0x67callentityallentity
0x68cpalettepalette expr
0x69cdefcolordefcolor expr, expr
0x6actimingtiming expr
0x6bczapzap expr ×4 (×5 si la durée n'est pas la constante 0)
0x6ccexplodeexplode expr, expr, expr, expr
0x6dcdingding expr, expr, expr, expr
0x6ecnoisenoise expr, expr, expr, expr
0x6fcinitabinitab
0x70cfopenfopen z"fichier", modeexpr, expr
0x71cfclosefclose
0x72cfcreatfcreat
0x73cfdelfdel
0x74cfreadvfreadv cible
0x75cfwritevfwritev expr
0x76cfwriteifwritei
0x77cfreadbfreadb &adresse, long
0x78cfwritebfwriteb &adresse, long
0x79cplotplot expr, expr
0x7acdrawdraw expr, expr
0x7bcboxbox expr, expr
0x7ccboxfboxf expr, expr
0x7dcinkink expr
0x7ecpsetpset expr, expr
0x7fcpmovepmove expr, expr
0x80cpmodepmode expr
0x81cpicturepicture
0x82cxyscrollxyscroll expr, expr
0x83clinkinglinking expr
0x84cmousonmouson
0x85cmousoffmousoff
0x86cmousemouse cible, cible, cible
0x87cdefmousedefmouse expr
0x88csetmousesetmouse expr, expr
0x89cdefvectdefvect hex"…"
0x8acsetvectsetvect mot
0x8bcnul2nul2
0x8ccapproachapproach expr
0x8dcescapeescape expr
0x8ecvtstmovvtstmov expr, cible
0x8fcvftstmovvftstmov expr, expr, cible
0x90cvmovvmov
0x91cdefworlddefworld mot, hex"(6 octets)"
0x92cworldworld octet, octet
0x93cfindmatfindmat
0x94cfindtypfindtyp mot, cible
0x95cmusicmusic expr, expr, expr, expr, expr, expr
0x96cdelmusicdelmusic expr
0x97ccadencecadence expr
0x98csetvolumsetvolum expr
0x99cxinvxinv
0x9acxinvonxinvon
0x9bcxinvoffxinvoff
0x9cclistentlistent cible
0x9dcsoundsound expr, expr, expr, expr, expr
0x9ecmsoundmsound expr, expr, expr, expr, expr
0x9fcredonredon
0xa0credoffredoff
0xa1cdelsounddelsound
0xa2cwmovwmov expr
0xa3cwtstmovwtstmov
0xa4cwftstmovwftstmov
0xa5ctstformtstform expr, expr, cible
0xa6cxputxput expr
0xa7cxputatxputat expr, expr, expr, expr, expr
0xa8cmputmput expr
0xa9cmputatmputat expr, expr, expr, expr, expr
0xaacmxputmxput expr
0xabcmxputatmxputat expr, expr, expr, expr, expr
0xaccmmusicmmusic expr, expr, expr, expr, expr, expr
0xadcmformemforme expr
0xaecsettimesettime expr, expr, expr
0xafcgettimegettime cible, cible, cible
0xb0cvinputvinput cible
0xb1csinputsinput cible
0xb2casleepfarasleepfar expr
0xb3casleeponasleepon
0xb4casleepoffasleepoff
0xb5crunfilmrunfilm expr, cible, cible
0xb6cvpicprintvpicprint expr
0xb7cspicprintspicprint expr
0xb8cvputprintvputprint expr
0xb9csputprintsputprint expr
0xbacfontfont expr, expr, expr, expr, expr
0xbbcpaperpaper expr
0xbcctoblacktoblack expr
0xbdcmovcolormovcolor expr, expr
0xbectopalettopalet expr, expr
0xbfcnumputnumput expr, expr, expr, expr
0xc0cscheartscheart expr, expr
0xc1cscposscpos expr, expr
0xc2cscsizescsize expr, expr
0xc3cschorizschoriz expr, expr, expr
0xc4cscverticscvertic expr, expr, expr
0xc5cscreducescreduce expr, expr, expr
0xc6cscscalescscale expr
0xc7creducingreducing expr, expr
0xc8cscmapscmap expr, &adresse
0xc9cscdumpscdump
0xcacfindclafindcla expr, cible
0xcbcnearclanearcla
0xcccviewclaviewcla
0xcdcinstruinstru expr, expr, expr
0xcecminstruminstru expr, expr, expr
0xcfcordsprordspr expr
0xd0calignalign expr, expr
0xd1cbackstarbackstar expr, expr, expr, expr, expr, expr
0xd2cstarringstarring expr, expr, expr, expr, expr, expr, expr, expr
0xd3cengineengine
0xd4cautobaseautobase
0xd5cqualityquality expr
0xd6chspritehsprite expr, expr, expr, expr
0xd7cselpaletselpalet expr
0xd8clinepaletlinepalet expr, expr
0xd9cautomodeautomode
0xdacautofileautofile expr
0xdbccancelcancel
0xdcccancallcancall
0xddccancencancen expr
0xdecblastblast expr
0xdfcscbackscback expr, expr, expr, expr, expr, expr
0xe0cscrolpagescrolpage expr, expr, expr, expr
0xe1cmatentmatent cible
0xe2cshrinkshrink expr, expr
0xe3cdefmapdefmap &adresse, expr, expr, expr, expr, expr, expr, expr
0xe4csetmapsetmap &adresse, expr, expr, expr, expr, expr, expr
0xe5cputmapputmap &adresse, expr, expr, expr, expr
0xe6csavepalsavepal expr
0xe7csczoomsczoom
0xe8ctexmaptexmap &adresse, expr, expr, expr, expr, expr, expr, expr, expr, expr, expr, expr
0xe9calloctaballoctab &adresse
0xeacfreetabfreetab &adresse
0xebcscantabscantab
0xeccneartabneartab
0xedcscsunscsun
0xeecdarkpaldarkpal expr, expr, expr, expr, expr
0xefcscdarkscdark expr, expr, expr
0xf0casetaset expr, expr, expr
0xf1camovamov expr, expr, expr
0xf2cscasetscaset
0xf3cscamovscamov
0xf4cscfollowscfollow expr, expr, expr, expr, expr, expr, expr, expr
0xf5cscviewscview expr, expr, expr, expr, expr, expr
0xf6cfilmfilm expr, expr, expr, cible
0xf7cwalkmapwalkmap &adresse, expr, expr, expr, cible
0xf8catstmapatstmap &adresse, expr, expr, expr, cible
0xf9cavtstmovavtstmov expr, cible
0xfacavmovavmov
0xfbcaimaim expr, expr, expr, expr, cible, cible, cible
0xfccpointpixpointpix expr, expr, cible, cible, cible, cible, cible, cible
0xfdcchartmapchartmap &adresse, mode, (&adresse si mode = 0 ou 1expr)
0xfecscskyscsky expr, expr, expr
0xffczoomzoom expr, expr

Escapes (cesc1 + un octet)

ÉchappementInstructionOpérandes
0x01 0x00cnulesc1 nul
0x01 0x01csoundonsoundon
0x01 0x02csoundoffsoundoff
0x01 0x03cmusiconmusicon
0x01 0x04cmusicoffmusicoff
0x01 0x05cdelfilmdelfilm
0x01 0x06copenfilmopenfilm expr, expr, expr, expr, cible

Expression items (opernames)

Les cibles d'affectation (storenames, addnames) suivent la même table avec s… / a… au lieu de o….

CodeÉlémentÉcriture
0x00oimmbnombre de -128 à 127
0x02oimmwnombre de -32768 à 32767
0x04oimmp"texte"
0x06olocbvb[offset] (autres offsets)
0x08olocwvw[offset] (autres offsets)
0x0aolocpvs[offset] (autres offsets)
0x0coloctpts[offset](index…) (autres offsets)
0x0eoloctctb[offset](index…) (autres offsets)
0x10oloctitw[offset](index…) (autres offsets)
0x12odirbvb[offset] (offset 0 à 255)
0x14odirwvw[offset] (offset 0 à 255)
0x16odirpvs[offset] (offset 0 à 255)
0x18odirtpts[offset](index…) (offset 0 à 255)
0x1aodirtctb[offset](index…) (offset 0 à 255)
0x1codirtitw[offset](index…) (offset 0 à 255)
0x1eomainbmb[offset]
0x20omainwmw[offset]
0x22omainpms[offset]
0x24omaintpmts[offset](index…)
0x26omaintcmtb[offset](index…)
0x28omaintimtw[offset](index…)
0x2aohimbhb[var, offset]
0x2cohimwhw[var, offset]
0x2eohimphs[var, offset]
0x30ohimtphimtp(…)
0x32ohimtchimtc(…)
0x34ohimtihimti(…)
0x36opilepile(…)
0x38oeval( … )
0x3aofinfin(…)
0x3coimmlautre nombre
0x3eoloctoto[offset](index…) (autres offsets)
0x40opushaccpush(…)
0x42oanda & b
0x44oora `` b
0x46oxora ^ b
0x48oeqva eqv b
0x4aoegala == b
0x4codiffa != b
0x4eoinfega <= b
0x50osupega >= b
0x52oinfa < b
0x54osupa > b
0x56oadda + b
0x58osuba - b
0x5aomoda % b
0x5codiva / b
0x5eomula * b
0x60onegneg(…)
0x62oabsabs(…)
0x64orndrnd(…)
0x66osgnsgn(…)
0x68onotnot(…)
0x6aoinkeyinkey(…)
0x6cokeyonkeyon(…)
0x6eojoyjoy(…)
0x70oprndprnd(…)
0x72oscanscan(…)
0x74oshiftkeyshiftkey(…)
0x76ofreefree(…)
0x78omodelmodel(…)
0x7aogetkeygetkey(…)
0x7coleftleft(…)
0x7eorightright(…)
0x80omidmid(…)
0x82olenlen(…)
0x84oascasc(…)
0x86ostrstr(…)
0x88osadda $+ b
0x8aosequala $== b
0x8cosdiffa $!= b
0x8eosinfega $<= b
0x90ossupega $>= b
0x92osinfa $< b
0x94ossupa $> b
0x96ospushaccspush(…)
0x98ospilespile(…)
0x9aovalval(…)
0x9coexistfexistf(…)
0x9eochrchr(…)
0xa0ochangechange(…)
0xa2ocountrycountry(…)
0xa4omipmip(…)
0xa6ojoykeyjoykey(…)
0xa8oconfigconfig(…)
0xaaogettextgettext(…)
0xacoipsips(…)

▶ Play