diff options
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/console.cpp | 36 | ||||
-rw-r--r-- | engines/dreamweb/console.h | 46 | ||||
-rw-r--r-- | engines/dreamweb/detection.cpp | 124 | ||||
-rw-r--r-- | engines/dreamweb/detection_tables.h | 69 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 22792 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 648 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 1101 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 147 | ||||
-rw-r--r-- | engines/dreamweb/module.mk | 15 | ||||
-rw-r--r-- | engines/dreamweb/runtime.h | 511 |
10 files changed, 25489 insertions, 0 deletions
diff --git a/engines/dreamweb/console.cpp b/engines/dreamweb/console.cpp new file mode 100644 index 0000000000..e004746d8a --- /dev/null +++ b/engines/dreamweb/console.cpp @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/console.cpp $ + * $Id: console.cpp 70 2011-01-26 05:36:55Z digitall $ + * + */ + +#include "dreamweb/console.h" + +namespace DreamWeb { + +DreamWebConsole::DreamWebConsole(DreamWebEngine *vm) : GUI::Debugger(), _vm(vm) { +} + +DreamWebConsole::~DreamWebConsole() { +} + +} // End of namespace DreamWeb diff --git a/engines/dreamweb/console.h b/engines/dreamweb/console.h new file mode 100644 index 0000000000..58c8467b34 --- /dev/null +++ b/engines/dreamweb/console.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/console.h $ + * $Id: console.h 70 2011-01-26 05:36:55Z digitall $ + * + */ + +#ifndef DREAMWEB_CONSOLE_H +#define DREAMWEB_CONSOLE_H + +#include "gui/debugger.h" + +namespace DreamWeb { + +class DreamWebEngine; + +class DreamWebConsole : public GUI::Debugger { +public: + DreamWebConsole(DreamWebEngine *vm); + virtual ~DreamWebConsole(void); + +private: + DreamWebEngine *_vm; +}; + +} // End of namespace DreamWeb + +#endif diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp new file mode 100644 index 0000000000..10f727f02e --- /dev/null +++ b/engines/dreamweb/detection.cpp @@ -0,0 +1,124 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/detection.cpp $ + * $Id: detection.cpp 3 2010-09-16 19:32:18Z megath $ + * + */ + +#include "base/plugins.h" + +#include "engines/advancedDetector.h" +#include "common/system.h" + +#include "dreamweb/dreamweb.h" + +namespace DreamWeb { + +struct DreamWebGameDescription { + ADGameDescription desc; +}; + +} // End of namespace DreamWeb + +static const PlainGameDescriptor dreamWebGames[] = { + { "dreamweb", "DreamWeb" }, + { 0, 0 } +}; + +#include "dreamweb/detection_tables.h" + +class DreamWebMetaEngine : public AdvancedMetaEngine { +public: + DreamWebMetaEngine(): + AdvancedMetaEngine(DreamWeb::gameDescriptions, + sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames) { + _singleid = "dreamweb"; + _guioptions = Common::GUIO_NOMIDI; + } + + virtual const char *getName() const { + return "DreamWeb engine"; + } + + virtual const char *getOriginalCopyright() const { + return "DreamWeb (C) Creative Reality"; + } + + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual bool hasFeature(MetaEngineFeature f) const; + virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + virtual void removeSaveState(const char *target, int slot) const; +}; + +bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; +} + +bool DreamWeb::DreamWebEngine::hasFeature(EngineFeature f) const { + return false; +} + +bool DreamWebMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const DreamWeb::DreamWebGameDescription *gd = (const DreamWeb::DreamWebGameDescription *)desc; + if (gd) { + *engine = new DreamWeb::DreamWebEngine(syst, gd); + } + return gd != 0; +} + +SaveStateList DreamWebMetaEngine::listSaves(const char *target) const { + //Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + SaveStateList saveList; + + return saveList; +} + +int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; } + +void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const { +} + +#if PLUGIN_ENABLED_DYNAMIC(DREAMWEB) + REGISTER_PLUGIN_DYNAMIC(DREAMWEB, PLUGIN_TYPE_ENGINE, DreamWebMetaEngine); +#else + REGISTER_PLUGIN_STATIC(DREAMWEB, PLUGIN_TYPE_ENGINE, DreamWebMetaEngine); +#endif + +namespace DreamWeb { + +Common::Error DreamWebEngine::loadGameState(int slot) { + return Common::kNoError; +} + +Common::Error DreamWebEngine::saveGameState(int slot, const char *desc) { + return Common::kNoError; +} + +bool DreamWebEngine::canLoadGameStateCurrently() { + return false; +} + +bool DreamWebEngine::canSaveGameStateCurrently() { + return false; +} + +} // End of namespace DreamWeb diff --git a/engines/dreamweb/detection_tables.h b/engines/dreamweb/detection_tables.h new file mode 100644 index 0000000000..1062b50d6b --- /dev/null +++ b/engines/dreamweb/detection_tables.h @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/detection_tables.h $ + * $Id: detection_tables.h 66 2010-11-07 08:31:21Z eriktorbjorn $ + * + */ + +#ifndef DREAMWEB_DETECTION_TABLES_H +#define DREAMWEB_DETECTION_TABLES_H + +namespace DreamWeb { + +using Common::GUIO_NONE; + +static const DreamWebGameDescription gameDescriptions[] = { + { + { + "dreamweb", + "", + { + {"dreamweb.r00", 0, "3b5c87717fc40cc5a5ae19c155662ee3", 152918}, + {"dreamweb.r02", 0, "28458718167a040d7e988cf7d2298eae", 210466}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NONE + }, + }, + { + { + "dreamweb", + "CD", + { + {"dreamweb.r00", 0, "3b5c87717fc40cc5a5ae19c155662ee3", 152918}, + {"dreamweb.r02", 0, "d6fe5e3590ec1eea42ff65c10b023e0f", 198681}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_CD, + GUIO_NONE + }, + }, + { AD_TABLE_END_MARKER } +}; + +} // End of namespace DreamWeb + +#endif diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp new file mode 100644 index 0000000000..331c8abbd7 --- /dev/null +++ b/engines/dreamweb/dreamgen.cpp @@ -0,0 +1,22792 @@ +#include "dreamgen.h" + +namespace dreamgen { + +void checkbasemem(Context &context); +void allocatebuffers(Context &context); +void clearbuffers(Context &context); +void clearpalette(Context &context); +void readsetdata(Context &context); +void scanfornames(Context &context); +void loadpalfromiff(Context &context); +void titles(Context &context); +void credits(Context &context); +void decide(Context &context); +void clearchanges(Context &context); +void loadroom(Context &context); +void clearsprites(Context &context); +void initman(Context &context); +void entrytexts(Context &context); +void entryanims(Context &context); +void initialinv(Context &context); +void startup1(Context &context); +void clearbeforeload(Context &context); +void startup(Context &context); +void worktoscreenm(Context &context); +void screenupdate(Context &context); +void showgun(Context &context); +void fadescreendown(Context &context); +void hangon(Context &context); +void fadescreendowns(Context &context); +void endgame(Context &context); +void makename(Context &context); +void standardload(Context &context); +void getroomspaths(Context &context); +void readheader(Context &context); +void allocateload(Context &context); +void fillspace(Context &context); +void sortoutmap(Context &context); +void findroominloc(Context &context); +void deletetaken(Context &context); +void setallchanges(Context &context); +void autoappear(Context &context); +void getroomdata(Context &context); +void autosetwalk(Context &context); +void findxyfrompath(Context &context); +void twodigitnum(Context &context); +void startloading(Context &context); +void loadroomssample(Context &context); +void switchryanon(Context &context); +void drawflags(Context &context); +void getdimension(Context &context); +void getflagunderp(Context &context); +void dumpblink(Context &context); +void showblink(Context &context); +void showframe(Context &context); +void printcurs(Context &context); +void delcurs(Context &context); +void delpointer(Context &context); +void readmouse(Context &context); +void animpointer(Context &context); +void showpointer(Context &context); +void dumppointer(Context &context); +void commandonly(Context &context); +void showtime(Context &context); +void showwatch(Context &context); +void printmessage(Context &context); +void printdirect(Context &context); +void usecharset1(Context &context); +void showpanel(Context &context); +void showman(Context &context); +void roomname(Context &context); +void panelicons1(Context &context); +void zoomicon(Context &context); +void middlepanel(Context &context); +void findobname(Context &context); +void workoutframes(Context &context); +void checkdest(Context &context); +void bresenhams(Context &context); +void facerightway(Context &context); +void checkone(Context &context); +void commandwithob(Context &context); +void findnextcolon(Context &context); +void deltextline(Context &context); +void copyname(Context &context); +void finishedwalking(Context &context); +void examineob(Context &context); +void talk(Context &context); +void setwalk(Context &context); +void examineobtext(Context &context); +void blocknametext(Context &context); +void personnametext(Context &context); +void walktotext(Context &context); +void clearwork(Context &context); +void drawfloor(Context &context); +void reelsonscreen(Context &context); +void spriteupdate(Context &context); +void printsprites(Context &context); +void playchannel0(Context &context); +void cancelch0(Context &context); +void createpanel(Context &context); +void findpathofpoint(Context &context); +void showicon(Context &context); +void undertextline(Context &context); +void mainscreen(Context &context); +void getunderzoom(Context &context); +void zoom(Context &context); +void walkintoroom(Context &context); +void reminders(Context &context); +void atmospheres(Context &context); +void findormake(Context &context); +void obname(Context &context); +void pixelcheckset(Context &context); +void isitdescribed(Context &context); +void getreelstart(Context &context); +void getreelframeax(Context &context); +void blank(Context &context); +void findfirstpath(Context &context); +void checkifex(Context &context); +void checkiffree(Context &context); +void checkifperson(Context &context); +void checkifset(Context &context); +void identifyob(Context &context); +void checkcoords(Context &context); +void walkandexamine(Context &context); +void convnum(Context &context); +void onedigit(Context &context); +void plotreel(Context &context); +void checkforshake(Context &context); +void newplace(Context &context); +void readmouse1(Context &context); +void dumptextline(Context &context); +void autolook(Context &context); +void watchcount(Context &context); +void readmouse2(Context &context); +void dumpzoom(Context &context); +void deleverything(Context &context); +void afternewroom(Context &context); +void readmouse3(Context &context); +void dumpmap(Context &context); +void dumptimedtext(Context &context); +void readmouse4(Context &context); +void dumpwatch(Context &context); +void fadescreenup(Context &context); +void clearreels(Context &context); +void clearrest(Context &context); +void trysoundalloc(Context &context); +void allocatework(Context &context); +void checkforemm(Context &context); +void getanyad(Context &context); +void transfertoex(Context &context); +void pickupob(Context &context); +void switchryanoff(Context &context); +void resetlocation(Context &context); +void removefreeobject(Context &context); +void checkifpathison(Context &context); +void turnpathon(Context &context); +void removesetobject(Context &context); +void placesetobject(Context &context); +void turnanypathon(Context &context); +void setuptimeduse(Context &context); +void volumeadjust(Context &context); +void loopchannel0(Context &context); +void cancelch1(Context &context); +void createname(Context &context); +void doload(Context &context); +void showdecisions(Context &context); +void showopbox(Context &context); +void showloadops(Context &context); +void showslots(Context &context); +void shownames(Context &context); +void namestoold(Context &context); +void getridoftemp(Context &context); +void initrain(Context &context); +void createpanel2(Context &context); +void loadsavebox(Context &context); +void storeit(Context &context); +void makeheader(Context &context); +void oldtonames(Context &context); +void showsaveops(Context &context); +void readkey(Context &context); +void getnamepos(Context &context); +void selectslot(Context &context); +void loadposition(Context &context); +void saveposition(Context &context); +void restoreall(Context &context); +void redrawmainscrn(Context &context); +void checkinput(Context &context); +void showdiscops(Context &context); +void loadintotemp(Context &context); +void getback1(Context &context); +void getridofall(Context &context); +void showmainops(Context &context); +void dosaveload(Context &context); +void findtext1(Context &context); +void usetempcharset(Context &context); +void playchannel1(Context &context); +void getlocation(Context &context); +void setlocation(Context &context); +void hangonp(Context &context); +void showdiary(Context &context); +void showdiarypage(Context &context); +void getridofreels(Context &context); +void loadtemptext(Context &context); +void loadtempcharset(Context &context); +void showdiarykeys(Context &context); +void dumpdiarykeys(Context &context); +void getridoftemptext(Context &context); +void getridoftempcharset(Context &context); +void restorereels(Context &context); +void nextsymbol(Context &context); +void showsymbol(Context &context); +void updatesymboltop(Context &context); +void updatesymbolbot(Context &context); +void dumpsymbol(Context &context); +void turnanypathoff(Context &context); +void folderexit(Context &context); +void showleftpage(Context &context); +void showrightpage(Context &context); +void loadintotemp2(Context &context); +void loadintotemp3(Context &context); +void showfolder(Context &context); +void folderhints(Context &context); +void loadfolder(Context &context); +void getridoftemp2(Context &context); +void getridoftemp3(Context &context); +void loadmenu(Context &context); +void getundermenu(Context &context); +void putundermenu(Context &context); +void showmenu(Context &context); +void dumpmenu(Context &context); +void singlekey(Context &context); +void buttonpress(Context &context); +void loadkeypad(Context &context); +void showouterpad(Context &context); +void showkeypad(Context &context); +void dumpkeypad(Context &context); +void addtopresslist(Context &context); +void isitright(Context &context); +void checkinside(Context &context); +void compare(Context &context); +void showfirstuse(Context &context); +void putbackobstuff(Context &context); +void withwhat(Context &context); +void showpuztext(Context &context); +void placefreeobject(Context &context); +void issetobonmap(Context &context); +void showseconduse(Context &context); +void removeobfrominv(Context &context); +void turnpathoff(Context &context); +void getundertimed(Context &context); +void putundertimed(Context &context); +void getsetad(Context &context); +void getfreead(Context &context); +void dochange(Context &context); +void findpuztext(Context &context); +void showexit(Context &context); +void obicons(Context &context); +void obpicture(Context &context); +void describeob(Context &context); +void getanyaddir(Context &context); +void findinvpos(Context &context); +void useroutine(Context &context); +void printmessage2(Context &context); +void fillryan(Context &context); +void findsetobject(Context &context); +void getobtextstart(Context &context); +void usetext(Context &context); +void selectlocation(Context &context); +void hangonw(Context &context); +void moneypoke(Context &context); +void nextcolon(Context &context); +void getexad(Context &context); +void entercode(Context &context); +void findexobject(Context &context); +void makeworn(Context &context); +void isryanholding(Context &context); +void nothelderror(Context &context); +void triggermessage(Context &context); +void monprint(Context &context); +void printchar(Context &context); +void showcurrentfile(Context &context); +void printlogo(Context &context); +void randomaccess(Context &context); +void locklighton(Context &context); +void locklightoff(Context &context); +void makecaps(Context &context); +void monmessage(Context &context); +void scrollmonitor(Context &context); +void searchforstring(Context &context); +void getkeyandlogo(Context &context); +void monitorlogo(Context &context); +void parser(Context &context); +void neterror(Context &context); +void processtrigger(Context &context); +void input(Context &context); +void dirfile(Context &context); +void searchforfiles(Context &context); +void dircom(Context &context); +void signon(Context &context); +void read(Context &context); +void showkeys(Context &context); +void delchar(Context &context); +void randomnum1(Context &context); +void accesslighton(Context &context); +void accesslightoff(Context &context); +void powerlighton(Context &context); +void powerlightoff(Context &context); +void lookininterface(Context &context); +void loadpersonal(Context &context); +void loadnews(Context &context); +void loadcart(Context &context); +void printoutermon(Context &context); +void initialmoncols(Context &context); +void turnonpower(Context &context); +void fadeupyellows(Context &context); +void fadeupmonfirst(Context &context); +void hangoncurs(Context &context); +void execcommand(Context &context); +void purgealocation(Context &context); +void getdestinfo(Context &context); +void showarrows(Context &context); +void locationpic(Context &context); +void getundercentre(Context &context); +void putundercentre(Context &context); +void readcitypic(Context &context); +void showcity(Context &context); +void readdesticon(Context &context); +void loadtraveltext(Context &context); +void convicons(Context &context); +void starttalk(Context &context); +void hangonpq(Context &context); +void redes(Context &context); +void dosometalk(Context &context); +void getpersontext(Context &context); +void getpersframe(Context &context); +void findsource(Context &context); +void printslow(Context &context); +void dolook(Context &context); +void getxad(Context &context); +void getyad(Context &context); +void getmapad(Context &context); +void calcfrframe(Context &context); +void finalframe(Context &context); +void makesprite(Context &context); +void makebackob(Context &context); +void addalong(Context &context); +void addlength(Context &context); +void eraseoldobs(Context &context); +void calcmapad(Context &context); +void doblocks(Context &context); +void showallobs(Context &context); +void showallfree(Context &context); +void showallex(Context &context); +void paneltomap(Context &context); +void deleteexframe(Context &context); +void deleteextext(Context &context); +void deleteexobject(Context &context); +void purgeanitem(Context &context); +void getexpos(Context &context); +void transfermap(Context &context); +void transferinv(Context &context); +void transfertext(Context &context); +void transfercontoex(Context &context); +void emergencypurge(Context &context); +void pickupconts(Context &context); +void findopenpos(Context &context); +void reexfromopen(Context &context); +void geteitherad(Context &context); +void fillopen(Context &context); +void useopened(Context &context); +void getopenedsize(Context &context); +void errormessage3(Context &context); +void errormessage2(Context &context); +void examicon(Context &context); +void outofopen(Context &context); +void swapwithopen(Context &context); +void isitworn(Context &context); +void wornerror(Context &context); +void errormessage1(Context &context); +void checkobjectsize(Context &context); +void openinv(Context &context); +void openob(Context &context); +void droperror(Context &context); +void cantdrop(Context &context); +void reexfrominv(Context &context); +void intoinv(Context &context); +void outofinv(Context &context); +void swapwithinv(Context &context); +void makemainscreen(Context &context); +void searchforsame(Context &context); +void lookatcard(Context &context); +void obsthatdothings(Context &context); +void additionaltext(Context &context); +void findallopen(Context &context); +void obtoinv(Context &context); +void findallryan(Context &context); +void showryanpage(Context &context); +void kernchars(Context &context); +void getnextword(Context &context); +void getnumber(Context &context); +void lockmon(Context &context); +void printboth(Context &context); +void waitframes(Context &context); +void hangone(Context &context); +void allpalette(Context &context); +void fadescreenups(Context &context); +void afterintroroom(Context &context); +void usetimedtext(Context &context); +void loadintroroom(Context &context); +void runintroseq(Context &context); +void realcredits(Context &context); +void runendseq(Context &context); +void showmonk(Context &context); +void monkspeaking(Context &context); +void gettingshot(Context &context); +void biblequote(Context &context); +void intro(Context &context); +void paltostartpal(Context &context); +void paltoendpal(Context &context); +void dumpcurrent(Context &context); +void rollem(Context &context); +void greyscalesum(Context &context); +void endpaltostart(Context &context); +void clearendpal(Context &context); +void rollendcredits2(Context &context); +void clearstartpal(Context &context); +void fadecalculation(Context &context); +void frameoutfx(Context &context); +void frameoutbh(Context &context); +void frameoutv(Context &context); +void putunderzoom(Context &context); +void crosshair(Context &context); +void maptopanel(Context &context); +void movemap(Context &context); +void dealwithspecial(Context &context); +void showreelframe(Context &context); +void soundonreels(Context &context); +void reconstruct(Context &context); +void updatepeople(Context &context); +void watchreel(Context &context); +void showrain(Context &context); +void dodoor(Context &context); +void liftnoise(Context &context); +void widedoor(Context &context); +void random(Context &context); +void lockeddoorway(Context &context); +void liftsprite(Context &context); +void doorway(Context &context); +void constant(Context &context); +void steady(Context &context); +void getblockofpixel(Context &context); +void splitintolines(Context &context); +void adjustleft(Context &context); +void adjustright(Context &context); +void adjustdown(Context &context); +void adjustup(Context &context); +void aboutturn(Context &context); +void checkforexit(Context &context); +void walking(Context &context); +void printasprite(Context &context); +void showgamereel(Context &context); +void checkspeed(Context &context); +void addtopeoplelist(Context &context); +void setuptimedtemp(Context &context); +void madmantext(Context &context); +void madmode(Context &context); +void priesttext(Context &context); +void fadescreenuphalf(Context &context); +void textforend(Context &context); +void fadescreendownhalf(Context &context); +void rollendcredits(Context &context); +void textformonk(Context &context); +void monks2text(Context &context); +void intro2text(Context &context); +void intro3text(Context &context); +void intro1text(Context &context); + +void alleybarksound(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._dec(context.ax); + context._cmp(context.ax, 0); + if (!context.flags.z()) goto nobark; + context.push(context.bx); + context.push(context.es); + context.al = 14; + playchannel1(context); + context.es = context.pop(); + context.bx = context.pop(); + context.ax = 1000; +nobark: + context.es.word(context.bx+3) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void intromusic(Context & context) { + uint stack_depth = context.stack.size(); + {assert(stack_depth == context.stack.size()); return; } +} + +void foghornsound(Context & context) { + uint stack_depth = context.stack.size(); + randomnumber(context); + context._cmp(context.al, 198); + if (!context.flags.z()) goto nofog; + context.al = 13; + playchannel1(context); +nofog: + {assert(stack_depth == context.stack.size()); return; } +} + +void receptionist(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto gotrecep; + context._cmp(context.data.byte(kCardpassflag), 1); + if (!context.flags.z()) goto notsetcard; + context._inc(context.data.byte(kCardpassflag)); + context.es.byte(context.bx+7) = 1; + context.es.word(context.bx+3) = 64; +notsetcard: + context._cmp(context.es.word(context.bx+3), 58); + if (!context.flags.z()) goto notdes1; + randomnumber(context); + context._cmp(context.al, 30); + if (context.flags.c()) goto notdes2; + context.es.word(context.bx+3) = 55; + goto gotrecep; +notdes1: + context._cmp(context.es.word(context.bx+3), 60); + if (!context.flags.z()) goto notdes2; + randomnumber(context); + context._cmp(context.al, 240); + if (context.flags.c()) goto gotrecep; + context.es.word(context.bx+3) = 53; + goto gotrecep; +notdes2: + context._cmp(context.es.word(context.bx+3), 88); + if (!context.flags.z()) goto notendcard; + context.es.word(context.bx+3) = 53; + goto gotrecep; +notendcard: + context._inc(context.es.word(context.bx+3)); +gotrecep: + showgamereel(context); + addtopeoplelist(context); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 128); + if (context.flags.z()) goto nottalkedrecep; + context.data.byte(kTalkedtorecep) = 1; +nottalkedrecep: + {assert(stack_depth == context.stack.size()); return; } +} + +void smokebloke(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRockstardead), 0); + if (!context.flags.z()) goto notspokento; + context.al = context.es.byte(context.bx+7); + context._and(context.al, 128); + if (context.flags.z()) goto notspokento; + context.push(context.es); + context.push(context.bx); + context.al = 5; + setlocation(context); + context.bx = context.pop(); + context.es = context.pop(); +notspokento: + checkspeed(context); + if (!context.flags.z()) goto gotsmokeb; + context._cmp(context.es.word(context.bx+3), 100); + if (!context.flags.z()) goto notsmokeb1; + randomnumber(context); + context._cmp(context.al, 30); + if (context.flags.c()) goto notsmokeb2; + context.es.word(context.bx+3) = 96; + goto gotsmokeb; +notsmokeb1: + context._cmp(context.es.word(context.bx+3), 117); + if (!context.flags.z()) goto notsmokeb2; + context.es.word(context.bx+3) = 96; + goto gotsmokeb; +notsmokeb2: + context._inc(context.es.word(context.bx+3)); +gotsmokeb: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void attendant(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 128); + if (context.flags.z()) goto nottalked; + context.data.byte(kTalkedtoattendant) = 1; +nottalked: + {assert(stack_depth == context.stack.size()); return; } +} + +void manasleep(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 127); + context.es.byte(context.bx+7) = context.al; + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void eden(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kGeneraldead), 0); + if (!context.flags.z()) goto notinbed; + showgamereel(context); + addtopeoplelist(context); +notinbed: + {assert(stack_depth == context.stack.size()); return; } +} + +void edeninbath(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kGeneraldead), 0); + if (context.flags.z()) goto notinbed; + context._cmp(context.data.byte(kSartaindead), 0); + if (!context.flags.z()) goto notinbath; + showgamereel(context); + addtopeoplelist(context); +notinbath: + {assert(stack_depth == context.stack.size()); return; } +/*continuing to unbounded code: notinbed from eden:5-6*/ +notinbed: + {assert(stack_depth == context.stack.size()); return; } + {assert(stack_depth == context.stack.size()); return; } +} + +void malefan(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void femalefan(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void louis(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRockstardead), 0); + if (!context.flags.z()) goto notlouis1; + showgamereel(context); + addtopeoplelist(context); +notlouis1: + {assert(stack_depth == context.stack.size()); return; } +} + +void louischair(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRockstardead), 0); + if (context.flags.z()) goto notlouis2; + checkspeed(context); + if (!context.flags.z()) goto notlouisanim; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 191); + if (context.flags.z()) goto restartlouis; + context._cmp(context.ax, 185); + if (context.flags.z()) goto randomlouis; + context.es.word(context.bx+3) = context.ax; + goto notlouisanim; +randomlouis: + context.es.word(context.bx+3) = context.ax; + randomnumber(context); + context._cmp(context.al, 245); + if (!context.flags.c()) goto notlouisanim; +restartlouis: + context.ax = 182; + context.es.word(context.bx+3) = context.ax; +notlouisanim: + showgamereel(context); + addtopeoplelist(context); +notlouis2: + {assert(stack_depth == context.stack.size()); return; } +} + +void manasleep2(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 127); + context.es.byte(context.bx+7) = context.al; + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void mansatstill(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void tattooman(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void drinker(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto gotdrinker; + context._inc(context.es.word(context.bx+3)); + context._cmp(context.es.word(context.bx+3), 115); + if (!context.flags.z()) goto notdrinker1; + context.es.word(context.bx+3) = 105; + goto gotdrinker; +notdrinker1: + context._cmp(context.es.word(context.bx+3), 106); + if (!context.flags.z()) goto gotdrinker; + randomnumber(context); + context._cmp(context.al, 3); + if (context.flags.c()) goto gotdrinker; + context.es.word(context.bx+3) = 105; +gotdrinker: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void bartender(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto gotsmoket; + context._cmp(context.es.word(context.bx+3), 86); + if (!context.flags.z()) goto notsmoket1; + randomnumber(context); + context._cmp(context.al, 18); + if (context.flags.c()) goto notsmoket2; + context.es.word(context.bx+3) = 81; + goto gotsmoket; +notsmoket1: + context._cmp(context.es.word(context.bx+3), 103); + if (!context.flags.z()) goto notsmoket2; + context.es.word(context.bx+3) = 81; + goto gotsmoket; +notsmoket2: + context._inc(context.es.word(context.bx+3)); +gotsmoket: + showgamereel(context); + context._cmp(context.data.byte(kGunpassflag), 1); + if (!context.flags.z()) goto notgotgun; + context.es.byte(context.bx+7) = 9; +notgotgun: + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void othersmoker(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void barwoman(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void interviewer(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kReeltowatch), 68); + if (!context.flags.z()) goto notgeneralstart; + context._inc(context.es.word(context.bx+3)); +notgeneralstart: + context._cmp(context.es.word(context.bx+3), 250); + if (context.flags.z()) goto talking; + checkspeed(context); + if (!context.flags.z()) goto talking; + context._cmp(context.es.word(context.bx+3), 259); + if (context.flags.z()) goto talking; + context._inc(context.es.word(context.bx+3)); +talking: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void soldier1(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.es.word(context.bx+3), 0); + if (context.flags.z()) goto soldierwait; + context.data.word(kWatchingtime) = 10; + context._cmp(context.es.word(context.bx+3), 30); + if (!context.flags.z()) goto notaftersshot; + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 40); + if (!context.flags.z()) goto gotsoldframe; + context.data.byte(kMandead) = 2; + goto gotsoldframe; +notaftersshot: + checkspeed(context); + if (!context.flags.z()) goto gotsoldframe; + context._inc(context.es.word(context.bx+3)); + goto gotsoldframe; +soldierwait: + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto gotsoldframe; + context.data.word(kWatchingtime) = 10; + context._cmp(context.data.byte(kManspath), 2); + if (!context.flags.z()) goto gotsoldframe; + context._cmp(context.data.byte(kFacing), 4); + if (!context.flags.z()) goto gotsoldframe; + context._inc(context.es.word(context.bx+3)); + context.data.byte(kLastweapon) = -1; + context.data.byte(kCombatcount) = 0; +gotsoldframe: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void rockstar(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 303); + if (context.flags.z()) goto rockcombatend; + context._cmp(context.ax, 118); + if (context.flags.z()) goto rockcombatend; + checkspeed(context); + if (!context.flags.z()) goto rockspeed; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 118); + if (!context.flags.z()) goto notbeforedead; + context.data.byte(kMandead) = 2; + goto gotrockframe; +notbeforedead: + context._cmp(context.ax, 79); + if (!context.flags.z()) goto gotrockframe; + context._dec(context.ax); + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto notgunonrock; + context.data.byte(kLastweapon) = -1; + context.ax = 123; + goto gotrockframe; +notgunonrock: + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 40); + if (!context.flags.z()) goto gotrockframe; + context.data.byte(kCombatcount) = 0; + context.ax = 79; +gotrockframe: + context.es.word(context.bx+3) = context.ax; +rockspeed: + showgamereel(context); + context._cmp(context.es.word(context.bx+3), 78); + if (!context.flags.z()) goto notalkrock; + addtopeoplelist(context); + context.data.byte(kPointermode) = 2; + context.data.word(kWatchingtime) = 0; + {assert(stack_depth == context.stack.size()); return; } +notalkrock: + context.data.word(kWatchingtime) = 2; + context.data.byte(kPointermode) = 0; + context.al = context.data.byte(kMapy); + context.es.byte(context.bx+2) = context.al; + {assert(stack_depth == context.stack.size()); return; } +rockcombatend: + context.data.byte(kNewlocation) = 45; + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void helicopter(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 203); + if (context.flags.z()) goto heliwon; + checkspeed(context); + if (!context.flags.z()) goto helispeed; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 53); + if (!context.flags.z()) goto notbeforehdead; + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 8); + if (context.flags.c()) goto waitabit; + context.data.byte(kMandead) = 2; +waitabit: + context.ax = 49; + goto gotheliframe; +notbeforehdead: + context._cmp(context.ax, 9); + if (!context.flags.z()) goto gotheliframe; + context._dec(context.ax); + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto notgunonheli; + context.data.byte(kLastweapon) = -1; + context.ax = 55; + goto gotheliframe; +notgunonheli: + context.ax = 5; + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 20); + if (!context.flags.z()) goto gotheliframe; + context.data.byte(kCombatcount) = 0; + context.ax = 9; +gotheliframe: + context.es.word(context.bx+3) = context.ax; +helispeed: + showgamereel(context); + context.al = context.data.byte(kMapx); + context.es.byte(context.bx+1) = context.al; +helicombatend: + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 9); + if (!context.flags.c()) goto notwaitingheli; + context._cmp(context.data.byte(kCombatcount), 7); + if (context.flags.c()) goto notwaitingheli; + context.data.byte(kPointermode) = 2; + context.data.word(kWatchingtime) = 0; + {assert(stack_depth == context.stack.size()); return; } +notwaitingheli: + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 2; + {assert(stack_depth == context.stack.size()); return; } +heliwon: + context.data.byte(kPointermode) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void mugger(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 138); + if (context.flags.z()) goto endmugger1; + context._cmp(context.ax, 176); + if (context.flags.z()) goto endmugger2; + context._cmp(context.ax, 2); + if (!context.flags.z()) goto havesetwatch; + context.data.word(kWatchingtime) = 175*2; +havesetwatch: + checkspeed(context); + if (!context.flags.z()) goto notmugger; + context._inc(context.es.word(context.bx+3)); +notmugger: + showgamereel(context); + context.al = context.data.byte(kMapx); + context.es.byte(context.bx+1) = context.al; + {assert(stack_depth == context.stack.size()); return; } +endmugger1: + context.push(context.es); + context.push(context.bx); + createpanel2(context); + showicon(context); + context.al = 41; + findpuztext(context); + context.di = 33+20; + context.bx = 104; + context.dl = 241; + context.ah = 0; + printdirect(context); + worktoscreen(context); + context.cx = 300; + hangon(context); + context.bx = context.pop(); + context.es = context.pop(); + context.push(context.es); + context.push(context.bx); + context.es.word(context.bx+3) = 140; + context.data.byte(kManspath) = 2; + context.data.byte(kFinaldest) = 2; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + context.al = 'W'; + context.ah = 'E'; + context.cl = 'T'; + context.ch = 'A'; + findexobject(context); + context.data.byte(kCommand) = context.al; + context.data.byte(kObjecttype) = 4; + removeobfrominv(context); + context.al = 'W'; + context.ah = 'E'; + context.cl = 'T'; + context.ch = 'B'; + findexobject(context); + context.data.byte(kCommand) = context.al; + context.data.byte(kObjecttype) = 4; + removeobfrominv(context); + makemainscreen(context); + context.al = 48; + context.bl = 68-32; + context.bh = 54+64; + context.cx = 70; + context.dx = 10; + setuptimeduse(context); + context.data.byte(kBeenmugged) = 1; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +endmugger2: + {assert(stack_depth == context.stack.size()); return; } +} + +void aide(Context & context) { + uint stack_depth = context.stack.size(); + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void businessman(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 2; + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 2); + if (!context.flags.z()) goto notfirstbiz; + context.push(context.ax); + context.push(context.bx); + context.push(context.es); + context.al = 49; + context.cx = 30; + context.dx = 1; + context.bl = 68; + context.bh = 174; + setuptimeduse(context); + context.es = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); +notfirstbiz: + context._cmp(context.ax, 95); + if (context.flags.z()) goto buscombatwonend; + context._cmp(context.ax, 49); + if (context.flags.z()) goto buscombatend; + checkspeed(context); + if (!context.flags.z()) goto busspeed; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 48); + if (!context.flags.z()) goto notbeforedeadb; + context.data.byte(kMandead) = 2; + goto gotbusframe; +notbeforedeadb: + context._cmp(context.ax, 15); + if (!context.flags.z()) goto buscombatwon; + context._dec(context.ax); + context._cmp(context.data.byte(kLastweapon), 3); + if (!context.flags.z()) goto notshieldonbus; + context.data.byte(kLastweapon) = -1; + context.data.byte(kCombatcount) = 0; + context.ax = 51; + goto gotbusframe; +notshieldonbus: + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 20); + if (!context.flags.z()) goto gotbusframe; + context.data.byte(kCombatcount) = 0; + context.ax = 15; + goto gotbusframe; +buscombatwon: + context._cmp(context.ax, 91); + if (!context.flags.z()) goto gotbusframe; + context.push(context.bx); + context.push(context.es); + context.al = 0; + turnpathon(context); + context.al = 1; + turnpathon(context); + context.al = 2; + turnpathon(context); + context.al = 3; + turnpathoff(context); + context.data.byte(kManspath) = 5; + context.data.byte(kFinaldest) = 5; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + context.es = context.pop(); + context.bx = context.pop(); + context.ax = 92; + goto gotbusframe; +gotbusframe: + context.es.word(context.bx+3) = context.ax; +busspeed: + showgamereel(context); + context.al = context.data.byte(kMapy); + context.es.byte(context.bx+2) = context.al; + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 14); + if (!context.flags.z()) goto buscombatend; + context.data.word(kWatchingtime) = 0; + context.data.byte(kPointermode) = 2; + {assert(stack_depth == context.stack.size()); return; } +buscombatend: + {assert(stack_depth == context.stack.size()); return; } +buscombatwonend: + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void poolguard(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 214); + if (context.flags.z()) goto combatover2; + context._cmp(context.ax, 258); + if (context.flags.z()) goto combatover2; + context._cmp(context.ax, 185); + if (context.flags.z()) goto combatover1; + context._cmp(context.ax, 0); + if (!context.flags.z()) goto notfirstpool; + context.al = 0; + turnpathon(context); +notfirstpool: + checkspeed(context); + if (!context.flags.z()) goto guardspeed; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 122); + if (!context.flags.z()) goto notendguard1; + context._dec(context.ax); + context._cmp(context.data.byte(kLastweapon), 2); + if (!context.flags.z()) goto notaxeonpool; + context.data.byte(kLastweapon) = -1; + context.ax = 122; + goto gotguardframe; +notaxeonpool: + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 40); + if (!context.flags.z()) goto gotguardframe; + context.data.byte(kCombatcount) = 0; + context.ax = 195; + goto gotguardframe; +notendguard1: + context._cmp(context.ax, 147); + if (!context.flags.z()) goto gotguardframe; + context._dec(context.ax); + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto notgunonpool; + context.data.byte(kLastweapon) = -1; + context.ax = 147; + goto gotguardframe; +notgunonpool: + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 40); + if (!context.flags.z()) goto gotguardframe; + context.data.byte(kCombatcount) = 0; + context.ax = 220; +gotguardframe: + context.es.word(context.bx+3) = context.ax; +guardspeed: + showgamereel(context); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 121); + if (context.flags.z()) goto iswaitingpool; + context._cmp(context.ax, 146); + if (context.flags.z()) goto iswaitingpool; + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 2; + {assert(stack_depth == context.stack.size()); return; } +iswaitingpool: + context.data.byte(kPointermode) = 2; + context.data.word(kWatchingtime) = 0; + {assert(stack_depth == context.stack.size()); return; } +combatover1: + context.data.word(kWatchingtime) = 0; + context.data.byte(kPointermode) = 0; + context.al = 0; + turnpathon(context); + context.al = 1; + turnpathoff(context); + {assert(stack_depth == context.stack.size()); return; } +combatover2: + showgamereel(context); + context.data.word(kWatchingtime) = 2; + context.data.byte(kPointermode) = 0; + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 100); + if (context.flags.c()) goto doneover2; + context.data.word(kWatchingtime) = 0; + context.data.byte(kMandead) = 2; +doneover2: + {assert(stack_depth == context.stack.size()); return; } +} + +void security(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.es.word(context.bx+3), 32); + if (context.flags.z()) goto securwait; + context._cmp(context.es.word(context.bx+3), 69); + if (!context.flags.z()) goto notaftersec; + {assert(stack_depth == context.stack.size()); return; } +notaftersec: + context.data.word(kWatchingtime) = 10; + checkspeed(context); + if (!context.flags.z()) goto gotsecurframe; + context._inc(context.es.word(context.bx+3)); + goto gotsecurframe; +securwait: + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto gotsecurframe; + context.data.word(kWatchingtime) = 10; + context._cmp(context.data.byte(kManspath), 9); + if (!context.flags.z()) goto gotsecurframe; + context._cmp(context.data.byte(kFacing), 0); + if (!context.flags.z()) goto gotsecurframe; + context.data.byte(kLastweapon) = -1; + context._inc(context.es.word(context.bx+3)); +gotsecurframe: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void heavy(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 127); + context.es.byte(context.bx+7) = context.al; + context._cmp(context.es.word(context.bx+3), 43); + if (context.flags.z()) goto heavywait; + context.data.word(kWatchingtime) = 10; + context._cmp(context.es.word(context.bx+3), 70); + if (!context.flags.z()) goto notafterhshot; + context._inc(context.data.byte(kCombatcount)); + context._cmp(context.data.byte(kCombatcount), 80); + if (!context.flags.z()) goto gotheavyframe; + context.data.byte(kMandead) = 2; + goto gotheavyframe; +notafterhshot: + checkspeed(context); + if (!context.flags.z()) goto gotheavyframe; + context._inc(context.es.word(context.bx+3)); + goto gotheavyframe; +heavywait: + context._cmp(context.data.byte(kLastweapon), 1); + if (!context.flags.z()) goto gotheavyframe; + context._cmp(context.data.byte(kManspath), 5); + if (!context.flags.z()) goto gotheavyframe; + context._cmp(context.data.byte(kFacing), 4); + if (!context.flags.z()) goto gotheavyframe; + context.data.byte(kLastweapon) = -1; + context._inc(context.es.word(context.bx+3)); + context.data.byte(kCombatcount) = 0; +gotheavyframe: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void bossman(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto notboss; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 4); + if (context.flags.z()) goto firstdes; + context._cmp(context.ax, 20); + if (context.flags.z()) goto secdes; + context._cmp(context.ax, 41); + if (!context.flags.z()) goto gotallboss; + context.ax = 0; + context._inc(context.data.byte(kGunpassflag)); + context.es.byte(context.bx+7) = 10; + goto gotallboss; +firstdes: + context._cmp(context.data.byte(kGunpassflag), 1); + if (context.flags.z()) goto gotallboss; + context.push(context.ax); + randomnumber(context); + context.cl = context.al; + context.ax = context.pop(); + context._cmp(context.cl, 10); + if (context.flags.c()) goto gotallboss; + context.ax = 0; + goto gotallboss; +secdes: + context._cmp(context.data.byte(kGunpassflag), 1); + if (context.flags.z()) goto gotallboss; + context.ax = 0; +gotallboss: + context.es.word(context.bx+3) = context.ax; +notboss: + showgamereel(context); + addtopeoplelist(context); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 128); + if (context.flags.z()) goto nottalkedboss; + context.data.byte(kTalkedtoboss) = 1; +nottalkedboss: + {assert(stack_depth == context.stack.size()); return; } +} + +void gamer(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto gamerfin; +gameragain: + randomnum1(context); + context._and(context.al, 7); + context._cmp(context.al, 5); + if (!context.flags.c()) goto gameragain; + context._add(context.al, 20); + context._cmp(context.al, context.es.byte(context.bx+3)); + if (context.flags.z()) goto gameragain; + context.ah = 0; + context.es.word(context.bx+3) = context.ax; +gamerfin: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void sparkydrip(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto cantdrip; + context.al = 14; + context.ah = 0; + playchannel0(context); +cantdrip: + {assert(stack_depth == context.stack.size()); return; } +} + +void carparkdrip(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto cantdrip2; + context.al = 14; + playchannel1(context); +cantdrip2: + {assert(stack_depth == context.stack.size()); return; } +} + +void keeper(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kKeeperflag), 0); + if (!context.flags.z()) goto notwaiting; + context._cmp(context.data.word(kReeltowatch), 190); + if (context.flags.c()) goto waiting; + context._inc(context.data.byte(kKeeperflag)); + context.ah = context.es.byte(context.bx+7); + context._and(context.ah, 127); + context._cmp(context.ah, context.data.byte(kDreamnumber)); + if (context.flags.z()) goto notdiff; + context.al = context.data.byte(kDreamnumber); + context.es.byte(context.bx+7) = context.al; +notdiff: + {assert(stack_depth == context.stack.size()); return; } +notwaiting: + addtopeoplelist(context); + showgamereel(context); +waiting: + {assert(stack_depth == context.stack.size()); return; } +} + +void candles1(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto candle1; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 44); + if (!context.flags.z()) goto notendcandle1; + context.ax = 39; +notendcandle1: + context.es.word(context.bx+3) = context.ax; +candle1: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void smallcandle(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto smallcandlef; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 37); + if (!context.flags.z()) goto notendsmallcandle; + context.ax = 25; +notendsmallcandle: + context.es.word(context.bx+3) = context.ax; +smallcandlef: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intromagic1(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto introm1fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 145); + if (!context.flags.z()) goto gotintrom1; + context.ax = 121; +gotintrom1: + context.es.word(context.bx+3) = context.ax; + context._cmp(context.ax, 121); + if (!context.flags.z()) goto introm1fin; + context._inc(context.data.byte(kIntrocount)); + context.push(context.es); + context.push(context.bx); + intro1text(context); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.data.byte(kIntrocount), 8); + if (!context.flags.z()) goto introm1fin; + context._add(context.data.byte(kMapy), 10); + context.data.byte(kNowinnewroom) = 1; +introm1fin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void candles(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto candlesfin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 167); + if (!context.flags.z()) goto gotcandles; + context.ax = 162; +gotcandles: + context.es.word(context.bx+3) = context.ax; +candlesfin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void candles2(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto candles2fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 238); + if (!context.flags.z()) goto gotcandles2; + context.ax = 233; +gotcandles2: + context.es.word(context.bx+3) = context.ax; +candles2fin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void gates(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto gatesfin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 116); + if (!context.flags.z()) goto notbang; + context.push(context.ax); + context.push(context.bx); + context.push(context.es); + context.al = 17; + playchannel1(context); + context.es = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); +notbang: + context._cmp(context.ax, 110); + if (context.flags.c()) goto slowgates; + context.es.byte(context.bx+5) = 2; +slowgates: + context._cmp(context.ax, 120); + if (!context.flags.z()) goto gotgates; + context.data.byte(kGetback) = 1; + context.ax = 119; +gotgates: + context.es.word(context.bx+3) = context.ax; + context.push(context.es); + context.push(context.bx); + intro3text(context); + context.bx = context.pop(); + context.es = context.pop(); +gatesfin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intromagic2(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto introm2fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 216); + if (!context.flags.z()) goto gotintrom2; + context.ax = 192; +gotintrom2: + context.es.word(context.bx+3) = context.ax; +introm2fin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intromagic3(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto introm3fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 218); + if (!context.flags.z()) goto gotintrom3; + context.data.byte(kGetback) = 1; +gotintrom3: + context.es.word(context.bx+3) = context.ax; +introm3fin: + showgamereel(context); + context.al = context.data.byte(kMapx); + context.es.byte(context.bx+1) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void intromonks1(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto intromonk1fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 80); + if (!context.flags.z()) goto notendmonk1; + context._add(context.data.byte(kMapy), 10); + context.data.byte(kNowinnewroom) = 1; + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +notendmonk1: + context._cmp(context.ax, 30); + if (!context.flags.z()) goto gotintromonk1; + context._sub(context.data.byte(kMapy), 10); + context.data.byte(kNowinnewroom) = 1; + context.ax = 51; +gotintromonk1: + context.es.word(context.bx+3) = context.ax; + context._cmp(context.ax, 5); + if (context.flags.z()) goto waitstep; + context._cmp(context.ax, 15); + if (context.flags.z()) goto waitstep; + context._cmp(context.ax, 25); + if (context.flags.z()) goto waitstep; + context._cmp(context.ax, 61); + if (context.flags.z()) goto waitstep; + context._cmp(context.ax, 71); + if (context.flags.z()) goto waitstep; + goto intromonk1fin; +waitstep: + context.push(context.es); + context.push(context.bx); + intro2text(context); + context.bx = context.pop(); + context.es = context.pop(); + context.es.byte(context.bx+6) = -20; +intromonk1fin: + showgamereel(context); + context.al = context.data.byte(kMapy); + context.es.byte(context.bx+2) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void intromonks2(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto intromonk2fin; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 87); + if (!context.flags.z()) goto nottalk1; + context._inc(context.data.byte(kIntrocount)); + context.push(context.es); + context.push(context.bx); + monks2text(context); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.data.byte(kIntrocount), 19); + if (!context.flags.z()) goto notlasttalk1; + context.ax = 87; + goto gotintromonk2; +notlasttalk1: + context.ax = 74; + goto gotintromonk2; +nottalk1: + context._cmp(context.ax, 110); + if (!context.flags.z()) goto notraisearm; + context._inc(context.data.byte(kIntrocount)); + context.push(context.es); + context.push(context.bx); + monks2text(context); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.data.byte(kIntrocount), 35); + if (!context.flags.z()) goto notlastraise; + context.ax = 111; + goto gotintromonk2; +notlastraise: + context.ax = 98; + goto gotintromonk2; +notraisearm: + context._cmp(context.ax, 176); + if (!context.flags.z()) goto notendmonk2; + context.data.byte(kGetback) = 1; + goto gotintromonk2; +notendmonk2: + context._cmp(context.ax, 125); + if (!context.flags.z()) goto gotintromonk2; + context.ax = 140; +gotintromonk2: + context.es.word(context.bx+3) = context.ax; +intromonk2fin: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void handclap(Context & context) { + uint stack_depth = context.stack.size(); + {assert(stack_depth == context.stack.size()); return; } +} + +void monks2text(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kIntrocount), 1); + if (!context.flags.z()) goto notmonk2text1; + context.al = 8; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text1: + context._cmp(context.data.byte(kIntrocount), 4); + if (!context.flags.z()) goto notmonk2text2; + context.al = 9; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text2: + context._cmp(context.data.byte(kIntrocount), 7); + if (!context.flags.z()) goto notmonk2text3; + context.al = 10; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text3: + context._cmp(context.data.byte(kIntrocount), 10); + if (!context.flags.z()) goto notmonk2text4; + context.data.byte(kIntrocount) = 12; + context.al = 11; + context.bl = 0; + context.bh = 105; + context.cx = 100; + goto gotmonks2text; +notmonk2text4: + context._cmp(context.data.byte(kIntrocount), 13); + if (!context.flags.z()) goto notmonk2text5; + context.data.byte(kIntrocount) = 17; + {assert(stack_depth == context.stack.size()); return; } + context.al = 12; + context.bl = 0; + context.bh = 120; + context.cx = 100; + goto gotmonks2text; +notmonk2text5: + context._cmp(context.data.byte(kIntrocount), 16); + if (!context.flags.z()) goto notmonk2text6; + context.al = 13; + context.bl = 0; + context.bh = 135; + context.cx = 100; + goto gotmonks2text; +notmonk2text6: + context._cmp(context.data.byte(kIntrocount), 19); + if (!context.flags.z()) goto notmonk2text7; + context.al = 14; + context.bl = 36; + context.bh = 160; + context.cx = 100; + context.dx = 1; + context.ah = 82; + { setuptimedtemp(context); return; }; +notmonk2text7: + context._cmp(context.data.byte(kIntrocount), 22); + if (!context.flags.z()) goto notmonk2text8; + context.al = 15; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text8: + context._cmp(context.data.byte(kIntrocount), 25); + if (!context.flags.z()) goto notmonk2text9; + context.al = 16; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text9: + context._cmp(context.data.byte(kIntrocount), 27); + if (!context.flags.z()) goto notmonk2text10; + context.al = 17; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text10: + context._cmp(context.data.byte(kIntrocount), 31); + if (!context.flags.z()) goto notmonk2text11; + context.al = 18; + context.bl = 36; + context.bh = 160; + context.cx = 100; + goto gotmonks2text; +notmonk2text11: + {assert(stack_depth == context.stack.size()); return; } +gotmonks2text: + context.dx = 1; + context.cx = 120; + context.ah = 82; + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intro1text(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kIntrocount), 2); + if (!context.flags.z()) goto notintro1text1; + context.al = 40; + context.bl = 34; + context.bh = 130; + context.cx = 90; + goto gotintro1text; +notintro1text1: + context._cmp(context.data.byte(kIntrocount), 4); + if (!context.flags.z()) goto notintro1text2; + context.al = 41; + context.bl = 34; + context.bh = 130; + context.cx = 90; + goto gotintro1text; +notintro1text2: + context._cmp(context.data.byte(kIntrocount), 6); + if (!context.flags.z()) goto notintro1text3; + context.al = 42; + context.bl = 34; + context.bh = 130; + context.cx = 90; + goto gotintro1text; +notintro1text3: + {assert(stack_depth == context.stack.size()); return; } +gotintro1text: + context.dx = 1; + context.ah = 82; + context._cmp(context.data.byte(kCh1playing), 255); + if (context.flags.z()) goto oktalk2; + context._dec(context.data.byte(kIntrocount)); + {assert(stack_depth == context.stack.size()); return; } +oktalk2: + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intro2text(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ax, 5); + if (!context.flags.z()) goto notintro2text1; + context.al = 43; + context.bl = 34; + context.bh = 40; + context.cx = 90; + goto gotintro2text; +notintro2text1: + context._cmp(context.ax, 15); + if (!context.flags.z()) goto notintro2text2; + context.al = 44; + context.bl = 34; + context.bh = 40; + context.cx = 90; + goto gotintro2text; +notintro2text2: + {assert(stack_depth == context.stack.size()); return; } +gotintro2text: + context.dx = 1; + context.ah = 82; + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intro3text(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ax, 107); + if (!context.flags.z()) goto notintro3text1; + context.al = 45; + context.bl = 36; + context.bh = 56; + context.cx = 100; + goto gotintro3text; +notintro3text1: + context._cmp(context.ax, 108); + if (!context.flags.z()) goto notintro3text2; + context.al = 46; + context.bl = 36; + context.bh = 56; + context.cx = 100; + goto gotintro3text; +notintro3text2: + {assert(stack_depth == context.stack.size()); return; } +gotintro3text: + context.dx = 1; + context.ah = 82; + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void monkandryan(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto notmonkryan; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 83); + if (!context.flags.z()) goto gotmonkryan; + context._inc(context.data.byte(kIntrocount)); + context.push(context.es); + context.push(context.bx); + textformonk(context); + context.bx = context.pop(); + context.es = context.pop(); + context.ax = 77; + context._cmp(context.data.byte(kIntrocount), 57); + if (!context.flags.z()) goto gotmonkryan; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +gotmonkryan: + context.es.word(context.bx+3) = context.ax; +notmonkryan: + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void endgameseq(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto notendseq; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 51); + if (!context.flags.z()) goto gotendseq; + context._cmp(context.data.byte(kIntrocount), 140); + if (context.flags.z()) goto gotendseq; + context._inc(context.data.byte(kIntrocount)); + context.push(context.es); + context.push(context.bx); + textforend(context); + context.bx = context.pop(); + context.es = context.pop(); + context.ax = 50; +gotendseq: + context.es.word(context.bx+3) = context.ax; + context._cmp(context.ax, 134); + if (!context.flags.z()) goto notfadedown; + context.push(context.es); + context.push(context.bx); + context.push(context.ax); + fadescreendownhalf(context); + context.ax = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + goto notendseq; +notfadedown: + context._cmp(context.ax, 324); + if (!context.flags.z()) goto notfadeend; + context.push(context.es); + context.push(context.bx); + context.push(context.ax); + fadescreendowns(context); + context.data.byte(kVolumeto) = 7; + context.data.byte(kVolumedirection) = 1; + context.ax = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); +notfadeend: + context._cmp(context.ax, 340); + if (!context.flags.z()) goto notendseq; + context.data.byte(kGetback) = 1; +notendseq: + showgamereel(context); + context.al = context.data.byte(kMapy); + context.es.byte(context.bx+2) = context.al; + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 145); + if (!context.flags.z()) goto notendcreds; + context.es.word(context.bx+3) = 146; + rollendcredits(context); +notendcreds: + {assert(stack_depth == context.stack.size()); return; } +} + +void rollendcredits(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 16; + context.ah = 255; + playchannel0(context); + context.data.byte(kVolume) = 7; + context.data.byte(kVolumeto) = 0; + context.data.byte(kVolumedirection) = -1; + context.cl = 160; + context.ch = 160; + context.di = 75; + context.bx = 20; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiget(context); + context.es = context.data.word(kTextfile1); + context.si = 3*2; + context.ax = context.es.word(context.si); + context.si = context.ax; + context._add(context.si, (66*2)); + context.cx = 254; +endcredits1: + context.push(context.cx); + context.bx = 10; + context.cx = context.data.word(kLinespacing); +endcredits2: + context.push(context.cx); + context.push(context.si); + context.push(context.di); + context.push(context.es); + context.push(context.bx); + vsync(context); + context.cl = 160; + context.ch = 160; + context.di = 75; + context.bx = 20; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiput(context); + vsync(context); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); + context.si = context.pop(); + context.push(context.si); + context.push(context.di); + context.push(context.es); + context.push(context.bx); + context.cx = 18; +onelot: + context.push(context.cx); + context.di = 75; + context.dx = 161; + context.ax = 0; + printdirect(context); + context._add(context.bx, context.data.word(kLinespacing)); + context.cx = context.pop(); + if (--context.cx) goto onelot; + vsync(context); + context.cl = 160; + context.ch = 160; + context.di = 75; + context.bx = 20; + multidump(context); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context._dec(context.bx); + if (--context.cx) goto endcredits2; + context.cx = context.pop(); +looknext: + context.al = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.al, ':'); + if (context.flags.z()) goto gotnext; + context._cmp(context.al, 0); + if (context.flags.z()) goto gotnext; + goto looknext; +gotnext: + if (--context.cx) goto endcredits1; + context.cx = 100; + hangon(context); + paneltomap(context); + fadescreenuphalf(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void priest(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.es.word(context.bx+3), 8); + if (context.flags.z()) goto priestspoken; + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 2; + checkspeed(context); + if (!context.flags.z()) goto priestwait; + context._inc(context.es.word(context.bx+3)); + context.push(context.es); + context.push(context.bx); + priesttext(context); + context.bx = context.pop(); + context.es = context.pop(); +priestwait: + {assert(stack_depth == context.stack.size()); return; } +priestspoken: + {assert(stack_depth == context.stack.size()); return; } +} + +void madmanstelly(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 307); + if (!context.flags.z()) goto notendtelly; + context.ax = 300; +notendtelly: + context.es.word(context.bx+3) = context.ax; + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void madman(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kWatchingtime) = 2; + checkspeed(context); + if (!context.flags.z()) goto nomadspeed; + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 364); + if (!context.flags.c()) goto ryansded; + context._cmp(context.ax, 10); + if (!context.flags.z()) goto notfirstmad; + context.push(context.es); + context.push(context.bx); + context.push(context.ax); + context.dx = 2247; + loadtemptext(context); + context.ax = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.data.byte(kCombatcount) = -1; + context.data.byte(kSpeechcount) = 0; +notfirstmad: + context._inc(context.ax); + context._cmp(context.ax, 294); + if (context.flags.z()) goto madmanspoken; + context._cmp(context.ax, 66); + if (!context.flags.z()) goto nomadspeak; + context._inc(context.data.byte(kCombatcount)); + context.push(context.es); + context.push(context.bx); + madmantext(context); + context.bx = context.pop(); + context.es = context.pop(); + context.ax = 53; + context._cmp(context.data.byte(kCombatcount), 64); + if (context.flags.c()) goto nomadspeak; + context._cmp(context.data.byte(kCombatcount), 70); + if (context.flags.z()) goto killryan; + context._cmp(context.data.byte(kLastweapon), 8); + if (!context.flags.z()) goto nomadspeak; + context.data.byte(kCombatcount) = 72; + context.data.byte(kLastweapon) = -1; + context.data.byte(kMadmanflag) = 1; + context.ax = 67; + goto nomadspeak; +killryan: + context.ax = 310; +nomadspeak: + context.es.word(context.bx+3) = context.ax; +nomadspeed: + showgamereel(context); + context.al = context.data.byte(kMapx); + context.es.byte(context.bx+1) = context.al; + madmode(context); + {assert(stack_depth == context.stack.size()); return; } +madmanspoken: + context._cmp(context.data.byte(kWongame), 1); + if (context.flags.z()) goto alreadywon; + context.data.byte(kWongame) = 1; + context.push(context.es); + context.push(context.bx); + getridoftemptext(context); + context.bx = context.pop(); + context.es = context.pop(); +alreadywon: + {assert(stack_depth == context.stack.size()); return; } +ryansded: + context.data.byte(kMandead) = 2; + showgamereel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void madmantext(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSpeechcount), 63); + if (!context.flags.c()) goto nomadtext; + context._cmp(context.data.byte(kCh1playing), 255); + if (!context.flags.z()) goto nomadtext; + context.al = context.data.byte(kSpeechcount); + context._inc(context.data.byte(kSpeechcount)); + context._add(context.al, 47); + context.bl = 72; + context.bh = 80; + context.cx = 90; + context.dx = 1; + context.ah = 82; + setuptimedtemp(context); +nomadtext: + {assert(stack_depth == context.stack.size()); return; } +} + +void madmode(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kWatchingtime) = 2; + context.data.byte(kPointermode) = 0; + context._cmp(context.data.byte(kCombatcount), 65); + if (context.flags.c()) goto iswatchmad; + context._cmp(context.data.byte(kCombatcount), 70); + if (!context.flags.c()) goto iswatchmad; + context.data.byte(kPointermode) = 2; +iswatchmad: + {assert(stack_depth == context.stack.size()); return; } +} + +void priesttext(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.es.word(context.bx+3), 2); + if (context.flags.c()) goto nopriesttext; + context._cmp(context.es.word(context.bx+3), 7); + if (!context.flags.c()) goto nopriesttext; + context.al = context.es.byte(context.bx+3); + context._and(context.al, 1); + if (!context.flags.z()) goto nopriesttext; + context.al = context.es.byte(context.bx+3); + context._shr(context.al, 1); + context._add(context.al, 50); + context.bl = 72; + context.bh = 80; + context.cx = 54; + context.dx = 1; + setuptimeduse(context); +nopriesttext: + {assert(stack_depth == context.stack.size()); return; } +} + +void textforend(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kIntrocount), 20); + if (!context.flags.z()) goto notendtext1; + context.al = 0; + context.bl = 34; + context.bh = 20; + context.cx = 60; + goto gotendtext; +notendtext1: + context._cmp(context.data.byte(kIntrocount), 50); + if (!context.flags.z()) goto notendtext2; + context.al = 1; + context.bl = 34; + context.bh = 20; + context.cx = 60; + goto gotendtext; +notendtext2: + context._cmp(context.data.byte(kIntrocount), 85); + if (!context.flags.z()) goto notendtext3; + context.al = 2; + context.bl = 34; + context.bh = 20; + context.cx = 60; + goto gotendtext; +notendtext3: + {assert(stack_depth == context.stack.size()); return; } +gotendtext: + context.dx = 1; + context.ah = 83; + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void textformonk(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kIntrocount), 1); + if (!context.flags.z()) goto notmonktext1; + context.al = 19; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext1: + context._cmp(context.data.byte(kIntrocount), 5); + if (!context.flags.z()) goto notmonktext2; + context.al = 20; + context.bl = 68; + context.bh = 38; + context.cx = 120; + goto gotmonktext; +notmonktext2: + context._cmp(context.data.byte(kIntrocount), 9); + if (!context.flags.z()) goto notmonktext3; + context.al = 21; + context.bl = 48; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext3: + context._cmp(context.data.byte(kIntrocount), 13); + if (!context.flags.z()) goto notmonktext4; + context.al = 22; + context.bl = 68; + context.bh = 38; + context.cx = 120; + goto gotmonktext; +notmonktext4: + context._cmp(context.data.byte(kIntrocount), 15); + if (!context.flags.z()) goto notmonktext5; + context.al = 23; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext5: + context._cmp(context.data.byte(kIntrocount), 21); + if (!context.flags.z()) goto notmonktext6; + context.al = 24; + context.bl = 68; + context.bh = 38; + context.cx = 120; + goto gotmonktext; +notmonktext6: + context._cmp(context.data.byte(kIntrocount), 25); + if (!context.flags.z()) goto notmonktext7; + context.al = 25; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext7: + context._cmp(context.data.byte(kIntrocount), 29); + if (!context.flags.z()) goto notmonktext8; + context.al = 26; + context.bl = 68; + context.bh = 38; + context.cx = 120; + goto gotmonktext; +notmonktext8: + context._cmp(context.data.byte(kIntrocount), 33); + if (!context.flags.z()) goto notmonktext9; + context.al = 27; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext9: + context._cmp(context.data.byte(kIntrocount), 37); + if (!context.flags.z()) goto notmonktext10; + context.al = 28; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext10: + context._cmp(context.data.byte(kIntrocount), 41); + if (!context.flags.z()) goto notmonktext11; + context.al = 29; + context.bl = 68; + context.bh = 38; + context.cx = 120; + goto gotmonktext; +notmonktext11: + context._cmp(context.data.byte(kIntrocount), 45); + if (!context.flags.z()) goto notmonktext12; + context.al = 30; + context.bl = 68; + context.bh = 154; + context.cx = 120; + goto gotmonktext; +notmonktext12: + context._cmp(context.data.byte(kIntrocount), 52); + if (!context.flags.z()) goto notmonktext13; + context.al = 31; + context.bl = 68; + context.bh = 154; + context.cx = 220; + goto gotmonktext; +notmonktext13: + context._cmp(context.data.byte(kIntrocount), 53); + if (!context.flags.z()) goto notendtitles; + fadescreendowns(context); + context.data.byte(kVolumeto) = 7; + context.data.byte(kVolumedirection) = 1; +notendtitles: + {assert(stack_depth == context.stack.size()); return; } +gotmonktext: + context.dx = 1; + context.ah = 82; + context._cmp(context.data.byte(kCh1playing), 255); + if (context.flags.z()) goto oktalk; + context._dec(context.data.byte(kIntrocount)); + {assert(stack_depth == context.stack.size()); return; } +oktalk: + setuptimedtemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void drunk(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kGeneraldead), 0); + if (!context.flags.z()) goto trampgone; + context.al = context.es.byte(context.bx+7); + context._and(context.al, 127); + context.es.byte(context.bx+7) = context.al; + showgamereel(context); + addtopeoplelist(context); +trampgone: + {assert(stack_depth == context.stack.size()); return; } +} + +void advisor(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto noadvisor; + goto noadvisor; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 123); + if (!context.flags.z()) goto notendadvis; + context.ax = 106; + goto gotadvframe; +notendadvis: + context._cmp(context.ax, 108); + if (!context.flags.z()) goto gotadvframe; + context.push(context.ax); + randomnumber(context); + context.cl = context.al; + context.ax = context.pop(); + context._cmp(context.cl, 3); + if (context.flags.c()) goto gotadvframe; + context.ax = 106; +gotadvframe: + context.es.word(context.bx+3) = context.ax; +noadvisor: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void copper(Context & context) { + uint stack_depth = context.stack.size(); + checkspeed(context); + if (!context.flags.z()) goto nocopper; + context.ax = context.es.word(context.bx+3); + context._inc(context.ax); + context._cmp(context.ax, 94); + if (!context.flags.z()) goto notendcopper; + context.ax = 64; + goto gotcopframe; +notendcopper: + context._cmp(context.ax, 81); + if (context.flags.z()) goto mightwait; + context._cmp(context.ax, 66); + if (!context.flags.z()) goto gotcopframe; +mightwait: + context.push(context.ax); + randomnumber(context); + context.cl = context.al; + context.ax = context.pop(); + context._cmp(context.cl, 7); + if (context.flags.c()) goto gotcopframe; + context._dec(context.ax); +gotcopframe: + context.es.word(context.bx+3) = context.ax; +nocopper: + showgamereel(context); + addtopeoplelist(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void sparky(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kCard1money), 0); + if (context.flags.z()) goto animsparky; + context.es.byte(context.bx+7) = 3; + goto animsparky; +animsparky: + checkspeed(context); + if (!context.flags.z()) goto finishsparky; + context._cmp(context.es.word(context.bx+3), 34); + if (!context.flags.z()) goto notsparky1; + randomnumber(context); + context._cmp(context.al, 30); + if (context.flags.c()) goto dosparky; + context.es.word(context.bx+3) = 27; + goto finishsparky; +notsparky1: + context._cmp(context.es.word(context.bx+3), 48); + if (!context.flags.z()) goto dosparky; + context.es.word(context.bx+3) = 27; + goto finishsparky; +dosparky: + context._inc(context.es.word(context.bx+3)); +finishsparky: + showgamereel(context); + addtopeoplelist(context); + context.al = context.es.byte(context.bx+7); + context._and(context.al, 128); + if (context.flags.z()) goto nottalkedsparky; + context.data.byte(kTalkedtosparky) = 1; +nottalkedsparky: + {assert(stack_depth == context.stack.size()); return; } +} + +void train(Context & context) { + uint stack_depth = context.stack.size(); + {assert(stack_depth == context.stack.size()); return; } + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 21); + if (!context.flags.c()) goto notrainyet; + context._inc(context.ax); + goto gottrainframe; +notrainyet: + randomnumber(context); + context._cmp(context.al, 253); + if (context.flags.c()) goto notrainatall; + context._cmp(context.data.byte(kManspath), 5); + if (!context.flags.z()) goto notrainatall; + context._cmp(context.data.byte(kFinaldest), 5); + if (!context.flags.z()) goto notrainatall; + context.ax = 5; +gottrainframe: + context.es.word(context.bx+3) = context.ax; + showgamereel(context); +notrainatall: + {assert(stack_depth == context.stack.size()); return; } +} + +void addtopeoplelist(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.push(context.bx); + context.cl = context.es.byte(context.bx+7); + context.ax = context.es.word(context.bx+3); + context.bx = context.data.word(kListpos); + context.es = context.data.word(kBuffers); + context.es.word(context.bx) = context.ax; + context.ax = context.pop(); + context.es.word(context.bx+2) = context.ax; + context.es.byte(context.bx+4) = context.cl; + context.bx = context.pop(); + context.es = context.pop(); + context._add(context.data.word(kListpos), 5); + {assert(stack_depth == context.stack.size()); return; } +} + +void showgamereel(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.es.word(context.bx+3); + context._cmp(context.ax, 512); + if (!context.flags.c()) goto noshow; + context.data.word(kReelpointer) = context.ax; + context.push(context.es); + context.push(context.bx); + plotreel(context); + context.bx = context.pop(); + context.es = context.pop(); + context.ax = context.data.word(kReelpointer); + context.es.word(context.bx+3) = context.ax; +noshow: + {assert(stack_depth == context.stack.size()); return; } +} + +void checkspeed(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLastweapon), -1); + if (!context.flags.z()) goto forcenext; + context._inc(context.es.byte(context.bx+6)); + context.al = context.es.byte(context.bx+6); + context._cmp(context.al, context.es.byte(context.bx+5)); + if (!context.flags.z()) goto notspeed; + context.al = 0; + context.es.byte(context.bx+6) = context.al; + context._cmp(context.al, context.al); +notspeed: + {assert(stack_depth == context.stack.size()); return; } +forcenext: + context._cmp(context.al, context.al); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearsprites(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + context.al = 255; + context.cx = (32)*16; + while(context.cx--) context._stosb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void makesprite(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); +_tmp17: + context._cmp(context.es.byte(context.bx+15), 255); + if (context.flags.z()) goto _tmp17a; + context._add(context.bx, (32)); + goto _tmp17; +_tmp17a: + context.es.word(context.bx) = context.cx; + context.es.word(context.bx+10) = context.si; + context.es.word(context.bx+6) = context.dx; + context.es.word(context.bx+8) = context.di; + context.es.word(context.bx+2) = 0x0ffff; + context.es.byte(context.bx+15) = 0; + context.es.byte(context.bx+18) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void delsprite(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.bx; + context.cx = (32); + context.al = 255; + while(context.cx--) context._stosb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void spriteupdate(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + context.al = context.data.byte(kRyanon); + context.es.byte(context.bx+31) = context.al; + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + context.cx = 16; +_tmp18: + context.push(context.cx); + context.push(context.bx); + context.ax = context.es.word(context.bx); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto _tmp18a; + context.push(context.es); + context.push(context.ds); + context.cx = context.es.word(context.bx+2); + context.es.word(context.bx+24) = context.cx; + __dispatch_call(context, context.ax); + context.ds = context.pop(); + context.es = context.pop(); +_tmp18a: + context.bx = context.pop(); + context.cx = context.pop(); + context._cmp(context.data.byte(kNowinnewroom), 1); + if (context.flags.z()) goto _tmp18b; + context._add(context.bx, (32)); + if (--context.cx) goto _tmp18; +_tmp18b: + {assert(stack_depth == context.stack.size()); return; } +} + +void printsprites(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.cx = 0; +priorityloop: + context.push(context.cx); + context.data.byte(kPriority) = context.cl; + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + context.cx = 16; +prtspriteloop: + context.push(context.cx); + context.push(context.bx); + context.ax = context.es.word(context.bx); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto skipsprite; + context.al = context.data.byte(kPriority); + context._cmp(context.al, context.es.byte(context.bx+23)); + if (!context.flags.z()) goto skipsprite; + context._cmp(context.es.byte(context.bx+31), 1); + if (context.flags.z()) goto skipsprite; + printasprite(context); +skipsprite: + context.bx = context.pop(); + context.cx = context.pop(); + context._add(context.bx, (32)); + if (--context.cx) goto prtspriteloop; + context.cx = context.pop(); + context._inc(context.cx); + context._cmp(context.cx, 7); + if (!context.flags.z()) goto priorityloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void printasprite(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.si = context.bx; + context.ds = context.es.word(context.si+6); + context.al = context.es.byte(context.si+11); + context.ah = 0; + context._cmp(context.al, 220); + if (context.flags.c()) goto notnegative1; + context.ah = 255; +notnegative1: + context.bx = context.ax; + context._add(context.bx, context.data.word(kMapady)); + context.al = context.es.byte(context.si+10); + context.ah = 0; + context._cmp(context.al, 220); + if (context.flags.c()) goto notnegative2; + context.ah = 255; +notnegative2: + context.di = context.ax; + context._add(context.di, context.data.word(kMapadx)); + context.al = context.es.byte(context.si+15); + context.ah = 0; + context._cmp(context.es.byte(context.si+30), 0); + if (context.flags.z()) goto steadyframe; + context.ah = 8; +steadyframe: + context._cmp(context.data.byte(kPriority), 6); + if (!context.flags.z()) goto notquickp; +notquickp: + showframe(context); + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkone(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + context.al = context.ch; + context.ah = 0; + context.cl = 4; + context._shr(context.ax, context.cl); + context.dl = context.al; + context.cx = context.pop(); + context.al = context.cl; + context.ah = 0; + context.cl = 4; + context._shr(context.ax, context.cl); + context.ah = context.dl; + context.push(context.ax); + context.ch = 0; + context.cl = context.al; + context.push(context.cx); + context.al = context.ah; + context.ah = 0; + context.cx = 11; + context._mul(context.cx); + context.cx = context.pop(); + context._add(context.ax, context.cx); + context.cx = 3; + context._mul(context.cx); + context.si = context.ax; + context.ds = context.data.word(kBuffers); + context._add(context.si, (0+(180*10)+32+60+(32*32))); + context._lodsw(); + context.cx = context.ax; + context._lodsb(); + context.dx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void findsource(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kCurrentframe); + context._cmp(context.ax, 160); + if (!context.flags.c()) goto over1000; + context.ds = context.data.word(kReel1); + context.data.word(kTakeoff) = 0; + {assert(stack_depth == context.stack.size()); return; } +over1000: + context._cmp(context.ax, 320); + if (!context.flags.c()) goto over1001; + context.ds = context.data.word(kReel2); + context.data.word(kTakeoff) = 160; + {assert(stack_depth == context.stack.size()); return; } +over1001: + context.ds = context.data.word(kReel3); + context.data.word(kTakeoff) = 320; + {assert(stack_depth == context.stack.size()); return; } +} + +void initman(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kRyanx); + context.ah = context.data.byte(kRyany); + context.si = context.ax; + context.cx = 49464; + context.dx = context.data.word(kMainsprites); + context.di = 0; + makesprite(context); + context.es.byte(context.bx+23) = 4; + context.es.byte(context.bx+22) = 0; + context.es.byte(context.bx+29) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void mainman(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kResetmanxy), 1); + if (!context.flags.z()) goto notinnewroom; + context.data.byte(kResetmanxy) = 0; + context.al = context.data.byte(kRyanx); + context.ah = context.data.byte(kRyany); + context.es.word(context.bx+10) = context.ax; + context.es.byte(context.bx+29) = 0; + goto executewalk; +notinnewroom: + context._dec(context.es.byte(context.bx+22)); + context._cmp(context.es.byte(context.bx+22), -1); + if (context.flags.z()) goto executewalk; + {assert(stack_depth == context.stack.size()); return; } +executewalk: + context.es.byte(context.bx+22) = 0; + context.al = context.data.byte(kTurntoface); + context._cmp(context.al, context.data.byte(kFacing)); + if (context.flags.z()) goto facingok; + aboutturn(context); + goto notwalk; +facingok: + context._cmp(context.data.byte(kTurndirection), 0); + if (context.flags.z()) goto alreadyturned; + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto alreadyturned; + context.data.byte(kReasseschanges) = 1; + context.al = context.data.byte(kFacing); + context._cmp(context.al, context.data.byte(kLeavedirection)); + if (!context.flags.z()) goto alreadyturned; + checkforexit(context); +alreadyturned: + context.data.byte(kTurndirection) = 0; + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto walkman; + context.es.byte(context.bx+29) = 0; + goto notwalk; +walkman: + context.al = context.es.byte(context.bx+29); + context._inc(context.al); + context._cmp(context.al, 11); + if (!context.flags.z()) goto notanimend1; + context.al = 1; +notanimend1: + context.es.byte(context.bx+29) = context.al; + walking(context); + context._cmp(context.data.byte(kLinepointer), 254); + if (context.flags.z()) goto afterwalk; + context.al = context.data.byte(kFacing); + context._and(context.al, 1); + if (context.flags.z()) goto isdouble; + context.al = context.es.byte(context.bx+29); + context._cmp(context.al, 2); + if (context.flags.z()) goto afterwalk; + context._cmp(context.al, 7); + if (context.flags.z()) goto afterwalk; +isdouble: + walking(context); +afterwalk: + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto notwalk; + context.al = context.data.byte(kTurntoface); + context._cmp(context.al, context.data.byte(kFacing)); + if (!context.flags.z()) goto notwalk; + context.data.byte(kReasseschanges) = 1; + context.al = context.data.byte(kFacing); + context._cmp(context.al, context.data.byte(kLeavedirection)); + if (!context.flags.z()) goto notwalk; + checkforexit(context); +notwalk: + context.al = context.data.byte(kFacing); + context.ah = 0; + context.di = 1105; + context._add(context.di, context.ax); + context.al = context.cs.byte(context.di); + context._add(context.al, context.es.byte(context.bx+29)); + context.es.byte(context.bx+15) = context.al; + context.ax = context.es.word(context.bx+10); + context.data.byte(kRyanx) = context.al; + context.data.byte(kRyany) = context.ah; + {assert(stack_depth == context.stack.size()); return; } +} + +void aboutturn(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kTurndirection), 1); + if (context.flags.z()) goto incdir; + context._cmp(context.data.byte(kTurndirection), -1); + if (context.flags.z()) goto decdir; + context.al = context.data.byte(kFacing); + context._sub(context.al, context.data.byte(kTurntoface)); + if (!context.flags.c()) goto higher; + context._neg(context.al); + context._cmp(context.al, 4); + if (!context.flags.c()) goto decdir; + goto incdir; +higher: + context._cmp(context.al, 4); + if (!context.flags.c()) goto incdir; + goto decdir; +incdir: + context.data.byte(kTurndirection) = 1; + context.al = context.data.byte(kFacing); + context._inc(context.al); + context._and(context.al, 7); + context.data.byte(kFacing) = context.al; + context.es.byte(context.bx+29) = 0; + {assert(stack_depth == context.stack.size()); return; } +decdir: + context.data.byte(kTurndirection) = -1; + context.al = context.data.byte(kFacing); + context._dec(context.al); + context._and(context.al, 7); + context.data.byte(kFacing) = context.al; + context.es.byte(context.bx+29) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void walking(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLinedirection), 0); + if (context.flags.z()) goto normalwalk; + context.al = context.data.byte(kLinepointer); + context._dec(context.al); + context.data.byte(kLinepointer) = context.al; + context._cmp(context.al, 200); + if (!context.flags.c()) goto endofline; + goto continuewalk; +normalwalk: + context.al = context.data.byte(kLinepointer); + context._inc(context.al); + context.data.byte(kLinepointer) = context.al; + context._cmp(context.al, context.data.byte(kLinelength)); + if (!context.flags.c()) goto endofline; +continuewalk: + context.ah = 0; + context._add(context.ax, context.ax); + context.push(context.es); + context.push(context.bx); + context.dx = context.data; + context.es = context.dx; + context.bx = 8173; + context._add(context.bx, context.ax); + context.ax = context.es.word(context.bx); + context.bx = context.pop(); + context.es = context.pop(); +stillline: + context.es.word(context.bx+10) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +endofline: + context.data.byte(kLinepointer) = 254; + context.al = context.data.byte(kDestination); + context.data.byte(kManspath) = context.al; + context._cmp(context.al, context.data.byte(kFinaldest)); + if (context.flags.z()) goto finishedwalk; + context.al = context.data.byte(kFinaldest); + context.data.byte(kDestination) = context.al; + context.push(context.es); + context.push(context.bx); + autosetwalk(context); + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +finishedwalk: + facerightway(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void facerightway(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + getroomspaths(context); + context.al = context.data.byte(kManspath); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx+7); + context.data.byte(kTurntoface) = context.al; + context.data.byte(kLeavedirection) = context.al; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkforexit(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = context.data.byte(kRyanx); + context._add(context.cl, 12); + context.ch = context.data.byte(kRyany); + context._add(context.ch, 12); + checkone(context); + context.data.byte(kLastflag) = context.cl; + context.data.byte(kLastflagex) = context.ch; + context.data.byte(kFlagx) = context.dl; + context.data.byte(kFlagy) = context.dh; + context.al = context.data.byte(kLastflag); + context._test(context.al, 64); + if (context.flags.z()) goto notnewdirect; + context.al = context.data.byte(kLastflagex); + context.data.byte(kAutolocation) = context.al; + {assert(stack_depth == context.stack.size()); return; } +notnewdirect: + context._test(context.al, 32); + if (context.flags.z()) goto notleave; + context.push(context.es); + context.push(context.bx); + context._cmp(context.data.byte(kReallocation), 2); + if (!context.flags.z()) goto notlouis; + context.bl = 0; + context.push(context.bx); + context.al = 'W'; + context.ah = 'E'; + context.cl = 'T'; + context.ch = 'A'; + isryanholding(context); + context.bx = context.pop(); + if (context.flags.z()) goto noshoe1; + context._inc(context.bl); +noshoe1: + context.push(context.bx); + context.al = 'W'; + context.ah = 'E'; + context.cl = 'T'; + context.ch = 'B'; + isryanholding(context); + context.bx = context.pop(); + if (context.flags.z()) goto noshoe2; + context._inc(context.bl); +noshoe2: + context._cmp(context.bl, 2); + if (context.flags.z()) goto notlouis; + context.al = 42; + context._cmp(context.bl, 0); + if (context.flags.z()) goto notravmessage; + context._inc(context.al); +notravmessage: + context.cx = 80; + context.dx = 10; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + context.al = context.data.byte(kFacing); + context._add(context.al, 4); + context._and(context.al, 7); + context.data.byte(kTurntoface) = context.al; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +notlouis: + context.bx = context.pop(); + context.es = context.pop(); + context.data.byte(kNeedtotravel) = 1; + {assert(stack_depth == context.stack.size()); return; } +notleave: + context._test(context.al, 4); + if (context.flags.z()) goto notaleft; + adjustleft(context); + {assert(stack_depth == context.stack.size()); return; } +notaleft: + context._test(context.al, 2); + if (context.flags.z()) goto notaright; + adjustright(context); + {assert(stack_depth == context.stack.size()); return; } +notaright: + context._test(context.al, 8); + if (context.flags.z()) goto notadown; + adjustdown(context); + {assert(stack_depth == context.stack.size()); return; } +notadown: + context._test(context.al, 16); + if (context.flags.z()) goto notanup; + adjustup(context); + {assert(stack_depth == context.stack.size()); return; } +notanup: + {assert(stack_depth == context.stack.size()); return; } +} + +void adjustdown(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context._add(context.data.byte(kMapy), 10); + context.al = context.data.byte(kLastflagex); + context.cl = 16; + context._mul(context.cl); + context.es.byte(context.bx+11) = context.al; + context.data.byte(kNowinnewroom) = 1; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void adjustup(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context._sub(context.data.byte(kMapy), 10); + context.al = context.data.byte(kLastflagex); + context.cl = 16; + context._mul(context.cl); + context.es.byte(context.bx+11) = context.al; + context.data.byte(kNowinnewroom) = 1; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void adjustleft(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.data.byte(kLastflag) = 0; + context._sub(context.data.byte(kMapx), 11); + context.al = context.data.byte(kLastflagex); + context.cl = 16; + context._mul(context.cl); + context.es.byte(context.bx+10) = context.al; + context.data.byte(kNowinnewroom) = 1; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void adjustright(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context._add(context.data.byte(kMapx), 11); + context.al = context.data.byte(kLastflagex); + context.cl = 16; + context._mul(context.cl); + context._sub(context.al, 2); + context.es.byte(context.bx+10) = context.al; + context.data.byte(kNowinnewroom) = 1; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void reminders(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 24); + if (!context.flags.z()) goto notinedenslift; + context._cmp(context.data.byte(kMapx), 44); + if (!context.flags.z()) goto notinedenslift; + context._cmp(context.data.byte(kProgresspoints), 0); + if (!context.flags.z()) goto notfirst; + context.al = 'D'; + context.ah = 'K'; + context.cl = 'E'; + context.ch = 'Y'; + isryanholding(context); + if (context.flags.z()) goto forgotone; + context.al = 'C'; + context.ah = 'S'; + context.cl = 'H'; + context.ch = 'R'; + findexobject(context); + context._cmp(context.al, (114)); + if (context.flags.z()) goto forgotone; + context.ax = context.es.word(context.bx+2); + context._cmp(context.al, 4); + if (!context.flags.z()) goto forgotone; + context._cmp(context.ah, 255); + if (context.flags.z()) goto havegotcard; + context.cl = 'P'; + context.ch = 'U'; + context.dl = 'R'; + context.dh = 'S'; + context._xchg(context.al, context.ah); + compare(context); + if (!context.flags.z()) goto forgotone; +havegotcard: + context._inc(context.data.byte(kProgresspoints)); +notfirst: + {assert(stack_depth == context.stack.size()); return; } +forgotone: + context.al = 50; + context.bl = 54; + context.bh = 70; + context.cx = 48; + context.dx = 8; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notinedenslift: + {assert(stack_depth == context.stack.size()); return; } +} + +void initrain(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)); + context.bx = 1113; +checkmorerain: + context.al = context.cs.byte(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto finishinitrain; + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto checkrain; + context.al = context.cs.byte(context.bx+1); + context._cmp(context.al, context.data.byte(kMapx)); + if (!context.flags.z()) goto checkrain; + context.al = context.cs.byte(context.bx+2); + context._cmp(context.al, context.data.byte(kMapy)); + if (!context.flags.z()) goto checkrain; + context.al = context.cs.byte(context.bx+3); + context.data.byte(kRainspace) = context.al; + goto dorain; +checkrain: + context._add(context.bx, 4); + goto checkmorerain; +dorain: + context.cx = 4; +initraintop: + randomnumber(context); + context._and(context.al, 31); + context._add(context.al, 3); + context._cmp(context.al, context.data.byte(kRainspace)); + if (!context.flags.c()) goto initraintop; + context._add(context.cl, context.al); + context._cmp(context.cl, context.data.byte(kMapxsize)); + if (!context.flags.c()) goto initrainside; + context.push(context.cx); + splitintolines(context); + context.cx = context.pop(); + goto initraintop; +initrainside: + context.cl = context.data.byte(kMapxsize); + context._dec(context.cl); +initrainside2: + randomnumber(context); + context._and(context.al, 31); + context._add(context.al, 3); + context._cmp(context.al, context.data.byte(kRainspace)); + if (!context.flags.c()) goto initrainside2; + context._add(context.ch, context.al); + context._cmp(context.ch, context.data.byte(kMapysize)); + if (!context.flags.c()) goto finishinitrain; + context.push(context.cx); + splitintolines(context); + context.cx = context.pop(); + goto initrainside2; +finishinitrain: + context.al = 255; + context._stosb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void splitintolines(Context & context) { + uint stack_depth = context.stack.size(); +lookforlinestart: + getblockofpixel(context); + context._cmp(context.al, 0); + if (!context.flags.z()) goto foundlinestart; + context._dec(context.cl); + context._inc(context.ch); + context._cmp(context.cl, 0); + if (context.flags.z()) goto endofthisline; + context._cmp(context.ch, context.data.byte(kMapysize)); + if (!context.flags.c()) goto endofthisline; + goto lookforlinestart; +foundlinestart: + context.es.word(context.di) = context.cx; + context.bh = 1; +lookforlineend: + getblockofpixel(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundlineend; + context._dec(context.cl); + context._inc(context.ch); + context._cmp(context.cl, 0); + if (context.flags.z()) goto foundlineend; + context._cmp(context.ch, context.data.byte(kMapysize)); + if (!context.flags.c()) goto foundlineend; + context._inc(context.bh); + goto lookforlineend; +foundlineend: + context.push(context.cx); + context.es.byte(context.di+2) = context.bh; + randomnumber(context); + context.es.byte(context.di+3) = context.al; + randomnumber(context); + context.es.byte(context.di+4) = context.al; + randomnumber(context); + context._and(context.al, 3); + context._add(context.al, 4); + context.es.byte(context.di+5) = context.al; + context._add(context.di, 6); + context.cx = context.pop(); + context._cmp(context.cl, 0); + if (context.flags.z()) goto endofthisline; + context._cmp(context.ch, context.data.byte(kMapysize)); + if (!context.flags.c()) goto endofthisline; + goto lookforlinestart; +endofthisline: + {assert(stack_depth == context.stack.size()); return; } +} + +void getblockofpixel(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + context.push(context.es); + context.push(context.di); + context.ax = context.data.word(kMapxstart); + context._add(context.cl, context.al); + context.ax = context.data.word(kMapystart); + context._add(context.ch, context.al); + checkone(context); + context._and(context.cl, 1); + if (!context.flags.z()) goto failrain; + context.di = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +failrain: + context.di = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void showrain(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kMainsprites); + context.si = 6*58; + context.ax = context.ds.word(context.si+2); + context.si = context.ax; + context._add(context.si, 2080); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)); + context.es = context.data.word(kBuffers); + context._cmp(context.es.byte(context.bx), 255); + if (context.flags.z()) goto nothunder; +morerain: + context.es = context.data.word(kBuffers); + context._cmp(context.es.byte(context.bx), 255); + if (context.flags.z()) goto finishrain; + context.al = context.es.byte(context.bx+1); + context.ah = 0; + context._add(context.ax, context.data.word(kMapady)); + context._add(context.ax, context.data.word(kMapystart)); + context.cx = 320; + context._mul(context.cx); + context.cl = context.es.byte(context.bx); + context.ch = 0; + context._add(context.ax, context.cx); + context._add(context.ax, context.data.word(kMapadx)); + context._add(context.ax, context.data.word(kMapxstart)); + context.di = context.ax; + context.cl = context.es.byte(context.bx+2); + context.ch = 0; + context.ax = context.es.word(context.bx+3); + context.dl = context.es.byte(context.bx+5); + context.dh = 0; + context._sub(context.ax, context.dx); + context._and(context.ax, 511); + context.es.word(context.bx+3) = context.ax; + context._add(context.bx, 6); + context.push(context.si); + context._add(context.si, context.ax); + context.es = context.data.word(kWorkspace); + context.ah = 0; + context.dx = 320-2; +rainloop: + context._lodsb(); + context._cmp(context.al, context.ah); + if (context.flags.z()) goto noplot; + context._stosb(); + context._add(context.di, context.dx); + if (--context.cx) goto rainloop; + context.si = context.pop(); + goto morerain; +noplot: + context._add(context.di, 320-1); + if (--context.cx) goto rainloop; + context.si = context.pop(); + goto morerain; +finishrain: + context._cmp(context.data.word(kCh1blockstocopy), 0); + if (!context.flags.z()) goto nothunder; + context._cmp(context.data.byte(kReallocation), 2); + if (!context.flags.z()) goto notlouisthund; + context._cmp(context.data.byte(kBeenmugged), 1); + if (!context.flags.z()) goto nothunder; +notlouisthund: + context._cmp(context.data.byte(kReallocation), 55); + if (context.flags.z()) goto nothunder; + randomnum1(context); + context._cmp(context.al, 1); + if (!context.flags.c()) goto nothunder; + context.al = 7; + context._cmp(context.data.byte(kCh0playing), 6); + if (context.flags.z()) goto isthunder1; + context.al = 4; +isthunder1: + playchannel1(context); +nothunder: + {assert(stack_depth == context.stack.size()); return; } +} + +void backobject(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kSetdat); + context.di = context.es.word(context.bx+20); + context.al = context.es.byte(context.bx+18); + context._cmp(context.al, 0); + if (context.flags.z()) goto _tmp48z; + context._dec(context.al); + context.es.byte(context.bx+18) = context.al; + goto finishback; +_tmp48z: + context.al = context.ds.byte(context.di+7); + context.es.byte(context.bx+18) = context.al; + context.al = context.ds.byte(context.di+8); + context._cmp(context.al, 6); + if (!context.flags.z()) goto notwidedoor; + widedoor(context); + goto finishback; +notwidedoor: + context._cmp(context.al, 5); + if (!context.flags.z()) goto notrandom; + random(context); + goto finishback; +notrandom: + context._cmp(context.al, 4); + if (!context.flags.z()) goto notlockdoor; + lockeddoorway(context); + goto finishback; +notlockdoor: + context._cmp(context.al, 3); + if (!context.flags.z()) goto notlift; + liftsprite(context); + goto finishback; +notlift: + context._cmp(context.al, 2); + if (!context.flags.z()) goto notdoor; + doorway(context); + goto finishback; +notdoor: + context._cmp(context.al, 1); + if (!context.flags.z()) goto steadyob; + constant(context); + goto finishback; +steadyob: + steady(context); +finishback: + {assert(stack_depth == context.stack.size()); return; } +} + +void liftsprite(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kLiftflag); + context._cmp(context.al, 0); + if (context.flags.z()) goto liftclosed; + context._cmp(context.al, 1); + if (context.flags.z()) goto liftopen; + context._cmp(context.al, 3); + if (context.flags.z()) goto openlift; + context.al = context.es.byte(context.bx+19); + context._cmp(context.al, 0); + if (context.flags.z()) goto finishclose; + context._dec(context.al); + context._cmp(context.al, 11); + if (!context.flags.z()) goto pokelift; + context.push(context.ax); + context.al = 3; + liftnoise(context); + context.ax = context.pop(); + goto pokelift; +finishclose: + context.data.byte(kLiftflag) = 0; + {assert(stack_depth == context.stack.size()); return; } +openlift: + context.al = context.es.byte(context.bx+19); + context._cmp(context.al, 12); + if (context.flags.z()) goto endoflist; + context._inc(context.al); + context._cmp(context.al, 1); + if (!context.flags.z()) goto pokelift; + context.push(context.ax); + context.al = 2; + liftnoise(context); + context.ax = context.pop(); +pokelift: + context.es.byte(context.bx+19) = context.al; + context.ah = 0; + context.push(context.di); + context._add(context.di, context.ax); + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + {assert(stack_depth == context.stack.size()); return; } +endoflist: + context.data.byte(kLiftflag) = 1; + {assert(stack_depth == context.stack.size()); return; } +liftopen: + context.al = context.data.byte(kLiftpath); + context.push(context.es); + context.push(context.bx); + turnpathon(context); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.data.byte(kCounttoclose), 0); + if (context.flags.z()) goto nocountclose; + context._dec(context.data.byte(kCounttoclose)); + context._cmp(context.data.byte(kCounttoclose), 0); + if (!context.flags.z()) goto nocountclose; + context.data.byte(kLiftflag) = 2; +nocountclose: + context.al = 12; + goto pokelift; +liftclosed: + context.al = context.data.byte(kLiftpath); + context.push(context.es); + context.push(context.bx); + turnpathoff(context); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.data.byte(kCounttoopen), 0); + if (context.flags.z()) goto nocountopen; + context._dec(context.data.byte(kCounttoopen)); + context._cmp(context.data.byte(kCounttoopen), 0); + if (!context.flags.z()) goto nocountopen; + context.data.byte(kLiftflag) = 3; +nocountopen: + context.al = 0; + goto pokelift; +} + +void liftnoise(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 5); + if (context.flags.z()) goto hissnoise; + context._cmp(context.data.byte(kReallocation), 21); + if (context.flags.z()) goto hissnoise; + playchannel1(context); + {assert(stack_depth == context.stack.size()); return; } +hissnoise: + context.al = 13; + playchannel1(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void random(Context & context) { + uint stack_depth = context.stack.size(); + randomnum1(context); + context.push(context.di); + context._and(context.ax, 7); + context._add(context.di, 18); + context._add(context.di, context.ax); + context.al = context.ds.byte(context.di); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void steady(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.ds.byte(context.di+18); + context.ds.byte(context.di+17) = context.al; + context.es.byte(context.bx+15) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void constant(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.es.byte(context.bx+19)); + context.cl = context.es.byte(context.bx+19); + context.ch = 0; + context._add(context.di, context.cx); + context._cmp(context.ds.byte(context.di+18), 255); + if (!context.flags.z()) goto gotconst; + context._sub(context.di, context.cx); + context.cx = 0; + context.es.byte(context.bx+19) = context.cl; +gotconst: + context.al = context.ds.byte(context.di+18); + context._sub(context.di, context.cx); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void doorway(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kDoorcheck1) = -24; + context.data.byte(kDoorcheck2) = 10; + context.data.byte(kDoorcheck3) = -30; + context.data.byte(kDoorcheck4) = 10; + dodoor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void widedoor(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kDoorcheck1) = -24; + context.data.byte(kDoorcheck2) = 24; + context.data.byte(kDoorcheck3) = -30; + context.data.byte(kDoorcheck4) = 24; + dodoor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dodoor(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kRyanx); + context.ah = context.data.byte(kRyany); + context.cl = context.es.byte(context.bx+10); + context.ch = context.es.byte(context.bx+11); + context._cmp(context.al, context.cl); + if (!context.flags.c()) goto rtofdoor; + context._sub(context.al, context.cl); + context._cmp(context.al, context.data.byte(kDoorcheck1)); + if (!context.flags.c()) goto upordown; + goto shutdoor; +rtofdoor: + context._sub(context.al, context.cl); + context._cmp(context.al, context.data.byte(kDoorcheck2)); + if (!context.flags.c()) goto shutdoor; +upordown: + context._cmp(context.ah, context.ch); + if (!context.flags.c()) goto botofdoor; + context._sub(context.ah, context.ch); + context._cmp(context.ah, context.data.byte(kDoorcheck3)); + if (context.flags.c()) goto shutdoor; + goto opendoor; +botofdoor: + context._sub(context.ah, context.ch); + context._cmp(context.ah, context.data.byte(kDoorcheck4)); + if (!context.flags.c()) goto shutdoor; +opendoor: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.data.byte(kThroughdoor), 1); + if (!context.flags.z()) goto notthrough; + context._cmp(context.cl, 0); + if (!context.flags.z()) goto notthrough; + context.cl = 6; +notthrough: + context._inc(context.cl); + context._cmp(context.cl, 1); + if (!context.flags.z()) goto notdoorsound2; + context.al = 0; + context._cmp(context.data.byte(kReallocation), 5); + if (!context.flags.z()) goto nothoteldoor2; + context.al = 13; +nothoteldoor2: + playchannel1(context); +notdoorsound2: + context.ch = 0; + context.push(context.di); + context._add(context.di, context.cx); + context.al = context.ds.byte(context.di+18); + context._cmp(context.al, 255); + if (!context.flags.z()) goto atlast1; + context._dec(context.di); + context._dec(context.cl); +atlast1: + context.es.byte(context.bx+19) = context.cl; + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + context.data.byte(kThroughdoor) = 1; + {assert(stack_depth == context.stack.size()); return; } +shutdoor: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.cl, 5); + if (!context.flags.z()) goto notdoorsound1; + context.al = 1; + context._cmp(context.data.byte(kReallocation), 5); + if (!context.flags.z()) goto nothoteldoor1; + context.al = 13; +nothoteldoor1: + playchannel1(context); +notdoorsound1: + context._cmp(context.cl, 0); + if (context.flags.z()) goto atlast2; + context._dec(context.cl); + context.es.byte(context.bx+19) = context.cl; +atlast2: + context.ch = 0; + context.push(context.di); + context._add(context.di, context.cx); + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + context._cmp(context.cl, 5); + if (!context.flags.z()) goto notnearly; + context.data.byte(kThroughdoor) = 0; +notnearly: + {assert(stack_depth == context.stack.size()); return; } +} + +void lockeddoorway(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kRyanx); + context.ah = context.data.byte(kRyany); + context.cl = context.es.byte(context.bx+10); + context.ch = context.es.byte(context.bx+11); + context._cmp(context.al, context.cl); + if (!context.flags.c()) goto rtofdoor2; + context._sub(context.al, context.cl); + context._cmp(context.al, -24); + if (!context.flags.c()) goto upordown2; + goto shutdoor2; +rtofdoor2: + context._sub(context.al, context.cl); + context._cmp(context.al, 10); + if (!context.flags.c()) goto shutdoor2; +upordown2: + context._cmp(context.ah, context.ch); + if (!context.flags.c()) goto botofdoor2; + context._sub(context.ah, context.ch); + context._cmp(context.ah, -30); + if (context.flags.c()) goto shutdoor2; + goto opendoor2; +botofdoor2: + context._sub(context.ah, context.ch); + context._cmp(context.ah, 12); + if (!context.flags.c()) goto shutdoor2; +opendoor2: + context._cmp(context.data.byte(kThroughdoor), 1); + if (context.flags.z()) goto mustbeopen; + context._cmp(context.data.byte(kLockstatus), 1); + if (context.flags.z()) goto shutdoor; +mustbeopen: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.cl, 1); + if (!context.flags.z()) goto notdoorsound4; + context.al = 0; + playchannel1(context); +notdoorsound4: + context._cmp(context.cl, 6); + if (!context.flags.z()) goto noturnonyet; + context.al = context.data.byte(kDoorpath); + context.push(context.es); + context.push(context.bx); + turnpathon(context); + context.bx = context.pop(); + context.es = context.pop(); +noturnonyet: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.data.byte(kThroughdoor), 1); + if (!context.flags.z()) goto notthrough2; + context._cmp(context.cl, 0); + if (!context.flags.z()) goto notthrough2; + context.cl = 6; +notthrough2: + context._inc(context.cl); + context.ch = 0; + context.push(context.di); + context._add(context.di, context.cx); + context.al = context.ds.byte(context.di+18); + context._cmp(context.al, 255); + if (!context.flags.z()) goto atlast3; + context._dec(context.di); + context._dec(context.cl); +atlast3: + context.es.byte(context.bx+19) = context.cl; + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + context._cmp(context.cl, 5); + if (!context.flags.z()) goto justshutting; + context.data.byte(kThroughdoor) = 1; +justshutting: + {assert(stack_depth == context.stack.size()); return; } +shutdoor2: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.cl, 5); + if (!context.flags.z()) goto notdoorsound3; + context.al = 1; + playchannel1(context); +notdoorsound3: + context._cmp(context.cl, 0); + if (context.flags.z()) goto atlast4; + context._dec(context.cl); + context.es.byte(context.bx+19) = context.cl; +atlast4: + context.ch = 0; + context.data.byte(kThroughdoor) = 0; + context.push(context.di); + context._add(context.di, context.cx); + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + context._cmp(context.cl, 0); + if (!context.flags.z()) goto notlocky; + context.al = context.data.byte(kDoorpath); + context.push(context.es); + context.push(context.bx); + turnpathoff(context); + context.bx = context.pop(); + context.es = context.pop(); + context.data.byte(kLockstatus) = 1; +notlocky: + {assert(stack_depth == context.stack.size()); return; } +/*continuing to unbounded code: shutdoor from dodoor:60-87*/ +shutdoor: + context.cl = context.es.byte(context.bx+19); + context._cmp(context.cl, 5); + if (!context.flags.z()) goto notdoorsound1; + context.al = 1; + context._cmp(context.data.byte(kReallocation), 5); + if (!context.flags.z()) goto nothoteldoor1; + context.al = 13; +nothoteldoor1: + playchannel1(context); +notdoorsound1: + context._cmp(context.cl, 0); + if (context.flags.z()) goto atlast2; + context._dec(context.cl); + context.es.byte(context.bx+19) = context.cl; +atlast2: + context.ch = 0; + context.push(context.di); + context._add(context.di, context.cx); + context.al = context.ds.byte(context.di+18); + context.di = context.pop(); + context.es.byte(context.bx+15) = context.al; + context.ds.byte(context.di+17) = context.al; + context._cmp(context.cl, 5); + if (!context.flags.z()) goto notnearly; + context.data.byte(kThroughdoor) = 0; +notnearly: + {assert(stack_depth == context.stack.size()); return; } + {assert(stack_depth == context.stack.size()); return; } +} + +void updatepeople(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)); + context.data.word(kListpos) = context.di; + context.cx = 12*5; + context.al = 255; + while(context.cx--) context._stosb(); + context._inc(context.data.word(kMaintimer)); + context.es = context.cs; + context.bx = 534; + context.di = 991; +updateloop: + context.al = context.es.byte(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto endupdate; + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto notinthisroom; + context.cx = context.es.word(context.bx+1); + context._cmp(context.cl, context.data.byte(kMapx)); + if (!context.flags.z()) goto notinthisroom; + context._cmp(context.ch, context.data.byte(kMapy)); + if (!context.flags.z()) goto notinthisroom; + context.push(context.di); + context.ax = context.cs.word(context.di); + __dispatch_call(context, context.ax); + context.di = context.pop(); +notinthisroom: + context._add(context.bx, 8); + context._add(context.di, 2); + goto updateloop; +endupdate: + {assert(stack_depth == context.stack.size()); return; } +} + +void getreelframeax(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ds); + context.data.word(kCurrentframe) = context.ax; + findsource(context); + context.es = context.ds; + context.ds = context.pop(); + context.ax = context.data.word(kCurrentframe); + context._sub(context.ax, context.data.word(kTakeoff)); + context._add(context.ax, context.ax); + context.cx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.cx); + context.bx = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void reelsonscreen(Context & context) { + uint stack_depth = context.stack.size(); + reconstruct(context); + updatepeople(context); + watchreel(context); + showrain(context); + usetimedtext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void plotreel(Context & context) { + uint stack_depth = context.stack.size(); + getreelstart(context); +retryreel: + context.push(context.es); + context.push(context.si); + context.ax = context.es.word(context.si+2); + context._cmp(context.al, 220); + if (context.flags.c()) goto normalreel; + context._cmp(context.al, 255); + if (context.flags.z()) goto normalreel; + dealwithspecial(context); + context._inc(context.data.word(kReelpointer)); + context.si = context.pop(); + context.es = context.pop(); + context._add(context.si, 40); + goto retryreel; +normalreel: + context.cx = 8; +plotloop: + context.push(context.cx); + context.push(context.es); + context.push(context.si); + context.ax = context.es.word(context.si); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto notplot; + showreelframe(context); +notplot: + context.si = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context._add(context.si, 5); + if (--context.cx) goto plotloop; + soundonreels(context); + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void soundonreels(Context & context) { + uint stack_depth = context.stack.size(); + context.bl = context.data.byte(kReallocation); + context._add(context.bl, context.bl); + context._xor(context.bh, context.bh); + context._add(context.bx, 1214); + context.si = context.cs.word(context.bx); +reelsoundloop: + context.al = context.cs.byte(context.si); + context._cmp(context.al, 255); + if (context.flags.z()) goto endreelsound; + context.ax = context.cs.word(context.si+1); + context._cmp(context.ax, context.data.word(kReelpointer)); + if (!context.flags.z()) goto skipreelsound; + context._cmp(context.ax, context.data.word(kLastsoundreel)); + if (context.flags.z()) goto skipreelsound; + context.data.word(kLastsoundreel) = context.ax; + context.al = context.cs.byte(context.si); + context._cmp(context.al, 64); + if (context.flags.c()) { playchannel1(context); return; }; + context._cmp(context.al, 128); + if (context.flags.c()) goto channel0once; + context._and(context.al, 63); + context.ah = 255; + { playchannel0(context); return; }; +channel0once: + context._and(context.al, 63); + context.ah = 0; + { playchannel0(context); return; }; +skipreelsound: + context._add(context.si, 3); + goto reelsoundloop; +endreelsound: + context.ax = context.data.word(kLastsoundreel); + context._cmp(context.ax, context.data.word(kReelpointer)); + if (context.flags.z()) goto nochange2; + context.data.word(kLastsoundreel) = -1; +nochange2: + {assert(stack_depth == context.stack.size()); return; } +} + +void reconstruct(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kHavedoneobs), 0); + if (context.flags.z()) goto noneedtorecon; + context.data.byte(kNewobs) = 1; + drawfloor(context); + spriteupdate(context); + printsprites(context); + context.data.byte(kHavedoneobs) = 0; +noneedtorecon: + {assert(stack_depth == context.stack.size()); return; } +} + +void dealwithspecial(Context & context) { + uint stack_depth = context.stack.size(); + context._sub(context.al, 220); + context._cmp(context.al, 0); + if (!context.flags.z()) goto notplset; + context.al = context.ah; + placesetobject(context); + context.data.byte(kHavedoneobs) = 1; + {assert(stack_depth == context.stack.size()); return; } +notplset: + context._cmp(context.al, 1); + if (!context.flags.z()) goto notremset; + context.al = context.ah; + removesetobject(context); + context.data.byte(kHavedoneobs) = 1; + {assert(stack_depth == context.stack.size()); return; } +notremset: + context._cmp(context.al, 2); + if (!context.flags.z()) goto notplfree; + context.al = context.ah; + placefreeobject(context); + context.data.byte(kHavedoneobs) = 1; + {assert(stack_depth == context.stack.size()); return; } +notplfree: + context._cmp(context.al, 3); + if (!context.flags.z()) goto notremfree; + context.al = context.ah; + removefreeobject(context); + context.data.byte(kHavedoneobs) = 1; + {assert(stack_depth == context.stack.size()); return; } +notremfree: + context._cmp(context.al, 4); + if (!context.flags.z()) goto notryanoff; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notryanoff: + context._cmp(context.al, 5); + if (!context.flags.z()) goto notryanon; + context.data.byte(kTurntoface) = context.ah; + context.data.byte(kFacing) = context.ah; + switchryanon(context); + {assert(stack_depth == context.stack.size()); return; } +notryanon: + context._cmp(context.al, 6); + if (!context.flags.z()) goto notchangeloc; + context.data.byte(kNewlocation) = context.ah; + {assert(stack_depth == context.stack.size()); return; } +notchangeloc: + movemap(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void movemap(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ah, 32); + if (!context.flags.z()) goto notmapup2; + context._sub(context.data.byte(kMapy), 20); + context.data.byte(kNowinnewroom) = 1; + {assert(stack_depth == context.stack.size()); return; } +notmapup2: + context._cmp(context.ah, 16); + if (!context.flags.z()) goto notmapupspec; + context._sub(context.data.byte(kMapy), 10); + context.data.byte(kNowinnewroom) = 1; + {assert(stack_depth == context.stack.size()); return; } +notmapupspec: + context._cmp(context.ah, 8); + if (!context.flags.z()) goto notmapdownspec; + context._add(context.data.byte(kMapy), 10); + context.data.byte(kNowinnewroom) = 1; + {assert(stack_depth == context.stack.size()); return; } +notmapdownspec: + context._cmp(context.ah, 2); + if (!context.flags.z()) goto notmaprightspec; + context._add(context.data.byte(kMapx), 11); + context.data.byte(kNowinnewroom) = 1; + {assert(stack_depth == context.stack.size()); return; } +notmaprightspec: + context._sub(context.data.byte(kMapx), 11); + context.data.byte(kNowinnewroom) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void getreelstart(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kReelpointer); + context.cx = 40; + context._mul(context.cx); + context.es = context.data.word(kReels); + context.si = context.ax; + context._add(context.si, (0+(36*144))); + {assert(stack_depth == context.stack.size()); return; } +} + +void showreelframe(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.si+2); + context.ah = 0; + context.di = context.ax; + context._add(context.di, context.data.word(kMapadx)); + context.al = context.es.byte(context.si+3); + context.bx = context.ax; + context._add(context.bx, context.data.word(kMapady)); + context.ax = context.es.word(context.si); + context.data.word(kCurrentframe) = context.ax; + findsource(context); + context.ax = context.data.word(kCurrentframe); + context._sub(context.ax, context.data.word(kTakeoff)); + context.ah = 8; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void deleverything(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kMapysize); + context.ah = 0; + context._add(context.ax, context.data.word(kMapoffsety)); + context._cmp(context.ax, 182); + if (!context.flags.c()) goto bigroom; + maptopanel(context); + {assert(stack_depth == context.stack.size()); return; } +bigroom: + context._sub(context.data.byte(kMapysize), 8); + maptopanel(context); + context._add(context.data.byte(kMapysize), 8); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpeverything(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)); +dumpevery1: + context.ax = context.es.word(context.bx); + context.cx = context.es.word(context.bx+2); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto finishevery1; + context._cmp(context.ax, context.es.word(context.bx+(40*5))); + if (!context.flags.z()) goto notskip1; + context._cmp(context.cx, context.es.word(context.bx+(40*5)+2)); + if (context.flags.z()) goto skip1; +notskip1: + context.push(context.bx); + context.push(context.es); + context.push(context.ds); + context.bl = context.ah; + context.bh = 0; + context.ah = 0; + context.di = context.ax; + context._add(context.di, context.data.word(kMapadx)); + context._add(context.bx, context.data.word(kMapady)); + multidump(context); + context.ds = context.pop(); + context.es = context.pop(); + context.bx = context.pop(); +skip1: + context._add(context.bx, 5); + goto dumpevery1; +finishevery1: + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40))+(40*5); +dumpevery2: + context.ax = context.es.word(context.bx); + context.cx = context.es.word(context.bx+2); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto finishevery2; + context.push(context.bx); + context.push(context.es); + context.push(context.ds); + context.bl = context.ah; + context.bh = 0; + context.ah = 0; + context.di = context.ax; + context._add(context.di, context.data.word(kMapadx)); + context._add(context.bx, context.data.word(kMapady)); + multidump(context); + context.ds = context.pop(); + context.es = context.pop(); + context.bx = context.pop(); + context._add(context.bx, 5); + goto dumpevery2; +finishevery2: + {assert(stack_depth == context.stack.size()); return; } +} + +void allocatework(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = 0x1000; + allocatemem(context); + context.data.word(kWorkspace) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void readabyte(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.si, 30000); + if (!context.flags.z()) goto notendblock; + context.push(context.bx); + context.push(context.es); + context.push(context.di); + context.push(context.ds); + context.push(context.si); + readoneblock(context); + context.si = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.es = context.pop(); + context.bx = context.pop(); + context.si = 0; +notendblock: + context._lodsb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadpalfromiff(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2481; + openfile(context); + context.cx = 2000; + context.ds = context.data.word(kMapstore); + context.dx = 0; + readfromfile(context); + closefile(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + context.ds = context.data.word(kMapstore); + context.si = 0x30; + context.cx = 768; +palloop: + context._lodsb(); + context._shr(context.al, 1); + context._shr(context.al, 1); + context._cmp(context.data.byte(kBrightness), 1); + if (!context.flags.z()) goto nought; + context._cmp(context.al, 0); + if (context.flags.z()) goto nought; + context.ah = context.al; + context._shr(context.ah, 1); + context._add(context.al, context.ah); + context._shr(context.ah, 1); + context._add(context.al, context.ah); + context._cmp(context.al, 64); + if (context.flags.c()) goto nought; + context.al = 63; +nought: + context._stosb(); + if (--context.cx) goto palloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void paneltomap(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kMapxstart); + context._add(context.di, context.data.word(kMapadx)); + context.bx = context.data.word(kMapystart); + context._add(context.bx, context.data.word(kMapady)); + context.ds = context.data.word(kMapstore); + context.si = 0; + context.cl = context.data.byte(kMapxsize); + context.ch = context.data.byte(kMapysize); + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void maptopanel(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kMapxstart); + context._add(context.di, context.data.word(kMapadx)); + context.bx = context.data.word(kMapystart); + context._add(context.bx, context.data.word(kMapady)); + context.ds = context.data.word(kMapstore); + context.si = 0; + context.cl = context.data.byte(kMapxsize); + context.ch = context.data.byte(kMapysize); + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpmap(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kMapxstart); + context._add(context.di, context.data.word(kMapadx)); + context.bx = context.data.word(kMapystart); + context._add(context.bx, context.data.word(kMapady)); + context.cl = context.data.byte(kMapxsize); + context.ch = context.data.byte(kMapysize); + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void pixelcheckset(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context._sub(context.al, context.es.byte(context.bx)); + context._sub(context.ah, context.es.byte(context.bx+1)); + context.push(context.es); + context.push(context.bx); + context.push(context.cx); + context.push(context.ax); + context.al = context.es.byte(context.bx+4); + getsetad(context); + context.al = context.es.byte(context.bx+17); + context.es = context.data.word(kSetframes); + context.bx = (0); + context.ah = 0; + context.cx = 6; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.ax = context.pop(); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context.cl = context.es.byte(context.bx); + context.ch = 0; + context._mul(context.cx); + context.cx = context.pop(); + context.ch = 0; + context._add(context.ax, context.cx); + context._add(context.ax, context.es.word(context.bx+2)); + context.bx = context.ax; + context._add(context.bx, (0+2080)); + context.al = context.es.byte(context.bx); + context.dl = context.al; + context.cx = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.ax = context.pop(); + context._cmp(context.dl, 0); + {assert(stack_depth == context.stack.size()); return; } +} + +void createpanel(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 0; + context.bx = 8; + context.ds = context.data.word(kIcons2); + context.al = 0; + context.ah = 2; + showframe(context); + context.di = 160; + context.bx = 8; + context.ds = context.data.word(kIcons2); + context.al = 0; + context.ah = 2; + showframe(context); + context.di = 0; + context.bx = 104; + context.ds = context.data.word(kIcons2); + context.al = 0; + context.ah = 2; + showframe(context); + context.di = 160; + context.bx = 104; + context.ds = context.data.word(kIcons2); + context.al = 0; + context.ah = 2; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void createpanel2(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + context.di = 0; + context.bx = 0; + context.ds = context.data.word(kIcons2); + context.al = 5; + context.ah = 2; + showframe(context); + context.di = 160; + context.bx = 0; + context.ds = context.data.word(kIcons2); + context.al = 5; + context.ah = 2; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearwork(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = 0x0; + context.es = context.data.word(kWorkspace); + context.di = 0; + context.cx = (200*320)/64; +clearloop: + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + if (--context.cx) goto clearloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void zoom(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto inwatching; + context._cmp(context.data.byte(kZoomon), 1); + if (context.flags.z()) goto zoomswitch; +inwatching: + {assert(stack_depth == context.stack.size()); return; } +zoomswitch: + context._cmp(context.data.byte(kCommandtype), 199); + if (context.flags.c()) goto zoomit; +cantzoom: + putunderzoom(context); + {assert(stack_depth == context.stack.size()); return; } +zoomit: + context.ax = context.data.word(kOldpointery); + context._sub(context.ax, 9); + context.cx = (320); + context._mul(context.cx); + context._add(context.ax, context.data.word(kOldpointerx)); + context._sub(context.ax, 11); + context.si = context.ax; + context.ax = (132)+4; + context.cx = (320); + context._mul(context.cx); + context._add(context.ax, (8)+5); + context.di = context.ax; + context.es = context.data.word(kWorkspace); + context.ds = context.data.word(kWorkspace); + context.cx = 20; +zoomloop: + context.push(context.cx); + context.cx = 23; +zoomloop2: + context._lodsb(); + context.ah = context.al; + context._stosw(); + context.es.word(context.di+(320)-2) = context.ax; + if (--context.cx) goto zoomloop2; + context._add(context.si, (320)-23); + context._add(context.di, (320)-46+(320)); + context.cx = context.pop(); + if (--context.cx) goto zoomloop; + crosshair(context); + context.data.byte(kDidzoom) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void delthisone(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context._add(context.ax, context.data.word(kMapady)); + context.bx = (320); + context._mul(context.bx); + context.bx = context.pop(); + context.bh = 0; + context._add(context.bx, context.data.word(kMapadx)); + context._add(context.ax, context.bx); + context.di = context.ax; + context.ax = context.pop(); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context.bx = 22*8; + context._mul(context.bx); + context.bx = context.pop(); + context.bh = 0; + context._add(context.ax, context.bx); + context.si = context.ax; + context.es = context.data.word(kWorkspace); + context.ds = context.data.word(kMapstore); + context.dl = context.cl; + context.dh = 0; + context.ax = (320); + context._sub(context.ax, context.dx); + context._neg(context.dx); + context._add(context.dx, 22*8); +deloneloop: + context.push(context.cx); + context.ch = 0; + while(context.cx--) context._movsb(); + context.cx = context.pop(); + context._add(context.di, context.ax); + context._add(context.si, context.dx); + context._dec(context.ch); + if (!context.flags.z()) goto deloneloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void width160(Context & context) { + uint stack_depth = context.stack.size(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + width128: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + width110: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + width88: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + width80: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + width63: + context._movsw(); + width62: + context._movsw(); + width61: + context._movsw(); + width60: + context._movsw(); + width59: + context._movsw(); + width58: + context._movsw(); + width57: + context._movsw(); + width56: + context._movsw(); + width55: + context._movsw(); + width54: + context._movsw(); + width53: + context._movsw(); + width52: + context._movsw(); + width51: + context._movsw(); + width50: + context._movsw(); + width49: + context._movsw(); + width48: + context._movsw(); + width47: + context._movsw(); + width46: + context._movsw(); + width45: + context._movsw(); + width44: + context._movsw(); + width43: + context._movsw(); + width42: + context._movsw(); + width41: + context._movsw(); + width40: + context._movsw(); + width39: + context._movsw(); + width38: + context._movsw(); + width37: + context._movsw(); + width36: + context._movsw(); + width35: + context._movsw(); + width34: + context._movsw(); + width33: + context._movsw(); + width32: + context._movsw(); + width31: + context._movsw(); + width30: + context._movsw(); + width29: + context._movsw(); + width28: + context._movsw(); + width27: + context._movsw(); + width26: + context._movsw(); + width25: + context._movsw(); + width24: + context._movsw(); + width23: + context._movsw(); + width22: + context._movsw(); + width21: + context._movsw(); + width20: + context._movsw(); + width19: + context._movsw(); + width18: + context._movsw(); + width17: + context._movsw(); + width16: + context._movsw(); + width15: + context._movsw(); + width14: + context._movsw(); + width13: + context._movsw(); + width12: + context._movsw(); + width11: + context._movsw(); + width10: + context._movsw(); + width9: + context._movsw(); + width8: + context._movsw(); + width7: + context._movsw(); + width6: + context._movsw(); + width5: + context._movsw(); + width4: + context._movsw(); + width3: + context._movsw(); + width2: + context._movsw(); + width1: + context._movsw(); + width0: + {assert(stack_depth == context.stack.size()); return; } +} + +void doblocks(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kWorkspace); + context.ax = context.data.word(kMapady); + context.cx = (320); + context._mul(context.cx); + context.di = context.data.word(kMapadx); + context._add(context.di, context.ax); + context.al = context.data.byte(kMapy); + context.ah = 0; + context.bx = (66); + context._mul(context.bx); + context.bl = context.data.byte(kMapx); + context.bh = 0; + context._add(context.ax, context.bx); + context.si = (0); + context._add(context.si, context.ax); + context.cx = 10; +loop120: + context.push(context.di); + context.push(context.cx); + context.cx = 11; +loop124: + context.push(context.cx); + context.push(context.di); + context.ds = context.data.word(kMapdata); + context._lodsb(); + context.ds = context.data.word(kBackdrop); + context.push(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto zeroblock; + context.ah = context.al; + context.al = 0; + context.si = (0+192); + context._add(context.si, context.ax); + context.bh = 14; + context.bh = 4; +firstbitofblock: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._add(context.di, (320)-16); + context._dec(context.bh); + if (!context.flags.z()) goto firstbitofblock; + context.bh = 12; +loop125: + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context._movsw(); + context.ax = 0x0dfdf; + context._stosw(); + context._stosw(); + context._add(context.di, (320)-20); + context._dec(context.bh); + if (!context.flags.z()) goto loop125; + context._add(context.di, 4); + context.ax = 0x0dfdf; + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._add(context.di, (320)-16); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._add(context.di, (320)-16); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._add(context.di, (320)-16); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); + context._stosw(); +zeroblock: + context.si = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.di, 16); + if (--context.cx) goto loop124; + context._add(context.si, (66)-11); + context.cx = context.pop(); + context.di = context.pop(); + context._add(context.di, (320)*16); + if (--context.cx) goto loop120; + {assert(stack_depth == context.stack.size()); return; } +} + +void showframe(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.push(context.ax); + context.cx = context.ax; + context._and(context.cx, 511); + context._add(context.cx, context.cx); + context.si = context.cx; + context._add(context.cx, context.cx); + context._add(context.si, context.cx); + context._cmp(context.ds.word(context.si), 0); + if (!context.flags.z()) goto notblankshow; + context.ax = context.pop(); + context.dx = context.pop(); + context.cx = 0; + {assert(stack_depth == context.stack.size()); return; } +notblankshow: + context._test(context.ah, 128); + if (!context.flags.z()) goto skipoffsets; + context.al = context.ds.byte(context.si+4); + context.ah = 0; + context._add(context.di, context.ax); + context.al = context.ds.byte(context.si+5); + context.ah = 0; + context._add(context.bx, context.ax); +skipoffsets: + context.cx = context.ds.word(context.si+0); + context.ax = context.ds.word(context.si+2); + context._add(context.ax, 2080); + context.si = context.ax; + context.ax = context.pop(); + context.dx = context.pop(); + context._cmp(context.ah, 0); + if (context.flags.z()) goto noeffects; + context._test(context.ah, 128); + if (context.flags.z()) goto notcentred; + context.push(context.ax); + context.al = context.cl; + context.ah = 0; + context._shr(context.ax, 1); + context._sub(context.di, context.ax); + context.al = context.ch; + context.ah = 0; + context._shr(context.ax, 1); + context._sub(context.bx, context.ax); + context.ax = context.pop(); +notcentred: + context._test(context.ah, 64); + if (context.flags.z()) goto notdiffdest; + context.push(context.cx); + frameoutfx(context); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +notdiffdest: + context._test(context.ah, 8); + if (context.flags.z()) goto notprintlist; + context.push(context.ax); + context.ax = context.di; + context._sub(context.ax, context.data.word(kMapadx)); + context.push(context.bx); + context._sub(context.bx, context.data.word(kMapady)); + context.ah = context.bl; + context.bx = context.pop(); + context.ax = context.pop(); +notprintlist: + context._test(context.ah, 4); + if (context.flags.z()) goto notflippedx; + context.dx = (320); + context.es = context.data.word(kWorkspace); + context.push(context.cx); + frameoutfx(context); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +notflippedx: + context._test(context.ah, 2); + if (context.flags.z()) goto notnomask; + context.dx = (320); + context.es = context.data.word(kWorkspace); + context.push(context.cx); + frameoutnm(context); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +notnomask: + context._test(context.ah, 32); + if (context.flags.z()) goto noeffects; + context.dx = (320); + context.es = context.data.word(kWorkspace); + context.push(context.cx); + frameoutbh(context); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +noeffects: + context.dx = (320); + context.es = context.data.word(kWorkspace); + context.push(context.cx); + frameoutv(context); + context.cx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void frameoutv(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.ax = context.bx; + context.bx = context.dx; + context._mul(context.bx); + context._add(context.di, context.ax); + context.dx = context.pop(); + context.push(context.cx); + context.ch = 0; + context._sub(context.dx, context.cx); + context.cx = context.pop(); +frameloop1: + context.push(context.cx); + context.ch = 0; +frameloop2: + context._lodsb(); + context._cmp(context.al, 0); + if (!context.flags.z()) goto backtosolid; +backtoother: + context._inc(context.di); + if (--context.cx) goto frameloop2; + context.cx = context.pop(); + context._add(context.di, context.dx); + context._dec(context.ch); + if (!context.flags.z()) goto frameloop1; + {assert(stack_depth == context.stack.size()); return; } +frameloop3: + context._lodsb(); + context._cmp(context.al, 0); + if (context.flags.z()) goto backtoother; +backtosolid: + context._stosb(); + if (--context.cx) goto frameloop3; + context.cx = context.pop(); + context._add(context.di, context.dx); + context._dec(context.ch); + if (!context.flags.z()) goto frameloop1; + {assert(stack_depth == context.stack.size()); return; } +} + +void frameoutbh(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.ax = context.bx; + context.bx = context.dx; + context._mul(context.bx); + context._add(context.di, context.ax); + context.dx = context.pop(); + context.push(context.cx); + context.ch = 0; + context._sub(context.dx, context.cx); + context.cx = context.pop(); +bhloop2: + context.push(context.cx); + context.ch = 0; + context.ah = 255; +bhloop1: + context._cmp(context.es.byte(context.di), context.ah); + if (!context.flags.z()) goto nofill; + context._movsb(); + if (--context.cx) goto bhloop1; + goto nextline; +nofill: + context._inc(context.di); + context._inc(context.si); + if (--context.cx) goto bhloop1; +nextline: + context._add(context.di, context.dx); + context.cx = context.pop(); + context._dec(context.ch); + if (!context.flags.z()) goto bhloop2; + {assert(stack_depth == context.stack.size()); return; } +} + +void frameoutfx(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.ax = context.bx; + context.bx = context.dx; + context._mul(context.bx); + context._add(context.di, context.ax); + context.dx = context.pop(); + context.push(context.cx); + context.ch = 0; + context._add(context.dx, context.cx); + context.cx = context.pop(); +frameloopfx1: + context.push(context.cx); + context.ch = 0; +frameloopfx2: + context._lodsb(); + context._cmp(context.al, 0); + if (!context.flags.z()) goto backtosolidfx; +backtootherfx: + context._dec(context.di); + if (--context.cx) goto frameloopfx2; + context.cx = context.pop(); + context._add(context.di, context.dx); + context._dec(context.ch); + if (!context.flags.z()) goto frameloopfx1; + {assert(stack_depth == context.stack.size()); return; } +frameloopfx3: + context._lodsb(); + context._cmp(context.al, 0); + if (context.flags.z()) goto backtootherfx; +backtosolidfx: + context.es.byte(context.di) = context.al; + context._dec(context.di); + if (--context.cx) goto frameloopfx3; + context.cx = context.pop(); + context._add(context.di, context.dx); + context._dec(context.ch); + if (!context.flags.z()) goto frameloopfx1; + {assert(stack_depth == context.stack.size()); return; } +} + +void transferinv(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kExframepos); + context.push(context.di); + context.al = context.data.byte(kExpos); + context.ah = 0; + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.bx); + context._inc(context.ax); + context.cx = 6; + context._mul(context.cx); + context.es = context.data.word(kExtras); + context.bx = (0); + context._add(context.bx, context.ax); + context._add(context.di, (0+2080)); + context.push(context.bx); + context.al = context.data.byte(kItemtotran); + context.ah = 0; + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.bx); + context._inc(context.ax); + context.cx = 6; + context._mul(context.cx); + context.ds = context.data.word(kFreeframes); + context.bx = (0); + context._add(context.bx, context.ax); + context.si = (0+2080); + context.al = context.ds.byte(context.bx); + context.ah = 0; + context.cl = context.ds.byte(context.bx+1); + context.ch = 0; + context._add(context.si, context.ds.word(context.bx+2)); + context.dx = context.ds.word(context.bx+4); + context.bx = context.pop(); + context.es.byte(context.bx+0) = context.al; + context.es.byte(context.bx+1) = context.cl; + context.es.word(context.bx+4) = context.dx; + context._mul(context.cx); + context.cx = context.ax; + context.push(context.cx); + while(context.cx--) context._movsb(); + context.cx = context.pop(); + context.ax = context.pop(); + context.es.word(context.bx+2) = context.ax; + context._add(context.data.word(kExframepos), context.cx); + {assert(stack_depth == context.stack.size()); return; } +} + +void transfermap(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kExframepos); + context.push(context.di); + context.al = context.data.byte(kExpos); + context.ah = 0; + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.bx); + context.cx = 6; + context._mul(context.cx); + context.es = context.data.word(kExtras); + context.bx = (0); + context._add(context.bx, context.ax); + context._add(context.di, (0+2080)); + context.push(context.bx); + context.al = context.data.byte(kItemtotran); + context.ah = 0; + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.bx); + context.cx = 6; + context._mul(context.cx); + context.ds = context.data.word(kFreeframes); + context.bx = (0); + context._add(context.bx, context.ax); + context.si = (0+2080); + context.al = context.ds.byte(context.bx); + context.ah = 0; + context.cl = context.ds.byte(context.bx+1); + context.ch = 0; + context._add(context.si, context.ds.word(context.bx+2)); + context.dx = context.ds.word(context.bx+4); + context.bx = context.pop(); + context.es.byte(context.bx+0) = context.al; + context.es.byte(context.bx+1) = context.cl; + context.es.word(context.bx+4) = context.dx; + context._mul(context.cx); + context.cx = context.ax; + context.push(context.cx); + while(context.cx--) context._movsb(); + context.cx = context.pop(); + context.ax = context.pop(); + context.es.word(context.bx+2) = context.ax; + context._add(context.data.word(kExframepos), context.cx); + {assert(stack_depth == context.stack.size()); return; } +} + +void dofade(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kFadedirection), 0); + if (context.flags.z()) goto finishfade; + context.cl = context.data.byte(kNumtofade); + context.ch = 0; + context.al = context.data.byte(kColourpos); + context.ah = 0; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context._add(context.si, context.ax); + context._add(context.si, context.ax); + context._add(context.si, context.ax); + showgroup(context); + context.al = context.data.byte(kNumtofade); + context._add(context.al, context.data.byte(kColourpos)); + context.data.byte(kColourpos) = context.al; + context._cmp(context.al, 0); + if (!context.flags.z()) goto finishfade; + fadecalculation(context); +finishfade: + {assert(stack_depth == context.stack.size()); return; } +} + +void clearendpal(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.cx = 768; + context.al = 0; + while(context.cx--) context._stosb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearpalette(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kFadedirection) = 0; + clearstartpal(context); + dumpcurrent(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreenup(Context & context) { + uint stack_depth = context.stack.size(); + clearstartpal(context); + paltoendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadetowhite(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.cx = 768; + context.al = 63; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.al = 0; + context._stosb(); + context._stosb(); + context._stosb(); + paltostartpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadefromwhite(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.cx = 768; + context.al = 63; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.al = 0; + context._stosb(); + context._stosb(); + context._stosb(); + paltoendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreenups(Context & context) { + uint stack_depth = context.stack.size(); + clearstartpal(context); + paltoendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 64; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreendownhalf(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + paltoendpal(context); + context.cx = 768; + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); +halfend: + context.al = context.es.byte(context.bx); + context._shr(context.al, 1); + context.es.byte(context.bx) = context.al; + context._inc(context.bx); + if (--context.cx) goto halfend; + context.ds = context.data.word(kBuffers); + context.es = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(56*3); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(56*3); + context.cx = 3*5; + while(context.cx--) context._movsb(); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(77*3); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(77*3); + context.cx = 3*2; + while(context.cx--) context._movsb(); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 31; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 32; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreenuphalf(Context & context) { + uint stack_depth = context.stack.size(); + endpaltostart(context); + paltoendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 31; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 32; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreendown(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + clearendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + {assert(stack_depth == context.stack.size()); return; } +} + +void fadescreendowns(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + clearendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 64; + {assert(stack_depth == context.stack.size()); return; } +} + +void clearstartpal(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.cx = 256; +wholeloop1: + context.ax = 0; + context._stosw(); + context.al = 0; + context._stosb(); + if (--context.cx) goto wholeloop1; + {assert(stack_depth == context.stack.size()); return; } +} + +void showgun(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kAddtored) = 0; + context.data.byte(kAddtogreen) = 0; + context.data.byte(kAddtoblue) = 0; + paltostartpal(context); + paltoendpal(context); + greyscalesum(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 130; + hangon(context); + endpaltostart(context); + clearendpal(context); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 200; + hangon(context); + context.data.byte(kRoomssample) = 34; + loadroomssample(context); + context.data.byte(kVolume) = 0; + context.dx = 2351; + loadintotemp(context); + createpanel2(context); + context.ds = context.data.word(kTempgraphics); + context.al = 0; + context.ah = 0; + context.di = 100; + context.bx = 4; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.al = 1; + context.ah = 0; + context.di = 158; + context.bx = 106; + showframe(context); + worktoscreen(context); + getridoftemp(context); + fadescreenup(context); + context.cx = 160; + hangon(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.dx = 2260; + loadtemptext(context); + rollendcredits2(context); + getridoftemptext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void rollendcredits2(Context & context) { + uint stack_depth = context.stack.size(); + rollem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void rollem(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 160; + context.ch = 160; + context.di = 25; + context.bx = 20; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiget(context); + context.es = context.data.word(kTextfile1); + context.si = 49*2; + context.ax = context.es.word(context.si); + context.si = context.ax; + context._add(context.si, (66*2)); + context.cx = 80; +endcredits21: + context.push(context.cx); + context.bx = 10; + context.cx = context.data.word(kLinespacing); +endcredits22: + context.push(context.cx); + context.push(context.si); + context.push(context.di); + context.push(context.es); + context.push(context.bx); + vsync(context); + context.cl = 160; + context.ch = 160; + context.di = 25; + context.bx = 20; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiput(context); + vsync(context); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); + context.si = context.pop(); + context.push(context.si); + context.push(context.di); + context.push(context.es); + context.push(context.bx); + context.cx = 18; +onelot2: + context.push(context.cx); + context.di = 25; + context.dx = 161; + context.ax = 0; + printdirect(context); + context._add(context.bx, context.data.word(kLinespacing)); + context.cx = context.pop(); + if (--context.cx) goto onelot2; + vsync(context); + context.cl = 160; + context.ch = 160; + context.di = 25; + context.bx = 20; + multidump(context); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto endearly2; + context._dec(context.bx); + if (--context.cx) goto endcredits22; + context.cx = context.pop(); +looknext2: + context.al = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.al, ':'); + if (context.flags.z()) goto gotnext2; + context._cmp(context.al, 0); + if (context.flags.z()) goto gotnext2; + goto looknext2; +gotnext2: + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto endearly; + if (--context.cx) goto endcredits21; + context.cx = 120; + hangone(context); + {assert(stack_depth == context.stack.size()); return; } +endearly2: + context.cx = context.pop(); +endearly: + {assert(stack_depth == context.stack.size()); return; } +} + +void fadecalculation(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kFadecount), 0); + if (context.flags.z()) goto nomorefading; + context.bl = context.data.byte(kFadecount); + context.es = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.cx = 768; +fadecolloop: + context.al = context.es.byte(context.si); + context.ah = context.es.byte(context.di); + context._cmp(context.al, context.ah); + if (context.flags.z()) goto gotthere; + if (context.flags.c()) goto lesscolour; + context._dec(context.es.byte(context.si)); + goto gotthere; +lesscolour: + context._cmp(context.bl, context.ah); + if (context.flags.z()) goto withit; + if (!context.flags.c()) goto gotthere; +withit: + context._inc(context.es.byte(context.si)); +gotthere: + context._inc(context.si); + context._inc(context.di); + if (--context.cx) goto fadecolloop; + context._dec(context.data.byte(kFadecount)); + {assert(stack_depth == context.stack.size()); return; } +nomorefading: + context.data.byte(kFadedirection) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void greyscalesum(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.cx = 256; +greysumloop1: + context.push(context.cx); + context.bx = 0; + context.al = context.es.byte(context.si); + context.ah = 0; + context.cx = 20; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.si+1); + context.ah = 0; + context.cx = 59; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.si+2); + context.ah = 0; + context.cx = 11; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.al = -1; +greysumloop2: + context._inc(context.al); + context._sub(context.bx, 100); + if (!context.flags.c()) goto greysumloop2; + context.bl = context.al; + context.al = context.bl; + context.ah = context.data.byte(kAddtored); + context._cmp(context.al, 0); + context._add(context.al, context.ah); +noaddr: + context._stosb(); + context.ah = context.data.byte(kAddtogreen); + context.al = context.bl; + context._cmp(context.al, 0); + if (context.flags.z()) goto noaddg; + context._add(context.al, context.ah); +noaddg: + context._stosb(); + context.ah = context.data.byte(kAddtoblue); + context.al = context.bl; + context._cmp(context.al, 0); + if (context.flags.z()) goto noaddb; + context._add(context.al, context.ah); +noaddb: + context._stosb(); + context._add(context.si, 3); + context.cx = context.pop(); + if (--context.cx) goto greysumloop1; + {assert(stack_depth == context.stack.size()); return; } +} + +void paltostartpal(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.cx = 768/2; + while(context.cx--) context._movsw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void endpaltostart(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.cx = 768/2; + while(context.cx--) context._movsw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void startpaltoend(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.ds = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.cx = 768/2; + while(context.cx--) context._movsw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void paltoendpal(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.ds = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + context.cx = 768/2; + while(context.cx--) context._movsw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void allpalette(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.ds = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + context.cx = 768/2; + while(context.cx--) context._movsw(); + dumpcurrent(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpcurrent(Context & context) { + uint stack_depth = context.stack.size(); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)); + context.ds = context.data.word(kBuffers); + vsync(context); + context.al = 0; + context.cx = 128; + showgroup(context); + vsync(context); + context.al = 128; + context.cx = 128; + showgroup(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fadedownmon(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + paltoendpal(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(231*3); + context.cx = 3*8; + context.ax = 0; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(246*3); + context._stosb(); + context._stosw(); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 64; + hangon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fadeupmon(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + paltoendpal(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3); + context.cx = 3*8; + context.ax = 0; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3); + context._stosb(); + context._stosw(); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 128; + hangon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fadeupmonfirst(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + paltoendpal(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3); + context.cx = 3*8; + context.ax = 0; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3); + context._stosb(); + context._stosw(); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 64; + hangon(context); + context.al = 26; + playchannel1(context); + context.cx = 64; + hangon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fadeupyellows(Context & context) { + uint stack_depth = context.stack.size(); + paltoendpal(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(231*3); + context.cx = 3*8; + context.ax = 0; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(246*3); + context._stosb(); + context._stosw(); + context.data.byte(kFadedirection) = 1; + context.data.byte(kFadecount) = 63; + context.data.byte(kColourpos) = 0; + context.data.byte(kNumtofade) = 128; + context.cx = 128; + hangon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void initialmoncols(Context & context) { + uint stack_depth = context.stack.size(); + paltostartpal(context); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(230*3); + context.cx = 3*9; + context.ax = 0; + while(context.cx--) context._stosb(); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3); + context._stosb(); + context._stosw(); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(230*3); + context.al = 230; + context.cx = 18; + showgroup(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void titles(Context & context) { + uint stack_depth = context.stack.size(); + clearpalette(context); + biblequote(context); + intro(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void endgame(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2260; + loadtemptext(context); + monkspeaking(context); + gettingshot(context); + getridoftemptext(context); + context.data.byte(kVolumeto) = 7; + context.data.byte(kVolumedirection) = 1; + context.cx = 200; + hangon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void monkspeaking(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kRoomssample) = 35; + loadroomssample(context); + context.dx = 2364; + loadintotemp(context); + clearwork(context); + showmonk(context); + worktoscreen(context); + context.data.byte(kVolume) = 7; + context.data.byte(kVolumedirection) = -1; + context.data.byte(kVolumeto) = 5; + context.al = 12; + context.ah = 255; + playchannel0(context); + fadescreenups(context); + context.cx = 300; + hangon(context); + context.al = 40; +loadspeech2: + context.push(context.ax); + context.dl = 'T'; + context.dh = 83; + context.cl = 'T'; + context.ah = 0; + loadspeech(context); + context.al = 50+12; + playchannel1(context); +notloadspeech2: + vsync(context); + context._cmp(context.data.byte(kCh1playing), 255); + if (!context.flags.z()) goto notloadspeech2; + context.ax = context.pop(); + context._inc(context.al); + context._cmp(context.al, 48); + if (!context.flags.z()) goto loadspeech2; + context.data.byte(kVolumedirection) = 1; + context.data.byte(kVolumeto) = 7; + fadescreendowns(context); + context.cx = 300; + hangon(context); + getridoftemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showmonk(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 0; + context.ah = 128; + context.di = 160; + context.bx = 72; + context.ds = context.data.word(kTempgraphics); + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void gettingshot(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kNewlocation) = 55; + clearpalette(context); + loadintroroom(context); + fadescreenups(context); + context.data.byte(kVolumeto) = 0; + context.data.byte(kVolumedirection) = -1; + runendseq(context); + clearbeforeload(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void credits(Context & context) { + uint stack_depth = context.stack.size(); + clearpalette(context); + realcredits(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void biblequote(Context & context) { + uint stack_depth = context.stack.size(); + mode640x480(context); + context.dx = 2377; + showpcx(context); + fadescreenups(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto biblequotearly; + context.cx = 560; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto biblequotearly; + fadescreendowns(context); + context.cx = 200; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto biblequotearly; + cancelch0(context); +biblequotearly: + context.data.byte(kLasthardkey) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void hangone(Context & context) { + uint stack_depth = context.stack.size(); +hangonloope: + context.push(context.cx); + vsync(context); + context.cx = context.pop(); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto hangonearly; + if (--context.cx) goto hangonloope; +hangonearly: + {assert(stack_depth == context.stack.size()); return; } +} + +void intro(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2247; + loadtemptext(context); + loadpalfromiff(context); + setmode(context); + context.data.byte(kNewlocation) = 50; + clearpalette(context); + loadintroroom(context); + context.data.byte(kVolume) = 7; + context.data.byte(kVolumedirection) = -1; + context.data.byte(kVolumeto) = 4; + context.al = 12; + context.ah = 255; + playchannel0(context); + fadescreenups(context); + runintroseq(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto introearly; + clearbeforeload(context); + context.data.byte(kNewlocation) = 52; + loadintroroom(context); + runintroseq(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto introearly; + clearbeforeload(context); + context.data.byte(kNewlocation) = 53; + loadintroroom(context); + runintroseq(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto introearly; + clearbeforeload(context); + allpalette(context); + context.data.byte(kNewlocation) = 54; + loadintroroom(context); + runintroseq(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto introearly; + getridoftemptext(context); + clearbeforeload(context); +introearly: + context.data.byte(kLasthardkey) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void runintroseq(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kGetback) = 0; +moreintroseq: + vsync(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto earlyendrun; + spriteupdate(context); + vsync(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto earlyendrun; + deleverything(context); + printsprites(context); + reelsonscreen(context); + afterintroroom(context); + usetimedtext(context); + vsync(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto earlyendrun; + dumpmap(context); + dumptimedtext(context); + vsync(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto earlyendrun; + context._cmp(context.data.byte(kGetback), 1); + if (!context.flags.z()) goto moreintroseq; + {assert(stack_depth == context.stack.size()); return; } +earlyendrun: + getridoftemptext(context); + clearbeforeload(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void runendseq(Context & context) { + uint stack_depth = context.stack.size(); + atmospheres(context); + context.data.byte(kGetback) = 0; +moreendseq: + vsync(context); + spriteupdate(context); + vsync(context); + deleverything(context); + printsprites(context); + reelsonscreen(context); + afterintroroom(context); + usetimedtext(context); + vsync(context); + dumpmap(context); + dumptimedtext(context); + vsync(context); + context._cmp(context.data.byte(kGetback), 1); + if (!context.flags.z()) goto moreendseq; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadintroroom(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kIntrocount) = 0; + context.data.byte(kLocation) = 255; + loadroom(context); + context.data.word(kMapoffsetx) = 72; + context.data.word(kMapoffsety) = 16; + clearsprites(context); + context.data.byte(kThroughdoor) = 0; + context.data.byte(kCurrentkey) = '0'; + context.data.byte(kMainmode) = 0; + clearwork(context); + context.data.byte(kNewobs) = 1; + drawfloor(context); + reelsonscreen(context); + spriteupdate(context); + printsprites(context); + worktoscreen(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void realcredits(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kRoomssample) = 33; + loadroomssample(context); + context.data.byte(kVolume) = 0; + mode640x480(context); + context.cx = 35; + hangon(context); + context.dx = 2390; + showpcx(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.cx = 2; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + allpalette(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.dx = 2403; + showpcx(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.cx = 2; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + allpalette(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.dx = 2416; + showpcx(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.cx = 2; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + allpalette(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.dx = 2429; + showpcx(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.cx = 2; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + allpalette(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.dx = 2442; + showpcx(context); + context.al = 12; + context.ah = 0; + playchannel0(context); + context.cx = 2; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + allpalette(context); + context.cx = 80; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.dx = 2455; + showpcx(context); + fadescreenups(context); + context.cx = 60; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + context.al = 13; + context.ah = 0; + playchannel0(context); + context.cx = 350; + hangone(context); + context._cmp(context.data.byte(kLasthardkey), 1); + if (context.flags.z()) goto realcreditsearly; + fadescreendowns(context); + context.cx = 256; + hangone(context); +realcreditsearly: + context.data.byte(kLasthardkey) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void printchar(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.al, 255); + if (context.flags.z()) goto ignoreit; + context.push(context.si); + context.push(context.bx); + context.push(context.di); + context.push(context.ax); + context._sub(context.al, 32); + context.ah = 0; + context._add(context.ax, context.data.word(kCharshift)); + showframe(context); + context.ax = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.si = context.pop(); + context._cmp(context.data.byte(kKerning), 0); + if (!context.flags.z()) goto nokern; + kernchars(context); +nokern: + context.push(context.cx); + context.ch = 0; + context._add(context.di, context.cx); + context.cx = context.pop(); +ignoreit: + {assert(stack_depth == context.stack.size()); return; } +} + +void kernchars(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.al, 'a'); + if (context.flags.z()) goto iskern; + context._cmp(context.al, 'u'); + if (context.flags.z()) goto iskern; + {assert(stack_depth == context.stack.size()); return; } +iskern: + context._cmp(context.ah, 'n'); + if (context.flags.z()) goto kernit; + context._cmp(context.ah, 't'); + if (context.flags.z()) goto kernit; + context._cmp(context.ah, 'r'); + if (context.flags.z()) goto kernit; + context._cmp(context.ah, 'i'); + if (context.flags.z()) goto kernit; + context._cmp(context.ah, 'l'); + if (context.flags.z()) goto kernit; + {assert(stack_depth == context.stack.size()); return; } +kernit: + context._dec(context.cl); + {assert(stack_depth == context.stack.size()); return; } +} + +void printslow(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kPointerframe) = 1; + context.data.byte(kPointermode) = 3; + context.ds = context.data.word(kCharset1); +printloopslow6: + context.push(context.bx); + context.push(context.di); + context.push(context.dx); + getnumber(context); + context.ch = 0; +printloopslow5: + context.push(context.cx); + context.push(context.si); + context.push(context.es); + context.ax = context.es.word(context.si); + context.push(context.bx); + context.push(context.cx); + context.push(context.es); + context.push(context.si); + context.push(context.ds); + printboth(context); + context.ds = context.pop(); + context.si = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ax = context.es.word(context.si+1); + context._inc(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto finishslow; + context._cmp(context.al, ':'); + if (context.flags.z()) goto finishslow; + context._cmp(context.cl, 1); + if (context.flags.z()) goto afterslow; + context.push(context.di); + context.push(context.ds); + context.push(context.bx); + context.push(context.cx); + context.push(context.es); + context.push(context.si); + context.data.word(kCharshift) = 91; + printboth(context); + context.data.word(kCharshift) = 0; + context.si = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + waitframes(context); + context._cmp(context.ax, 0); + if (context.flags.z()) goto keepgoing; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (!context.flags.z()) goto finishslow2; +keepgoing: + waitframes(context); +noslow: + context._cmp(context.ax, 0); + if (context.flags.z()) goto afterslow; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (!context.flags.z()) goto finishslow2; +afterslow: + context.es = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context._inc(context.si); + if (--context.cx) goto printloopslow5; + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context._add(context.bx, 10); + goto printloopslow6; +finishslow: + context.es = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +finishslow2: + context.es = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void waitframes(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.di); + context.push(context.bx); + context.push(context.es); + context.push(context.si); + context.push(context.ds); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + delpointer(context); + context.ax = context.data.word(kMousebutton); + context.ds = context.pop(); + context.si = context.pop(); + context.es = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void printboth(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.cx); + context.push(context.bx); + context.push(context.di); + printchar(context); + context.ax = context.pop(); + context.push(context.di); + context.di = context.ax; + multidump(context); + context.di = context.pop(); + context.bx = context.pop(); + context.cx = context.pop(); + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void printdirect(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kLastxpos) = context.di; + context.ds = context.data.word(kCurrentset); +printloop6: + context.push(context.bx); + context.push(context.di); + context.push(context.dx); + getnumber(context); + context.ch = 0; +printloop5: + context.ax = context.es.word(context.si); + context._inc(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto finishdirct; + context._cmp(context.al, ':'); + if (context.flags.z()) goto finishdirct; + context.push(context.cx); + context.push(context.es); + printchar(context); + context.data.word(kLastxpos) = context.di; + context.es = context.pop(); + context.cx = context.pop(); + if (--context.cx) goto printloop5; + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context._add(context.bx, context.data.word(kLinespacing)); + goto printloop6; +finishdirct: + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void monprint(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kKerning) = 1; + context.si = context.bx; + context.dl = 166; + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.ds = context.data.word(kTempcharset); +printloop8: + context.push(context.bx); + context.push(context.di); + context.push(context.dx); + getnumber(context); + context.ch = 0; +printloop7: + context.al = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.al, ':'); + if (context.flags.z()) goto finishmon2; + context._cmp(context.al, 0); + if (context.flags.z()) goto finishmon; + context._cmp(context.al, 34); + if (context.flags.z()) goto finishmon; + context._cmp(context.al, '='); + if (context.flags.z()) goto finishmon; + context._cmp(context.al, '%'); + if (!context.flags.z()) goto nottrigger; + context.ah = context.es.byte(context.si); + context._inc(context.si); + context._inc(context.si); + goto finishmon; +nottrigger: + context.push(context.cx); + context.push(context.es); + printchar(context); + context.data.word(kCurslocx) = context.di; + context.data.word(kCurslocy) = context.bx; + context.data.word(kMaintimer) = 1; + printcurs(context); + vsync(context); + context.push(context.si); + context.push(context.dx); + context.push(context.ds); + context.push(context.es); + context.push(context.bx); + context.push(context.di); + lockmon(context); + context.di = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.ds = context.pop(); + context.dx = context.pop(); + context.si = context.pop(); + delcurs(context); + context.es = context.pop(); + context.cx = context.pop(); + if (--context.cx) goto printloop7; +finishmon2: + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + scrollmonitor(context); + context.data.word(kCurslocx) = context.di; + goto printloop8; +finishmon: + context.dx = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context._cmp(context.al, '%'); + if (!context.flags.z()) goto nottrigger2; + context.data.byte(kLasttrigger) = context.ah; +nottrigger2: + context.data.word(kCurslocx) = context.di; + scrollmonitor(context); + context.bx = context.si; + context.data.byte(kKerning) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void getnumber(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = 0; + context.push(context.si); + context.push(context.bx); + context.push(context.di); + context.push(context.ds); + context.push(context.es); + context.di = context.si; +wordloop: + context.push(context.cx); + context.push(context.dx); + getnextword(context); + context.dx = context.pop(); + context.cx = context.pop(); + context._cmp(context.al, 1); + if (context.flags.z()) goto endoftext; + context.al = context.cl; + context.ah = 0; + context.push(context.bx); + context.bh = 0; + context._add(context.ax, context.bx); + context.bx = context.pop(); + context._sub(context.ax, 10); + context.dh = 0; + context._cmp(context.ax, context.dx); + if (!context.flags.c()) goto gotoverend; + context._add(context.cl, context.bl); + context._add(context.ch, context.bh); + goto wordloop; +gotoverend: + context.al = context.dl; + context._and(context.al, 1); + if (context.flags.z()) goto notcentre; + context.push(context.cx); + context.al = context.dl; + context._and(context.al, 0xfe); + context.ah = 0; + context.ch = 0; + context._sub(context.ax, context.cx); + context._add(context.ax, 20); + context._shr(context.ax, 1); + context.cx = context.pop(); + context.es = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.si = context.pop(); + context._add(context.di, context.ax); + context.cl = context.ch; + {assert(stack_depth == context.stack.size()); return; } +notcentre: + context.es = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.si = context.pop(); + context.cl = context.ch; + {assert(stack_depth == context.stack.size()); return; } +endoftext: + context.al = context.cl; + context.ah = 0; + context.push(context.bx); + context.bh = 0; + context._add(context.ax, context.bx); + context.bx = context.pop(); + context._sub(context.ax, 10); + context.dh = 0; + context._cmp(context.ax, context.dx); + if (!context.flags.c()) goto gotoverend2; + context._add(context.cl, context.bl); + context._add(context.ch, context.bh); +gotoverend2: + context.al = context.dl; + context._and(context.al, 1); + if (context.flags.z()) goto notcent2; + context.push(context.cx); + context.al = context.dl; + context._and(context.al, 0xfe); + context._add(context.al, 2); + context.ah = 0; + context.ch = 0; + context._add(context.ax, 20); + context._sub(context.ax, context.cx); + context._shr(context.ax, 1); + context.cx = context.pop(); + context.es = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.si = context.pop(); + context._add(context.di, context.ax); + context.cl = context.ch; + {assert(stack_depth == context.stack.size()); return; } +notcent2: + context.es = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.si = context.pop(); + context.cl = context.ch; + {assert(stack_depth == context.stack.size()); return; } +} + +void getnextword(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = 0; +getloop: + context.ax = context.es.word(context.di); + context._inc(context.di); + context._inc(context.bh); + context._cmp(context.al, ':'); + if (context.flags.z()) goto endall; + context._cmp(context.al, 0); + if (context.flags.z()) goto endall; + context._cmp(context.al, 32); + if (context.flags.z()) goto endword; + context._cmp(context.al, 255); + if (context.flags.z()) goto getloop; + context.push(context.ax); + context._sub(context.al, 32); + context.ah = 0; + context._add(context.ax, context.data.word(kCharshift)); + context._add(context.ax, context.ax); + context.si = context.ax; + context._add(context.ax, context.ax); + context._add(context.si, context.ax); + context.cl = context.ds.byte(context.si+0); + context.ax = context.pop(); + kernchars(context); + context._add(context.bl, context.cl); + goto getloop; +endword: + context._add(context.bl, 6); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +endall: + context._add(context.bl, 6); + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void fillryan(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32); + findallryan(context); + context.si = (0+(180*10)+32); + context.al = context.data.byte(kRyanpage); + context.ah = 0; + context.cx = 20; + context._mul(context.cx); + context._add(context.si, context.ax); + context.di = (80); + context.bx = (58); + context.cx = 2; +ryanloop2: + context.push(context.cx); + context.push(context.di); + context.push(context.bx); + context.cx = 5; +ryanloop1: + context.push(context.cx); + context.push(context.di); + context.push(context.bx); + context.ax = context.es.word(context.si); + context._add(context.si, 2); + context.push(context.si); + context.push(context.es); + obtoinv(context); + context.es = context.pop(); + context.si = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.di, (44)); + if (--context.cx) goto ryanloop1; + context.bx = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.bx, (44)); + if (--context.cx) goto ryanloop2; + showryanpage(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void fillopen(Context & context) { + uint stack_depth = context.stack.size(); + deltextline(context); + getopenedsize(context); + context._cmp(context.ah, 4); + if (context.flags.c()) goto lessthanapage; + context.ah = 4; +lessthanapage: + context.al = 1; + context.push(context.ax); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)); + findallopen(context); + context.si = (0+(180*10)); + context.di = (80); + context.bx = (58)+96; + context.cx = context.pop(); +openloop1: + context.push(context.cx); + context.push(context.di); + context.push(context.bx); + context.ax = context.es.word(context.si); + context._add(context.si, 2); + context.push(context.si); + context.push(context.es); + context._cmp(context.ch, context.cl); + if (context.flags.c()) goto nextopenslot; + obtoinv(context); +nextopenslot: + context.es = context.pop(); + context.si = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.di, (44)); + context._inc(context.cl); + context._cmp(context.cl, 5); + if (!context.flags.z()) goto openloop1; + undertextline(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void findallryan(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.di); + context.cx = 30; + context.ax = 0x0ffff; + while(context.cx--) context._stosw(); + context.di = context.pop(); + context.cl = 4; + context.ds = context.data.word(kExtras); + context.bx = (0+2080+30000); + context.ch = 0; +findryanloop: + context._cmp(context.ds.byte(context.bx+2), context.cl); + if (!context.flags.z()) goto notinryaninv; + context._cmp(context.ds.byte(context.bx+3), 255); + if (!context.flags.z()) goto notinryaninv; + context.al = context.ds.byte(context.bx+4); + context.ah = 0; + context.push(context.di); + context._add(context.di, context.ax); + context._add(context.di, context.ax); + context.al = context.ch; + context.ah = 4; + context._stosw(); + context.di = context.pop(); +notinryaninv: + context._add(context.bx, 16); + context._inc(context.ch); + context._cmp(context.ch, (114)); + if (!context.flags.z()) goto findryanloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void findallopen(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.di); + context.cx = 16; + context.ax = 0x0ffff; + while(context.cx--) context._stosw(); + context.di = context.pop(); + context.cl = context.data.byte(kOpenedob); + context.dl = context.data.byte(kOpenedtype); + context.ds = context.data.word(kExtras); + context.bx = (0+2080+30000); + context.ch = 0; +findopen1: + context._cmp(context.ds.byte(context.bx+3), context.cl); + if (!context.flags.z()) goto findopen2; + context._cmp(context.ds.byte(context.bx+2), context.dl); + if (!context.flags.z()) goto findopen2; + context._cmp(context.data.byte(kOpenedtype), 4); + if (context.flags.z()) goto noloccheck; + context.al = context.ds.byte(context.bx+5); + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto findopen2; +noloccheck: + context.al = context.ds.byte(context.bx+4); + context.ah = 0; + context.push(context.di); + context._add(context.di, context.ax); + context._add(context.di, context.ax); + context.al = context.ch; + context.ah = 4; + context._stosw(); + context.di = context.pop(); +findopen2: + context._add(context.bx, 16); + context._inc(context.ch); + context._cmp(context.ch, (114)); + if (!context.flags.z()) goto findopen1; + context.cl = context.data.byte(kOpenedob); + context.dl = context.data.byte(kOpenedtype); + context.push(context.dx); + context.ds = context.data.word(kFreedat); + context.dx = context.pop(); + context.bx = 0; + context.ch = 0; +findopen1a: + context._cmp(context.ds.byte(context.bx+3), context.cl); + if (!context.flags.z()) goto findopen2a; + context._cmp(context.ds.byte(context.bx+2), context.dl); + if (!context.flags.z()) goto findopen2a; + context.al = context.ds.byte(context.bx+4); + context.ah = 0; + context.push(context.di); + context._add(context.di, context.ax); + context._add(context.di, context.ax); + context.al = context.ch; + context.ah = 2; + context._stosw(); + context.di = context.pop(); +findopen2a: + context._add(context.bx, 16); + context._inc(context.ch); + context._cmp(context.ch, 80); + if (!context.flags.z()) goto findopen1a; + {assert(stack_depth == context.stack.size()); return; } +} + +void obtoinv(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.bx); + context.push(context.es); + context.push(context.si); + context.push(context.ax); + context.push(context.ax); + context.push(context.di); + context.push(context.bx); + context.ds = context.data.word(kIcons1); + context._sub(context.di, 2); + context._sub(context.bx, 1); + context.al = 10; + context.ah = 0; + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.ax = context.pop(); + context._cmp(context.al, 255); + if (context.flags.z()) goto finishfill; + context.push(context.bx); + context.push(context.di); + context.push(context.ax); + context.ds = context.data.word(kExtras); + context._cmp(context.ah, 4); + if (context.flags.z()) goto isanextra; + context.ds = context.data.word(kFreeframes); +isanextra: + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + context._inc(context.al); + context.ah = 128; + context._add(context.bx, 19); + context._add(context.di, 18); + showframe(context); + context.ax = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.push(context.bx); + getanyaddir(context); + isitworn(context); + context.bx = context.pop(); + if (!context.flags.z()) goto finishfill; + context.ds = context.data.word(kIcons1); + context._sub(context.di, 3); + context._sub(context.bx, 2); + context.al = 7; + context.ah = 0; + showframe(context); +finishfill: + context.ax = context.pop(); + context.si = context.pop(); + context.es = context.pop(); + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void isitworn(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.bx+12); + context._cmp(context.al, 'W'-'A'); + if (!context.flags.z()) goto notworn; + context.al = context.es.byte(context.bx+13); + context._cmp(context.al, 'E'-'A'); +notworn: + {assert(stack_depth == context.stack.size()); return; } +} + +void makeworn(Context & context) { + uint stack_depth = context.stack.size(); + context.es.byte(context.bx+12) = 'W'-'A'; + context.es.byte(context.bx+13) = 'E'-'A'; + {assert(stack_depth == context.stack.size()); return; } +} + +void examineob(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kPointermode) = 0; + context.data.word(kTimecount) = 0; +examineagain: + context.data.byte(kInmaparea) = 0; + context.data.byte(kExamagain) = 0; + context.data.byte(kOpenedob) = 255; + context.data.byte(kOpenedtype) = 255; + context.data.byte(kInvopen) = 0; + context.al = context.data.byte(kCommandtype); + context.data.byte(kObjecttype) = context.al; + context.data.byte(kItemframe) = 0; + context.data.byte(kPointerframe) = 0; + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + obpicture(context); + describeob(context); + undertextline(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); +waitexam: + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + delpointer(context); + context.data.byte(kGetback) = 0; + context.bx = 2494; + context._cmp(context.data.byte(kInvopen), 0); + if (context.flags.z()) goto notuseinv; + context.bx = 2556; + context._cmp(context.data.byte(kInvopen), 1); + if (context.flags.z()) goto notuseinv; + context.bx = 2618; +notuseinv: + checkcoords(context); + context._cmp(context.data.byte(kExamagain), 0); + if (context.flags.z()) goto norex; + goto examineagain; +norex: + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto waitexam; + context.data.byte(kPickup) = 0; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto iswatching; + context._cmp(context.data.byte(kNewlocation), 255); + if (!context.flags.z()) goto justgetback; +iswatching: + makemainscreen(context); + context.data.byte(kInvopen) = 0; + context.data.byte(kOpenedob) = 255; + {assert(stack_depth == context.stack.size()); return; } +justgetback: + context.data.byte(kInvopen) = 0; + context.data.byte(kOpenedob) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void makemainscreen(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + context.data.byte(kNewobs) = 1; + drawfloor(context); + spriteupdate(context); + printsprites(context); + reelsonscreen(context); + showicon(context); + getunderzoom(context); + undertextline(context); + context.data.byte(kCommandtype) = 255; + animpointer(context); + worktoscreenm(context); + context.data.byte(kCommandtype) = 200; + context.data.byte(kManisoffscreen) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void getbackfromob(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPickup), 1); + if (!context.flags.z()) goto notheldob; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +notheldob: + getback1(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void incryanpage(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadyincryan; + context.data.byte(kCommandtype) = 222; + context.al = 31; + commandonly(context); +alreadyincryan: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noincryan; + context._and(context.ax, 1); + if (!context.flags.z()) goto doincryan; +noincryan: + {assert(stack_depth == context.stack.size()); return; } +doincryan: + context.ax = context.data.word(kMousex); + context._sub(context.ax, (80)+167); + context.data.byte(kRyanpage) = -1; +findnewpage: + context._inc(context.data.byte(kRyanpage)); + context._sub(context.ax, 18); + if (!context.flags.c()) goto findnewpage; + delpointer(context); + fillryan(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void openinv(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kInvopen) = 1; + context.al = 61; + context.di = (80); + context.bx = (58)-10; + context.dl = 240; + printmessage(context); + fillryan(context); + context.data.byte(kCommandtype) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void showryanpage(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kIcons1); + context.di = (80)+167; + context.bx = (58)-12; + context.al = 12; + context.ah = 0; + showframe(context); + context.al = 13; + context._add(context.al, context.data.byte(kRyanpage)); + context.push(context.ax); + context.al = context.data.byte(kRyanpage); + context.ah = 0; + context.cx = 18; + context._mul(context.cx); + context.ds = context.data.word(kIcons1); + context.di = (80)+167; + context._add(context.di, context.ax); + context.bx = (58)-12; + context.ax = context.pop(); + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void openob(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kOpenedob); + context.ah = context.data.byte(kOpenedtype); + context.di = 5847; + copyname(context); + context.di = (80); + context.bx = (58)+86; + context.al = 62; + context.dl = 240; + printmessage(context); + context.di = context.data.word(kLastxpos); + context._add(context.di, 5); + context.bx = (58)+86; + context.es = context.cs; + context.si = 5847; + context.dl = 220; + context.al = 0; + context.ah = 0; + printdirect(context); + fillopen(context); + getopenedsize(context); + context.al = context.ah; + context.ah = 0; + context.cx = (44); + context._mul(context.cx); + context._add(context.ax, (80)); + context.bx = 2588; + context.cs.word(context.bx) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void obicons(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCommand); + getanyad(context); + context._cmp(context.al, 255); + if (context.flags.z()) goto cantopenit; + context.ds = context.data.word(kIcons2); + context.di = 210; + context.bx = 1; + context.al = 4; + context.ah = 0; + showframe(context); +cantopenit: + context.ds = context.data.word(kIcons2); + context.di = 260; + context.bx = 1; + context.al = 1; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void examicon(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kIcons2); + context.di = 254; + context.bx = 5; + context.al = 3; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void obpicture(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + context._cmp(context.ah, 1); + if (context.flags.z()) goto setframe; + context._cmp(context.ah, 4); + if (context.flags.z()) goto exframe; + context.ds = context.data.word(kFreeframes); + context.di = 160; + context.bx = 68; + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + context._inc(context.al); + context.ah = 128; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +setframe: + {assert(stack_depth == context.stack.size()); return; } +exframe: + context.ds = context.data.word(kExtras); + context.di = 160; + context.bx = 68; + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + context._inc(context.al); + context.ah = 128; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void describeob(Context & context) { + uint stack_depth = context.stack.size(); + getobtextstart(context); + context.di = 33; + context.bx = 92; + context.dl = 241; + context.ah = 16; + context.data.word(kCharshift) = 91+91; + printdirect(context); + context.data.word(kCharshift) = 0; + context.di = 36; + context.bx = 104; + context.dl = 241; + context.ah = 0; + printdirect(context); + context.push(context.bx); + obsthatdothings(context); + context.bx = context.pop(); + additionaltext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void additionaltext(Context & context) { + uint stack_depth = context.stack.size(); + context._add(context.bx, 10); + context.push(context.bx); + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto emptycup; + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'F'; + compare(context); + if (context.flags.z()) goto fullcup; + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +emptycup: + context.al = 40; + findpuztext(context); + context.bx = context.pop(); + context.di = 36; + context.dl = 241; + context.ah = 0; + printdirect(context); + {assert(stack_depth == context.stack.size()); return; } +fullcup: + context.al = 39; + findpuztext(context); + context.bx = context.pop(); + context.di = 36; + context.dl = 241; + context.ah = 0; + printdirect(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void obsthatdothings(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + context.cl = 'M'; + context.ch = 'E'; + context.dl = 'M'; + context.dh = 'B'; + compare(context); + if (!context.flags.z()) goto notlouiscard; + context.al = 4; + getlocation(context); + context._cmp(context.al, 1); + if (context.flags.z()) goto seencard; + context.al = 4; + setlocation(context); + lookatcard(context); +seencard: + {assert(stack_depth == context.stack.size()); return; } +notlouiscard: + {assert(stack_depth == context.stack.size()); return; } +} + +void getobtextstart(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kFreedesc); + context.si = (0); + context.cx = (0+(82*2)); + context._cmp(context.data.byte(kObjecttype), 2); + if (context.flags.z()) goto describe; + context.es = context.data.word(kSetdesc); + context.si = (0); + context.cx = (0+(130*2)); + context._cmp(context.data.byte(kObjecttype), 1); + if (context.flags.z()) goto describe; + context.es = context.data.word(kExtras); + context.si = (0+2080+30000+(16*114)); + context.cx = (0+2080+30000+(16*114)+((114+2)*2)); +describe: + context.al = context.data.byte(kCommand); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.si, context.ax); + context.ax = context.es.word(context.si); + context._add(context.ax, context.cx); + context.si = context.ax; + context.bx = context.ax; +tryagain: + context.push(context.si); + findnextcolon(context); + context.al = context.es.byte(context.si); + context.cx = context.si; + context.si = context.pop(); + context._cmp(context.data.byte(kObjecttype), 1); + if (!context.flags.z()) goto cantmakeoneup; + context._cmp(context.al, 0); + if (context.flags.z()) goto findsometext; + context._cmp(context.al, ':'); + if (context.flags.z()) goto findsometext; +cantmakeoneup: + {assert(stack_depth == context.stack.size()); return; } +findsometext: + searchforsame(context); + goto tryagain; + {assert(stack_depth == context.stack.size()); return; } +} + +void searchforsame(Context & context) { + uint stack_depth = context.stack.size(); + context.si = context.cx; +searchagain: + context._inc(context.si); + context.al = context.es.byte(context.bx); +search: + context._cmp(context.es.byte(context.si), context.al); + if (context.flags.z()) goto gotstartletter; + context._inc(context.cx); + context._inc(context.si); + context._cmp(context.si, 8000); + if (context.flags.c()) goto search; + context.si = context.bx; + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +gotstartletter: + context.push(context.bx); + context.push(context.si); +keepchecking: + context._inc(context.si); + context._inc(context.bx); + context.al = context.es.byte(context.bx); + context.ah = context.es.byte(context.si); + context._cmp(context.al, ':'); + if (context.flags.z()) goto foundmatch; + context._cmp(context.al, 0); + if (context.flags.z()) goto foundmatch; + context._cmp(context.al, context.ah); + if (context.flags.z()) goto keepchecking; + context.si = context.pop(); + context.bx = context.pop(); + goto searchagain; +foundmatch: + context.si = context.pop(); + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void findnextcolon(Context & context) { + uint stack_depth = context.stack.size(); +isntcolon: + context.al = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto endofcolon; + context._cmp(context.al, ':'); + if (!context.flags.z()) goto isntcolon; +endofcolon: + {assert(stack_depth == context.stack.size()); return; } +} + +void inventory(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kMandead), 1); + if (context.flags.z()) goto iswatchinv; + context._cmp(context.data.word(kWatchingtime), 0); + if (context.flags.z()) goto notwatchinv; +iswatchinv: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +notwatchinv: + context._cmp(context.data.byte(kCommandtype), 239); + if (context.flags.z()) goto alreadyopinv; + context.data.byte(kCommandtype) = 239; + context.al = 32; + commandonly(context); +alreadyopinv: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto cantopinv; + context._and(context.ax, 1); + if (!context.flags.z()) goto doopeninv; +cantopinv: + {assert(stack_depth == context.stack.size()); return; } +doopeninv: + context.data.word(kTimecount) = 0; + context.data.byte(kPointermode) = 0; + context.data.byte(kInmaparea) = 0; + animpointer(context); + createpanel(context); + showpanel(context); + examicon(context); + showman(context); + showexit(context); + undertextline(context); + context.data.byte(kPickup) = 0; + context.data.byte(kInvopen) = 2; + openinv(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.data.byte(kOpenedob) = 255; + goto waitexam; +/*continuing to unbounded code: examineagain from examineob:3-66*/ +examineagain: + context.data.byte(kInmaparea) = 0; + context.data.byte(kExamagain) = 0; + context.data.byte(kOpenedob) = 255; + context.data.byte(kOpenedtype) = 255; + context.data.byte(kInvopen) = 0; + context.al = context.data.byte(kCommandtype); + context.data.byte(kObjecttype) = context.al; + context.data.byte(kItemframe) = 0; + context.data.byte(kPointerframe) = 0; + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + obpicture(context); + describeob(context); + undertextline(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); +waitexam: + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + delpointer(context); + context.data.byte(kGetback) = 0; + context.bx = 2494; + context._cmp(context.data.byte(kInvopen), 0); + if (context.flags.z()) goto notuseinv; + context.bx = 2556; + context._cmp(context.data.byte(kInvopen), 1); + if (context.flags.z()) goto notuseinv; + context.bx = 2618; +notuseinv: + checkcoords(context); + context._cmp(context.data.byte(kExamagain), 0); + if (context.flags.z()) goto norex; + goto examineagain; +norex: + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto waitexam; + context.data.byte(kPickup) = 0; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto iswatching; + context._cmp(context.data.byte(kNewlocation), 255); + if (!context.flags.z()) goto justgetback; +iswatching: + makemainscreen(context); + context.data.byte(kInvopen) = 0; + context.data.byte(kOpenedob) = 255; + {assert(stack_depth == context.stack.size()); return; } +justgetback: + context.data.byte(kInvopen) = 0; + context.data.byte(kOpenedob) = 255; + {assert(stack_depth == context.stack.size()); return; } +examlist: +invlist1: +openchangesize: +withlist1: + {assert(stack_depth == context.stack.size()); return; } +} + +void setpickup(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kObjecttype), 1); + if (context.flags.z()) goto cantpick; + context._cmp(context.data.byte(kObjecttype), 3); + if (context.flags.z()) goto cantpick; + getanyad(context); + context.al = context.es.byte(context.bx+2); + context._cmp(context.al, 4); + if (!context.flags.z()) goto canpick; +cantpick: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canpick: + context._cmp(context.data.byte(kCommandtype), 209); + if (context.flags.z()) goto alreadysp; + context.data.byte(kCommandtype) = 209; + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kObjecttype); + context.al = 33; + commandwithob(context); +alreadysp: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, 1); + if (!context.flags.z()) goto nosetpick; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (!context.flags.z()) goto dosetpick; +nosetpick: + {assert(stack_depth == context.stack.size()); return; } +dosetpick: + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + examicon(context); + context.data.byte(kPickup) = 1; + context.data.byte(kInvopen) = 2; + context._cmp(context.data.byte(kObjecttype), 4); + if (context.flags.z()) goto pickupexob; + context.al = context.data.byte(kCommand); + context.data.byte(kItemframe) = context.al; + context.data.byte(kOpenedob) = 255; + transfertoex(context); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = 4; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; + openinv(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +pickupexob: + context.al = context.data.byte(kCommand); + context.data.byte(kItemframe) = context.al; + context.data.byte(kOpenedob) = 255; + openinv(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void examinventory(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 249); + if (context.flags.z()) goto alreadyexinv; + context.data.byte(kCommandtype) = 249; + context.al = 32; + commandonly(context); +alreadyexinv: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (!context.flags.z()) goto doexinv; + {assert(stack_depth == context.stack.size()); return; } +doexinv: + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + examicon(context); + context.data.byte(kPickup) = 0; + context.data.byte(kInvopen) = 2; + openinv(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void reexfrominv(Context & context) { + uint stack_depth = context.stack.size(); + findinvpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kCommandtype) = context.ah; + context.data.byte(kCommand) = context.al; + context.data.byte(kExamagain) = 1; + context.data.byte(kPointermode) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void reexfromopen(Context & context) { + uint stack_depth = context.stack.size(); + {assert(stack_depth == context.stack.size()); return; } + findopenpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kCommandtype) = context.ah; + context.data.byte(kCommand) = context.al; + context.data.byte(kExamagain) = 1; + context.data.byte(kPointermode) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void swapwithinv(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kItemframe); + context.ah = context.data.byte(kObjecttype); + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub7; + context._cmp(context.data.byte(kCommandtype), 243); + if (context.flags.z()) goto alreadyswap1; + context.data.byte(kCommandtype) = 243; +difsub7: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 34; + commandwithob(context); +alreadyswap1: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto cantswap1; + context._and(context.ax, 1); + if (!context.flags.z()) goto doswap1; +cantswap1: + {assert(stack_depth == context.stack.size()); return; } +doswap1: + context.ah = context.data.byte(kObjecttype); + context.al = context.data.byte(kItemframe); + context.push(context.ax); + findinvpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = context.ah; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; + context.bl = context.data.byte(kItemframe); + context.bh = context.data.byte(kObjecttype); + context.ax = context.pop(); + context.data.byte(kObjecttype) = context.ah; + context.data.byte(kItemframe) = context.al; + context.push(context.bx); + findinvpos(context); + delpointer(context); + context.al = context.data.byte(kItemframe); + geteitherad(context); + context.es.byte(context.bx+2) = 4; + context.es.byte(context.bx+3) = 255; + context.al = context.data.byte(kLastinvpos); + context.es.byte(context.bx+4) = context.al; + context.ax = context.pop(); + context.data.byte(kObjecttype) = context.ah; + context.data.byte(kItemframe) = context.al; + fillryan(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void swapwithopen(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kItemframe); + context.ah = context.data.byte(kObjecttype); + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub8; + context._cmp(context.data.byte(kCommandtype), 242); + if (context.flags.z()) goto alreadyswap2; + context.data.byte(kCommandtype) = 242; +difsub8: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 34; + commandwithob(context); +alreadyswap2: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto cantswap2; + context._and(context.ax, 1); + if (!context.flags.z()) goto doswap2; +cantswap2: + {assert(stack_depth == context.stack.size()); return; } +doswap2: + geteitherad(context); + isitworn(context); + if (!context.flags.z()) goto notwornswap; + wornerror(context); + {assert(stack_depth == context.stack.size()); return; } +notwornswap: + delpointer(context); + context.al = context.data.byte(kItemframe); + context._cmp(context.al, context.data.byte(kOpenedob)); + if (!context.flags.z()) goto isntsame2; + context.al = context.data.byte(kObjecttype); + context._cmp(context.al, context.data.byte(kOpenedtype)); + if (!context.flags.z()) goto isntsame2; + errormessage1(context); + {assert(stack_depth == context.stack.size()); return; } +isntsame2: + checkobjectsize(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto sizeok2; + {assert(stack_depth == context.stack.size()); return; } +sizeok2: + context.ah = context.data.byte(kObjecttype); + context.al = context.data.byte(kItemframe); + context.push(context.ax); + findopenpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = context.ah; + context._cmp(context.ah, 4); + if (!context.flags.z()) goto makeswapex; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; + goto actuallyswap; +makeswapex: + transfertoex(context); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = 4; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; +actuallyswap: + context.bl = context.data.byte(kItemframe); + context.bh = context.data.byte(kObjecttype); + context.ax = context.pop(); + context.data.byte(kObjecttype) = context.ah; + context.data.byte(kItemframe) = context.al; + context.push(context.bx); + findopenpos(context); + geteitherad(context); + context.al = context.data.byte(kOpenedtype); + context.es.byte(context.bx+2) = context.al; + context.al = context.data.byte(kOpenedob); + context.es.byte(context.bx+3) = context.al; + context.al = context.data.byte(kLastinvpos); + context.es.byte(context.bx+4) = context.al; + context.al = context.data.byte(kReallocation); + context.es.byte(context.bx+5) = context.al; + context.ax = context.pop(); + context.data.byte(kObjecttype) = context.ah; + context.data.byte(kItemframe) = context.al; + fillopen(context); + fillryan(context); + undertextline(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void intoinv(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPickup), 0); + if (!context.flags.z()) goto notout; + outofinv(context); + {assert(stack_depth == context.stack.size()); return; } +notout: + findinvpos(context); + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto canplace1; + swapwithinv(context); + {assert(stack_depth == context.stack.size()); return; } +canplace1: + context.al = context.data.byte(kItemframe); + context.ah = context.data.byte(kObjecttype); + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub1; + context._cmp(context.data.byte(kCommandtype), 220); + if (context.flags.z()) goto alreadyplce; + context.data.byte(kCommandtype) = 220; +difsub1: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 35; + commandwithob(context); +alreadyplce: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notletgo2; + context._and(context.ax, 1); + if (!context.flags.z()) goto doplace; +notletgo2: + {assert(stack_depth == context.stack.size()); return; } +doplace: + delpointer(context); + context.al = context.data.byte(kItemframe); + getexad(context); + context.es.byte(context.bx+2) = 4; + context.es.byte(context.bx+3) = 255; + context.al = context.data.byte(kLastinvpos); + context.es.byte(context.bx+4) = context.al; + context.data.byte(kPickup) = 0; + fillryan(context); + readmouse(context); + showpointer(context); + outofinv(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void deletetaken(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kFreedat); + context.ah = context.data.byte(kReallocation); + context.ds = context.data.word(kExtras); + context.si = (0+2080+30000); + context.cx = (114); +takenloop: + context.al = context.ds.byte(context.si+11); + context._cmp(context.al, context.ah); + if (!context.flags.z()) goto notinhere; + context.bl = context.ds.byte(context.si+1); + context.bh = 0; + context._add(context.bx, context.bx); + context._add(context.bx, context.bx); + context._add(context.bx, context.bx); + context._add(context.bx, context.bx); + context.es.byte(context.bx+2) = 254; +notinhere: + context._add(context.si, 16); + if (--context.cx) goto takenloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void outofinv(Context & context) { + uint stack_depth = context.stack.size(); + findinvpos(context); + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (!context.flags.z()) goto canpick2; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canpick2: + context.bx = context.data.word(kMousebutton); + context._cmp(context.bx, 2); + if (!context.flags.z()) goto canpick2a; + reexfrominv(context); + {assert(stack_depth == context.stack.size()); return; } +canpick2a: + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub3; + context._cmp(context.data.byte(kCommandtype), 221); + if (context.flags.z()) goto alreadygrab; + context.data.byte(kCommandtype) = 221; +difsub3: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 36; + commandwithob(context); +alreadygrab: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notletgo; + context._and(context.ax, 1); + if (!context.flags.z()) goto dograb; +notletgo: + {assert(stack_depth == context.stack.size()); return; } +dograb: + delpointer(context); + context.data.byte(kPickup) = 1; + findinvpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = context.ah; + getexad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; + fillryan(context); + readmouse(context); + showpointer(context); + intoinv(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getfreead(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.cl = 4; + context._shl(context.ax, context.cl); + context.bx = context.ax; + context.es = context.data.word(kFreedat); + {assert(stack_depth == context.stack.size()); return; } +} + +void getexad(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.bx = 16; + context._mul(context.bx); + context.bx = context.ax; + context.es = context.data.word(kExtras); + context._add(context.bx, (0+2080+30000)); + {assert(stack_depth == context.stack.size()); return; } +} + +void geteitherad(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kObjecttype), 4); + if (context.flags.z()) goto isinexlist; + context.al = context.data.byte(kItemframe); + getfreead(context); + {assert(stack_depth == context.stack.size()); return; } +isinexlist: + context.al = context.data.byte(kItemframe); + getexad(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getanyad(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kObjecttype), 4); + if (context.flags.z()) goto isex; + context._cmp(context.data.byte(kObjecttype), 2); + if (context.flags.z()) goto isfree; + context.al = context.data.byte(kCommand); + getsetad(context); + context.ax = context.es.word(context.bx+4); + {assert(stack_depth == context.stack.size()); return; } +isfree: + context.al = context.data.byte(kCommand); + getfreead(context); + context.ax = context.es.word(context.bx+7); + {assert(stack_depth == context.stack.size()); return; } +isex: + context.al = context.data.byte(kCommand); + getexad(context); + context.ax = context.es.word(context.bx+7); + {assert(stack_depth == context.stack.size()); return; } +} + +void getanyaddir(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ah, 4); + if (context.flags.z()) goto isex3; + context._cmp(context.ah, 2); + if (context.flags.z()) goto isfree3; + getsetad(context); + {assert(stack_depth == context.stack.size()); return; } +isfree3: + getfreead(context); + {assert(stack_depth == context.stack.size()); return; } +isex3: + getexad(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getopenedsize(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kOpenedtype), 4); + if (context.flags.z()) goto isex2; + context._cmp(context.data.byte(kOpenedtype), 2); + if (context.flags.z()) goto isfree2; + context.al = context.data.byte(kOpenedob); + getsetad(context); + context.ax = context.es.word(context.bx+3); + {assert(stack_depth == context.stack.size()); return; } +isfree2: + context.al = context.data.byte(kOpenedob); + getfreead(context); + context.ax = context.es.word(context.bx+7); + {assert(stack_depth == context.stack.size()); return; } +isex2: + context.al = context.data.byte(kOpenedob); + getexad(context); + context.ax = context.es.word(context.bx+7); + {assert(stack_depth == context.stack.size()); return; } +} + +void getsetad(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.bx = 64; + context._mul(context.bx); + context.bx = context.ax; + context.es = context.data.word(kSetdat); + {assert(stack_depth == context.stack.size()); return; } +} + +void findinvpos(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = context.data.word(kMousex); + context._sub(context.cx, (80)); + context.bx = -1; +findinv1: + context._inc(context.bx); + context._sub(context.cx, (44)); + if (!context.flags.c()) goto findinv1; + context.cx = context.data.word(kMousey); + context._sub(context.cx, (58)); + context._sub(context.bx, 5); +findinv2: + context._add(context.bx, 5); + context._sub(context.cx, (44)); + if (!context.flags.c()) goto findinv2; + context.al = context.data.byte(kRyanpage); + context.ah = 0; + context.cx = 10; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.al = context.bl; + context.data.byte(kLastinvpos) = context.al; + context._add(context.bx, context.bx); + context.es = context.data.word(kBuffers); + context._add(context.bx, (0+(180*10)+32)); + {assert(stack_depth == context.stack.size()); return; } +} + +void findopenpos(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = context.data.word(kMousex); + context._sub(context.cx, (80)); + context.bx = -1; +findopenp1: + context._inc(context.bx); + context._sub(context.cx, (44)); + if (!context.flags.c()) goto findopenp1; + context.al = context.bl; + context.data.byte(kLastinvpos) = context.al; + context._add(context.bx, context.bx); + context.es = context.data.word(kBuffers); + context._add(context.bx, (0+(180*10))); + {assert(stack_depth == context.stack.size()); return; } +} + +void dropobject(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 223); + if (context.flags.z()) goto alreadydrop; + context.data.byte(kCommandtype) = 223; + context._cmp(context.data.byte(kPickup), 0); + if (context.flags.z()) { blank(context); return; }; + context.bl = context.data.byte(kItemframe); + context.bh = context.data.byte(kObjecttype); + context.al = 37; + commandwithob(context); +alreadydrop: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nodrop; + context._and(context.ax, 1); + if (!context.flags.z()) goto dodrop; +nodrop: + {assert(stack_depth == context.stack.size()); return; } +dodrop: + geteitherad(context); + isitworn(context); + if (!context.flags.z()) goto nowornerror; + wornerror(context); + {assert(stack_depth == context.stack.size()); return; } +nowornerror: + context._cmp(context.data.byte(kReallocation), 47); + if (context.flags.z()) goto nodrop2; + context.cl = context.data.byte(kRyanx); + context._add(context.cl, 12); + context.ch = context.data.byte(kRyany); + context._add(context.ch, 12); + checkone(context); + context._cmp(context.cl, 2); + if (context.flags.c()) goto nodroperror; +nodrop2: + droperror(context); + {assert(stack_depth == context.stack.size()); return; } +nodroperror: + context._cmp(context.data.byte(kMapxsize), 64); + if (!context.flags.z()) goto notinlift; + context._cmp(context.data.byte(kMapysize), 64); + if (!context.flags.z()) goto notinlift; + droperror(context); + {assert(stack_depth == context.stack.size()); return; } +notinlift: + context.al = context.data.byte(kItemframe); + context.ah = 4; + context.cl = 'G'; + context.ch = 'U'; + context.dl = 'N'; + context.dh = 'A'; + compare(context); + if (context.flags.z()) { cantdrop(context); return; }; + context.al = context.data.byte(kItemframe); + context.ah = 4; + context.cl = 'S'; + context.ch = 'H'; + context.dl = 'L'; + context.dh = 'D'; + compare(context); + if (context.flags.z()) { cantdrop(context); return; }; + context.data.byte(kObjecttype) = 4; + context.al = context.data.byte(kItemframe); + getexad(context); + context.es.byte(context.bx+2) = 0; + context.al = context.data.byte(kRyanx); + context._add(context.al, 4); + context.cl = 4; + context._shr(context.al, context.cl); + context._add(context.al, context.data.byte(kMapx)); + context.ah = context.data.byte(kRyany); + context._add(context.ah, 8); + context.cl = 4; + context._shr(context.ah, context.cl); + context._add(context.ah, context.data.byte(kMapy)); + context.es.byte(context.bx+3) = context.al; + context.es.byte(context.bx+5) = context.ah; + context.al = context.data.byte(kRyanx); + context._add(context.al, 4); + context._and(context.al, 15); + context.ah = context.data.byte(kRyany); + context._add(context.ah, 8); + context._and(context.ah, 15); + context.es.byte(context.bx+4) = context.al; + context.es.byte(context.bx+6) = context.ah; + context.data.byte(kPickup) = 0; + context.al = context.data.byte(kReallocation); + context.es.byte(context.bx) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void droperror(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCommandtype) = 255; + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 56; + context.dl = 240; + printmessage(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + context.data.byte(kCommandtype) = 255; + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void cantdrop(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCommandtype) = 255; + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 24; + context.dl = 240; + printmessage(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + context.data.byte(kCommandtype) = 255; + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void wornerror(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCommandtype) = 255; + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 57; + context.dl = 240; + printmessage(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + context.data.byte(kCommandtype) = 255; + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void removeobfrominv(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommand), 100); + if (context.flags.z()) goto obnotexist; + getanyad(context); + context.di = context.bx; + context.cl = context.data.byte(kCommand); + context.ch = 0; + deleteexobject(context); +obnotexist: + {assert(stack_depth == context.stack.size()); return; } +} + +void selectopenob(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCommand); + getanyad(context); + context._cmp(context.al, 255); + if (!context.flags.z()) goto canopenit1; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canopenit1: + context._cmp(context.data.byte(kCommandtype), 224); + if (context.flags.z()) goto alreadyopob; + context.data.byte(kCommandtype) = 224; + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kObjecttype); + context.al = 38; + commandwithob(context); +alreadyopob: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noopenob; + context._and(context.ax, 1); + if (!context.flags.z()) goto doopenob; +noopenob: + {assert(stack_depth == context.stack.size()); return; } +doopenob: + context.al = context.data.byte(kCommand); + context.data.byte(kOpenedob) = context.al; + context.al = context.data.byte(kObjecttype); + context.data.byte(kOpenedtype) = context.al; + createpanel(context); + showpanel(context); + showman(context); + examicon(context); + showexit(context); + openinv(context); + openob(context); + undertextline(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useopened(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kOpenedob), 255); + if (context.flags.z()) goto cannotuseopen; + context._cmp(context.data.byte(kPickup), 0); + if (!context.flags.z()) goto notout2; + outofopen(context); + {assert(stack_depth == context.stack.size()); return; } +notout2: + findopenpos(context); + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto canplace3; + swapwithopen(context); +cannotuseopen: + {assert(stack_depth == context.stack.size()); return; } +canplace3: + context._cmp(context.data.byte(kPickup), 1); + if (context.flags.z()) goto intoopen; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +intoopen: + context.al = context.data.byte(kItemframe); + context.ah = context.data.byte(kObjecttype); + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub2; + context._cmp(context.data.byte(kCommandtype), 227); + if (context.flags.z()) goto alreadyplc2; + context.data.byte(kCommandtype) = 227; +difsub2: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 35; + commandwithob(context); +alreadyplc2: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notletgo3; + context._cmp(context.ax, 1); + if (context.flags.z()) goto doplace2; +notletgo3: + {assert(stack_depth == context.stack.size()); return; } +doplace2: + geteitherad(context); + isitworn(context); + if (!context.flags.z()) goto notworntoopen; + wornerror(context); + {assert(stack_depth == context.stack.size()); return; } +notworntoopen: + delpointer(context); + context.al = context.data.byte(kItemframe); + context._cmp(context.al, context.data.byte(kOpenedob)); + if (!context.flags.z()) goto isntsame; + context.al = context.data.byte(kObjecttype); + context._cmp(context.al, context.data.byte(kOpenedtype)); + if (!context.flags.z()) goto isntsame; + errormessage1(context); + {assert(stack_depth == context.stack.size()); return; } +isntsame: + checkobjectsize(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto sizeok1; + {assert(stack_depth == context.stack.size()); return; } +sizeok1: + context.data.byte(kPickup) = 0; + context.al = context.data.byte(kItemframe); + geteitherad(context); + context.al = context.data.byte(kOpenedtype); + context.es.byte(context.bx+2) = context.al; + context.al = context.data.byte(kOpenedob); + context.es.byte(context.bx+3) = context.al; + context.al = context.data.byte(kLastinvpos); + context.es.byte(context.bx+4) = context.al; + context.al = context.data.byte(kReallocation); + context.es.byte(context.bx+5) = context.al; + fillopen(context); + undertextline(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void errormessage1(Context & context) { + uint stack_depth = context.stack.size(); + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 58; + context.dl = 240; + printmessage(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void errormessage2(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCommandtype) = 255; + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 59; + context.dl = 240; + printmessage(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void errormessage3(Context & context) { + uint stack_depth = context.stack.size(); + delpointer(context); + context.di = 76; + context.bx = 21; + context.al = 60; + context.dl = 240; + printmessage(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + showpanel(context); + showman(context); + examicon(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkobjectsize(Context & context) { + uint stack_depth = context.stack.size(); + getopenedsize(context); + context.push(context.ax); + context.al = context.data.byte(kItemframe); + geteitherad(context); + context.al = context.es.byte(context.bx+9); + context.cx = context.pop(); + context._cmp(context.al, 255); + if (!context.flags.z()) goto notunsized; + context.al = 6; +notunsized: + context._cmp(context.al, 100); + if (!context.flags.c()) goto specialcase; + context._cmp(context.cl, 100); + if (context.flags.c()) goto isntspecial; + errormessage3(context); + goto sizewrong; +isntspecial: + context._cmp(context.cl, context.al); + if (!context.flags.c()) goto sizeok; +specialcase: + context._sub(context.al, 100); + context._cmp(context.cl, 100); + if (!context.flags.c()) goto bothspecial; + context._cmp(context.cl, context.al); + if (!context.flags.c()) goto sizeok; + errormessage2(context); + goto sizewrong; +bothspecial: + context._sub(context.cl, 100); + context._cmp(context.al, context.cl); + if (context.flags.z()) goto sizeok; + errormessage3(context); +sizewrong: + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +sizeok: + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void outofopen(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kOpenedob), 255); + if (context.flags.z()) goto cantuseopen; + findopenpos(context); + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (!context.flags.z()) goto canpick4; +cantuseopen: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canpick4: + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto difsub4; + context._cmp(context.data.byte(kCommandtype), 228); + if (context.flags.z()) goto alreadygrb; + context.data.byte(kCommandtype) = 228; +difsub4: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 36; + commandwithob(context); +alreadygrb: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notletgo4; + context._cmp(context.ax, 1); + if (context.flags.z()) goto dogrb; + context._cmp(context.ax, 2); + if (!context.flags.z()) goto notletgo4; + reexfromopen(context); +notletgo4: + {assert(stack_depth == context.stack.size()); return; } +dogrb: + delpointer(context); + context.data.byte(kPickup) = 1; + findopenpos(context); + context.ax = context.es.word(context.bx); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = context.ah; + context._cmp(context.ah, 4); + if (!context.flags.z()) goto makeintoex; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; + goto actuallyout; +makeintoex: + transfertoex(context); + context.data.byte(kItemframe) = context.al; + context.data.byte(kObjecttype) = 4; + geteitherad(context); + context.es.byte(context.bx+2) = 20; + context.es.byte(context.bx+3) = 255; +actuallyout: + fillopen(context); + undertextline(context); + readmouse(context); + useopened(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void transfertoex(Context & context) { + uint stack_depth = context.stack.size(); + emergencypurge(context); + getexpos(context); + context.al = context.data.byte(kExpos); + context.push(context.ax); + context.push(context.di); + context.al = context.data.byte(kItemframe); + context.ah = 0; + context.bx = 16; + context._mul(context.bx); + context.ds = context.data.word(kFreedat); + context.si = context.ax; + context.cx = 8; + while(context.cx--) context._movsw(); + context.di = context.pop(); + context.al = context.data.byte(kReallocation); + context.es.byte(context.di) = context.al; + context.es.byte(context.di+11) = context.al; + context.al = context.data.byte(kItemframe); + context.es.byte(context.di+1) = context.al; + context.es.byte(context.di+2) = 4; + context.es.byte(context.di+3) = 255; + context.al = context.data.byte(kLastinvpos); + context.es.byte(context.di+4) = context.al; + context.al = context.data.byte(kItemframe); + context.data.byte(kItemtotran) = context.al; + transfermap(context); + transferinv(context); + transfertext(context); + context.al = context.data.byte(kItemframe); + context.ah = 0; + context.bx = 16; + context._mul(context.bx); + context.ds = context.data.word(kFreedat); + context.si = context.ax; + context.ds.byte(context.si+2) = 254; + pickupconts(context); + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void pickupconts(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.ds.byte(context.si+7); + context._cmp(context.al, 255); + if (context.flags.z()) goto notopenable; + context.al = context.data.byte(kItemframe); + context.ah = context.data.byte(kObjecttype); + context.dl = context.data.byte(kExpos); + context.es = context.data.word(kFreedat); + context.bx = 0; + context.cx = 0; +pickupcontloop: + context.push(context.cx); + context.push(context.es); + context.push(context.bx); + context.push(context.dx); + context.push(context.ax); + context._cmp(context.es.byte(context.bx+2), context.ah); + if (!context.flags.z()) goto notinsidethis; + context._cmp(context.es.byte(context.bx+3), context.al); + if (!context.flags.z()) goto notinsidethis; + context.data.byte(kItemtotran) = context.cl; + transfercontoex(context); +notinsidethis: + context.ax = context.pop(); + context.dx = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context._add(context.bx, 16); + context._inc(context.cx); + context._cmp(context.cx, 80); + if (!context.flags.z()) goto pickupcontloop; +notopenable: + {assert(stack_depth == context.stack.size()); return; } +} + +void transfercontoex(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.push(context.dx); + context.push(context.es); + context.push(context.bx); + getexpos(context); + context.si = context.pop(); + context.ds = context.pop(); + context.push(context.di); + context.cx = 8; + while(context.cx--) context._movsw(); + context.di = context.pop(); + context.dx = context.pop(); + context.al = context.data.byte(kReallocation); + context.es.byte(context.di) = context.al; + context.es.byte(context.di+11) = context.al; + context.al = context.data.byte(kItemtotran); + context.es.byte(context.di+1) = context.al; + context.es.byte(context.di+3) = context.dl; + context.es.byte(context.di+2) = 4; + transfermap(context); + transferinv(context); + transfertext(context); + context.si = context.pop(); + context.ds = context.pop(); + context.ds.byte(context.si+2) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void transfertext(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kExtras); + context.al = context.data.byte(kExpos); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = (0+2080+30000+(16*114)); + context._add(context.bx, context.ax); + context.di = context.data.word(kExtextpos); + context.es.word(context.bx) = context.di; + context._add(context.di, (0+2080+30000+(16*114)+((114+2)*2))); + context.al = context.data.byte(kItemtotran); + context.ah = 0; + context._add(context.ax, context.ax); + context.ds = context.data.word(kFreedesc); + context.bx = (0); + context._add(context.bx, context.ax); + context.si = (0+(82*2)); + context.ax = context.ds.word(context.bx); + context._add(context.si, context.ax); +moretext: + context._lodsb(); + context._stosb(); + context._inc(context.data.word(kExtextpos)); + context._cmp(context.al, 0); + if (!context.flags.z()) goto moretext; + {assert(stack_depth == context.stack.size()); return; } +} + +void getexpos(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kExtras); + context.al = 0; + context.di = (0+2080+30000); +tryanotherex: + context._cmp(context.es.byte(context.di+2), 255); + if (context.flags.z()) goto foundnewex; + context._add(context.di, 16); + context._inc(context.al); + context._cmp(context.al, (114)); + if (!context.flags.z()) goto tryanotherex; +foundnewex: + context.data.byte(kExpos) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void purgealocation(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.es = context.data.word(kExtras); + context.di = (0+2080+30000); + context.bx = context.pop(); + context.cx = 0; +purgeloc: + context._cmp(context.bl, context.es.byte(context.di+0)); + if (!context.flags.z()) goto dontpurge; + context._cmp(context.es.byte(context.di+2), 0); + if (!context.flags.z()) goto dontpurge; + context.push(context.di); + context.push(context.es); + context.push(context.bx); + context.push(context.cx); + deleteexobject(context); + context.cx = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); +dontpurge: + context._add(context.di, 16); + context._inc(context.cx); + context._cmp(context.cx, (114)); + if (!context.flags.z()) goto purgeloc; + {assert(stack_depth == context.stack.size()); return; } +} + +void emergencypurge(Context & context) { + uint stack_depth = context.stack.size(); +checkpurgeagain: + context.ax = context.data.word(kExframepos); + context._add(context.ax, 4000); + context._cmp(context.ax, (30000)); + if (context.flags.c()) goto notnearframeend; + purgeanitem(context); + goto checkpurgeagain; +notnearframeend: + context.ax = context.data.word(kExtextpos); + context._add(context.ax, 400); + context._cmp(context.ax, (18000)); + if (context.flags.c()) goto notneartextend; + purgeanitem(context); + goto checkpurgeagain; +notneartextend: + {assert(stack_depth == context.stack.size()); return; } +} + +void purgeanitem(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kExtras); + context.di = (0+2080+30000); + context.bl = context.data.byte(kReallocation); + context.cx = 0; +lookforpurge: + context.al = context.es.byte(context.di+2); + context._cmp(context.al, 0); + if (!context.flags.z()) goto cantpurge; + context._cmp(context.es.byte(context.di+12), 2); + if (context.flags.z()) goto iscup; + context._cmp(context.es.byte(context.di+12), 255); + if (!context.flags.z()) goto cantpurge; +iscup: + context._cmp(context.es.byte(context.di+11), context.bl); + if (context.flags.z()) goto cantpurge; + deleteexobject(context); + {assert(stack_depth == context.stack.size()); return; } +cantpurge: + context._add(context.di, 16); + context._inc(context.cx); + context._cmp(context.cx, (114)); + if (!context.flags.z()) goto lookforpurge; + context.di = (0+2080+30000); + context.bl = context.data.byte(kReallocation); + context.cx = 0; +lookforpurge2: + context.al = context.es.byte(context.di+2); + context._cmp(context.al, 0); + if (!context.flags.z()) goto cantpurge2; + context._cmp(context.es.byte(context.di+12), 255); + if (!context.flags.z()) goto cantpurge2; + deleteexobject(context); + {assert(stack_depth == context.stack.size()); return; } +cantpurge2: + context._add(context.di, 16); + context._inc(context.cx); + context._cmp(context.cx, (114)); + if (!context.flags.z()) goto lookforpurge2; + {assert(stack_depth == context.stack.size()); return; } +} + +void deleteexobject(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + context.push(context.cx); + context.push(context.cx); + context.push(context.cx); + context.al = 255; + context.cx = 16; + while(context.cx--) context._stosb(); + context.ax = context.pop(); + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + deleteexframe(context); + context.ax = context.pop(); + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + context._inc(context.al); + deleteexframe(context); + context.ax = context.pop(); + deleteextext(context); + context.bx = context.pop(); + context.bh = context.bl; + context.bl = 4; + context.di = (0+2080+30000); + context.cx = 0; +deleteconts: + context._cmp(context.es.word(context.di+2), context.bx); + if (!context.flags.z()) goto notinsideex; + context.push(context.bx); + context.push(context.cx); + context.push(context.di); + deleteexobject(context); + context.di = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); +notinsideex: + context._add(context.di, 16); + context._inc(context.cx); + context._cmp(context.cx, (114)); + if (!context.flags.z()) goto deleteconts; + {assert(stack_depth == context.stack.size()); return; } +} + +void deleteexframe(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (0); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.di, context.ax); + context._add(context.ax, context.ax); + context._add(context.di, context.ax); + context.al = context.es.byte(context.di); + context.ah = 0; + context.cl = context.es.byte(context.di+1); + context.ch = 0; + context._mul(context.cx); + context.si = context.es.word(context.di+2); + context.push(context.si); + context._add(context.si, (0+2080)); + context.cx = (30000); + context._sub(context.cx, context.es.word(context.di+2)); + context.di = context.si; + context._add(context.si, context.ax); + context.push(context.ax); + context.ds = context.es; + while(context.cx--) context._movsb(); + context.bx = context.pop(); + context._sub(context.data.word(kExframepos), context.bx); + context.si = context.pop(); + context.cx = (114)*3; + context.di = (0); +shuffleadsdown: + context.ax = context.es.word(context.di+2); + context._cmp(context.ax, context.si); + if (context.flags.c()) goto beforethisone; + context._sub(context.ax, context.bx); +beforethisone: + context.es.word(context.di+2) = context.ax; + context._add(context.di, 6); + if (--context.cx) goto shuffleadsdown; + {assert(stack_depth == context.stack.size()); return; } +} + +void deleteextext(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (0+2080+30000+(16*114)); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.di, context.ax); + context.ax = context.es.word(context.di); + context.si = context.ax; + context.di = context.ax; + context._add(context.si, (0+2080+30000+(16*114)+((114+2)*2))); + context._add(context.di, (0+2080+30000+(16*114)+((114+2)*2))); + context.ax = 0; +findlenextext: + context.cl = context.es.byte(context.si); + context._inc(context.ax); + context._inc(context.si); + context._cmp(context.cl, 0); + if (!context.flags.z()) goto findlenextext; + context.cx = (18000); + context.bx = context.si; + context._sub(context.bx, (0+2080+30000+(16*114)+((114+2)*2))); + context.push(context.bx); + context.push(context.ax); + context._sub(context.cx, context.bx); + while(context.cx--) context._movsb(); + context.bx = context.pop(); + context._sub(context.data.word(kExtextpos), context.bx); + context.si = context.pop(); + context.cx = (114); + context.di = (0+2080+30000+(16*114)); +shuffletextads: + context.ax = context.es.word(context.di); + context._cmp(context.ax, context.si); + if (context.flags.c()) goto beforethistext; + context._sub(context.ax, context.bx); +beforethistext: + context.es.word(context.di) = context.ax; + context._add(context.di, 2); + if (--context.cx) goto shuffletextads; + {assert(stack_depth == context.stack.size()); return; } +} + +void blockget(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = context.al; + context.al = 0; + context.ds = context.data.word(kBackdrop); + context.si = (0+192); + context._add(context.si, context.ax); + {assert(stack_depth == context.stack.size()); return; } +} + +void drawfloor(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + eraseoldobs(context); + drawflags(context); + calcmapad(context); + doblocks(context); + showallobs(context); + showallfree(context); + showallex(context); + paneltomap(context); + initrain(context); + context.data.byte(kNewobs) = 0; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void calcmapad(Context & context) { + uint stack_depth = context.stack.size(); + getdimension(context); + context.push(context.cx); + context.push(context.dx); + context.al = 11; + context._sub(context.al, context.dl); + context._sub(context.al, context.cl); + context._sub(context.al, context.cl); + context.ax.cbw(); + context.bx = 8; + context._mul(context.bx); + context._add(context.ax, context.data.word(kMapoffsetx)); + context.data.word(kMapadx) = context.ax; + context.dx = context.pop(); + context.cx = context.pop(); + context.al = 10; + context._sub(context.al, context.dh); + context._sub(context.al, context.ch); + context._sub(context.al, context.ch); + context.ax.cbw(); + context.bx = 8; + context._mul(context.bx); + context._add(context.ax, context.data.word(kMapoffsety)); + context.data.word(kMapady) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void getdimension(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)); + context.ch = 0; +dimloop1: + addalong(context); + context._cmp(context.al, 0); + if (!context.flags.z()) goto finishdim1; + context._inc(context.ch); + goto dimloop1; +finishdim1: + context.bx = (0+(180*10)+32+60+(32*32)); + context.cl = 0; +dimloop2: + context.push(context.bx); + addlength(context); + context.bx = context.pop(); + context._cmp(context.al, 0); + if (!context.flags.z()) goto finishdim2; + context._inc(context.cl); + context._add(context.bx, 3); + goto dimloop2; +finishdim2: + context.bx = (0+(180*10)+32+60+(32*32))+(11*3*9); + context.dh = 10; +dimloop3: + context.push(context.bx); + addalong(context); + context.bx = context.pop(); + context._cmp(context.al, 0); + if (!context.flags.z()) goto finishdim3; + context._dec(context.dh); + context._sub(context.bx, 11*3); + goto dimloop3; +finishdim3: + context.bx = (0+(180*10)+32+60+(32*32))+(3*10); + context.dl = 11; +dimloop4: + context.push(context.bx); + addlength(context); + context.bx = context.pop(); + context._cmp(context.al, 0); + if (!context.flags.z()) goto finishdim4; + context._dec(context.dl); + context._sub(context.bx, 3); + goto dimloop4; +finishdim4: + context.al = context.cl; + context.ah = 0; + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context.data.word(kMapxstart) = context.ax; + context.al = context.ch; + context.ah = 0; + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context.data.word(kMapystart) = context.ax; + context._sub(context.dl, context.cl); + context._sub(context.dh, context.ch); + context.al = context.dl; + context.ah = 0; + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context.data.byte(kMapxsize) = context.al; + context.al = context.dh; + context.ah = 0; + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context._shl(context.ax, 1); + context.data.byte(kMapysize) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void addalong(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 11; +addloop: + context._cmp(context.es.byte(context.bx), 0); + if (!context.flags.z()) goto gotalong; + context._add(context.bx, 3); + context._dec(context.ah); + if (!context.flags.z()) goto addloop; + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +gotalong: + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void addlength(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 10; +addloop2: + context._cmp(context.es.byte(context.bx), 0); + if (!context.flags.z()) goto gotlength; + context._add(context.bx, 3*11); + context._dec(context.ah); + if (!context.flags.z()) goto addloop2; + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +gotlength: + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void drawflags(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)); + context.al = context.data.byte(kMapy); + context.ah = 0; + context.cx = (66); + context._mul(context.cx); + context.bl = context.data.byte(kMapx); + context.bh = 0; + context._add(context.ax, context.bx); + context.si = (0); + context._add(context.si, context.ax); + context.cx = 10; +_tmp28: + context.push(context.cx); + context.cx = 11; +_tmp28a: + context.ds = context.data.word(kMapdata); + context._lodsb(); + context.ds = context.data.word(kBackdrop); + context.push(context.si); + context.push(context.ax); + context.ah = 0; + context._add(context.ax, context.ax); + context.si = (0); + context._add(context.si, context.ax); + context._movsw(); + context.ax = context.pop(); + context._stosb(); + context.si = context.pop(); + if (--context.cx) goto _tmp28a; + context._add(context.si, (66)-11); + context.cx = context.pop(); + if (--context.cx) goto _tmp28; + {assert(stack_depth == context.stack.size()); return; } +} + +void eraseoldobs(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNewobs), 0); + if (context.flags.z()) goto donterase; + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + context.cx = 16; +oberase: + context.push(context.cx); + context.push(context.bx); + context.ax = context.es.word(context.bx+20); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto notthisob; + context.di = context.bx; + context.al = 255; + context.cx = (32); + while(context.cx--) context._stosb(); +notthisob: + context.bx = context.pop(); + context.cx = context.pop(); + context._add(context.bx, (32)); + if (--context.cx) goto oberase; +donterase: + {assert(stack_depth == context.stack.size()); return; } +} + +void showallobs(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)); + context.data.word(kListpos) = context.bx; + context.di = context.bx; + context.cx = 128*5; + context.al = 255; + while(context.cx--) context._stosb(); + context.es = context.data.word(kSetframes); + context.data.word(kFrsegment) = context.es; + context.ax = (0); + context.data.word(kDataad) = context.ax; + context.ax = (0+2080); + context.data.word(kFramesad) = context.ax; + context.data.byte(kCurrentob) = 0; + context.ds = context.data.word(kSetdat); + context.si = 0; + context.cx = 128; +showobsloop: + context.push(context.cx); + context.push(context.si); + context.push(context.si); + context._add(context.si, 58); + context.es = context.data.word(kSetdat); + getmapad(context); + context.si = context.pop(); + context._cmp(context.ch, 0); + if (context.flags.z()) goto blankframe; + context.al = context.es.byte(context.si+18); + context.ah = 0; + context.data.word(kCurrentframe) = context.ax; + context._cmp(context.al, 255); + if (context.flags.z()) goto blankframe; + context.push(context.es); + context.push(context.si); + calcfrframe(context); + finalframe(context); + context.si = context.pop(); + context.es = context.pop(); + context.al = context.es.byte(context.si+18); + context.es.byte(context.si+17) = context.al; + context._cmp(context.es.byte(context.si+8), 0); + if (!context.flags.z()) goto animating; + context._cmp(context.es.byte(context.si+5), 5); + if (context.flags.z()) goto animating; + context._cmp(context.es.byte(context.si+5), 6); + if (context.flags.z()) goto animating; + context.ax = context.data.word(kCurrentframe); + context.ah = 0; + context._add(context.di, context.data.word(kMapadx)); + context._add(context.bx, context.data.word(kMapady)); + showframe(context); + goto drawnsetob; +animating: + makebackob(context); +drawnsetob: + context.si = context.data.word(kListpos); + context.es = context.data.word(kBuffers); + context.al = context.data.byte(kSavex); + context.ah = context.data.byte(kSavey); + context.es.word(context.si) = context.ax; + context.cx = context.ax; + context.ax = context.data.word(kSavesize); + context._add(context.al, context.cl); + context._add(context.ah, context.ch); + context.es.word(context.si+2) = context.ax; + context.al = context.data.byte(kCurrentob); + context.es.byte(context.si+4) = context.al; + context._add(context.si, 5); + context.data.word(kListpos) = context.si; +blankframe: + context._inc(context.data.byte(kCurrentob)); + context.si = context.pop(); + context.cx = context.pop(); + context._add(context.si, 64); + context._dec(context.cx); + if (context.flags.z()) goto finishedsetobs; + goto showobsloop; +finishedsetobs: + {assert(stack_depth == context.stack.size()); return; } +} + +void makebackob(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNewobs), 0); + if (context.flags.z()) goto nomake; + context.al = context.es.byte(context.si+5); + context.ah = context.es.byte(context.si+8); + context.push(context.si); + context.push(context.ax); + context.push(context.si); + context.ax = context.data.word(kObjectx); + context.bx = context.data.word(kObjecty); + context.ah = context.bl; + context.si = context.ax; + context.cx = 49520; + context.dx = context.data.word(kSetframes); + context.di = (0); + makesprite(context); + context.ax = context.pop(); + context.es.word(context.bx+20) = context.ax; + context.ax = context.pop(); + context._cmp(context.al, 255); + if (!context.flags.z()) goto usedpriority; + context.al = 0; +usedpriority: + context.es.byte(context.bx+23) = context.al; + context.es.byte(context.bx+30) = context.ah; + context.es.byte(context.bx+16) = 0; + context.es.byte(context.bx+18) = 0; + context.es.byte(context.bx+19) = 0; + context.si = context.pop(); +nomake: + {assert(stack_depth == context.stack.size()); return; } +} + +void showallfree(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)); + context.data.word(kListpos) = context.bx; + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)); + context.cx = 80*5; + context.al = 255; + while(context.cx--) context._stosb(); + context.es = context.data.word(kFreeframes); + context.data.word(kFrsegment) = context.es; + context.ax = (0); + context.data.word(kDataad) = context.ax; + context.ax = (0+2080); + context.data.word(kFramesad) = context.ax; + context.al = 0; + context.data.byte(kCurrentfree) = context.al; + context.ds = context.data.word(kFreedat); + context.si = 2; + context.cx = 0; +loop127: + context.push(context.cx); + context.push(context.si); + context.push(context.si); + context.es = context.data.word(kFreedat); + getmapad(context); + context.si = context.pop(); + context._cmp(context.ch, 0); + if (context.flags.z()) goto over138; + context.al = context.data.byte(kCurrentfree); + context.ah = 0; + context.dx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.dx); + context.data.word(kCurrentframe) = context.ax; + context.push(context.es); + context.push(context.si); + calcfrframe(context); + context.es = context.data.word(kMapstore); + context.ds = context.data.word(kFrsegment); + finalframe(context); + context.si = context.pop(); + context.es = context.pop(); + context._cmp(context.cx, 0); + if (context.flags.z()) goto over138; + context.ax = context.data.word(kCurrentframe); + context.ah = 0; + context._add(context.di, context.data.word(kMapadx)); + context._add(context.bx, context.data.word(kMapady)); + showframe(context); + context.si = context.data.word(kListpos); + context.es = context.data.word(kBuffers); + context.al = context.data.byte(kSavex); + context.ah = context.data.byte(kSavey); + context.es.word(context.si) = context.ax; + context.cx = context.ax; + context.ax = context.data.word(kSavesize); + context._add(context.al, context.cl); + context._add(context.ah, context.ch); + context.es.word(context.si+2) = context.ax; + context.ax = context.pop(); + context.cx = context.pop(); + context.push(context.cx); + context.push(context.ax); + context.es.byte(context.si+4) = context.cl; + context._add(context.si, 5); + context.data.word(kListpos) = context.si; +over138: + context._inc(context.data.byte(kCurrentfree)); + context.si = context.pop(); + context.cx = context.pop(); + context._add(context.si, 16); + context._inc(context.cx); + context._cmp(context.cx, 80); + if (context.flags.z()) goto finfree; + goto loop127; +finfree: + {assert(stack_depth == context.stack.size()); return; } +} + +void showallex(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)); + context.data.word(kListpos) = context.bx; + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)); + context.cx = 100*5; + context.al = 255; + while(context.cx--) context._stosb(); + context.es = context.data.word(kExtras); + context.data.word(kFrsegment) = context.es; + context.ax = (0); + context.data.word(kDataad) = context.ax; + context.ax = (0+2080); + context.data.word(kFramesad) = context.ax; + context.data.byte(kCurrentex) = 0; + context.si = (0+2080+30000)+2; + context.cx = 0; +exloop: + context.push(context.cx); + context.push(context.si); + context.es = context.data.word(kExtras); + context.push(context.si); + context.ch = 0; + context._cmp(context.es.byte(context.si), 255); + if (context.flags.z()) goto notinroom; + context.al = context.es.byte(context.si-2); + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto notinroom; + getmapad(context); +notinroom: + context.si = context.pop(); + context._cmp(context.ch, 0); + if (context.flags.z()) goto blankex; + context.al = context.data.byte(kCurrentex); + context.ah = 0; + context.dx = context.ax; + context._add(context.ax, context.ax); + context._add(context.ax, context.dx); + context.data.word(kCurrentframe) = context.ax; + context.push(context.es); + context.push(context.si); + calcfrframe(context); + context.es = context.data.word(kMapstore); + context.ds = context.data.word(kFrsegment); + finalframe(context); + context.si = context.pop(); + context.es = context.pop(); + context._cmp(context.cx, 0); + if (context.flags.z()) goto blankex; + context.ax = context.data.word(kCurrentframe); + context.ah = 0; + context._add(context.di, context.data.word(kMapadx)); + context._add(context.bx, context.data.word(kMapady)); + showframe(context); + context.si = context.data.word(kListpos); + context.es = context.data.word(kBuffers); + context.al = context.data.byte(kSavex); + context.ah = context.data.byte(kSavey); + context.es.word(context.si) = context.ax; + context.cx = context.ax; + context.ax = context.data.word(kSavesize); + context._add(context.al, context.cl); + context._add(context.ah, context.ch); + context.es.word(context.si+2) = context.ax; + context.ax = context.pop(); + context.cx = context.pop(); + context.push(context.cx); + context.push(context.ax); + context.es.byte(context.si+4) = context.cl; + context._add(context.si, 5); + context.data.word(kListpos) = context.si; +blankex: + context._inc(context.data.byte(kCurrentex)); + context.si = context.pop(); + context.cx = context.pop(); + context._add(context.si, 16); + context._inc(context.cx); + context._cmp(context.cx, 100); + if (context.flags.z()) goto finex; + goto exloop; +finex: + {assert(stack_depth == context.stack.size()); return; } +} + +void calcfrframe(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = context.data.word(kFrsegment); + context.ax = context.data.word(kFramesad); + context.push(context.ax); + context.cx = context.data.word(kDataad); + context.ax = context.data.word(kCurrentframe); + context.ds = context.dx; + context.bx = 6; + context._mul(context.bx); + context._add(context.ax, context.cx); + context.bx = context.ax; + context.cx = context.ds.word(context.bx); + context.ax = context.ds.word(context.bx+2); + context.dx = context.ds.word(context.bx+4); + context.bx = context.pop(); + context.push(context.dx); + context._add(context.ax, context.bx); + context.data.word(kSavesource) = context.ax; + context.data.word(kSavesize) = context.cx; + context.ax = context.pop(); + context.push(context.ax); + context.ah = 0; + context.data.word(kOffsetx) = context.ax; + context.ax = context.pop(); + context.al = context.ah; + context.ah = 0; + context.data.word(kOffsety) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +nullframe: + context.ax = context.pop(); + context.cx = 0; + context.data.word(kSavesize) = context.cx; + {assert(stack_depth == context.stack.size()); return; } +} + +void finalframe(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kObjecty); + context._add(context.ax, context.data.word(kOffsety)); + context.bx = context.data.word(kObjectx); + context._add(context.bx, context.data.word(kOffsetx)); + context.data.byte(kSavex) = context.bl; + context.data.byte(kSavey) = context.al; + context.di = context.data.word(kObjectx); + context.bx = context.data.word(kObjecty); + {assert(stack_depth == context.stack.size()); return; } +} + +void adjustlen(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = context.al; + context._add(context.al, context.ch); + context._cmp(context.al, 100); + if (context.flags.c()) goto over242; + context.al = 224; + context._sub(context.al, context.ch); + context.ch = context.al; +over242: + {assert(stack_depth == context.stack.size()); return; } +} + +void getmapad(Context & context) { + uint stack_depth = context.stack.size(); + getxad(context); + context._cmp(context.ch, 0); + if (context.flags.z()) goto over146; + context.data.word(kObjectx) = context.ax; + getyad(context); + context._cmp(context.ch, 0); + if (context.flags.z()) goto over146; + context.data.word(kObjecty) = context.ax; + context.ch = 1; +over146: + {assert(stack_depth == context.stack.size()); return; } +} + +void getxad(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = context.es.byte(context.si); + context._inc(context.si); + context.al = context.es.byte(context.si); + context._inc(context.si); + context.ah = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.cl, 0); + if (!context.flags.z()) goto over148; + context._sub(context.al, context.data.byte(kMapx)); + if (context.flags.c()) goto over148; + context._cmp(context.al, 11); + if (!context.flags.c()) goto over148; + context.cl = 4; + context._shl(context.al, context.cl); + context._or(context.al, context.ah); + context.ah = 0; + context.ch = 1; + {assert(stack_depth == context.stack.size()); return; } +over148: + context.ch = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void getyad(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.es.byte(context.si); + context._inc(context.si); + context.ah = context.es.byte(context.si); + context._inc(context.si); + context._sub(context.al, context.data.byte(kMapy)); + if (context.flags.c()) goto over147; + context._cmp(context.al, 10); + if (!context.flags.c()) goto over147; + context.cl = 4; + context._shl(context.al, context.cl); + context._or(context.al, context.ah); + context.ah = 0; + context.ch = 1; + {assert(stack_depth == context.stack.size()); return; } +over147: + context.ch = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void autolook(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousex); + context._cmp(context.ax, context.data.word(kOldx)); + if (!context.flags.z()) goto diffmouse; + context.ax = context.data.word(kMousey); + context._cmp(context.ax, context.data.word(kOldy)); + if (!context.flags.z()) goto diffmouse; + context._dec(context.data.word(kLookcounter)); + context._cmp(context.data.word(kLookcounter), 0); + if (!context.flags.z()) goto noautolook; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto noautolook; + dolook(context); +noautolook: + {assert(stack_depth == context.stack.size()); return; } +diffmouse: + context.data.word(kLookcounter) = 1000; + {assert(stack_depth == context.stack.size()); return; } +} + +void look(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kPointermode), 2); + if (context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 241); + if (context.flags.z()) goto alreadylook; + context.data.byte(kCommandtype) = 241; + context.al = 25; + commandonly(context); +alreadylook: + context._cmp(context.data.word(kMousebutton), 1); + if (!context.flags.z()) goto nolook; + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nolook; + dolook(context); +nolook: + {assert(stack_depth == context.stack.size()); return; } +} + +void dolook(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + showicon(context); + undertextline(context); + worktoscreenm(context); + context.data.byte(kCommandtype) = 255; + dumptextline(context); + context.bl = context.data.byte(kRoomnum); + context._and(context.bl, 31); + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kRoomdesc); + context._add(context.bx, (0)); + context.si = context.es.word(context.bx); + context._add(context.si, (0+(38*2))); + findnextcolon(context); + context.di = 66; + context._cmp(context.data.byte(kReallocation), 50); + if (context.flags.c()) goto notdream3; + context.di = 40; +notdream3: + context.bx = 80; + context.dl = 241; + printslow(context); + context._cmp(context.al, 1); + if (context.flags.z()) goto afterlook; + context.cx = 400; + hangonp(context); +afterlook: + context.data.byte(kPointermode) = 0; + context.data.byte(kCommandtype) = 0; + redrawmainscrn(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void redrawmainscrn(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kTimecount) = 0; + createpanel(context); + context.data.byte(kNewobs) = 0; + drawfloor(context); + printsprites(context); + reelsonscreen(context); + showicon(context); + getunderzoom(context); + undertextline(context); + readmouse(context); + context.data.byte(kCommandtype) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void getback1(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPickup), 0); + if (context.flags.z()) goto notgotobject; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +notgotobject: + context._cmp(context.data.byte(kCommandtype), 202); + if (context.flags.z()) goto alreadyget; + context.data.byte(kCommandtype) = 202; + context.al = 26; + commandonly(context); +alreadyget: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nogetback; + context._and(context.ax, 1); + if (!context.flags.z()) goto dogetback; +nogetback: + {assert(stack_depth == context.stack.size()); return; } +dogetback: + context.data.byte(kGetback) = 1; + context.data.byte(kPickup) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void talk(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kTalkpos) = 0; + context.data.byte(kInmaparea) = 0; + context.al = context.data.byte(kCommand); + context.data.byte(kCharacter) = context.al; + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + undertextline(context); + convicons(context); + starttalk(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + showpointer(context); + worktoscreen(context); +waittalk: + delpointer(context); + readmouse(context); + animpointer(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.data.byte(kGetback) = 0; + context.bx = 2660; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto waittalk; +finishtalk: + context.bx = context.data.word(kPersondata); + context.es = context.cs; + context._cmp(context.data.byte(kTalkpos), 4); + if (context.flags.c()) goto notnexttalk; + context.al = context.es.byte(context.bx+7); + context._or(context.al, 128); + context.es.byte(context.bx+7) = context.al; +notnexttalk: + redrawmainscrn(context); + worktoscreenm(context); + context._cmp(context.data.byte(kSpeechloaded), 1); + if (!context.flags.z()) goto nospeech; + cancelch1(context); + context.data.byte(kVolumedirection) = -1; + context.data.byte(kVolumeto) = 0; +nospeech: + {assert(stack_depth == context.stack.size()); return; } +} + +void convicons(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + getpersframe(context); + context.di = 234; + context.bx = 2; + context.data.word(kCurrentframe) = context.ax; + findsource(context); + context.ax = context.data.word(kCurrentframe); + context._sub(context.ax, context.data.word(kTakeoff)); + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getpersframe(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kPeople); + context._add(context.bx, (0)); + context.ax = context.es.word(context.bx); + {assert(stack_depth == context.stack.size()); return; } +} + +void starttalk(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kTalkmode) = 0; + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + getpersontext(context); + context.data.word(kCharshift) = 91+91; + context.di = 66; + context.bx = 64; + context.dl = 241; + context.al = 0; + context.ah = 79; + printdirect(context); + context.data.word(kCharshift) = 0; + context.di = 66; + context.bx = 80; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + context.data.byte(kSpeechloaded) = 0; + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + context.ah = 0; + context.cx = 64; + context._mul(context.cx); + context.cl = 'C'; + context.dl = 'R'; + context.dh = context.data.byte(kReallocation); + loadspeech(context); + context._cmp(context.data.byte(kSpeechloaded), 1); + if (!context.flags.z()) goto nospeech1; + context.data.byte(kVolumedirection) = 1; + context.data.byte(kVolumeto) = 6; + context.al = 50+12; + playchannel1(context); +nospeech1: + {assert(stack_depth == context.stack.size()); return; } +} + +void getpersontext(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.cx = 64*2; + context._mul(context.cx); + context.si = context.ax; + context.es = context.data.word(kPeople); + context._add(context.si, (0+24)); + context.cx = (0+24+(1026*2)); + context.ax = context.es.word(context.si); + context._add(context.ax, context.cx); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void moretalk(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kTalkmode), 0); + if (context.flags.z()) goto canmore; + redes(context); + {assert(stack_depth == context.stack.size()); return; } +canmore: + context._cmp(context.data.byte(kCommandtype), 215); + if (context.flags.z()) goto alreadymore; + context.data.byte(kCommandtype) = 215; + context.al = 49; + commandonly(context); +alreadymore: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nomore; + context._and(context.ax, 1); + if (!context.flags.z()) goto domoretalk; +nomore: + {assert(stack_depth == context.stack.size()); return; } +domoretalk: + context.data.byte(kTalkmode) = 2; + context.data.byte(kTalkpos) = 4; + context._cmp(context.data.byte(kCharacter), 100); + if (context.flags.c()) goto notsecondpart; + context.data.byte(kTalkpos) = 48; +notsecondpart: + dosometalk(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dosometalk(Context & context) { + uint stack_depth = context.stack.size(); +dospeech: + context.al = context.data.byte(kTalkpos); + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + context.ah = 0; + context.cx = 64; + context._mul(context.cx); + context.cx = context.ax; + context.al = context.data.byte(kTalkpos); + context.ah = 0; + context._add(context.ax, context.cx); + context._add(context.ax, context.ax); + context.si = context.ax; + context.es = context.data.word(kPeople); + context._add(context.si, (0+24)); + context.cx = (0+24+(1026*2)); + context.ax = context.es.word(context.si); + context._add(context.ax, context.cx); + context.si = context.ax; + context._cmp(context.es.byte(context.si), 0); + if (context.flags.z()) goto endheartalk; + context.push(context.es); + context.push(context.si); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + convicons(context); + context.si = context.pop(); + context.es = context.pop(); + context.di = 164; + context.bx = 64; + context.dl = 144; + context.al = 0; + context.ah = 0; + printdirect(context); + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + context.ah = 0; + context.cx = 64; + context._mul(context.cx); + context.cl = context.data.byte(kTalkpos); + context.ch = 0; + context._add(context.ax, context.cx); + context.cl = 'C'; + context.dl = 'R'; + context.dh = context.data.byte(kReallocation); + loadspeech(context); + context._cmp(context.data.byte(kSpeechloaded), 0); + if (context.flags.z()) goto noplay1; + context.al = 62; + playchannel1(context); +noplay1: + context.data.byte(kPointermode) = 3; + worktoscreenm(context); + context.cx = 180; + hangonpq(context); + if (!context.flags.c()) goto _tmp1; + {assert(stack_depth == context.stack.size()); return; } +_tmp1: + context._inc(context.data.byte(kTalkpos)); + context.al = context.data.byte(kTalkpos); + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + context.ah = 0; + context.cx = 64; + context._mul(context.cx); + context.cx = context.ax; + context.al = context.data.byte(kTalkpos); + context.ah = 0; + context._add(context.ax, context.cx); + context._add(context.ax, context.ax); + context.si = context.ax; + context.es = context.data.word(kPeople); + context._add(context.si, (0+24)); + context.cx = (0+24+(1026*2)); + context.ax = context.es.word(context.si); + context._add(context.ax, context.cx); + context.si = context.ax; + context._cmp(context.es.byte(context.si), 0); + if (context.flags.z()) goto endheartalk; + context._cmp(context.es.byte(context.si), ':'); + if (context.flags.z()) goto skiptalk2; + context._cmp(context.es.byte(context.si), 32); + if (context.flags.z()) goto skiptalk2; + context.push(context.es); + context.push(context.si); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + convicons(context); + context.si = context.pop(); + context.es = context.pop(); + context.di = 48; + context.bx = 128; + context.dl = 144; + context.al = 0; + context.ah = 0; + printdirect(context); + context.al = context.data.byte(kCharacter); + context._and(context.al, 127); + context.ah = 0; + context.cx = 64; + context._mul(context.cx); + context.cl = context.data.byte(kTalkpos); + context.ch = 0; + context._add(context.ax, context.cx); + context.cl = 'C'; + context.dl = 'R'; + context.dh = context.data.byte(kReallocation); + loadspeech(context); + context._cmp(context.data.byte(kSpeechloaded), 0); + if (context.flags.z()) goto noplay2; + context.al = 62; + playchannel1(context); +noplay2: + context.data.byte(kPointermode) = 3; + worktoscreenm(context); + context.cx = 180; + hangonpq(context); + if (!context.flags.c()) goto skiptalk2; + {assert(stack_depth == context.stack.size()); return; } +skiptalk2: + context._inc(context.data.byte(kTalkpos)); + goto dospeech; +endheartalk: + context.data.byte(kPointermode) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void hangonpq(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kGetback) = 0; + context.bx = 0; +hangloopq: + context.push(context.cx); + context.push(context.bx); + delpointer(context); + readmouse(context); + animpointer(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 2692; + checkcoords(context); + context.bx = context.pop(); + context.cx = context.pop(); + context._cmp(context.data.byte(kGetback), 1); + if (context.flags.z()) goto quitconv; + context._cmp(context.data.byte(kSpeechloaded), 1); + if (!context.flags.z()) goto notspeaking; + context._cmp(context.data.byte(kCh1playing), 255); + if (!context.flags.z()) goto notspeaking; + context._inc(context.bx); + context._cmp(context.bx, 40); + if (context.flags.z()) goto finishconv; +notspeaking: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto hangloopq; + context._cmp(context.data.word(kOldbutton), 0); + if (!context.flags.z()) goto hangloopq; +finishconv: + delpointer(context); + context.data.byte(kPointermode) = 0; + context.flags._c = false; + {assert(stack_depth == context.stack.size()); return; } +quitconv: + delpointer(context); + context.data.byte(kPointermode) = 0; + cancelch1(context); + context.flags._c = true; + {assert(stack_depth == context.stack.size()); return; } +} + +void redes(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCh1playing), 255); + if (!context.flags.z()) goto cantredes; + context._cmp(context.data.byte(kTalkmode), 2); + if (context.flags.z()) goto canredes; +cantredes: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canredes: + context._cmp(context.data.byte(kCommandtype), 217); + if (context.flags.z()) goto alreadyreds; + context.data.byte(kCommandtype) = 217; + context.al = 50; + commandonly(context); +alreadyreds: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (!context.flags.z()) goto doredes; + {assert(stack_depth == context.stack.size()); return; } +doredes: + delpointer(context); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + convicons(context); + starttalk(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void newplace(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNeedtotravel), 1); + if (context.flags.z()) goto istravel; + context._cmp(context.data.byte(kAutolocation), -1); + if (!context.flags.z()) goto isautoloc; + {assert(stack_depth == context.stack.size()); return; } +isautoloc: + context.al = context.data.byte(kAutolocation); + context.data.byte(kNewlocation) = context.al; + context.data.byte(kAutolocation) = -1; + {assert(stack_depth == context.stack.size()); return; } +istravel: + context.data.byte(kNeedtotravel) = 0; + selectlocation(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void selectlocation(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kInmaparea) = 0; + clearbeforeload(context); + context.data.byte(kGetback) = 0; + context.data.byte(kPointerframe) = 22; + readcitypic(context); + showcity(context); + getridoftemp(context); + readdesticon(context); + loadtraveltext(context); + showpanel(context); + showman(context); + showarrows(context); + showexit(context); + locationpic(context); + undertextline(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + context.data.byte(kPointerframe) = 0; + showpointer(context); + worktoscreen(context); + context.al = 9; + context.ah = 255; + playchannel0(context); + context.data.byte(kNewlocation) = 255; +select: + delpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context._cmp(context.data.byte(kGetback), 1); + if (context.flags.z()) goto quittravel; + context.bx = 2714; + checkcoords(context); + context._cmp(context.data.byte(kNewlocation), 255); + if (context.flags.z()) goto select; + context.al = context.data.byte(kNewlocation); + context._cmp(context.al, context.data.byte(kLocation)); + if (context.flags.z()) goto quittravel; + getridoftemp(context); + getridoftemp2(context); + getridoftemp3(context); + context.es = context.data.word(kTraveltext); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +quittravel: + context.al = context.data.byte(kReallocation); + context.data.byte(kNewlocation) = context.al; + context.data.byte(kGetback) = 0; + getridoftemp(context); + getridoftemp2(context); + getridoftemp3(context); + context.es = context.data.word(kTraveltext); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showcity(Context & context) { + uint stack_depth = context.stack.size(); + clearwork(context); + context.ds = context.data.word(kTempgraphics); + context.di = 57; + context.bx = 32; + context.al = 0; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = 120+57; + context.bx = 32; + context.al = 1; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void lookatplace(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 224); + if (context.flags.z()) goto alreadyinfo; + context.data.byte(kCommandtype) = 224; + context.al = 27; + commandonly(context); +alreadyinfo: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto noinfo; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noinfo; + context.bl = context.data.byte(kDestpos); + context._cmp(context.bl, 15); + if (!context.flags.c()) goto noinfo; + context.push(context.bx); + delpointer(context); + deltextline(context); + getundercentre(context); + context.ds = context.data.word(kTempgraphics3); + context.al = 0; + context.ah = 0; + context.di = 60; + context.bx = 72; + showframe(context); + context.al = 4; + context.ah = 0; + context.di = 60; + context.bx = 72+55; + showframe(context); + context.bx = context.pop(); + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kTraveltext); + context.si = context.es.word(context.bx); + context._add(context.si, (66*2)); + findnextcolon(context); + context.di = 63; + context.bx = 84; + context.dl = 191; + context.al = 0; + context.ah = 0; + printdirect(context); + worktoscreenm(context); + context.cx = 500; + hangonp(context); +afterinfo: + context.data.byte(kPointermode) = 0; + context.data.byte(kPointerframe) = 0; + putundercentre(context); + worktoscreenm(context); +noinfo: + {assert(stack_depth == context.stack.size()); return; } +} + +void getundercentre(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 58; + context.bx = 72; + context.ds = context.data.word(kMapstore); + context.si = 0; + context.cl = 254; + context.ch = 110; + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void putundercentre(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 58; + context.bx = 72; + context.ds = context.data.word(kMapstore); + context.si = 0; + context.cl = 254; + context.ch = 110; + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void locationpic(Context & context) { + uint stack_depth = context.stack.size(); + getdestinfo(context); + context.al = context.es.byte(context.si); + context.push(context.es); + context.push(context.si); + context.di = 0; + context._cmp(context.al, 6); + if (!context.flags.c()) goto secondlot; + context.ds = context.data.word(kTempgraphics); + context._add(context.al, 4); + goto gotgraphic; +secondlot: + context._sub(context.al, 6); + context.ds = context.data.word(kTempgraphics2); +gotgraphic: + context._add(context.di, 104); + context.bx = 138+14; + context.ah = 0; + showframe(context); + context.si = context.pop(); + context.es = context.pop(); + context.al = context.data.byte(kDestpos); + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto notinthisone; + context.al = 3; + context.di = 104; + context.bx = 140+14; + context.ds = context.data.word(kTempgraphics); + context.ah = 0; + showframe(context); +notinthisone: + context.bl = context.data.byte(kDestpos); + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kTraveltext); + context.si = context.es.word(context.bx); + context._add(context.si, (66*2)); + context.di = 50; + context.bx = 20; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getdestinfo(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kDestpos); + context.ah = 0; + context.push(context.ax); + context.dx = context.data; + context.es = context.dx; + context.si = 8011; + context._add(context.si, context.ax); + context.cl = context.es.byte(context.si); + context.ax = context.pop(); + context.push(context.cx); + context.dx = context.data; + context.es = context.dx; + context.si = 8027; + context._add(context.si, context.ax); + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void showarrows(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 116-12; + context.bx = 16; + context.ds = context.data.word(kTempgraphics); + context.al = 0; + context.ah = 0; + showframe(context); + context.di = 226+12; + context.bx = 16; + context.ds = context.data.word(kTempgraphics); + context.al = 1; + context.ah = 0; + showframe(context); + context.di = 280; + context.bx = 14; + context.ds = context.data.word(kTempgraphics); + context.al = 2; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void nextdest(Context & context) { + uint stack_depth = context.stack.size(); +duok: + context._cmp(context.data.byte(kCommandtype), 218); + if (context.flags.z()) goto alreadydu; + context.data.byte(kCommandtype) = 218; + context.al = 28; + commandonly(context); +alreadydu: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto nodu; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nodu; +searchdestup: + context._inc(context.data.byte(kDestpos)); + context._cmp(context.data.byte(kDestpos), 15); + if (!context.flags.z()) goto notlastdest; + context.data.byte(kDestpos) = 0; +notlastdest: + getdestinfo(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto searchdestup; + context.data.byte(kNewtextline) = 1; + deltextline(context); + delpointer(context); + showpanel(context); + showman(context); + showarrows(context); + locationpic(context); + undertextline(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); +nodu: + {assert(stack_depth == context.stack.size()); return; } +} + +void lastdest(Context & context) { + uint stack_depth = context.stack.size(); +ddok: + context._cmp(context.data.byte(kCommandtype), 219); + if (context.flags.z()) goto alreadydd; + context.data.byte(kCommandtype) = 219; + context.al = 29; + commandonly(context); +alreadydd: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto nodd; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nodd; +searchdestdown: + context._dec(context.data.byte(kDestpos)); + context._cmp(context.data.byte(kDestpos), -1); + if (!context.flags.z()) goto notfirstdest; + context.data.byte(kDestpos) = 15; +notfirstdest: + getdestinfo(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto searchdestdown; + context.data.byte(kNewtextline) = 1; + deltextline(context); + delpointer(context); + showpanel(context); + showman(context); + showarrows(context); + locationpic(context); + undertextline(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); +nodd: + {assert(stack_depth == context.stack.size()); return; } +} + +void destselect(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadytrav; + context.data.byte(kCommandtype) = 222; + context.al = 30; + commandonly(context); +alreadytrav: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto notrav; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notrav; + getdestinfo(context); + context.al = context.data.byte(kDestpos); + context.data.byte(kNewlocation) = context.al; +notrav: + {assert(stack_depth == context.stack.size()); return; } +} + +void getlocation(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.bx = context.ax; + context.dx = context.data; + context.es = context.dx; + context._add(context.bx, 8011); + context.al = context.es.byte(context.bx); + {assert(stack_depth == context.stack.size()); return; } +} + +void setlocation(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.bx = context.ax; + context.dx = context.data; + context.es = context.dx; + context._add(context.bx, 8011); + context.es.byte(context.bx) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void resetlocation(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context._cmp(context.al, 5); + if (!context.flags.z()) goto notdelhotel; + purgealocation(context); + context.al = 21; + purgealocation(context); + context.al = 22; + purgealocation(context); + context.al = 27; + purgealocation(context); + goto clearedlocations; +notdelhotel: + context._cmp(context.al, 8); + if (!context.flags.z()) goto notdeltvstud; + purgealocation(context); + context.al = 28; + purgealocation(context); + goto clearedlocations; +notdeltvstud: + context._cmp(context.al, 6); + if (!context.flags.z()) goto notdelsarters; + purgealocation(context); + context.al = 20; + purgealocation(context); + context.al = 25; + purgealocation(context); + goto clearedlocations; +notdelsarters: + context._cmp(context.al, 13); + if (!context.flags.z()) goto notdelboathouse; + purgealocation(context); + context.al = 29; + purgealocation(context); + goto clearedlocations; +notdelboathouse: +clearedlocations: + context.ax = context.pop(); + context.ah = 0; + context.bx = context.ax; + context.dx = context.data; + context.es = context.dx; + context._add(context.bx, 8011); + context.es.byte(context.bx) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void readdesticon(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2013; + loadintotemp(context); + context.dx = 2026; + loadintotemp2(context); + context.dx = 1961; + loadintotemp3(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void readcitypic(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2000; + loadintotemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usemon(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kLasttrigger) = 0; + context.es = context.cs; + context.di = 2970+1; + context.cx = 12; + context.al = 32; + while(context.cx--) context._stosb(); + context.es = context.cs; + context.di = 2942+1; + context.cx = 12; + context.al = 32; + while(context.cx--) context._stosb(); + context.es = context.cs; + context.di = 2836; + context.es.byte(context.di) = 1; + context._add(context.di, 26); + context.cx = 3; +keyloop: + context.es.byte(context.di) = 0; + context._add(context.di, 26); + if (--context.cx) goto keyloop; + createpanel(context); + showpanel(context); + showicon(context); + drawfloor(context); + getridofall(context); + context.dx = 1974; + loadintotemp(context); + loadpersonal(context); + loadnews(context); + loadcart(context); + context.dx = 1870; + loadtempcharset(context); + printoutermon(context); + initialmoncols(context); + printlogo(context); + worktoscreen(context); + turnonpower(context); + fadeupyellows(context); + fadeupmonfirst(context); + context.data.word(kMonadx) = 76; + context.data.word(kMonady) = 141; + context.al = 1; + monmessage(context); + context.cx = 120; + hangoncurs(context); + context.al = 2; + monmessage(context); + context.cx = 60; + randomaccess(context); + context.al = 3; + monmessage(context); + context.cx = 100; + hangoncurs(context); + printlogo(context); + scrollmonitor(context); + context.data.word(kBufferin) = 0; + context.data.word(kBufferout) = 0; +moreinput: + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.push(context.di); + context.push(context.bx); + input(context); + context.bx = context.pop(); + context.di = context.pop(); + context.data.word(kMonadx) = context.di; + context.data.word(kMonady) = context.bx; + execcommand(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto moreinput; +endmon: + getridoftemp(context); + getridoftempcharset(context); + context.es = context.data.word(kTextfile1); + deallocatemem(context); + context.es = context.data.word(kTextfile2); + deallocatemem(context); + context.es = context.data.word(kTextfile3); + deallocatemem(context); + context.data.byte(kGetback) = 1; + context.al = 26; + playchannel1(context); + context.data.byte(kManisoffscreen) = 0; + restoreall(context); + redrawmainscrn(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void printoutermon(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 40; + context.bx = 32; + context.ds = context.data.word(kTempgraphics); + context.al = 1; + context.ah = 0; + showframe(context); + context.di = 264; + context.bx = 32; + context.ds = context.data.word(kTempgraphics); + context.al = 2; + context.ah = 0; + showframe(context); + context.di = 40; + context.bx = 12; + context.ds = context.data.word(kTempgraphics); + context.al = 3; + context.ah = 0; + showframe(context); + context.di = 40; + context.bx = 164; + context.ds = context.data.word(kTempgraphics); + context.al = 4; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadpersonal(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kLocation); + context.dx = 2052; + context._cmp(context.al, 0); + if (context.flags.z()) goto foundpersonal; + context._cmp(context.al, 42); + if (context.flags.z()) goto foundpersonal; + context.dx = 2065; + context._cmp(context.al, 2); + if (context.flags.z()) goto foundpersonal; +foundpersonal: + openfile(context); + readheader(context); + context.bx = context.es.word(context.di); + context.push(context.bx); + context.cl = 4; + context._shr(context.bx, context.cl); + allocatemem(context); + context.data.word(kTextfile1) = context.ax; + context.ds = context.ax; + context.cx = context.pop(); + context.dx = 0; + readfromfile(context); + closefile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadnews(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kNewsitem); + context.dx = 2078; + context._cmp(context.al, 0); + if (context.flags.z()) goto foundnews; + context.dx = 2091; + context._cmp(context.al, 1); + if (context.flags.z()) goto foundnews; + context.dx = 2104; + context._cmp(context.al, 2); + if (context.flags.z()) goto foundnews; + context.dx = 2117; +foundnews: + openfile(context); + readheader(context); + context.bx = context.es.word(context.di); + context.push(context.bx); + context.cl = 4; + context._shr(context.bx, context.cl); + allocatemem(context); + context.data.word(kTextfile2) = context.ax; + context.ds = context.ax; + context.cx = context.pop(); + context.dx = 0; + readfromfile(context); + closefile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadcart(Context & context) { + uint stack_depth = context.stack.size(); + lookininterface(context); + context.dx = 2130; + context._cmp(context.al, 0); + if (context.flags.z()) goto gotcart; + context.dx = 2143; + context._cmp(context.al, 1); + if (context.flags.z()) goto gotcart; + context.dx = 2156; + context._cmp(context.al, 2); + if (context.flags.z()) goto gotcart; + context.dx = 2169; + context._cmp(context.al, 3); + if (context.flags.z()) goto gotcart; + context.dx = 2182; +gotcart: + openfile(context); + readheader(context); + context.bx = context.es.word(context.di); + context.push(context.bx); + context.cl = 4; + context._shr(context.bx, context.cl); + allocatemem(context); + context.data.word(kTextfile3) = context.ax; + context.ds = context.ax; + context.cx = context.pop(); + context.dx = 0; + readfromfile(context); + closefile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void lookininterface(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 'I'; + context.ah = 'N'; + context.cl = 'T'; + context.ch = 'F'; + findsetobject(context); + context.ah = 1; + checkinside(context); + context._cmp(context.cl, (114)); + if (context.flags.z()) goto emptyinterface; + context.al = context.es.byte(context.bx+15); + context._inc(context.al); + {assert(stack_depth == context.stack.size()); return; } +emptyinterface: + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void turnonpower(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = 3; +powerloop: + context.push(context.cx); + powerlighton(context); + context.cx = 30; + hangon(context); + powerlightoff(context); + context.cx = 30; + hangon(context); + context.cx = context.pop(); + if (--context.cx) goto powerloop; + powerlighton(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void randomaccess(Context & context) { + uint stack_depth = context.stack.size(); +accessloop: + context.push(context.cx); + vsync(context); + vsync(context); + randomnum1(context); + context._and(context.al, 15); + context._cmp(context.al, 10); + if (context.flags.c()) goto off; + accesslighton(context); + goto chosenaccess; +off: + accesslightoff(context); +chosenaccess: + context.cx = context.pop(); + if (--context.cx) goto accessloop; + accesslightoff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void powerlighton(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 257+4; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 6; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void powerlightoff(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 257+4; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 5; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void accesslighton(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 74; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 8; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void accesslightoff(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 74; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 7; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void locklighton(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 56; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 10; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void locklightoff(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 56; + context.bx = 182; + context.ds = context.data.word(kTempgraphics); + context.al = 9; + context.ah = 0; + context.push(context.di); + context.push(context.bx); + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.cl = 12; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void input(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.cs; + context.di = 8045; + context.cx = 64; + context.al = 0; + while(context.cx--) context._stosb(); + context.data.word(kCurpos) = 0; + context.al = '>'; + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.ds = context.data.word(kTempcharset); + context.ah = 0; + printchar(context); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.cl = 6; + context.ch = 8; + multidump(context); + context._add(context.data.word(kMonadx), 6); + context.ax = context.data.word(kMonadx); + context.data.word(kCurslocx) = context.ax; + context.ax = context.data.word(kMonady); + context.data.word(kCurslocy) = context.ax; +waitkey: + printcurs(context); + vsync(context); + delcurs(context); + readkey(context); + context.al = context.data.byte(kCurrentkey); + context._cmp(context.al, 0); + if (context.flags.z()) goto waitkey; + context._cmp(context.al, 13); + if (context.flags.z()) goto endofinput; + context._cmp(context.al, 8); + if (!context.flags.z()) goto notdel; + context._cmp(context.data.word(kCurpos), 0); + if (context.flags.z()) goto waitkey; + delchar(context); + goto waitkey; +notdel: + context._cmp(context.data.word(kCurpos), 28); + if (context.flags.z()) goto waitkey; + context._cmp(context.data.byte(kCurrentkey), 32); + if (!context.flags.z()) goto notleadingspace; + context._cmp(context.data.word(kCurpos), 0); + if (context.flags.z()) goto waitkey; +notleadingspace: + makecaps(context); + context.es = context.cs; + context.si = context.data.word(kCurpos); + context._add(context.si, context.si); + context._add(context.si, 8045); + context.es.byte(context.si) = context.al; + context._cmp(context.al, 'Z'+1); + if (!context.flags.c()) goto waitkey; + context.push(context.ax); + context.push(context.es); + context.push(context.si); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.ds = context.data.word(kMapstore); + context.ax = context.data.word(kCurpos); + context._xchg(context.al, context.ah); + context.si = context.ax; + context.cl = 8; + context.ch = 8; + multiget(context); + context.si = context.pop(); + context.es = context.pop(); + context.ax = context.pop(); + context.push(context.es); + context.push(context.si); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.ds = context.data.word(kTempcharset); + context.ah = 0; + printchar(context); + context.si = context.pop(); + context.es = context.pop(); + context.es.byte(context.si+1) = context.cl; + context.ch = 0; + context._add(context.data.word(kMonadx), context.cx); + context._inc(context.data.word(kCurpos)); + context._add(context.data.word(kCurslocx), context.cx); + goto waitkey; +endofinput: + {assert(stack_depth == context.stack.size()); return; } +} + +void makecaps(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.al, 'a'); + if (context.flags.c()) goto notupperc; + context._sub(context.al, 32); +notupperc: + {assert(stack_depth == context.stack.size()); return; } +} + +void delchar(Context & context) { + uint stack_depth = context.stack.size(); + context._dec(context.data.word(kCurpos)); + context.si = context.data.word(kCurpos); + context._add(context.si, context.si); + context.es = context.cs; + context._add(context.si, 8045); + context.es.byte(context.si) = 0; + context.al = context.es.byte(context.si+1); + context.ah = 0; + context._sub(context.data.word(kMonadx), context.ax); + context._sub(context.data.word(kCurslocx), context.ax); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.ds = context.data.word(kMapstore); + context.ax = context.data.word(kCurpos); + context._xchg(context.al, context.ah); + context.si = context.ax; + context.cl = 8; + context.ch = 8; + multiput(context); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.cl = context.al; + context.ch = 8; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void execcommand(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.cs; + context.bx = 2776; + context.ds = context.cs; + context.si = 8045; + context.al = context.ds.byte(context.si); + context._cmp(context.al, 0); + if (!context.flags.z()) goto notblankinp; + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +notblankinp: + context.cl = 0; +comloop: + context.push(context.bx); + context.push(context.si); +comloop2: + context.al = context.ds.byte(context.si); + context._add(context.si, 2); + context.ah = context.es.byte(context.bx); + context._inc(context.bx); + context._cmp(context.ah, 32); + if (context.flags.z()) goto foundcom; + context._cmp(context.al, context.ah); + if (context.flags.z()) goto comloop2; + context.si = context.pop(); + context.bx = context.pop(); + context._add(context.bx, 10); + context._inc(context.cl); + context._cmp(context.cl, 6); + if (!context.flags.z()) goto comloop; + neterror(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +foundcom: + context.si = context.pop(); + context.bx = context.pop(); + context._cmp(context.cl, 1); + if (context.flags.z()) goto testcom; + context._cmp(context.cl, 2); + if (context.flags.z()) goto directory; + context._cmp(context.cl, 3); + if (context.flags.z()) goto accesscom; + context._cmp(context.cl, 4); + if (context.flags.z()) goto signoncom; + context._cmp(context.cl, 5); + if (context.flags.z()) goto keyscom; + goto quitcom; +directory: + dircom(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +signoncom: + signon(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +accesscom: + read(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +keyscom: + showkeys(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +testcom: + context.al = 6; + monmessage(context); + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +quitcom: + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void neterror(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 5; + monmessage(context); + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dircom(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = 30; + randomaccess(context); + parser(context); + context._cmp(context.es.byte(context.di+1), 0); + if (context.flags.z()) goto dirroot; + dirfile(context); + {assert(stack_depth == context.stack.size()); return; } +dirroot: + context.data.byte(kLogonum) = 0; + context.ds = context.cs; + context.si = 2956; + context._inc(context.si); + context.es = context.cs; + context.di = 2970; + context._inc(context.di); + context.cx = 12; + while(context.cx--) context._movsb(); + monitorlogo(context); + scrollmonitor(context); + context.al = 9; + monmessage(context); + context.es = context.data.word(kTextfile1); + searchforfiles(context); + context.es = context.data.word(kTextfile2); + searchforfiles(context); + context.es = context.data.word(kTextfile3); + searchforfiles(context); + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void searchforfiles(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = (66*2); +directloop1: + context.al = context.es.byte(context.bx); + context._inc(context.bx); + context._cmp(context.al, '*'); + if (context.flags.z()) goto endofdir; + context._cmp(context.al, 34); + if (!context.flags.z()) goto directloop1; + monprint(context); + goto directloop1; +endofdir: + {assert(stack_depth == context.stack.size()); return; } +} + +void signon(Context & context) { + uint stack_depth = context.stack.size(); + parser(context); + context._inc(context.di); + context.ds = context.cs; + context.si = 2836; + context.cx = 4; +signonloop: + context.push(context.cx); + context.push(context.si); + context.push(context.di); + context._add(context.si, 14); + context.cx = 11; +signonloop2: + context._lodsb(); + context._cmp(context.al, 32); + if (context.flags.z()) goto foundsign; + makecaps(context); + context.ah = context.es.byte(context.di); + context._inc(context.di); + context._cmp(context.al, context.ah); + if (!context.flags.z()) goto nomatch; + if (--context.cx) goto signonloop2; +nomatch: + context.di = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context._add(context.si, 26); + if (--context.cx) goto signonloop; + context.al = 13; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +foundsign: + context.di = context.pop(); + context.si = context.pop(); + context.cx = context.pop(); + context.bx = context.si; + context.es = context.ds; + context._cmp(context.es.byte(context.bx), 0); + if (context.flags.z()) goto notyetassigned; + context.al = 17; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +notyetassigned: + context.push(context.es); + context.push(context.bx); + scrollmonitor(context); + context.al = 15; + monmessage(context); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + context.push(context.di); + context.push(context.bx); + input(context); + context.bx = context.pop(); + context.di = context.pop(); + context.data.word(kMonadx) = context.di; + context.data.word(kMonady) = context.bx; + context.bx = context.pop(); + context.es = context.pop(); + context.push(context.es); + context.push(context.bx); + context._add(context.bx, 2); + context.ds = context.cs; + context.si = 8045; +checkpass: + context._lodsw(); + context.ah = context.es.byte(context.bx); + context._inc(context.bx); + context._cmp(context.ah, 32); + if (context.flags.z()) goto passpassed; + context._cmp(context.al, context.ah); + if (context.flags.z()) goto checkpass; +passerror: + context.bx = context.pop(); + context.es = context.pop(); + scrollmonitor(context); + context.al = 16; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +passpassed: + context.al = 14; + monmessage(context); + context.bx = context.pop(); + context.es = context.pop(); + context.push(context.es); + context.push(context.bx); + context._add(context.bx, 14); + monprint(context); + scrollmonitor(context); + context.bx = context.pop(); + context.es = context.pop(); + context.es.byte(context.bx) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void showkeys(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = 10; + randomaccess(context); + scrollmonitor(context); + context.al = 18; + monmessage(context); + context.es = context.cs; + context.bx = 2836; + context.cx = 4; +keysloop: + context.push(context.cx); + context.push(context.bx); + context._cmp(context.es.byte(context.bx), 0); + if (context.flags.z()) goto notheld; + context._add(context.bx, 14); + monprint(context); +notheld: + context.bx = context.pop(); + context.cx = context.pop(); + context._add(context.bx, 26); + if (--context.cx) goto keysloop; + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void read(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = 40; + randomaccess(context); + parser(context); + context._cmp(context.es.byte(context.di+1), 0); + if (!context.flags.z()) goto okcom; + neterror(context); + {assert(stack_depth == context.stack.size()); return; } +okcom: + context.es = context.cs; + context.di = 2970; + context.ax = context.data.word(kTextfile1); + context.data.word(kMonsource) = context.ax; + context.ds = context.ax; + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile2; + context.ax = context.data.word(kTextfile2); + context.data.word(kMonsource) = context.ax; + context.ds = context.ax; + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile2; + context.ax = context.data.word(kTextfile3); + context.data.word(kMonsource) = context.ax; + context.ds = context.ax; + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile2; + context.al = 7; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +foundfile2: + getkeyandlogo(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto keyok1; + {assert(stack_depth == context.stack.size()); return; } +keyok1: + context.es = context.cs; + context.di = 2942; + context.ds = context.data.word(kMonsource); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto findtopictext; + context.al = context.data.byte(kOldlogonum); + context.data.byte(kLogonum) = context.al; + context.al = 11; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +findtopictext: + context._inc(context.bx); + context.push(context.es); + context.push(context.bx); + monitorlogo(context); + scrollmonitor(context); + context.bx = context.pop(); + context.es = context.pop(); +moretopic: + monprint(context); + context.al = context.es.byte(context.bx); + context._cmp(context.al, 34); + if (context.flags.z()) goto endoftopic; + context._cmp(context.al, '='); + if (context.flags.z()) goto endoftopic; + context._cmp(context.al, '*'); + if (context.flags.z()) goto endoftopic; + context.push(context.es); + context.push(context.bx); + processtrigger(context); + context.cx = 24; + randomaccess(context); + context.bx = context.pop(); + context.es = context.pop(); + goto moretopic; +endoftopic: + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dirfile(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 34; + context.es.byte(context.di) = context.al; + context.push(context.es); + context.push(context.di); + context.ds = context.data.word(kTextfile1); + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile; + context.di = context.pop(); + context.es = context.pop(); + context.push(context.es); + context.push(context.di); + context.ds = context.data.word(kTextfile2); + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile; + context.di = context.pop(); + context.es = context.pop(); + context.push(context.es); + context.push(context.di); + context.ds = context.data.word(kTextfile3); + context.si = (66*2); + searchforstring(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto foundfile; + context.di = context.pop(); + context.es = context.pop(); + context.al = 7; + monmessage(context); + {assert(stack_depth == context.stack.size()); return; } +foundfile: + context.ax = context.pop(); + context.ax = context.pop(); + getkeyandlogo(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto keyok2; + {assert(stack_depth == context.stack.size()); return; } +keyok2: + context.push(context.es); + context.push(context.bx); + context.ds = context.cs; + context.si = 2942+1; + context.es = context.cs; + context.di = 2970+1; + context.cx = 12; + while(context.cx--) context._movsb(); + monitorlogo(context); + scrollmonitor(context); + context.al = 10; + monmessage(context); + context.bx = context.pop(); + context.es = context.pop(); +directloop2: + context.al = context.es.byte(context.bx); + context._inc(context.bx); + context._cmp(context.al, 34); + if (context.flags.z()) goto endofdir2; + context._cmp(context.al, '*'); + if (context.flags.z()) goto endofdir2; + context._cmp(context.al, '='); + if (!context.flags.z()) goto directloop2; + monprint(context); + goto directloop2; +endofdir2: + scrollmonitor(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getkeyandlogo(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.bx); + context.al = context.es.byte(context.bx); + context._sub(context.al, 48); + context.data.byte(kNewlogonum) = context.al; + context._add(context.bx, 2); + context.al = context.es.byte(context.bx); + context._sub(context.al, 48); + context.data.byte(kKeynum) = context.al; + context._inc(context.bx); + context.push(context.es); + context.push(context.bx); + context.al = context.data.byte(kKeynum); + context.ah = 0; + context.cx = 26; + context._mul(context.cx); + context.es = context.cs; + context.bx = 2836; + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx); + context._cmp(context.al, 1); + if (context.flags.z()) goto keyok; + context.push(context.bx); + context.push(context.es); + context.al = 12; + monmessage(context); + context.es = context.pop(); + context.bx = context.pop(); + context._add(context.bx, 14); + monprint(context); + scrollmonitor(context); + context.bx = context.pop(); + context.es = context.pop(); + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +keyok: + context.bx = context.pop(); + context.es = context.pop(); + context.al = context.data.byte(kNewlogonum); + context.data.byte(kLogonum) = context.al; + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void searchforstring(Context & context) { + uint stack_depth = context.stack.size(); + context.dl = context.es.byte(context.di); + context.cx = context.di; +restartlook: + context.di = context.cx; + context.bx = context.si; + context.dh = 0; +keeplooking: + context._lodsb(); + makecaps(context); + context._cmp(context.al, '*'); + if (context.flags.z()) goto notfound; + context._cmp(context.dl, '='); + if (!context.flags.z()) goto nofindingtopic; + context._cmp(context.al, 34); + if (context.flags.z()) goto notfound; +nofindingtopic: + context.ah = context.es.byte(context.di); + context._cmp(context.al, context.dl); + if (!context.flags.z()) goto notbracket; + context._inc(context.dh); + context._cmp(context.dh, 2); + if (context.flags.z()) goto complete; +notbracket: + context._cmp(context.al, context.ah); + if (!context.flags.z()) goto restartlook; + context._inc(context.di); + goto keeplooking; +complete: + context.es = context.ds; + context.al = 0; + context.bx = context.si; + {assert(stack_depth == context.stack.size()); return; } +notfound: + context.al = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void parser(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.cs; + context.di = 2942; + context.cx = 13; + context.al = 0; + while(context.cx--) context._stosb(); + context.di = 2942; + context.al = '='; + context._stosb(); + context.ds = context.cs; + context.si = 8045; +notspace1: + context._lodsw(); + context._cmp(context.al, 32); + if (context.flags.z()) goto stillspace1; + context._cmp(context.al, 0); + if (!context.flags.z()) goto notspace1; + goto finishpars; +stillspace1: + context._lodsw(); + context._cmp(context.al, 32); + if (context.flags.z()) goto stillspace1; +copyin1: + context._stosb(); + context._lodsw(); + context._cmp(context.al, 0); + if (context.flags.z()) goto finishpars; + context._cmp(context.al, 32); + if (!context.flags.z()) goto copyin1; +finishpars: + context.di = 2942; + {assert(stack_depth == context.stack.size()); return; } +} + +void scrollmonitor(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.bx); + context.push(context.cx); + context.push(context.dx); + context.push(context.di); + context.push(context.si); + context.push(context.es); + context.push(context.ds); + printlogo(context); + context.di = context.data.word(kMonadx); + context.bx = context.data.word(kMonady); + printundermon(context); + context.ax = context.data.word(kMonady); + worktoscreen(context); + context.al = 25; + playchannel1(context); + context.ds = context.pop(); + context.es = context.pop(); + context.si = context.pop(); + context.di = context.pop(); + context.dx = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void lockmon(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLasthardkey), 57); + if (!context.flags.z()) goto notlock; + locklighton(context); +lockloop: + context._cmp(context.data.byte(kLasthardkey), 57); + if (context.flags.z()) goto lockloop; + locklightoff(context); +notlock: + {assert(stack_depth == context.stack.size()); return; } +} + +void monitorlogo(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kLogonum); + context._cmp(context.al, context.data.byte(kOldlogonum)); + if (context.flags.z()) goto notnewlogo; + context.data.byte(kOldlogonum) = context.al; + printlogo(context); + printundermon(context); + worktoscreen(context); + printlogo(context); + printlogo(context); + context.al = 26; + playchannel1(context); + context.cx = 20; + randomaccess(context); + {assert(stack_depth == context.stack.size()); return; } +notnewlogo: + printlogo(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void printlogo(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 56; + context.bx = 32; + context.ds = context.data.word(kTempgraphics); + context.al = 0; + context.ah = 0; + showframe(context); + showcurrentfile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showcurrentfile(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 178; + context.bx = 37; + context.si = 2970+1; +curfileloop: + context.al = context.cs.byte(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto finishfile; + context._inc(context.si); + context.push(context.si); + context.ds = context.data.word(kTempcharset); + context.ah = 0; + printchar(context); + context.si = context.pop(); + goto curfileloop; +finishfile: + {assert(stack_depth == context.stack.size()); return; } +} + +void monmessage(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTextfile1); + context.bx = (66*2); + context.cl = context.al; + context.ch = 0; +monmessageloop: + context.al = context.es.byte(context.bx); + context._inc(context.bx); + context._cmp(context.al, '+'); + if (!context.flags.z()) goto monmessageloop; + if (--context.cx) goto monmessageloop; + monprint(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void processtrigger(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLasttrigger), '1'); + if (!context.flags.z()) goto notfirsttrigger; + context.al = 8; + setlocation(context); + context.al = 45; + triggermessage(context); + {assert(stack_depth == context.stack.size()); return; } +notfirsttrigger: + context._cmp(context.data.byte(kLasttrigger), '2'); + if (!context.flags.z()) goto notsecondtrigger; + context.al = 9; + setlocation(context); + context.al = 55; + triggermessage(context); + {assert(stack_depth == context.stack.size()); return; } +notsecondtrigger: + context._cmp(context.data.byte(kLasttrigger), '3'); + if (!context.flags.z()) goto notthirdtrigger; + context.al = 2; + setlocation(context); + context.al = 59; + triggermessage(context); +notthirdtrigger: + {assert(stack_depth == context.stack.size()); return; } +} + +void triggermessage(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.di = 174; + context.bx = 153; + context.cl = 200; + context.ch = 63; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiget(context); + context.ax = context.pop(); + findpuztext(context); + context.di = 174; + context.bx = 156; + context.dl = 141; + context.ah = 16; + printdirect(context); + context.cx = 140; + hangon(context); + worktoscreen(context); + context.cx = 340; + hangon(context); + context.di = 174; + context.bx = 153; + context.cl = 200; + context.ch = 63; + context.ds = context.data.word(kMapstore); + context.si = 0; + multiput(context); + worktoscreen(context); + context.data.byte(kLasttrigger) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void printcurs(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.si); + context.push(context.di); + context.push(context.ds); + context.push(context.dx); + context.push(context.bx); + context.push(context.es); + context.di = context.data.word(kCurslocx); + context.bx = context.data.word(kCurslocy); + context.cl = 6; + context.ch = 8; + context.ds = context.data.word(kBuffers); + context.si = (0); + context.push(context.di); + context.push(context.bx); + multiget(context); + context.bx = context.pop(); + context.di = context.pop(); + context.push(context.bx); + context.push(context.di); + context._inc(context.data.word(kMaintimer)); + context.ax = context.data.word(kMaintimer); + context._and(context.al, 16); + if (!context.flags.z()) goto flashcurs; + context.al = '/'; + context._sub(context.al, 32); + context.ah = 0; + context.ds = context.data.word(kTempcharset); + showframe(context); +flashcurs: + context.di = context.pop(); + context.bx = context.pop(); + context._sub(context.di, 6); + context.cl = 12; + context.ch = 8; + multidump(context); + context.es = context.pop(); + context.bx = context.pop(); + context.dx = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.si = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void delcurs(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.push(context.di); + context.push(context.ds); + context.push(context.dx); + context.push(context.si); + context.di = context.data.word(kCurslocx); + context.bx = context.data.word(kCurslocy); + context.cl = 6; + context.ch = 8; + context.push(context.di); + context.push(context.bx); + context.push(context.cx); + context.ds = context.data.word(kBuffers); + context.si = (0); + multiput(context); + context.cx = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + multidump(context); +finishcurdel: + context.si = context.pop(); + context.dx = context.pop(); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void useobject(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kWithobject) = 255; + context._cmp(context.data.byte(kCommandtype), 229); + if (context.flags.z()) goto alreadyuse; + context.data.byte(kCommandtype) = 229; + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kObjecttype); + context.al = 51; + commandwithob(context); +alreadyuse: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nouse; + context._and(context.ax, 1); + if (!context.flags.z()) goto douse; +nouse: + {assert(stack_depth == context.stack.size()); return; } +douse: + useroutine(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useroutine(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 50); + if (context.flags.c()) goto nodream7; + context._cmp(context.data.byte(kPointerpower), 0); + if (!context.flags.z()) goto powerok; + {assert(stack_depth == context.stack.size()); return; } +powerok: + context.data.byte(kPointerpower) = 0; +nodream7: + getanyad(context); + context.dx = context.data; + context.ds = context.dx; + context.si = 2984; +checkuselist: + context.push(context.si); + context._lodsb(); + context._sub(context.al, 'A'); + context._cmp(context.al, context.es.byte(context.bx+12)); + if (!context.flags.z()) goto failed; + context._lodsb(); + context._sub(context.al, 'A'); + context._cmp(context.al, context.es.byte(context.bx+13)); + if (!context.flags.z()) goto failed; + context._lodsb(); + context._sub(context.al, 'A'); + context._cmp(context.al, context.es.byte(context.bx+14)); + if (!context.flags.z()) goto failed; + context._lodsb(); + context._sub(context.al, 'A'); + context._cmp(context.al, context.es.byte(context.bx+15)); + if (!context.flags.z()) goto failed; + context._lodsw(); + context.si = context.pop(); + __dispatch_call(context, context.ax); + {assert(stack_depth == context.stack.size()); return; } +failed: + context.si = context.pop(); + context._add(context.si, 6); + context._cmp(context.ds.byte(context.si), 140); + if (!context.flags.z()) goto checkuselist; + delpointer(context); + getobtextstart(context); + findnextcolon(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto cantuse2; + findnextcolon(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto cantuse2; + context.al = context.es.byte(context.si); + context._cmp(context.al, 0); + if (context.flags.z()) goto cantuse2; + usetext(context); + context.cx = 400; + hangonp(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +cantuse2: + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + context.di = 33; + context.bx = 100; + context.al = 63; + context.dl = 241; + printmessage(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + putbackobstuff(context); + context.data.byte(kCommandtype) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void wheelsound(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 17; + playchannel1(context); + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void runtap(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto tapwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +tapwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto fillcupfromtap; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'F'; + compare(context); + if (context.flags.z()) goto cupfromtapfull; + context.cx = 300; + context.al = 56; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +fillcupfromtap: + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+15) = 'F'-'A'; + context.al = 8; + playchannel1(context); + context.cx = 300; + context.al = 57; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +cupfromtapfull: + context.cx = 300; + context.al = 58; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void playguitar(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 14; + playchannel1(context); + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void hotelcontrol(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 21); + if (!context.flags.z()) goto notrightcont; + context._cmp(context.data.byte(kMapx), 33); + if (!context.flags.z()) goto notrightcont; + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +notrightcont: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void hotelbell(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 12; + playchannel1(context); + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void opentomb(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + context.data.word(kWatchingtime) = 35*2; + context.data.word(kReeltowatch) = 1; + context.data.word(kEndwatchreel) = 33; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usetrainer(Context & context) { + uint stack_depth = context.stack.size(); + getanyad(context); + context._cmp(context.es.byte(context.bx+2), 4); + if (!context.flags.z()) goto notheldtrainer; + context._inc(context.data.byte(kProgresspoints)); + makeworn(context); + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +notheldtrainer: + nothelderror(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void nothelderror(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + context.di = 64; + context.bx = 100; + context.al = 63; + context.ah = 1; + context.dl = 201; + printmessage2(context); + worktoscreenm(context); + context.cx = 50; + hangonp(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usepipe(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto pipewith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +pipewith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto fillcup; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'F'; + compare(context); + if (context.flags.z()) goto alreadyfull; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +fillcup: + context.cx = 300; + context.al = 36; + showpuztext(context); + putbackobstuff(context); + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+15) = 'F'-'A'; + {assert(stack_depth == context.stack.size()); return; } +alreadyfull: + context.cx = 300; + context.al = 35; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usefullcart(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.data.byte(kProgresspoints)); + context.al = 2; + context.ah = context.data.byte(kRoomnum); + context._add(context.ah, 6); + turnanypathon(context); + context.data.byte(kManspath) = 4; + context.data.byte(kFacing) = 4; + context.data.byte(kTurntoface) = 4; + context.data.byte(kFinaldest) = 4; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + showfirstuse(context); + context.data.word(kWatchingtime) = 72*2; + context.data.word(kReeltowatch) = 58; + context.data.word(kEndwatchreel) = 142; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useplinth(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto plinthwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +plinthwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'D'; + context.ch = 'K'; + context.dl = 'E'; + context.dh = 'Y'; + compare(context); + if (context.flags.z()) goto isrightkey; + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +isrightkey: + context._inc(context.data.byte(kProgresspoints)); + showseconduse(context); + context.data.word(kWatchingtime) = 220; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 104; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context.al = context.data.byte(kRoomafterdream); + context.data.byte(kNewlocation) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void chewy(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + getanyad(context); + context.es.byte(context.bx+2) = 255; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useladder(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context._sub(context.data.byte(kMapx), 11); + findroominloc(context); + context.data.byte(kFacing) = 6; + context.data.byte(kTurntoface) = 6; + context.data.byte(kManspath) = 0; + context.data.byte(kDestination) = 0; + context.data.byte(kFinaldest) = 0; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useladderb(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context._add(context.data.byte(kMapx), 11); + findroominloc(context); + context.data.byte(kFacing) = 2; + context.data.byte(kTurntoface) = 2; + context.data.byte(kManspath) = 1; + context.data.byte(kDestination) = 1; + context.data.byte(kFinaldest) = 1; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoora(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 13; + context._cmp(context.data.byte(kDreamnumber), 3); + if (!context.flags.z()) goto slabawrong; + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 42; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabawrong: + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 34; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoorb(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kDreamnumber), 1); + if (!context.flags.z()) goto slabbwrong; + context.al = 'S'; + context.ah = 'H'; + context.cl = 'L'; + context.ch = 'D'; + isryanholding(context); + if (!context.flags.z()) goto gotcrystal; + context.al = 44; + context.cx = 200; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +gotcrystal: + showfirstuse(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 44; + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 71; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabbwrong: + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 44; + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 63; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoord(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 75; + context._cmp(context.data.byte(kDreamnumber), 0); + if (!context.flags.z()) goto slabcwrong; + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 102; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabcwrong: + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 94; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoorc(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 108; + context._cmp(context.data.byte(kDreamnumber), 4); + if (!context.flags.z()) goto slabdwrong; + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 135; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabdwrong: + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 127; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoore(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 141; + context._cmp(context.data.byte(kDreamnumber), 5); + if (!context.flags.z()) goto slabewrong; + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 168; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabewrong: + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 160; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void slabdoorf(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kReeltowatch) = 171; + context._cmp(context.data.byte(kDreamnumber), 2); + if (!context.flags.z()) goto slabfwrong; + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 60; + context.data.word(kEndwatchreel) = 197; + context.data.byte(kNewlocation) = 47; + {assert(stack_depth == context.stack.size()); return; } +slabfwrong: + context.data.word(kWatchingtime) = 40; + context.data.word(kEndwatchreel) = 189; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useslab(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto slabwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +slabwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'J'; + context.ch = 'E'; + context.dl = 'W'; + context.dh = 'L'; + compare(context); + if (context.flags.z()) goto nextslab; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +nextslab: + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+2) = 0; + context.al = context.data.byte(kCommand); + context.push(context.ax); + removesetobject(context); + context.ax = context.pop(); + context._inc(context.al); + context.push(context.ax); + placesetobject(context); + context.ax = context.pop(); + context._cmp(context.al, 54); + if (!context.flags.z()) goto notlastslab; + context.al = 0; + turnpathon(context); + context.data.word(kWatchingtime) = 22; + context.data.word(kReeltowatch) = 35; + context.data.word(kEndwatchreel) = 48; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; +notlastslab: + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usecart(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto cartwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +cartwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'R'; + context.ch = 'O'; + context.dl = 'C'; + context.dh = 'K'; + compare(context); + if (context.flags.z()) goto nextcart; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +nextcart: + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+2) = 0; + context.al = context.data.byte(kCommand); + context.push(context.ax); + removesetobject(context); + context.ax = context.pop(); + context._inc(context.al); + placesetobject(context); + context._inc(context.data.byte(kProgresspoints)); + context.al = 17; + playchannel1(context); + showfirstuse(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useclearbox(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto clearboxwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +clearboxwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'R'; + context.ch = 'A'; + context.dl = 'I'; + context.dh = 'L'; + compare(context); + if (context.flags.z()) goto openbox; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +openbox: + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + context.data.word(kWatchingtime) = 80; + context.data.word(kReeltowatch) = 67; + context.data.word(kEndwatchreel) = 105; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usecoveredbox(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + context.data.word(kWatchingtime) = 50; + context.data.word(kReeltowatch) = 41; + context.data.word(kEndwatchreel) = 66; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void userailing(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.word(kWatchingtime) = 80; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 30; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context.data.byte(kMandead) = 4; + {assert(stack_depth == context.stack.size()); return; } +} + +void useopenbox(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto openboxwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +openboxwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'F'; + compare(context); + if (context.flags.z()) goto destoryopenbox; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'P'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto openboxwrong; + showfirstuse(context); + {assert(stack_depth == context.stack.size()); return; } +destoryopenbox: + context._inc(context.data.byte(kProgresspoints)); + context.cx = 300; + context.al = 37; + showpuztext(context); + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+15) = 'E'-'A'; + context.data.word(kWatchingtime) = 140; + context.data.word(kReeltowatch) = 105; + context.data.word(kEndwatchreel) = 181; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.al = 4; + turnpathon(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +openboxwrong: + context.cx = 300; + context.al = 38; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void wearwatch(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchon), 1); + if (context.flags.z()) goto wearingwatch; + showfirstuse(context); + context.data.byte(kWatchon) = 1; + context.data.byte(kGetback) = 1; + getanyad(context); + makeworn(context); + {assert(stack_depth == context.stack.size()); return; } +wearingwatch: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void wearshades(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kShadeson), 1); + if (context.flags.z()) goto wearingshades; + context.data.byte(kShadeson) = 1; + showfirstuse(context); + context.data.byte(kGetback) = 1; + getanyad(context); + makeworn(context); + {assert(stack_depth == context.stack.size()); return; } +wearingshades: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void sitdowninbar(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchmode), -1); + if (!context.flags.z()) goto satdown; + showfirstuse(context); + context.data.word(kWatchingtime) = 50; + context.data.word(kReeltowatch) = 55; + context.data.word(kEndwatchreel) = 71; + context.data.word(kReeltohold) = 73; + context.data.word(kEndofholdreel) = 83; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +satdown: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usechurchhole(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kGetback) = 1; + context.data.word(kWatchingtime) = 28; + context.data.word(kReeltowatch) = 13; + context.data.word(kEndwatchreel) = 26; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usehole(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto holewith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +holewith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'H'; + context.ch = 'N'; + context.dl = 'D'; + context.dh = 'A'; + compare(context); + if (context.flags.z()) goto righthand; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +righthand: + showfirstuse(context); + context.al = 86; + removesetobject(context); + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+2) = 255; + context.data.byte(kCanmovealtar) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usealtar(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 'C'; + context.ah = 'N'; + context.cl = 'D'; + context.ch = 'A'; + findexobject(context); + context._cmp(context.al, (114)); + if (context.flags.z()) goto thingsonaltar; + context.al = 'C'; + context.ah = 'N'; + context.cl = 'D'; + context.ch = 'B'; + findexobject(context); + context._cmp(context.al, (114)); + if (context.flags.z()) goto thingsonaltar; + context._cmp(context.data.byte(kCanmovealtar), 1); + if (context.flags.z()) goto movealtar; + context.cx = 300; + context.al = 23; + showpuztext(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +movealtar: + context._inc(context.data.byte(kProgresspoints)); + showseconduse(context); + context.data.word(kWatchingtime) = 160; + context.data.word(kReeltowatch) = 81; + context.data.word(kEndwatchreel) = 174; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.al = 47; + context.bl = 52; + context.bh = 76; + context.cx = 32; + context.dx = 98; + setuptimeduse(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +thingsonaltar: + showfirstuse(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void opentvdoor(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto tvdoorwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +tvdoorwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'U'; + context.ch = 'L'; + context.dl = 'O'; + context.dh = 'K'; + compare(context); + if (context.flags.z()) goto keyontv; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +keyontv: + showfirstuse(context); + context.data.byte(kLockstatus) = 0; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usedryer(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 12; + playchannel1(context); + showfirstuse(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void openlouis(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 5; + context.ah = 2; + context.cl = 3; + context.ch = 8; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void nextcolon(Context & context) { + uint stack_depth = context.stack.size(); +lookcolon: + context.al = context.es.byte(context.si); + context._inc(context.si); + context._cmp(context.al, ':'); + if (!context.flags.z()) goto lookcolon; + {assert(stack_depth == context.stack.size()); return; } +} + +void openyourneighbour(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 255; + context.ah = 255; + context.cl = 255; + context.ch = 255; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usewindow(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kManspath), 6); + if (!context.flags.z()) goto notonbalc; + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + context.data.byte(kNewlocation) = 29; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +notonbalc: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usebalcony(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.al = 6; + turnpathon(context); + context.al = 0; + turnpathoff(context); + context.al = 1; + turnpathoff(context); + context.al = 2; + turnpathoff(context); + context.al = 3; + turnpathoff(context); + context.al = 4; + turnpathoff(context); + context.al = 5; + turnpathoff(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kManspath) = 6; + context.data.byte(kDestination) = 6; + context.data.byte(kFinaldest) = 6; + findxyfrompath(context); + switchryanoff(context); + context.data.byte(kResetmanxy) = 1; + context.data.word(kWatchingtime) = 30*2; + context.data.word(kReeltowatch) = 183; + context.data.word(kEndwatchreel) = 212; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void openryan(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 5; + context.ah = 1; + context.cl = 0; + context.ch = 6; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void openpoolboss(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 5; + context.ah = 2; + context.cl = 2; + context.ch = 2; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void openeden(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 2; + context.ah = 8; + context.cl = 6; + context.ch = 5; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void opensarters(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 7; + context.ah = 8; + context.cl = 3; + context.ch = 3; + entercode(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void isitright(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = context.data; + context.es = context.bx; + context.bx = 8573; + context._cmp(context.es.byte(context.bx+0), context.al); + if (!context.flags.z()) goto notright; + context._cmp(context.es.byte(context.bx+1), context.ah); + if (!context.flags.z()) goto notright; + context._cmp(context.es.byte(context.bx+2), context.cl); + if (!context.flags.z()) goto notright; + context._cmp(context.es.byte(context.bx+3), context.ch); +notright: + {assert(stack_depth == context.stack.size()); return; } +} + +void drawitall(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + drawfloor(context); + printsprites(context); + showicon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void openhoteldoor(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto hoteldoorwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +hoteldoorwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'E'; + context.dl = 'Y'; + context.dh = 'A'; + compare(context); + if (context.flags.z()) goto keyonhotel1; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +keyonhotel1: + context.al = 16; + playchannel1(context); + showfirstuse(context); + context.data.byte(kLockstatus) = 0; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void openhoteldoor2(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto hoteldoorwith2; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +hoteldoorwith2: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'E'; + context.dl = 'Y'; + context.dh = 'A'; + compare(context); + if (context.flags.z()) goto keyonhotel2; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +keyonhotel2: + context.al = 16; + playchannel1(context); + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void grafittidoor(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto grafwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +grafwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'A'; + context.ch = 'P'; + context.dl = 'E'; + context.dh = 'N'; + compare(context); + if (context.flags.z()) goto dograf; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +dograf: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void trapdoor(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.data.byte(kProgresspoints)); + showfirstuse(context); + switchryanoff(context); + context.data.word(kWatchingtime) = 20*2; + context.data.word(kReeltowatch) = 181; + context.data.word(kEndwatchreel) = 197; + context.data.byte(kNewlocation) = 26; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void callhotellift(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 12; + playchannel1(context); + showfirstuse(context); + context.data.byte(kCounttoopen) = 8; + context.data.byte(kGetback) = 1; + context.data.byte(kDestination) = 5; + context.data.byte(kFinaldest) = 5; + autosetwalk(context); + context.al = 4; + turnpathon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void calledenslift(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kCounttoopen) = 8; + context.data.byte(kGetback) = 1; + context.al = 2; + turnpathon(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void calledensdlift(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLiftflag), 1); + if (context.flags.z()) goto edensdhere; + showfirstuse(context); + context.data.byte(kCounttoopen) = 8; + context.data.byte(kGetback) = 1; + context.al = 2; + turnpathon(context); + {assert(stack_depth == context.stack.size()); return; } +edensdhere: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usepoolreader(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto poolwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +poolwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'M'; + context.ch = 'E'; + context.dl = 'M'; + context.dh = 'B'; + compare(context); + if (context.flags.z()) goto openpool; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +openpool: + context._cmp(context.data.byte(kTalkedtoattendant), 1); + if (context.flags.z()) goto canopenpool; + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +canopenpool: + context.al = 17; + playchannel1(context); + showfirstuse(context); + context.data.byte(kCounttoopen) = 6; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void uselighter(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotlighterwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotlighterwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'S'; + context.ch = 'M'; + context.dl = 'K'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto cigarette; + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +cigarette: + context.cx = 300; + context.al = 9; + showpuztext(context); + context.al = context.data.byte(kWithobject); + getexad(context); + context.es.byte(context.bx+2) = 255; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void showseconduse(Context & context) { + uint stack_depth = context.stack.size(); + getobtextstart(context); + nextcolon(context); + nextcolon(context); + nextcolon(context); + usetext(context); + context.cx = 400; + hangonp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecardreader1(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotreader1with; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotreader1with: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'S'; + context.dl = 'H'; + context.dh = 'R'; + compare(context); + if (context.flags.z()) goto correctcard; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +correctcard: + context._cmp(context.data.byte(kTalkedtosparky), 0); + if (context.flags.z()) goto notyet; + context._cmp(context.data.word(kCard1money), 0); + if (context.flags.z()) goto getscash; + context.cx = 300; + context.al = 17; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +getscash: + context.al = 16; + playchannel1(context); + context.cx = 300; + context.al = 18; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kCard1money) = 12432; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +notyet: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecardreader2(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotreader2with; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotreader2with: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'S'; + context.dl = 'H'; + context.dh = 'R'; + compare(context); + if (context.flags.z()) goto correctcard2; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +correctcard2: + context._cmp(context.data.byte(kTalkedtoboss), 0); + if (context.flags.z()) goto notyetboss; + context._cmp(context.data.word(kCard1money), 0); + if (context.flags.z()) goto nocash; + context._cmp(context.data.byte(kGunpassflag), 2); + if (context.flags.z()) goto alreadygotnew; + context.al = 18; + playchannel1(context); + context.cx = 300; + context.al = 19; + showpuztext(context); + context.al = 94; + placesetobject(context); + context.data.byte(kGunpassflag) = 1; + context._sub(context.data.word(kCard1money), 2000); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +nocash: + context.cx = 300; + context.al = 20; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +alreadygotnew: + context.cx = 300; + context.al = 22; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +notyetboss: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecardreader3(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotreader3with; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotreader3with: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'S'; + context.dl = 'H'; + context.dh = 'R'; + compare(context); + if (context.flags.z()) goto rightcard; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +rightcard: + context._cmp(context.data.byte(kTalkedtorecep), 0); + if (context.flags.z()) goto notyetrecep; + context._cmp(context.data.byte(kCardpassflag), 0); + if (!context.flags.z()) goto alreadyusedit; + context.al = 16; + playchannel1(context); + context.cx = 300; + context.al = 25; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context._sub(context.data.word(kCard1money), 8300); + context.data.byte(kCardpassflag) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +alreadyusedit: + context.cx = 300; + context.al = 26; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +notyetrecep: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecashcard(Context & context) { + uint stack_depth = context.stack.size(); + getridofreels(context); + loadkeypad(context); + createpanel(context); + showpanel(context); + showexit(context); + showman(context); + context.di = 114; + context.bx = 120; + context.ds = context.data.word(kTempgraphics); + context.al = 39; + context.ah = 0; + showframe(context); + context.ax = context.data.word(kCard1money); + moneypoke(context); + getobtextstart(context); + nextcolon(context); + nextcolon(context); + context.di = 36; + context.bx = 98; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + context.di = 160; + context.bx = 155; + context.es = context.cs; + context.si = 3474; + context.data.word(kCharshift) = 91*2+75; + context.al = 0; + context.ah = 0; + context.dl = 240; + printdirect(context); + context.di = 187; + context.bx = 155; + context.es = context.cs; + context.si = 3479; + context.data.word(kCharshift) = 91*2+85; + context.al = 0; + context.ah = 0; + context.dl = 240; + printdirect(context); + context.data.word(kCharshift) = 0; + worktoscreenm(context); + context.cx = 400; + hangonp(context); + getridoftemp(context); + restorereels(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void lookatcard(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kManisoffscreen) = 1; + getridofreels(context); + loadkeypad(context); + createpanel2(context); + context.di = 160; + context.bx = 80; + context.ds = context.data.word(kTempgraphics); + context.al = 42; + context.ah = 128; + showframe(context); + getobtextstart(context); + findnextcolon(context); + findnextcolon(context); + findnextcolon(context); + context.di = 36; + context.bx = 124; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + context.push(context.es); + context.push(context.si); + worktoscreenm(context); + context.cx = 280; + hangonw(context); + createpanel2(context); + context.di = 160; + context.bx = 80; + context.ds = context.data.word(kTempgraphics); + context.al = 42; + context.ah = 128; + showframe(context); + context.si = context.pop(); + context.es = context.pop(); + context.di = 36; + context.bx = 130; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + worktoscreenm(context); + context.cx = 200; + hangonw(context); + context.data.byte(kManisoffscreen) = 0; + getridoftemp(context); + restorereels(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void moneypoke(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = 3474; + context.cl = 48-1; +numberpoke0: + context._inc(context.cl); + context._sub(context.ax, 10000); + if (!context.flags.c()) goto numberpoke0; + context._add(context.ax, 10000); + context.cs.byte(context.bx) = context.cl; + context._inc(context.bx); + context.cl = 48-1; +numberpoke1: + context._inc(context.cl); + context._sub(context.ax, 1000); + if (!context.flags.c()) goto numberpoke1; + context._add(context.ax, 1000); + context.cs.byte(context.bx) = context.cl; + context._inc(context.bx); + context.cl = 48-1; +numberpoke2: + context._inc(context.cl); + context._sub(context.ax, 100); + if (!context.flags.c()) goto numberpoke2; + context._add(context.ax, 100); + context.cs.byte(context.bx) = context.cl; + context._inc(context.bx); + context.cl = 48-1; +numberpoke3: + context._inc(context.cl); + context._sub(context.ax, 10); + if (!context.flags.c()) goto numberpoke3; + context._add(context.ax, 10); + context.cs.byte(context.bx) = context.cl; + context.bx = 3479; + context._add(context.al, 48); + context.cs.byte(context.bx) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void usecontrol(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotcontrolwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotcontrolwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'E'; + context.dl = 'Y'; + context.dh = 'A'; + compare(context); + if (context.flags.z()) goto rightkey; + context._cmp(context.data.byte(kReallocation), 21); + if (!context.flags.z()) goto balls; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'N'; + context.dl = 'F'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto jimmycontrols; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'A'; + context.ch = 'X'; + context.dl = 'E'; + context.dh = 'D'; + compare(context); + if (context.flags.z()) goto axeoncontrols; +balls: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +rightkey: + context.al = 16; + playchannel1(context); + context._cmp(context.data.byte(kLocation), 21); + if (context.flags.z()) goto goingdown; + context.cx = 300; + context.al = 0; + showpuztext(context); + context.data.byte(kNewlocation) = 21; + context.data.byte(kCounttoclose) = 8; + context.data.byte(kCounttoopen) = 0; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +goingdown: + context.cx = 300; + context.al = 3; + showpuztext(context); + context.data.byte(kNewlocation) = 30; + context.data.byte(kCounttoclose) = 8; + context.data.byte(kCounttoopen) = 0; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +jimmycontrols: + context.al = 50; + placesetobject(context); + context.al = 51; + placesetobject(context); + context.al = 26; + placesetobject(context); + context.al = 30; + placesetobject(context); + context.al = 16; + removesetobject(context); + context.al = 17; + removesetobject(context); + context.al = 14; + playchannel1(context); + context.cx = 300; + context.al = 10; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +axeoncontrols: + context.cx = 300; + context.al = 16; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usehatch(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kNewlocation) = 40; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usewire(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotwirewith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotwirewith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'N'; + context.dl = 'F'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto wireknife; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'A'; + context.ch = 'X'; + context.dl = 'E'; + context.dh = 'D'; + compare(context); + if (context.flags.z()) goto wireaxe; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +wireaxe: + context.cx = 300; + context.al = 16; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +wireknife: + context.al = 51; + removesetobject(context); + context.al = 52; + placesetobject(context); + context.cx = 300; + context.al = 11; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usehandle(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 'C'; + context.ah = 'U'; + context.cl = 'T'; + context.ch = 'W'; + findsetobject(context); + context.al = context.es.byte(context.bx+58); + context._cmp(context.al, 255); + if (!context.flags.z()) goto havecutwire; + context.cx = 300; + context.al = 12; + showpuztext(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +havecutwire: + context.cx = 300; + context.al = 13; + showpuztext(context); + context.data.byte(kNewlocation) = 22; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useelevator1(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + selectlocation(context); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void showfirstuse(Context & context) { + uint stack_depth = context.stack.size(); + getobtextstart(context); + findnextcolon(context); + findnextcolon(context); + usetext(context); + context.cx = 400; + hangonp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useelevator3(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.byte(kCounttoclose) = 20; + context.data.byte(kNewlocation) = 34; + context.data.word(kReeltowatch) = 46; + context.data.word(kEndwatchreel) = 63; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useelevator4(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 11; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kCounttoclose) = 20; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + context.data.byte(kNewlocation) = 24; + {assert(stack_depth == context.stack.size()); return; } +} + +void useelevator2(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 23); + if (context.flags.z()) goto inpoolhall; + showfirstuse(context); + context.data.byte(kNewlocation) = 23; + context.data.byte(kCounttoclose) = 20; + context.data.byte(kCounttoopen) = 0; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +inpoolhall: + showfirstuse(context); + context.data.byte(kNewlocation) = 31; + context.data.byte(kCounttoclose) = 20; + context.data.byte(kCounttoopen) = 0; + context.data.word(kWatchingtime) = 80; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void useelevator5(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 4; + placesetobject(context); + context.al = 0; + removesetobject(context); + context.data.byte(kNewlocation) = 20; + context.data.word(kWatchingtime) = 80; + context.data.byte(kLiftflag) = 1; + context.data.byte(kCounttoclose) = 8; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usekey(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 5); + if (context.flags.z()) goto usekey1; + context._cmp(context.data.byte(kLocation), 30); + if (context.flags.z()) goto usekey1; + context._cmp(context.data.byte(kLocation), 21); + if (context.flags.z()) goto usekey2; + context.cx = 200; + context.al = 1; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +usekey1: + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) goto wrongroom1; + context._cmp(context.data.byte(kMapy), 10); + if (!context.flags.z()) goto wrongroom1; + context.cx = 300; + context.al = 0; + showpuztext(context); + context.data.byte(kCounttoclose) = 100; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +usekey2: + context._cmp(context.data.byte(kMapx), 11); + if (!context.flags.z()) goto wrongroom1; + context._cmp(context.data.byte(kMapy), 10); + if (!context.flags.z()) goto wrongroom1; + context.cx = 300; + context.al = 3; + showpuztext(context); + context.data.byte(kNewlocation) = 30; + context.al = 2; + fadescreendown(context); + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +wrongroom1: + context.cx = 200; + context.al = 2; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usestereo(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 0); + if (context.flags.z()) goto stereook; + context.cx = 400; + context.al = 4; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +stereook: + context._cmp(context.data.byte(kMapx), 11); + if (!context.flags.z()) goto stereonotok; + context._cmp(context.data.byte(kMapy), 0); + if (context.flags.z()) goto stereook2; +stereonotok: + context.cx = 400; + context.al = 5; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +stereook2: + context.al = 'C'; + context.ah = 'D'; + context.cl = 'P'; + context.ch = 'L'; + findsetobject(context); + context.ah = 1; + checkinside(context); + context._cmp(context.cl, (114)); + if (!context.flags.z()) goto cdinside; + context.al = 6; + context.cx = 400; + showpuztext(context); + putbackobstuff(context); + getanyad(context); + context.al = 255; + context.es.byte(context.bx+10) = context.al; + {assert(stack_depth == context.stack.size()); return; } +cdinside: + getanyad(context); + context.al = context.es.byte(context.bx+10); + context._xor(context.al, 1); + context.es.byte(context.bx+10) = context.al; + context._cmp(context.al, 255); + if (context.flags.z()) goto stereoon; + context.al = 7; + context.cx = 400; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +stereoon: + context.al = 8; + context.cx = 400; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecooker(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + checkinside(context); + context._cmp(context.cl, (114)); + if (!context.flags.z()) goto foodinside; + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +foodinside: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useaxe(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 22); + if (!context.flags.z()) goto notinpool; + context._cmp(context.data.byte(kMapy), 10); + if (context.flags.z()) goto axeondoor; + showseconduse(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kLastweapon) = 2; + context.data.byte(kGetback) = 1; + removeobfrominv(context); + {assert(stack_depth == context.stack.size()); return; } +notinpool: + showfirstuse(context); + {assert(stack_depth == context.stack.size()); return; } +/*continuing to unbounded code: axeondoor from useelvdoor:19-30*/ +axeondoor: + context.al = 15; + context.cx = 300; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 46*2; + context.data.word(kReeltowatch) = 31; + context.data.word(kEndwatchreel) = 77; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } + {assert(stack_depth == context.stack.size()); return; } +} + +void useelvdoor(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gotdoorwith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gotdoorwith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'A'; + context.ch = 'X'; + context.dl = 'E'; + context.dh = 'D'; + compare(context); + if (context.flags.z()) goto axeondoor; + context.al = 14; + context.cx = 300; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +axeondoor: + context.al = 15; + context.cx = 300; + showpuztext(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.word(kWatchingtime) = 46*2; + context.data.word(kReeltowatch) = 31; + context.data.word(kEndwatchreel) = 77; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void withwhat(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + context.al = context.data.byte(kCommand); + context.ah = context.data.byte(kObjecttype); + context.es = context.cs; + context.di = 5847; + copyname(context); + context.di = 100; + context.bx = 21; + context.dl = 200; + context.al = 63; + context.ah = 2; + printmessage2(context); + context.di = context.data.word(kLastxpos); + context._add(context.di, 5); + context.bx = 21; + context.es = context.cs; + context.si = 5847; + context.dl = 220; + context.al = 0; + context.ah = 0; + printdirect(context); + context.di = context.data.word(kLastxpos); + context._add(context.di, 5); + context.bx = 21; + context.dl = 200; + context.al = 63; + context.ah = 3; + printmessage2(context); + fillryan(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.data.byte(kInvopen) = 2; + {assert(stack_depth == context.stack.size()); return; } +} + +void selectob(Context & context) { + uint stack_depth = context.stack.size(); + findinvpos(context); + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (!context.flags.z()) goto canselectob; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canselectob: + context.data.byte(kWithobject) = context.al; + context.data.byte(kWithtype) = context.ah; + context._cmp(context.ax, context.data.word(kOldsubject)); + if (!context.flags.z()) goto diffsub3; + context._cmp(context.data.byte(kCommandtype), 221); + if (context.flags.z()) goto alreadyselob; + context.data.byte(kCommandtype) = 221; +diffsub3: + context.data.word(kOldsubject) = context.ax; + context.bx = context.ax; + context.al = 0; + commandwithob(context); +alreadyselob: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notselob; + context._and(context.ax, 1); + if (!context.flags.z()) goto doselob; +notselob: + {assert(stack_depth == context.stack.size()); return; } +doselob: + delpointer(context); + context.data.byte(kInvopen) = 0; + useroutine(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void compare(Context & context) { + uint stack_depth = context.stack.size(); + context._sub(context.dl, 'A'); + context._sub(context.dh, 'A'); + context._sub(context.cl, 'A'); + context._sub(context.ch, 'A'); + context.push(context.cx); + context.push(context.dx); + getanyaddir(context); + context.dx = context.pop(); + context.cx = context.pop(); + context._cmp(context.es.word(context.bx+12), context.cx); + if (!context.flags.z()) goto comparefin; + context._cmp(context.es.word(context.bx+14), context.dx); +comparefin: + {assert(stack_depth == context.stack.size()); return; } +} + +void findsetobject(Context & context) { + uint stack_depth = context.stack.size(); + context._sub(context.al, 'A'); + context._sub(context.ah, 'A'); + context._sub(context.cl, 'A'); + context._sub(context.ch, 'A'); + context.es = context.data.word(kSetdat); + context.bx = 0; + context.dl = 0; +findsetloop: + context._cmp(context.al, context.es.byte(context.bx+12)); + if (!context.flags.z()) goto nofind; + context._cmp(context.ah, context.es.byte(context.bx+13)); + if (!context.flags.z()) goto nofind; + context._cmp(context.cl, context.es.byte(context.bx+14)); + if (!context.flags.z()) goto nofind; + context._cmp(context.ch, context.es.byte(context.bx+15)); + if (!context.flags.z()) goto nofind; + context.al = context.dl; + {assert(stack_depth == context.stack.size()); return; } +nofind: + context._add(context.bx, 64); + context._inc(context.dl); + context._cmp(context.dl, 128); + if (!context.flags.z()) goto findsetloop; + context.al = context.dl; + {assert(stack_depth == context.stack.size()); return; } +} + +void findexobject(Context & context) { + uint stack_depth = context.stack.size(); + context._sub(context.al, 'A'); + context._sub(context.ah, 'A'); + context._sub(context.cl, 'A'); + context._sub(context.ch, 'A'); + context.es = context.data.word(kExtras); + context.bx = (0+2080+30000); + context.dl = 0; +findexloop: + context._cmp(context.al, context.es.byte(context.bx+12)); + if (!context.flags.z()) goto nofindex; + context._cmp(context.ah, context.es.byte(context.bx+13)); + if (!context.flags.z()) goto nofindex; + context._cmp(context.cl, context.es.byte(context.bx+14)); + if (!context.flags.z()) goto nofindex; + context._cmp(context.ch, context.es.byte(context.bx+15)); + if (!context.flags.z()) goto nofindex; + context.al = context.dl; + {assert(stack_depth == context.stack.size()); return; } +nofindex: + context._add(context.bx, 16); + context._inc(context.dl); + context._cmp(context.dl, (114)); + if (!context.flags.z()) goto findexloop; + context.al = context.dl; + {assert(stack_depth == context.stack.size()); return; } +} + +void isryanholding(Context & context) { + uint stack_depth = context.stack.size(); + context._sub(context.al, 'A'); + context._sub(context.ah, 'A'); + context._sub(context.cl, 'A'); + context._sub(context.ch, 'A'); + context.es = context.data.word(kExtras); + context.bx = (0+2080+30000); + context.dl = 0; +searchinv: + context._cmp(context.es.byte(context.bx+2), 4); + if (!context.flags.z()) goto nofindininv; + context._cmp(context.al, context.es.byte(context.bx+12)); + if (!context.flags.z()) goto nofindininv; + context._cmp(context.ah, context.es.byte(context.bx+13)); + if (!context.flags.z()) goto nofindininv; + context._cmp(context.cl, context.es.byte(context.bx+14)); + if (!context.flags.z()) goto nofindininv; + context._cmp(context.ch, context.es.byte(context.bx+15)); + if (!context.flags.z()) goto nofindininv; + context.al = context.dl; + context._cmp(context.al, (114)); + {assert(stack_depth == context.stack.size()); return; } +nofindininv: + context._add(context.bx, 16); + context._inc(context.dl); + context._cmp(context.dl, (114)); + if (!context.flags.z()) goto searchinv; + context.al = context.dl; + context._cmp(context.al, (114)); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkinside(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kExtras); + context.bx = (0+2080+30000); + context.cl = 0; +insideloop: + context._cmp(context.al, context.es.byte(context.bx+3)); + if (!context.flags.z()) goto notfoundinside; + context._cmp(context.ah, context.es.byte(context.bx+2)); + if (!context.flags.z()) goto notfoundinside; + {assert(stack_depth == context.stack.size()); return; } +notfoundinside: + context._add(context.bx, 16); + context._inc(context.cl); + context._cmp(context.cl, (114)); + if (!context.flags.z()) goto insideloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void usetext(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.si); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + context.si = context.pop(); + context.es = context.pop(); + context.di = 36; + context.bx = 104; + context.dl = 241; + context.al = 0; + context.ah = 0; + printdirect(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void putbackobstuff(Context & context) { + uint stack_depth = context.stack.size(); + createpanel(context); + showpanel(context); + showman(context); + obicons(context); + showexit(context); + obpicture(context); + describeob(context); + undertextline(context); + context.data.byte(kCommandtype) = 255; + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showpuztext(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + findpuztext(context); + context.push(context.es); + context.push(context.si); + createpanel(context); + showpanel(context); + showman(context); + showexit(context); + obicons(context); + context.si = context.pop(); + context.es = context.pop(); + context.di = 36; + context.bx = 104; + context.dl = 241; + context.ah = 0; + printdirect(context); + worktoscreenm(context); + context.cx = context.pop(); + hangonp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void findpuztext(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.si = context.ax; + context._add(context.si, context.si); + context.es = context.data.word(kPuzzletext); + context.ax = context.es.word(context.si); + context._add(context.ax, (66*2)); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void placesetobject(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.cl = 0; + context.ch = 0; + findormake(context); + getsetad(context); + context.es.byte(context.bx+58) = 0; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void removesetobject(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.cl = 255; + context.ch = 0; + findormake(context); + getsetad(context); + context.es.byte(context.bx+58) = 255; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void issetobonmap(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + getsetad(context); + context.al = context.es.byte(context.bx+58); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.al, 0); + {assert(stack_depth == context.stack.size()); return; } +} + +void placefreeobject(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + context.cl = 0; + context.ch = 1; + findormake(context); + getfreead(context); + context.es.byte(context.bx+2) = 0; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void removefreeobject(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.bx); + getfreead(context); + context.es.byte(context.bx+2) = 255; + context.bx = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void findormake(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); + context.push(context.ax); + context.es = context.data.word(kBuffers); + context.ah = context.data.byte(kReallocation); +changeloop: + context._cmp(context.es.byte(context.bx), 255); + if (context.flags.z()) goto haventfound; + context._cmp(context.ax, context.es.word(context.bx)); + if (!context.flags.z()) goto nofoundchange; + context._cmp(context.ch, context.es.byte(context.bx+3)); + if (context.flags.z()) goto foundchange; +nofoundchange: + context._add(context.bx, 4); + goto changeloop; +foundchange: + context.ax = context.pop(); + context.es.byte(context.bx+2) = context.cl; + {assert(stack_depth == context.stack.size()); return; } +haventfound: + context.es.word(context.bx) = context.ax; + context.es.word(context.bx+2) = context.cx; + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void switchryanon(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kRyanon) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void switchryanoff(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kRyanon) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void setallchanges(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); +setallloop: + context.ax = context.es.word(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto endsetloop; + context.cx = context.es.word(context.bx+2); + context._add(context.bx, 4); + context._cmp(context.ah, context.data.byte(kReallocation)); + if (!context.flags.z()) goto setallloop; + context.push(context.es); + context.push(context.bx); + dochange(context); + context.bx = context.pop(); + context.es = context.pop(); + goto setallloop; +endsetloop: + {assert(stack_depth == context.stack.size()); return; } +} + +void dochange(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ch, 0); + if (context.flags.z()) goto object; + context._cmp(context.ch, 1); + if (context.flags.z()) goto freeobject; +path: + context.push(context.cx); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context.push(context.ax); + context.al = context.ch; + context._sub(context.al, 100); + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context.bx = context.pop(); + context._add(context.bx, context.ax); + context._add(context.bx, (0)); + context.es = context.data.word(kReels); + context.cx = context.pop(); + context.es.byte(context.bx+6) = context.cl; +nopath: + {assert(stack_depth == context.stack.size()); return; } +object: + context.push(context.cx); + getsetad(context); + context.cx = context.pop(); + context.es.byte(context.bx+58) = context.cl; + {assert(stack_depth == context.stack.size()); return; } +freeobject: + context.push(context.cx); + getfreead(context); + context.cx = context.pop(); + context._cmp(context.es.byte(context.bx+2), 255); + if (!context.flags.z()) goto beenpickedup; + context.es.byte(context.bx+2) = context.cl; +beenpickedup: + {assert(stack_depth == context.stack.size()); return; } +} + +void autoappear(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 32); + if (!context.flags.z()) goto notinalley; + context.al = 5; + resetlocation(context); + context.al = 10; + setlocation(context); + context.data.byte(kDestpos) = 10; + {assert(stack_depth == context.stack.size()); return; } +notinalley: + context._cmp(context.data.byte(kReallocation), 24); + if (!context.flags.z()) goto notinedens; + context._cmp(context.data.byte(kGeneraldead), 1); + if (!context.flags.z()) goto edenspart2; + context._inc(context.data.byte(kGeneraldead)); + context.al = 44; + placesetobject(context); + context.al = 18; + placesetobject(context); + context.al = 93; + placesetobject(context); + context.al = 92; + removesetobject(context); + context.al = 55; + removesetobject(context); + context.al = 75; + removesetobject(context); + context.al = 84; + removesetobject(context); + context.al = 85; + removesetobject(context); + {assert(stack_depth == context.stack.size()); return; } +edenspart2: + context._cmp(context.data.byte(kSartaindead), 1); + if (!context.flags.z()) goto notedens2; + context.al = 44; + removesetobject(context); + context.al = 93; + removesetobject(context); + context.al = 55; + placesetobject(context); + context._inc(context.data.byte(kSartaindead)); +notedens2: + {assert(stack_depth == context.stack.size()); return; } +notinedens: + context._cmp(context.data.byte(kReallocation), 25); + if (!context.flags.z()) goto notonsartroof; + context.data.byte(kNewsitem) = 3; + context.al = 6; + resetlocation(context); + context.al = 11; + setlocation(context); + context.data.byte(kDestpos) = 11; + {assert(stack_depth == context.stack.size()); return; } +notonsartroof: + context._cmp(context.data.byte(kReallocation), 2); + if (!context.flags.z()) goto notinlouiss; + context._cmp(context.data.byte(kRockstardead), 0); + if (context.flags.z()) goto notinlouiss; + context.al = 23; + placesetobject(context); +notinlouiss: + {assert(stack_depth == context.stack.size()); return; } +} + +void getundertimed(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kTimedy); + context.ah = 0; + context.bx = context.ax; + context.al = context.data.byte(kTimedx); + context.ah = 0; + context.di = context.ax; + context.ch = (24); + context.cl = 240; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void putundertimed(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kTimedy); + context.ah = 0; + context.bx = context.ax; + context.al = context.data.byte(kTimedx); + context.ah = 0; + context.di = context.ax; + context.ch = (24); + context.cl = 240; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumptimedtext(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNeedtodumptimed), 1); + if (!context.flags.z()) goto nodumptimed; + context.al = context.data.byte(kTimedy); + context.ah = 0; + context.bx = context.ax; + context.al = context.data.byte(kTimedx); + context.ah = 0; + context.di = context.ax; + context.cl = 240; + context.ch = (24); + multidump(context); + context.data.byte(kNeedtodumptimed) = 0; +nodumptimed: + {assert(stack_depth == context.stack.size()); return; } +} + +void setuptimeduse(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kTimecount), 0); + if (!context.flags.z()) goto cantsetup; + context.data.byte(kTimedy) = context.bh; + context.data.byte(kTimedx) = context.bl; + context.data.word(kCounttotimed) = context.cx; + context._add(context.dx, context.cx); + context.data.word(kTimecount) = context.dx; + context.bl = context.al; + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kPuzzletext); + context.cx = (66*2); + context.ax = context.es.word(context.bx); + context._add(context.ax, context.cx); + context.bx = context.ax; + context.data.word(kTimedseg) = context.es; + context.data.word(kTimedoffset) = context.bx; +cantsetup: + {assert(stack_depth == context.stack.size()); return; } +} + +void setuptimedtemp(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ah, 0); + if (context.flags.z()) goto notloadspeech3; + context.dl = 'T'; + context.dh = context.ah; + context.cl = 'T'; + context.ah = 0; + loadspeech(context); + context._cmp(context.data.byte(kSpeechloaded), 1); + if (!context.flags.z()) goto notloadspeech3; + context.al = 50+12; + playchannel1(context); + {assert(stack_depth == context.stack.size()); return; } +notloadspeech3: + context._cmp(context.data.word(kTimecount), 0); + if (!context.flags.z()) goto cantsetup2; + context.data.byte(kTimedy) = context.bh; + context.data.byte(kTimedx) = context.bl; + context.data.word(kCounttotimed) = context.cx; + context._add(context.dx, context.cx); + context.data.word(kTimecount) = context.dx; + context.bl = context.al; + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kTextfile1); + context.cx = (66*2); + context.ax = context.es.word(context.bx); + context._add(context.ax, context.cx); + context.bx = context.ax; + context.data.word(kTimedseg) = context.es; + context.data.word(kTimedoffset) = context.bx; +cantsetup2: + {assert(stack_depth == context.stack.size()); return; } +} + +void usetimedtext(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kTimecount), 0); + if (context.flags.z()) goto notext; + context._dec(context.data.word(kTimecount)); + context._cmp(context.data.word(kTimecount), 0); + if (context.flags.z()) goto deltimedtext; + context.ax = context.data.word(kTimecount); + context._cmp(context.ax, context.data.word(kCounttotimed)); + if (context.flags.z()) goto firsttimed; + if (!context.flags.c()) goto notext; + goto notfirsttimed; +firsttimed: + getundertimed(context); +notfirsttimed: + context.bl = context.data.byte(kTimedy); + context.bh = 0; + context.al = context.data.byte(kTimedx); + context.ah = 0; + context.di = context.ax; + context.es = context.data.word(kTimedseg); + context.si = context.data.word(kTimedoffset); + context.dl = 237; + context.ah = 0; + printdirect(context); + context.data.byte(kNeedtodumptimed) = 1; +notext: + {assert(stack_depth == context.stack.size()); return; } +deltimedtext: + putundertimed(context); + context.data.byte(kNeedtodumptimed) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void edenscdplayer(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context.data.word(kWatchingtime) = 18*2; + context.data.word(kReeltowatch) = 25; + context.data.word(kEndwatchreel) = 42; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void usewall(Context & context) { + uint stack_depth = context.stack.size(); + showfirstuse(context); + context._cmp(context.data.byte(kManspath), 3); + if (context.flags.z()) goto gobackover; + context.data.word(kWatchingtime) = 30*2; + context.data.word(kReeltowatch) = 2; + context.data.word(kEndwatchreel) = 31; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context.al = 3; + turnpathon(context); + context.al = 4; + turnpathon(context); + context.al = 0; + turnpathoff(context); + context.al = 1; + turnpathoff(context); + context.al = 2; + turnpathoff(context); + context.al = 5; + turnpathoff(context); + context.data.byte(kManspath) = 3; + context.data.byte(kFinaldest) = 3; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +gobackover: + context.data.word(kWatchingtime) = 30*2; + context.data.word(kReeltowatch) = 34; + context.data.word(kEndwatchreel) = 60; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context.al = 3; + turnpathoff(context); + context.al = 4; + turnpathoff(context); + context.al = 0; + turnpathon(context); + context.al = 1; + turnpathon(context); + context.al = 2; + turnpathon(context); + context.al = 5; + turnpathon(context); + context.data.byte(kManspath) = 5; + context.data.byte(kFinaldest) = 5; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usechurchgate(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto gatewith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +gatewith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'C'; + context.ch = 'U'; + context.dl = 'T'; + context.dh = 'T'; + compare(context); + if (context.flags.z()) goto cutgate; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +cutgate: + showfirstuse(context); + context.data.word(kWatchingtime) = 64*2; + context.data.word(kReeltowatch) = 4; + context.data.word(kEndwatchreel) = 70; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + context.al = 3; + turnpathon(context); + context._cmp(context.data.byte(kAidedead), 0); + if (context.flags.z()) goto notopenchurch; + context.al = 2; + turnpathon(context); +notopenchurch: + {assert(stack_depth == context.stack.size()); return; } +} + +void usegun(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kObjecttype), 4); + if (context.flags.z()) goto istakengun; + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +istakengun: + context._cmp(context.data.byte(kReallocation), 22); + if (!context.flags.z()) goto notinpoolroom; + context.cx = 300; + context.al = 34; + showpuztext(context); + context.data.byte(kLastweapon) = 1; + context.data.byte(kCombatcount) = 39; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +notinpoolroom: + context._cmp(context.data.byte(kReallocation), 25); + if (!context.flags.z()) goto nothelicopter; + context.cx = 300; + context.al = 34; + showpuztext(context); + context.data.byte(kLastweapon) = 1; + context.data.byte(kCombatcount) = 19; + context.data.byte(kGetback) = 1; + context.data.byte(kDreamnumber) = 2; + context.data.byte(kRoomafterdream) = 38; + context.data.byte(kSartaindead) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +nothelicopter: + context._cmp(context.data.byte(kReallocation), 27); + if (!context.flags.z()) goto notinrockroom; + context.cx = 300; + context.al = 46; + showpuztext(context); + context.data.byte(kPointermode) = 2; + context.data.byte(kRockstardead) = 1; + context.data.byte(kLastweapon) = 1; + context.data.byte(kNewsitem) = 1; + context.data.byte(kGetback) = 1; + context.data.byte(kRoomafterdream) = 32; + context.data.byte(kDreamnumber) = 0; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +notinrockroom: + context._cmp(context.data.byte(kReallocation), 8); + if (!context.flags.z()) goto notbystudio; + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) goto notbystudio; + context._cmp(context.data.byte(kMapy), 40); + if (!context.flags.z()) goto notbystudio; + context.al = 92; + issetobonmap(context); + if (context.flags.z()) goto notbystudio; + context._cmp(context.data.byte(kManspath), 9); + if (context.flags.z()) goto notbystudio; + context.data.byte(kDestination) = 9; + context.data.byte(kFinaldest) = 9; + autosetwalk(context); + context.data.byte(kLastweapon) = 1; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +notbystudio: + context._cmp(context.data.byte(kReallocation), 6); + if (!context.flags.z()) goto notsarters; + context._cmp(context.data.byte(kMapx), 11); + if (!context.flags.z()) goto notsarters; + context._cmp(context.data.byte(kMapy), 20); + if (!context.flags.z()) goto notsarters; + context.al = 5; + issetobonmap(context); + if (!context.flags.z()) goto notsarters; + context.data.byte(kDestination) = 1; + context.data.byte(kFinaldest) = 1; + autosetwalk(context); + context.al = 5; + removesetobject(context); + context.al = 6; + placesetobject(context); + context.al = 1; + context.ah = context.data.byte(kRoomnum); + context._dec(context.ah); + turnanypathon(context); + context.data.byte(kLiftflag) = 1; + context.data.word(kWatchingtime) = 40*2; + context.data.word(kReeltowatch) = 4; + context.data.word(kEndwatchreel) = 43; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +notsarters: + context._cmp(context.data.byte(kReallocation), 29); + if (!context.flags.z()) goto notaide; + context.data.byte(kGetback) = 1; + context.al = 13; + resetlocation(context); + context.al = 12; + setlocation(context); + context.data.byte(kDestpos) = 12; + context.data.byte(kDestination) = 2; + context.data.byte(kFinaldest) = 2; + autosetwalk(context); + context.data.word(kWatchingtime) = 164*2; + context.data.word(kReeltowatch) = 3; + context.data.word(kEndwatchreel) = 164; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kAidedead) = 1; + context.data.byte(kDreamnumber) = 3; + context.data.byte(kRoomafterdream) = 33; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +notaide: + context._cmp(context.data.byte(kReallocation), 23); + if (!context.flags.z()) goto notwithboss; + context._cmp(context.data.byte(kMapx), 0); + if (!context.flags.z()) goto notwithboss; + context._cmp(context.data.byte(kMapy), 50); + if (!context.flags.z()) goto notwithboss; + context._cmp(context.data.byte(kManspath), 5); + if (context.flags.z()) goto pathokboss; + context.data.byte(kDestination) = 5; + context.data.byte(kFinaldest) = 5; + autosetwalk(context); +pathokboss: + context.data.byte(kLastweapon) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +notwithboss: + context._cmp(context.data.byte(kReallocation), 8); + if (!context.flags.z()) goto nottvsoldier; + context._cmp(context.data.byte(kMapx), 11); + if (!context.flags.z()) goto nottvsoldier; + context._cmp(context.data.byte(kMapy), 10); + if (!context.flags.z()) goto nottvsoldier; + context._cmp(context.data.byte(kManspath), 2); + if (context.flags.z()) goto pathoktv; + context.data.byte(kDestination) = 2; + context.data.byte(kFinaldest) = 2; + autosetwalk(context); +pathoktv: + context.data.byte(kLastweapon) = 1; + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +nottvsoldier: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useshield(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 20); + if (!context.flags.z()) goto notinsartroom; + context._cmp(context.data.byte(kCombatcount), 0); + if (context.flags.z()) goto notinsartroom; + context.data.byte(kLastweapon) = 3; + showseconduse(context); + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + removeobfrominv(context); + {assert(stack_depth == context.stack.size()); return; } +notinsartroom: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usebuttona(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 95; + issetobonmap(context); + if (context.flags.z()) goto donethisbit; + showfirstuse(context); + context.al = 0; + context.ah = context.data.byte(kRoomnum); + context._dec(context.ah); + turnanypathon(context); + context.al = 9; + removesetobject(context); + context.al = 95; + placesetobject(context); + context.data.word(kWatchingtime) = 15*2; + context.data.word(kReeltowatch) = 71; + context.data.word(kEndwatchreel) = 85; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +donethisbit: + showseconduse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void useplate(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWithobject), 255); + if (!context.flags.z()) goto platewith; + withwhat(context); + {assert(stack_depth == context.stack.size()); return; } +platewith: + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'S'; + context.ch = 'C'; + context.dl = 'R'; + context.dh = 'W'; + compare(context); + if (context.flags.z()) goto unscrewplate; + context.al = context.data.byte(kWithobject); + context.ah = context.data.byte(kWithtype); + context.cl = 'K'; + context.ch = 'N'; + context.dl = 'F'; + context.dh = 'E'; + compare(context); + if (context.flags.z()) goto triedknife; + context.cx = 300; + context.al = 14; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +unscrewplate: + context.al = 20; + playchannel1(context); + showfirstuse(context); + context.al = 28; + placesetobject(context); + context.al = 24; + placesetobject(context); + context.al = 25; + removesetobject(context); + context.al = 0; + placefreeobject(context); + context._inc(context.data.byte(kProgresspoints)); + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +triedknife: + context.cx = 300; + context.al = 54; + showpuztext(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usewinch(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 40; + context.ah = 1; + checkinside(context); + context._cmp(context.cl, (114)); + if (context.flags.z()) goto nowinch; + context.al = context.cl; + context.ah = 4; + context.cl = 'F'; + context.ch = 'U'; + context.dl = 'S'; + context.dh = 'E'; + compare(context); + if (!context.flags.z()) goto nowinch; + context.data.word(kWatchingtime) = 217*2; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 217; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + context.data.byte(kDestpos) = 1; + context.data.byte(kNewlocation) = 45; + context.data.byte(kDreamnumber) = 1; + context.data.byte(kRoomafterdream) = 44; + context.data.byte(kGeneraldead) = 1; + context.data.byte(kNewsitem) = 2; + context.data.byte(kGetback) = 1; + context._inc(context.data.byte(kProgresspoints)); + {assert(stack_depth == context.stack.size()); return; } +nowinch: + showfirstuse(context); + putbackobstuff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void entercode(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kKeypadax) = context.ax; + context.data.word(kKeypadcx) = context.cx; + getridofreels(context); + loadkeypad(context); + createpanel(context); + showicon(context); + showouterpad(context); + showkeypad(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.data.word(kPresspointer) = 0; + context.data.byte(kGetback) = 0; +keypadloop: + delpointer(context); + readmouse(context); + showkeypad(context); + showpointer(context); + context._cmp(context.data.byte(kPresscount), 0); + if (context.flags.z()) goto nopresses; + context._dec(context.data.byte(kPresscount)); + goto afterpress; +nopresses: + context.data.byte(kPressed) = 255; + context.data.byte(kGraphicpress) = 255; + vsync(context); +afterpress: + dumppointer(context); + dumpkeypad(context); + dumptextline(context); + context.bx = 3482; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 1); + if (context.flags.z()) goto numberright; + context._cmp(context.data.byte(kLightcount), 1); + if (!context.flags.z()) goto notendkey; + context._cmp(context.data.byte(kLockstatus), 0); + if (context.flags.z()) goto numberright; + goto keypadloop; +notendkey: + context._cmp(context.data.byte(kPresscount), 40); + if (!context.flags.z()) goto keypadloop; + addtopresslist(context); + context._cmp(context.data.byte(kPressed), 11); + if (!context.flags.z()) goto keypadloop; + context.ax = context.data.word(kKeypadax); + context.cx = context.data.word(kKeypadcx); + isitright(context); + if (!context.flags.z()) goto incorrect; + context.data.byte(kLockstatus) = 0; + context.al = 11; + playchannel1(context); + context.data.byte(kLightcount) = 120; + context.data.word(kPresspointer) = 0; + goto keypadloop; +incorrect: + context.al = 11; + playchannel1(context); + context.data.byte(kLightcount) = 120; + context.data.word(kPresspointer) = 0; + goto keypadloop; +numberright: + context.data.byte(kManisoffscreen) = 0; + getridoftemp(context); + restorereels(context); + redrawmainscrn(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadkeypad(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 1948; + loadintotemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void quitkey(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadyqk; + context.data.byte(kCommandtype) = 222; + context.al = 4; + commandonly(context); +alreadyqk: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notqk; + context._and(context.ax, 1); + if (!context.flags.z()) goto doqk; +notqk: + {assert(stack_depth == context.stack.size()); return; } +doqk: + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void addtopresslist(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kPresspointer), 5); + if (context.flags.z()) goto nomorekeys; + context.al = context.data.byte(kPressed); + context._cmp(context.al, 10); + if (!context.flags.z()) goto not10; + context.al = 0; +not10: + context.bx = context.data.word(kPresspointer); + context.dx = context.data; + context.es = context.dx; + context._add(context.bx, 8573); + context.es.byte(context.bx) = context.al; + context._inc(context.data.word(kPresspointer)); +nomorekeys: + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonone(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 1; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttontwo(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 2; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonthree(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 3; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonfour(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 4; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonfive(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 5; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonsix(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 6; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonseven(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 7; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttoneight(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 8; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonnine(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 9; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonnought(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 10; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonenter(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = 11; + buttonpress(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void buttonpress(Context & context) { + uint stack_depth = context.stack.size(); + context.ch = context.cl; + context._add(context.ch, 100); + context._cmp(context.data.byte(kCommandtype), context.ch); + if (context.flags.z()) goto alreadyb; + context.data.byte(kCommandtype) = context.ch; + context.al = context.cl; + context._add(context.al, 4); + context.push(context.cx); + commandonly(context); + context.cx = context.pop(); +alreadyb: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notb; + context._and(context.ax, 1); + if (!context.flags.z()) goto dob; +notb: + {assert(stack_depth == context.stack.size()); return; } +dob: + context.data.byte(kPressed) = context.cl; + context._add(context.cl, 21); + context.data.byte(kGraphicpress) = context.cl; + context.data.byte(kPresscount) = 40; + context._cmp(context.cl, 32); + if (context.flags.z()) goto nonoise; + context.al = 10; + playchannel1(context); +nonoise: + {assert(stack_depth == context.stack.size()); return; } +} + +void showouterpad(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (36+112)-3; + context.bx = (72)-4; + context.ds = context.data.word(kTempgraphics); + context.al = 1; + context.ah = 0; + showframe(context); + context.di = (36+112)+74; + context.bx = (72)+76; + context.ds = context.data.word(kTempgraphics); + context.al = 37; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showkeypad(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 22; + context.di = (36+112)+9; + context.bx = (72)+5; + singlekey(context); + context.al = 23; + context.di = (36+112)+31; + context.bx = (72)+5; + singlekey(context); + context.al = 24; + context.di = (36+112)+53; + context.bx = (72)+5; + singlekey(context); + context.al = 25; + context.di = (36+112)+9; + context.bx = (72)+23; + singlekey(context); + context.al = 26; + context.di = (36+112)+31; + context.bx = (72)+23; + singlekey(context); + context.al = 27; + context.di = (36+112)+53; + context.bx = (72)+23; + singlekey(context); + context.al = 28; + context.di = (36+112)+9; + context.bx = (72)+41; + singlekey(context); + context.al = 29; + context.di = (36+112)+31; + context.bx = (72)+41; + singlekey(context); + context.al = 30; + context.di = (36+112)+53; + context.bx = (72)+41; + singlekey(context); + context.al = 31; + context.di = (36+112)+9; + context.bx = (72)+59; + singlekey(context); + context.al = 32; + context.di = (36+112)+31; + context.bx = (72)+59; + singlekey(context); + context._cmp(context.data.byte(kLightcount), 0); + if (context.flags.z()) goto notenter; + context._dec(context.data.byte(kLightcount)); + context.al = 36; + context.bx = (72)-1+63; + context._cmp(context.data.byte(kLockstatus), 0); + if (!context.flags.z()) goto changelight; + context.al = 41; + context.bx = (72)+4+63; +changelight: + context._cmp(context.data.byte(kLightcount), 60); + if (context.flags.c()) goto gotlight; + context._cmp(context.data.byte(kLightcount), 100); + if (!context.flags.c()) goto gotlight; + context._dec(context.al); +gotlight: + context.ds = context.data.word(kTempgraphics); + context.ah = 0; + context.di = (36+112)+60; + showframe(context); +notenter: + {assert(stack_depth == context.stack.size()); return; } +} + +void singlekey(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kGraphicpress), context.al); + if (!context.flags.z()) goto gotkey; + context._add(context.al, 11); + context._cmp(context.data.byte(kPresscount), 8); + if (!context.flags.c()) goto gotkey; + context._sub(context.al, 11); +gotkey: + context.ds = context.data.word(kTempgraphics); + context._sub(context.al, 20); + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpkeypad(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (36+112)-3; + context.bx = (72)-4; + context.cl = 120; + context.ch = 90; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usemenu(Context & context) { + uint stack_depth = context.stack.size(); + getridofreels(context); + loadmenu(context); + createpanel(context); + showpanel(context); + showicon(context); + context.data.byte(kNewobs) = 0; + drawfloor(context); + printsprites(context); + context.al = 4; + context.ah = 0; + context.di = (80+40)-48; + context.bx = (60)-4; + context.ds = context.data.word(kTempgraphics2); + showframe(context); + getundermenu(context); + context.al = 5; + context.ah = 0; + context.di = (80+40)+54; + context.bx = (60)+72; + context.ds = context.data.word(kTempgraphics2); + showframe(context); + worktoscreenm(context); + context.data.byte(kGetback) = 0; +menuloop: + delpointer(context); + putundermenu(context); + showmenu(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumpmenu(context); + dumptextline(context); + context.bx = 3614; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 1); + if (!context.flags.z()) goto menuloop; + context.data.byte(kManisoffscreen) = 0; + redrawmainscrn(context); + getridoftemp(context); + getridoftemp2(context); + restorereels(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +menulist: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpmenu(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (80+40); + context.bx = (60); + context.cl = 48; + context.ch = 48; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getundermenu(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (80+40); + context.bx = (60); + context.cl = 48; + context.ch = 48; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void putundermenu(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (80+40); + context.bx = (60); + context.cl = 48; + context.ch = 48; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showoutermenu(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 40; + context.ah = 0; + context.di = (80+40)-34; + context.bx = (60)-40; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = 41; + context.ah = 0; + context.di = (80+40)+64-34; + context.bx = (60)-40; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = 42; + context.ah = 0; + context.di = (80+40)-26; + context.bx = (60)+57-40; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = 43; + context.ah = 0; + context.di = (80+40)+64-26; + context.bx = (60)+57-40; + context.ds = context.data.word(kTempgraphics); + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showmenu(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.data.byte(kMenucount)); + context._cmp(context.data.byte(kMenucount), 37*2); + if (!context.flags.z()) goto menuframeok; + context.data.byte(kMenucount) = 0; +menuframeok: + context.al = context.data.byte(kMenucount); + context._shr(context.al, 1); + context.ah = 0; + context.di = (80+40); + context.bx = (60); + context.ds = context.data.word(kTempgraphics); + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadmenu(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 1832; + loadintotemp(context); + context.dx = 1987; + loadintotemp2(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void viewfolder(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kManisoffscreen) = 1; + getridofall(context); + loadfolder(context); + context.data.byte(kFolderpage) = 0; + showfolder(context); + worktoscreenm(context); + context.data.byte(kGetback) = 0; +folderloop: + delpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 3636; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto folderloop; + context.data.byte(kManisoffscreen) = 0; + getridoftemp(context); + getridoftemp2(context); + getridoftemp3(context); + getridoftempcharset(context); + restoreall(context); + redrawmainscrn(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void nextfolder(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kFolderpage), 12); + if (!context.flags.z()) goto cannextf; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +cannextf: + context._cmp(context.data.byte(kCommandtype), 201); + if (context.flags.z()) goto alreadynextf; + context.data.byte(kCommandtype) = 201; + context.al = 16; + commandonly(context); +alreadynextf: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notnextf; + context._cmp(context.ax, 1); + if (context.flags.z()) goto donextf; +notnextf: + {assert(stack_depth == context.stack.size()); return; } +donextf: + context._inc(context.data.byte(kFolderpage)); + folderhints(context); + delpointer(context); + showfolder(context); + context.data.word(kMousebutton) = 0; + context.bx = 3636; + checkcoords(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void folderhints(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kFolderpage), 5); + if (!context.flags.z()) goto notaideadd; + context._cmp(context.data.byte(kAidedead), 1); + if (context.flags.z()) goto notaideadd; + context.al = 13; + getlocation(context); + context._cmp(context.al, 1); + if (context.flags.z()) goto notaideadd; + context.al = 13; + setlocation(context); + showfolder(context); + context.al = 30; + findtext1(context); + context.di = 0; + context.bx = 86; + context.dl = 141; + context.ah = 16; + printdirect(context); + worktoscreenm(context); + context.cx = 200; + hangonp(context); + {assert(stack_depth == context.stack.size()); return; } +notaideadd: + context._cmp(context.data.byte(kFolderpage), 9); + if (!context.flags.z()) goto notaristoadd; + context.al = 7; + getlocation(context); + context._cmp(context.al, 1); + if (context.flags.z()) goto notaristoadd; + context.al = 7; + setlocation(context); + showfolder(context); + context.al = 31; + findtext1(context); + context.di = 0; + context.bx = 86; + context.dl = 141; + context.ah = 16; + printdirect(context); + worktoscreenm(context); + context.cx = 200; + hangonp(context); +notaristoadd: + {assert(stack_depth == context.stack.size()); return; } +} + +void lastfolder(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kFolderpage), 0); + if (!context.flags.z()) goto canlastf; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +canlastf: + context._cmp(context.data.byte(kCommandtype), 202); + if (context.flags.z()) goto alreadylastf; + context.data.byte(kCommandtype) = 202; + context.al = 17; + commandonly(context); +alreadylastf: + context._cmp(context.data.byte(kFolderpage), 0); + if (context.flags.z()) goto notlastf; + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notlastf; + context._cmp(context.ax, 1); + if (context.flags.z()) goto dolastf; +notlastf: + {assert(stack_depth == context.stack.size()); return; } +dolastf: + context._dec(context.data.byte(kFolderpage)); + delpointer(context); + showfolder(context); + context.data.word(kMousebutton) = 0; + context.bx = 3636; + checkcoords(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadfolder(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2299; + loadintotemp(context); + context.dx = 2312; + loadintotemp2(context); + context.dx = 2325; + loadintotemp3(context); + context.dx = 1883; + loadtempcharset(context); + context.dx = 2195; + loadtemptext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showfolder(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCommandtype) = 255; + context._cmp(context.data.byte(kFolderpage), 0); + if (context.flags.z()) goto closedfolder; + usetempcharset(context); + createpanel2(context); + context.ds = context.data.word(kTempgraphics); + context.di = 0; + context.bx = 0; + context.al = 0; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = 143; + context.bx = 0; + context.al = 1; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = 0; + context.bx = 92; + context.al = 2; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = 143; + context.bx = 92; + context.al = 3; + context.ah = 0; + showframe(context); + folderexit(context); + context._cmp(context.data.byte(kFolderpage), 1); + if (context.flags.z()) goto noleftpage; + showleftpage(context); +noleftpage: + context._cmp(context.data.byte(kFolderpage), 12); + if (context.flags.z()) goto norightpage; + showrightpage(context); +norightpage: + usecharset1(context); + undertextline(context); + {assert(stack_depth == context.stack.size()); return; } +closedfolder: + createpanel2(context); + context.ds = context.data.word(kTempgraphics3); + context.di = 143-28; + context.bx = 0; + context.al = 0; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics3); + context.di = 143-28; + context.bx = 92; + context.al = 1; + context.ah = 0; + showframe(context); + folderexit(context); + undertextline(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void folderexit(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics2); + context.di = 296; + context.bx = 178; + context.al = 6; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showleftpage(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics2); + context.di = 0; + context.bx = 12; + context.al = 3; + context.ah = 0; + showframe(context); + context.bx = 12+5; + context.cx = 9; +leftpageloop: + context.push(context.cx); + context.push(context.bx); + context.ds = context.data.word(kTempgraphics2); + context.di = 0; + context.al = 4; + context.ah = 0; + showframe(context); + context.bx = context.pop(); + context.cx = context.pop(); + context._add(context.bx, 16); + if (--context.cx) goto leftpageloop; + context.ds = context.data.word(kTempgraphics2); + context.di = 0; + context.al = 5; + context.ah = 0; + showframe(context); + context.data.word(kLinespacing) = 8; + context.data.word(kCharshift) = 91; + context.data.byte(kKerning) = 1; + context.bl = context.data.byte(kFolderpage); + context._dec(context.bl); + context._dec(context.bl); + context._add(context.bl, context.bl); + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kTextfile1); + context.si = context.es.word(context.bx); + context._add(context.si, 66*2); + context.di = 2; + context.bx = 48; + context.dl = 140; + context.cx = 2; +twolotsleft: + context.push(context.cx); +contleftpage: + printdirect(context); + context._add(context.bx, context.data.word(kLinespacing)); + context._cmp(context.al, 0); + if (!context.flags.z()) goto contleftpage; + context.cx = context.pop(); + if (--context.cx) goto twolotsleft; + context.data.byte(kKerning) = 0; + context.data.word(kCharshift) = 0; + context.data.word(kLinespacing) = 10; + context.es = context.data.word(kWorkspace); + context.ds = context.data.word(kWorkspace); + context.di = (48*320)+2; + context.si = (48*320)+2+130; + context.cx = 120; +flipfolder: + context.push(context.cx); + context.push(context.di); + context.push(context.si); + context.cx = 65; +flipfolderline: + context.al = context.es.byte(context.di); + context.ah = context.es.byte(context.si); + context.es.byte(context.di) = context.ah; + context.es.byte(context.si) = context.al; + context._dec(context.si); + context._inc(context.di); + if (--context.cx) goto flipfolderline; + context.si = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.si, 320); + context._add(context.di, 320); + if (--context.cx) goto flipfolder; + {assert(stack_depth == context.stack.size()); return; } +} + +void showrightpage(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics2); + context.di = 143; + context.bx = 12; + context.al = 0; + context.ah = 0; + showframe(context); + context.bx = 12+37; + context.cx = 7; +rightpageloop: + context.push(context.cx); + context.push(context.bx); + context.ds = context.data.word(kTempgraphics2); + context.di = 143; + context.al = 1; + context.ah = 0; + showframe(context); + context.bx = context.pop(); + context.cx = context.pop(); + context._add(context.bx, 16); + if (--context.cx) goto rightpageloop; + context.ds = context.data.word(kTempgraphics2); + context.di = 143; + context.al = 2; + context.ah = 0; + showframe(context); + context.data.word(kLinespacing) = 8; + context.data.byte(kKerning) = 1; + context.bl = context.data.byte(kFolderpage); + context._dec(context.bl); + context._add(context.bl, context.bl); + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kTextfile1); + context.si = context.es.word(context.bx); + context._add(context.si, 66*2); + context.di = 152; + context.bx = 48; + context.dl = 140; + context.cx = 2; +twolotsright: + context.push(context.cx); +contrightpage: + printdirect(context); + context._add(context.bx, context.data.word(kLinespacing)); + context._cmp(context.al, 0); + if (!context.flags.z()) goto contrightpage; + context.cx = context.pop(); + if (--context.cx) goto twolotsright; + context.data.byte(kKerning) = 0; + context.data.word(kLinespacing) = 10; + {assert(stack_depth == context.stack.size()); return; } +} + +void entersymbol(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kManisoffscreen) = 1; + getridofreels(context); + context.dx = 2338; + loadintotemp(context); + context.data.byte(kSymboltopx) = 24; + context.data.byte(kSymboltopdir) = 0; + context.data.byte(kSymbolbotx) = 24; + context.data.byte(kSymbolbotdir) = 0; + redrawmainscrn(context); + showsymbol(context); + undertextline(context); + worktoscreenm(context); + context.data.byte(kGetback) = 0; +symbolloop: + delpointer(context); + updatesymboltop(context); + updatesymbolbot(context); + showsymbol(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + dumpsymbol(context); + context.bx = 3678; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto symbolloop; + context._cmp(context.data.byte(kSymbolbotnum), 3); + if (!context.flags.z()) goto symbolwrong; + context._cmp(context.data.byte(kSymboltopnum), 5); + if (!context.flags.z()) goto symbolwrong; + context.al = 43; + removesetobject(context); + context.al = 46; + placesetobject(context); + context.ah = context.data.byte(kRoomnum); + context._add(context.ah, 12); + context.al = 0; + turnanypathon(context); + context.data.byte(kManisoffscreen) = 0; + redrawmainscrn(context); + getridoftemp(context); + restorereels(context); + worktoscreenm(context); + context.al = 13; + playchannel1(context); + {assert(stack_depth == context.stack.size()); return; } +symbolwrong: + context.al = 46; + removesetobject(context); + context.al = 43; + placesetobject(context); + context.ah = context.data.byte(kRoomnum); + context._add(context.ah, 12); + context.al = 0; + turnanypathoff(context); + context.data.byte(kManisoffscreen) = 0; + redrawmainscrn(context); + getridoftemp(context); + restorereels(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void quitsymbol(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymboltopx), 24); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kSymbolbotx), 24); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadyqs; + context.data.byte(kCommandtype) = 222; + context.al = 18; + commandonly(context); +alreadyqs: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notqs; + context._and(context.ax, 1); + if (!context.flags.z()) goto doqs; +notqs: + {assert(stack_depth == context.stack.size()); return; } +doqs: + context.data.byte(kGetback) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void settopleft(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymboltopdir), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 210); + if (context.flags.z()) goto alreadytopl; + context.data.byte(kCommandtype) = 210; + context.al = 19; + commandonly(context); +alreadytopl: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto notopleft; + context.data.byte(kSymboltopdir) = -1; +notopleft: + {assert(stack_depth == context.stack.size()); return; } +} + +void settopright(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymboltopdir), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 211); + if (context.flags.z()) goto alreadytopr; + context.data.byte(kCommandtype) = 211; + context.al = 20; + commandonly(context); +alreadytopr: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto notopright; + context.data.byte(kSymboltopdir) = 1; +notopright: + {assert(stack_depth == context.stack.size()); return; } +} + +void setbotleft(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymbolbotdir), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 212); + if (context.flags.z()) goto alreadybotl; + context.data.byte(kCommandtype) = 212; + context.al = 21; + commandonly(context); +alreadybotl: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto nobotleft; + context.data.byte(kSymbolbotdir) = -1; +nobotleft: + {assert(stack_depth == context.stack.size()); return; } +} + +void setbotright(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymbolbotdir), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 213); + if (context.flags.z()) goto alreadybotr; + context.data.byte(kCommandtype) = 213; + context.al = 22; + commandonly(context); +alreadybotr: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto nobotright; + context.data.byte(kSymbolbotdir) = 1; +nobotright: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpsymbol(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kNewtextline) = 0; + context.di = (64); + context.bx = (56)+20; + context.cl = 104; + context.ch = 60; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showsymbol(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 12; + context.ah = 0; + context.di = (64); + context.bx = (56); + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = context.data.byte(kSymboltopx); + context.ah = 0; + context.di = context.ax; + context._add(context.di, (64)-44); + context.al = context.data.byte(kSymboltopnum); + context.bx = (56)+20; + context.ds = context.data.word(kTempgraphics); + context.ah = 32; + context.push(context.ax); + context.push(context.di); + context.push(context.bx); + context.push(context.ds); + showframe(context); + context.ds = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.ax = context.pop(); + nextsymbol(context); + context._add(context.di, 49); + context.push(context.ax); + context.push(context.di); + context.push(context.bx); + context.push(context.ds); + showframe(context); + context.ds = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.ax = context.pop(); + nextsymbol(context); + context._add(context.di, 49); + showframe(context); + context.al = context.data.byte(kSymbolbotx); + context.ah = 0; + context.di = context.ax; + context._add(context.di, (64)-44); + context.al = context.data.byte(kSymbolbotnum); + context._add(context.al, 6); + context.bx = (56)+49; + context.ds = context.data.word(kTempgraphics); + context.ah = 32; + context.push(context.ax); + context.push(context.di); + context.push(context.bx); + context.push(context.ds); + showframe(context); + context.ds = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.ax = context.pop(); + nextsymbol(context); + context._add(context.di, 49); + context.push(context.ax); + context.push(context.di); + context.push(context.bx); + context.push(context.ds); + showframe(context); + context.ds = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.ax = context.pop(); + nextsymbol(context); + context._add(context.di, 49); + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void nextsymbol(Context & context) { + uint stack_depth = context.stack.size(); + context._inc(context.al); + context._cmp(context.al, 6); + if (context.flags.z()) goto topwrap; + context._cmp(context.al, 12); + if (context.flags.z()) goto botwrap; + {assert(stack_depth == context.stack.size()); return; } +topwrap: + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +botwrap: + context.al = 6; + {assert(stack_depth == context.stack.size()); return; } +} + +void updatesymboltop(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymboltopdir), 0); + if (context.flags.z()) goto topfinished; + context._cmp(context.data.byte(kSymboltopdir), -1); + if (context.flags.z()) goto backwards; + context._inc(context.data.byte(kSymboltopx)); + context._cmp(context.data.byte(kSymboltopx), 49); + if (!context.flags.z()) goto notwrapfor; + context.data.byte(kSymboltopx) = 0; + context._dec(context.data.byte(kSymboltopnum)); + context._cmp(context.data.byte(kSymboltopnum), -1); + if (!context.flags.z()) goto topfinished; + context.data.byte(kSymboltopnum) = 5; + {assert(stack_depth == context.stack.size()); return; } +notwrapfor: + context._cmp(context.data.byte(kSymboltopx), 24); + if (!context.flags.z()) goto topfinished; + context.data.byte(kSymboltopdir) = 0; + {assert(stack_depth == context.stack.size()); return; } +backwards: + context._dec(context.data.byte(kSymboltopx)); + context._cmp(context.data.byte(kSymboltopx), -1); + if (!context.flags.z()) goto notwrapback; + context.data.byte(kSymboltopx) = 48; + context._inc(context.data.byte(kSymboltopnum)); + context._cmp(context.data.byte(kSymboltopnum), 6); + if (!context.flags.z()) goto topfinished; + context.data.byte(kSymboltopnum) = 0; + {assert(stack_depth == context.stack.size()); return; } +notwrapback: + context._cmp(context.data.byte(kSymboltopx), 24); + if (!context.flags.z()) goto topfinished; + context.data.byte(kSymboltopdir) = 0; +topfinished: + {assert(stack_depth == context.stack.size()); return; } +} + +void updatesymbolbot(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSymbolbotdir), 0); + if (context.flags.z()) goto botfinished; + context._cmp(context.data.byte(kSymbolbotdir), -1); + if (context.flags.z()) goto backwardsbot; + context._inc(context.data.byte(kSymbolbotx)); + context._cmp(context.data.byte(kSymbolbotx), 49); + if (!context.flags.z()) goto notwrapforb; + context.data.byte(kSymbolbotx) = 0; + context._dec(context.data.byte(kSymbolbotnum)); + context._cmp(context.data.byte(kSymbolbotnum), -1); + if (!context.flags.z()) goto botfinished; + context.data.byte(kSymbolbotnum) = 5; + {assert(stack_depth == context.stack.size()); return; } +notwrapforb: + context._cmp(context.data.byte(kSymbolbotx), 24); + if (!context.flags.z()) goto botfinished; + context.data.byte(kSymbolbotdir) = 0; + {assert(stack_depth == context.stack.size()); return; } +backwardsbot: + context._dec(context.data.byte(kSymbolbotx)); + context._cmp(context.data.byte(kSymbolbotx), -1); + if (!context.flags.z()) goto notwrapbackb; + context.data.byte(kSymbolbotx) = 48; + context._inc(context.data.byte(kSymbolbotnum)); + context._cmp(context.data.byte(kSymbolbotnum), 6); + if (!context.flags.z()) goto botfinished; + context.data.byte(kSymbolbotnum) = 0; + {assert(stack_depth == context.stack.size()); return; } +notwrapbackb: + context._cmp(context.data.byte(kSymbolbotx), 24); + if (!context.flags.z()) goto botfinished; + context.data.byte(kSymbolbotdir) = 0; +botfinished: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpsymbox(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kDumpx), -1); + if (context.flags.z()) goto nodumpsym; + context.di = context.data.word(kDumpx); + context.bx = context.data.word(kDumpy); + context.cl = 30; + context.ch = 77; + multidump(context); + context.data.word(kDumpx) = -1; +nodumpsym: + {assert(stack_depth == context.stack.size()); return; } +} + +void usediary(Context & context) { + uint stack_depth = context.stack.size(); + getridofreels(context); + context.dx = 2039; + loadintotemp(context); + context.dx = 2208; + loadtemptext(context); + context.dx = 1883; + loadtempcharset(context); + createpanel(context); + showicon(context); + showdiary(context); + undertextline(context); + showdiarypage(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + context.data.byte(kGetback) = 0; +diaryloop: + delpointer(context); + readmouse(context); + showdiarykeys(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumpdiarykeys(context); + dumptextline(context); + context.bx = 3740; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto diaryloop; + getridoftemp(context); + getridoftemptext(context); + getridoftempcharset(context); + restorereels(context); + context.data.byte(kManisoffscreen) = 0; + redrawmainscrn(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +diarylist: + {assert(stack_depth == context.stack.size()); return; } +} + +void showdiary(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 1; + context.ah = 0; + context.di = (68+24); + context.bx = (48+12)+37; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = 2; + context.ah = 0; + context.di = (68+24)+176; + context.bx = (48+12)+108; + context.ds = context.data.word(kTempgraphics); + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showdiarykeys(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPresscount), 0); + if (context.flags.z()) goto nokeyatall; + context._dec(context.data.byte(kPresscount)); + context._cmp(context.data.byte(kPresscount), 0); + if (context.flags.z()) goto nokeyatall; + context._cmp(context.data.byte(kPressed), 'N'); + if (!context.flags.z()) goto nokeyn; + context.al = 3; + context._cmp(context.data.byte(kPresscount), 1); + if (context.flags.z()) goto gotkeyn; + context.al = 4; +gotkeyn: + context.ah = 0; + context.di = (68+24)+94; + context.bx = (48+12)+97; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context._cmp(context.data.byte(kPresscount), 1); + if (!context.flags.z()) goto notshown; + showdiarypage(context); +notshown: + {assert(stack_depth == context.stack.size()); return; } +nokeyn: + context.al = 5; + context._cmp(context.data.byte(kPresscount), 1); + if (context.flags.z()) goto gotkeyp; + context.al = 6; +gotkeyp: + context.ah = 0; + context.di = (68+24)+151; + context.bx = (48+12)+71; + context.ds = context.data.word(kTempgraphics); + showframe(context); + context._cmp(context.data.byte(kPresscount), 1); + if (!context.flags.z()) goto notshowp; + showdiarypage(context); +notshowp: + {assert(stack_depth == context.stack.size()); return; } +nokeyatall: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpdiarykeys(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPresscount), 1); + if (!context.flags.z()) goto notdumpdiary; + context._cmp(context.data.byte(kSartaindead), 1); + if (context.flags.z()) goto notsartadd; + context._cmp(context.data.byte(kDiarypage), 5); + if (!context.flags.z()) goto notsartadd; + context._cmp(context.data.byte(kDiarypage), 5); + if (!context.flags.z()) goto notsartadd; + context.al = 6; + getlocation(context); + context._cmp(context.al, 1); + if (context.flags.z()) goto notsartadd; + context.al = 6; + setlocation(context); + delpointer(context); + context.al = 12; + findtext1(context); + context.di = 70; + context.bx = 106; + context.dl = 241; + context.ah = 16; + printdirect(context); + worktoscreenm(context); + context.cx = 200; + hangonp(context); + createpanel(context); + showicon(context); + showdiary(context); + showdiarypage(context); + worktoscreenm(context); + showpointer(context); + {assert(stack_depth == context.stack.size()); return; } +notsartadd: + context.di = (68+24)+48; + context.bx = (48+12)+15; + context.cl = 200; + context.ch = 16; + multidump(context); +notdumpdiary: + context.di = (68+24)+94; + context.bx = (48+12)+97; + context.cl = 16; + context.ch = 16; + multidump(context); + context.di = (68+24)+151; + context.bx = (48+12)+71; + context.cl = 16; + context.ch = 16; + multidump(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void diarykeyp(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 214); + if (context.flags.z()) goto alreadykeyp; + context.data.byte(kCommandtype) = 214; + context.al = 23; + commandonly(context); +alreadykeyp: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto notkeyp; + context.ax = context.data.word(kOldbutton); + context._cmp(context.ax, context.data.word(kMousebutton)); + if (context.flags.z()) goto notkeyp; + context._cmp(context.data.byte(kPresscount), 0); + if (!context.flags.z()) goto notkeyp; + context.al = 16; + playchannel1(context); + context.data.byte(kPresscount) = 12; + context.data.byte(kPressed) = 'P'; + context._dec(context.data.byte(kDiarypage)); + context._cmp(context.data.byte(kDiarypage), -1); + if (!context.flags.z()) goto notkeyp; + context.data.byte(kDiarypage) = 11; +notkeyp: + {assert(stack_depth == context.stack.size()); return; } +} + +void diarykeyn(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 213); + if (context.flags.z()) goto alreadykeyn; + context.data.byte(kCommandtype) = 213; + context.al = 23; + commandonly(context); +alreadykeyn: + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto notkeyn; + context.ax = context.data.word(kOldbutton); + context._cmp(context.ax, context.data.word(kMousebutton)); + if (context.flags.z()) goto notkeyn; + context._cmp(context.data.byte(kPresscount), 0); + if (!context.flags.z()) goto notkeyn; + context.al = 16; + playchannel1(context); + context.data.byte(kPresscount) = 12; + context.data.byte(kPressed) = 'N'; + context._inc(context.data.byte(kDiarypage)); + context._cmp(context.data.byte(kDiarypage), 12); + if (!context.flags.z()) goto notkeyn; + context.data.byte(kDiarypage) = 0; +notkeyn: + {assert(stack_depth == context.stack.size()); return; } +} + +void showdiarypage(Context & context) { + uint stack_depth = context.stack.size(); + context.al = 0; + context.ah = 0; + context.di = (68+24); + context.bx = (48+12); + context.ds = context.data.word(kTempgraphics); + showframe(context); + context.al = context.data.byte(kDiarypage); + findtext1(context); + context.data.byte(kKerning) = 1; + usetempcharset(context); + context.di = (68+24)+48; + context.bx = (48+12)+16; + context.dl = 240; + context.ah = 16; + context.data.word(kCharshift) = 91+91; + printdirect(context); + context.di = (68+24)+129; + context.bx = (48+12)+16; + context.dl = 240; + context.ah = 16; + printdirect(context); + context.di = (68+24)+48; + context.bx = (48+12)+23; + context.dl = 240; + context.ah = 16; + printdirect(context); + context.data.byte(kKerning) = 0; + context.data.word(kCharshift) = 0; + usecharset1(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void findtext1(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.si = context.ax; + context._add(context.si, context.si); + context.es = context.data.word(kTextfile1); + context.ax = context.es.word(context.si); + context._add(context.ax, (66*2)); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void zoomonoff(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kPointermode), 2); + if (context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadyonoff; + context.data.byte(kCommandtype) = 222; + context.al = 39; + commandonly(context); +alreadyonoff: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nozoomonoff; + context._and(context.ax, 1); + if (!context.flags.z()) goto dozoomonoff; +nozoomonoff: + {assert(stack_depth == context.stack.size()); return; } +dozoomonoff: + context.al = context.data.byte(kZoomon); + context._xor(context.al, 1); + context.data.byte(kZoomon) = context.al; + createpanel(context); + context.data.byte(kNewobs) = 0; + drawfloor(context); + printsprites(context); + reelsonscreen(context); + showicon(context); + getunderzoom(context); + undertextline(context); + context.al = 39; + commandonly(context); + readmouse(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void saveload(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kPointermode), 2); + if (context.flags.z()) { blank(context); return; }; + context._cmp(context.data.byte(kCommandtype), 253); + if (context.flags.z()) goto alreadyops; + context.data.byte(kCommandtype) = 253; + context.al = 43; + commandonly(context); +alreadyops: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noops; + context._and(context.ax, 1); + if (context.flags.z()) goto noops; + dosaveload(context); +noops: + {assert(stack_depth == context.stack.size()); return; } +} + +void dosaveload(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kPointerframe) = 0; + context.data.word(kTextaddressx) = 70; + context.data.word(kTextaddressy) = 182-8; + context.data.byte(kTextlen) = 181; + context.data.byte(kManisoffscreen) = 1; + clearwork(context); + createpanel2(context); + undertextline(context); + getridofall(context); + loadsavebox(context); + showopbox(context); + showmainops(context); + worktoscreen(context); + goto donefirstops; +restartops: + showopbox(context); + showmainops(context); + worktoscreenm(context); +donefirstops: + context.data.byte(kGetback) = 0; +waitops: + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + delpointer(context); + context.bx = 3782; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto waitops; + context._cmp(context.data.byte(kGetback), 2); + if (context.flags.z()) goto restartops; + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + context._cmp(context.data.byte(kGetback), 4); + if (context.flags.z()) goto justret; + getridoftemp(context); + restoreall(context); + redrawmainscrn(context); + worktoscreenm(context); + context.data.byte(kCommandtype) = 200; +justret: + context.data.byte(kManisoffscreen) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void getbackfromops(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kMandead), 2); + if (context.flags.z()) goto opsblock1; + getback1(context); + {assert(stack_depth == context.stack.size()); return; } +opsblock1: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showmainops(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+10; + context.bx = (52)+10; + context.al = 8; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+59; + context.bx = (52)+30; + context.al = 7; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+128+4; + context.bx = (52)+12; + context.al = 1; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showdiscops(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+128+4; + context.bx = (52)+12; + context.al = 1; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+10; + context.bx = (52)+10; + context.al = 9; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+59; + context.bx = (52)+30; + context.al = 10; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+176+2; + context.bx = (52)+60-4; + context.al = 5; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadsavebox(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 1961; + loadintotemp(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadgame(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 246); + if (context.flags.z()) goto alreadyload; + context.data.byte(kCommandtype) = 246; + context.al = 41; + commandonly(context); +alreadyload: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noload; + context._cmp(context.ax, 1); + if (context.flags.z()) goto doload; +noload: + {assert(stack_depth == context.stack.size()); return; } +doload: + context.data.byte(kLoadingorsave) = 1; + showopbox(context); + showloadops(context); + context.data.byte(kCurrentslot) = 0; + showslots(context); + shownames(context); + context.data.byte(kPointerframe) = 0; + worktoscreenm(context); + namestoold(context); + context.data.byte(kGetback) = 0; +loadops: + delpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 3824; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto loadops; + context._cmp(context.data.byte(kGetback), 2); + if (context.flags.z()) goto quitloaded; + getridoftemp(context); + context.dx = context.data; + context.es = context.dx; + context.bx = 7979; + startloading(context); + loadroomssample(context); + context.data.byte(kRoomloaded) = 1; + context.data.byte(kNewlocation) = 255; + clearsprites(context); + initman(context); + initrain(context); + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + startup(context); + worktoscreen(context); + context.data.byte(kGetback) = 4; +quitloaded: + {assert(stack_depth == context.stack.size()); return; } +} + +void getbacktoops(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 201); + if (context.flags.z()) goto alreadygetops; + context.data.byte(kCommandtype) = 201; + context.al = 42; + commandonly(context); +alreadygetops: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nogetbackops; + context._and(context.ax, 1); + if (!context.flags.z()) goto dogetbackops; +nogetbackops: + {assert(stack_depth == context.stack.size()); return; } +dogetbackops: + oldtonames(context); + context.data.byte(kGetback) = 2; + {assert(stack_depth == context.stack.size()); return; } +} + +void discops(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 249); + if (context.flags.z()) goto alreadydiscops; + context.data.byte(kCommandtype) = 249; + context.al = 43; + commandonly(context); +alreadydiscops: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto nodiscops; + context._and(context.ax, 1); + if (!context.flags.z()) goto dodiscops; +nodiscops: + {assert(stack_depth == context.stack.size()); return; } +dodiscops: + scanfornames(context); + context.data.byte(kLoadingorsave) = 2; + showopbox(context); + showdiscops(context); + context.data.byte(kCurrentslot) = 0; + worktoscreenm(context); + context.data.byte(kGetback) = 0; +discopsloop: + delpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 3866; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto discopsloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void savegame(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kMandead), 2); + if (!context.flags.z()) goto cansaveok; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +cansaveok: + context._cmp(context.data.byte(kCommandtype), 247); + if (context.flags.z()) goto alreadysave; + context.data.byte(kCommandtype) = 247; + context.al = 44; + commandonly(context); +alreadysave: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (!context.flags.z()) goto dosave; + {assert(stack_depth == context.stack.size()); return; } +dosave: + context.data.byte(kLoadingorsave) = 2; + showopbox(context); + showsaveops(context); + context.data.byte(kCurrentslot) = 0; + showslots(context); + shownames(context); + worktoscreenm(context); + namestoold(context); + context.data.word(kBufferin) = 0; + context.data.word(kBufferout) = 0; + context.data.byte(kGetback) = 0; +saveops: + delpointer(context); + checkinput(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 3908; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto saveops; + {assert(stack_depth == context.stack.size()); return; } +} + +void actualsave(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 222); + if (context.flags.z()) goto alreadyactsave; + context.data.byte(kCommandtype) = 222; + context.al = 44; + commandonly(context); +alreadyactsave: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto noactsave; + context.dx = context.data; + context.ds = context.dx; + context.si = 8579; + context.al = context.data.byte(kCurrentslot); + context.ah = 0; + context.cx = 17; + context._mul(context.cx); + context._add(context.si, context.ax); + context._inc(context.si); + context._cmp(context.ds.byte(context.si), 0); + if (context.flags.z()) goto noactsave; + context.al = context.data.byte(kLocation); + context.ah = 0; + context.cx = 32; + context._mul(context.cx); + context.ds = context.cs; + context.si = 6187; + context._add(context.si, context.ax); + context.di = 7979; + context.bx = context.di; + context.es = context.cs; + context.cx = 16; + while(context.cx--) context._movsw(); + context.al = context.data.byte(kRoomssample); + context.es.byte(context.bx+13) = context.al; + context.al = context.data.byte(kMapx); + context.es.byte(context.bx+15) = context.al; + context.al = context.data.byte(kMapy); + context.es.byte(context.bx+16) = context.al; + context.al = context.data.byte(kLiftflag); + context.es.byte(context.bx+20) = context.al; + context.al = context.data.byte(kManspath); + context.es.byte(context.bx+21) = context.al; + context.al = context.data.byte(kFacing); + context.es.byte(context.bx+22) = context.al; + context.al = 255; + context.es.byte(context.bx+27) = context.al; + saveposition(context); + getridoftemp(context); + restoreall(context); + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + redrawmainscrn(context); + worktoscreenm(context); + context.data.byte(kGetback) = 4; +noactsave: + {assert(stack_depth == context.stack.size()); return; } +} + +void actualload(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 221); + if (context.flags.z()) goto alreadyactload; + context.data.byte(kCommandtype) = 221; + context.al = 41; + commandonly(context); +alreadyactload: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto notactload; + context._cmp(context.ax, 1); + if (!context.flags.z()) goto notactload; + context.dx = context.data; + context.ds = context.dx; + context.si = 8579; + context.al = context.data.byte(kCurrentslot); + context.ah = 0; + context.cx = 17; + context._mul(context.cx); + context._add(context.si, context.ax); + context._inc(context.si); + context._cmp(context.ds.byte(context.si), 0); + if (context.flags.z()) goto notactload; + loadposition(context); + context.data.byte(kGetback) = 1; +notactload: + {assert(stack_depth == context.stack.size()); return; } +} + +void selectslot2(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto noselslot2; + context.data.byte(kLoadingorsave) = 2; +noselslot2: + selectslot(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkinput(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLoadingorsave), 3); + if (context.flags.z()) goto nokeypress; + readkey(context); + context.al = context.data.byte(kCurrentkey); + context._cmp(context.al, 0); + if (context.flags.z()) goto nokeypress; + context._cmp(context.al, 13); + if (!context.flags.z()) goto notret; + context.data.byte(kLoadingorsave) = 3; + goto afterkey; +notret: + context._cmp(context.al, 8); + if (!context.flags.z()) goto nodel2; + context._cmp(context.data.byte(kCursorpos), 0); + if (context.flags.z()) goto nokeypress; + getnamepos(context); + context._dec(context.data.byte(kCursorpos)); + context.es.byte(context.bx) = 0; + context.es.byte(context.bx+1) = 1; + goto afterkey; +nodel2: +spacepress: + context._cmp(context.data.byte(kCursorpos), 14); + if (context.flags.z()) goto nokeypress; + getnamepos(context); + context._inc(context.data.byte(kCursorpos)); + context.al = context.data.byte(kCurrentkey); + context.es.byte(context.bx+1) = context.al; + context.es.byte(context.bx+2) = 0; + context.es.byte(context.bx+3) = 1; + goto afterkey; +nokeypress: + {assert(stack_depth == context.stack.size()); return; } +afterkey: + showopbox(context); + shownames(context); + showslots(context); + showsaveops(context); + worktoscreenm(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getnamepos(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kCurrentslot); + context.ah = 0; + context.cx = 17; + context._mul(context.cx); + context.dx = context.data; + context.es = context.dx; + context.bx = 8579; + context._add(context.bx, context.ax); + context.al = context.data.byte(kCursorpos); + context.ah = 0; + context._add(context.bx, context.ax); + {assert(stack_depth == context.stack.size()); return; } +} + +void showopbox(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics); + context.di = (60); + context.bx = (52); + context.al = 0; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60); + context.bx = (52)+55; + context.al = 4; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showloadops(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+128+4; + context.bx = (52)+12; + context.al = 1; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+176+2; + context.bx = (52)+60-4; + context.al = 5; + context.ah = 0; + showframe(context); + context.di = (60)+104; + context.bx = (52)+14; + context.al = 55; + context.dl = 101; + printmessage(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showsaveops(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+128+4; + context.bx = (52)+12; + context.al = 1; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+176+2; + context.bx = (52)+60-4; + context.al = 5; + context.ah = 0; + showframe(context); + context.di = (60)+104; + context.bx = (52)+14; + context.al = 54; + context.dl = 101; + printmessage(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void selectslot(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 244); + if (context.flags.z()) goto alreadysel; + context.data.byte(kCommandtype) = 244; + context.al = 45; + commandonly(context); +alreadysel: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, 1); + if (!context.flags.z()) goto noselslot; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto noselslot; + context._cmp(context.data.byte(kLoadingorsave), 3); + if (!context.flags.z()) goto notnocurs; + context._dec(context.data.byte(kLoadingorsave)); +notnocurs: + oldtonames(context); + context.ax = context.data.word(kMousey); + context._sub(context.ax, (52)+4); + context.cl = -1; +getslotnum: + context._inc(context.cl); + context._sub(context.ax, 11); + if (!context.flags.c()) goto getslotnum; + context.data.byte(kCurrentslot) = context.cl; + delpointer(context); + showopbox(context); + showslots(context); + shownames(context); + context._cmp(context.data.byte(kLoadingorsave), 1); + if (context.flags.z()) goto isloadmode; + showsaveops(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +isloadmode: + showloadops(context); + readmouse(context); + showpointer(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +noselslot: + {assert(stack_depth == context.stack.size()); return; } +} + +void showslots(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (60)+7; + context.bx = (52)+8; + context.al = 2; + context.ds = context.data.word(kTempgraphics); + context.ah = 0; + showframe(context); + context.di = (60)+10; + context.bx = (52)+11; + context.cl = 0; +slotloop: + context.push(context.cx); + context.push(context.di); + context.push(context.bx); + context._cmp(context.cl, context.data.byte(kCurrentslot)); + if (!context.flags.z()) goto nomatchslot; + context.al = 3; + context.ds = context.data.word(kTempgraphics); + context.ah = 0; + showframe(context); +nomatchslot: + context.bx = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.bx, 10); + context._inc(context.cl); + context._cmp(context.cl, 7); + if (!context.flags.z()) goto slotloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void shownames(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = context.data; + context.es = context.dx; + context.si = 8579+1; + context.di = (60)+21; + context.bx = (52)+10; + context.cl = 0; +shownameloop: + context.push(context.cx); + context.push(context.di); + context.push(context.es); + context.push(context.bx); + context.push(context.si); + context.al = 4; + context._cmp(context.cl, context.data.byte(kCurrentslot)); + if (!context.flags.z()) goto nomatchslot2; + context._cmp(context.data.byte(kLoadingorsave), 2); + if (!context.flags.z()) goto loadmode; + context.dx = context.si; + context.cx = 15; + context._add(context.si, 15); +zerostill: + context._dec(context.si); + context._dec(context.cl); + context._cmp(context.es.byte(context.si), 1); + if (!context.flags.z()) goto foundcharacter; + goto zerostill; +foundcharacter: + context.data.byte(kCursorpos) = context.cl; + context.es.byte(context.si) = '/'; + context.es.byte(context.si+1) = 0; + context.push(context.si); + context.si = context.dx; + context.dl = 200; + context.ah = 0; + printdirect(context); + context.si = context.pop(); + context.es.byte(context.si) = 0; + context.es.byte(context.si+1) = 1; + goto afterprintname; +loadmode: + context.al = 0; + context.dl = 200; + context.ah = 0; + context.data.word(kCharshift) = 91; + printdirect(context); + context.data.word(kCharshift) = 0; + goto afterprintname; +nomatchslot2: + context.dl = 200; + context.ah = 0; + printdirect(context); +afterprintname: + context.si = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context._add(context.si, 17); + context._add(context.bx, 10); + context._inc(context.cl); + context._cmp(context.cl, 7); + if (!context.flags.z()) goto shownameloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void namestoold(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.cs; + context.si = 8579; + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)); + context.es = context.data.word(kBuffers); + context.cx = 17*4; + while(context.cx--) context._movsb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void oldtonames(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.cs; + context.di = 8579; + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)); + context.ds = context.data.word(kBuffers); + context.cx = 17*4; + while(context.cx--) context._movsb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void saveposition(Context & context) { + uint stack_depth = context.stack.size(); + makeheader(context); + context.al = context.data.byte(kCurrentslot); + context.ah = 0; + context.push(context.ax); + context.cx = 13; + context._mul(context.cx); + context.dx = context.data; + context.ds = context.dx; + context.dx = 8698; + context._add(context.dx, context.ax); + openforsave(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 6091; + context.cx = (6187-6091); + savefilewrite(context); + context.dx = context.data; + context.es = context.dx; + context.di = 6141; + context.ax = context.pop(); + context.cx = 17; + context._mul(context.cx); + context.dx = context.data; + context.ds = context.dx; + context.dx = 8579; + context._add(context.dx, context.ax); + saveseg(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 0; + saveseg(context); + context.ds = context.data.word(kExtras); + context.dx = (0); + saveseg(context); + context.ds = context.data.word(kBuffers); + context.dx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); + saveseg(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 7979; + saveseg(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 534; + saveseg(context); +fquit: + closefile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadposition(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kTimecount) = 0; + clearchanges(context); + context.al = context.data.byte(kCurrentslot); + context.ah = 0; + context.push(context.ax); + context.cx = 13; + context._mul(context.cx); + context.dx = context.data; + context.ds = context.dx; + context.dx = 8698; + context._add(context.dx, context.ax); + openfilefromc(context); + context.ds = context.cs; + context.dx = 6091; + context.cx = (6187-6091); + savefileread(context); + context.es = context.cs; + context.di = 6141; + context.ax = context.pop(); + context.cx = 17; + context._mul(context.cx); + context.dx = context.data; + context.ds = context.dx; + context.dx = 8579; + context._add(context.dx, context.ax); + loadseg(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 0; + loadseg(context); + context.ds = context.data.word(kExtras); + context.dx = (0); + loadseg(context); + context.ds = context.data.word(kBuffers); + context.dx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); + loadseg(context); + context.dx = context.data; + context.ds = context.dx; + context.dx = 7979; + loadseg(context); + context.ds = context.cs; + context.dx = 534; + loadseg(context); + closefile(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void makeheader(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = context.data; + context.es = context.dx; + context.di = 6141; + context.ax = 17; + storeit(context); + context.ax = (68-0); + storeit(context); + context.ax = (0+2080+30000+(16*114)+((114+2)*2)+18000); + storeit(context); + context.ax = (250)*4; + storeit(context); + context.ax = 48; + storeit(context); + context.ax = (991-534); + storeit(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void storeit(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ax, 0); + if (!context.flags.z()) goto isntblank; + context._inc(context.ax); +isntblank: + context._stosw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void findlen(Context & context) { + uint stack_depth = context.stack.size(); + context._dec(context.bx); + context._add(context.bx, context.ax); +nextone: + context._cmp(context.cl, context.ds.byte(context.bx)); + if (!context.flags.z()) goto foundlen; + context._dec(context.bx); + context._dec(context.ax); + context._cmp(context.ax, 0); + if (!context.flags.z()) goto nextone; +foundlen: + {assert(stack_depth == context.stack.size()); return; } +} + +void scanfornames(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = context.data; + context.es = context.dx; + context.di = 8579; + context.dx = context.data; + context.ds = context.dx; + context.dx = 8698; + context.cx = 7; +scanloop: + context.push(context.es); + context.push(context.ds); + context.push(context.di); + context.push(context.dx); + context.push(context.cx); + openfilefromc(context); + if (context.flags.c()) goto notexist; + context.cx = context.pop(); + context._inc(context.ch); + context.push(context.cx); + context.push(context.di); + context.push(context.es); + context.dx = context.data; + context.ds = context.dx; + context.dx = 6091; + context.cx = (6187-6091); + savefileread(context); + context.dx = context.data; + context.es = context.dx; + context.di = 6141; + context.ds = context.pop(); + context.dx = context.pop(); + loadseg(context); + context.bx = context.data.word(kHandle); + closefile(context); +notexist: + context.cx = context.pop(); + context.dx = context.pop(); + context.di = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); + context._add(context.dx, 13); + context._add(context.di, 17); + context._dec(context.cl); + if (!context.flags.z()) goto scanloop; + context.al = context.ch; + {assert(stack_depth == context.stack.size()); return; } +} + +void decide(Context & context) { + uint stack_depth = context.stack.size(); + setmode(context); + loadpalfromiff(context); + clearpalette(context); + context.data.byte(kPointermode) = 0; + context.data.word(kWatchingtime) = 0; + context.data.byte(kPointerframe) = 0; + context.data.word(kTextaddressx) = 70; + context.data.word(kTextaddressy) = 182-8; + context.data.byte(kTextlen) = 181; + context.data.byte(kManisoffscreen) = 1; + loadsavebox(context); + showdecisions(context); + worktoscreen(context); + fadescreenup(context); + context.data.byte(kGetback) = 0; +waitdecide: + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + delpointer(context); + context.bx = 5057; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto waitdecide; + context._cmp(context.data.byte(kGetback), 4); + if (context.flags.z()) goto hasloadedroom; + getridoftemp(context); +hasloadedroom: + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + {assert(stack_depth == context.stack.size()); return; } +} + +void showdecisions(Context & context) { + uint stack_depth = context.stack.size(); + createpanel2(context); + showopbox(context); + context.ds = context.data.word(kTempgraphics); + context.di = (60)+17; + context.bx = (52)+13; + context.al = 6; + context.ah = 0; + showframe(context); + undertextline(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void newgame(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 251); + if (context.flags.z()) goto alreadynewgame; + context.data.byte(kCommandtype) = 251; + context.al = 47; + commandonly(context); +alreadynewgame: + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, 1); + if (!context.flags.z()) goto nonewgame; + context.data.byte(kGetback) = 3; +nonewgame: + {assert(stack_depth == context.stack.size()); return; } +} + +void doload(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kLoadingorsave) = 1; + showopbox(context); + showloadops(context); + context.data.byte(kCurrentslot) = 0; + showslots(context); + shownames(context); + context.data.byte(kPointerframe) = 0; + worktoscreenm(context); + namestoold(context); + context.data.byte(kGetback) = 0; +loadops: + delpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + dumppointer(context); + dumptextline(context); + context.bx = 3824; + checkcoords(context); + context._cmp(context.data.byte(kGetback), 0); + if (context.flags.z()) goto loadops; + context._cmp(context.data.byte(kGetback), 2); + if (context.flags.z()) goto quitloaded; + getridoftemp(context); + context.dx = context.data; + context.es = context.dx; + context.bx = 7979; + startloading(context); + loadroomssample(context); + context.data.byte(kRoomloaded) = 1; + context.data.byte(kNewlocation) = 255; + clearsprites(context); + initman(context); + initrain(context); + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + startup(context); + worktoscreen(context); + context.data.byte(kGetback) = 4; +quitloaded: + {assert(stack_depth == context.stack.size()); return; } +} + +void loadold(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 252); + if (context.flags.z()) goto alreadyloadold; + context.data.byte(kCommandtype) = 252; + context.al = 48; + commandonly(context); +alreadyloadold: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) goto noloadold; + doload(context); + context._cmp(context.data.byte(kGetback), 4); + if (context.flags.z()) goto noloadold; + showdecisions(context); + worktoscreenm(context); + context.data.byte(kGetback) = 0; +noloadold: + {assert(stack_depth == context.stack.size()); return; } +} + +void createname(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.di = 5105; + context.cs.byte(context.di+0) = context.dl; + context.cs.byte(context.di+3) = context.cl; + context.al = context.dh; + context.ah = '0'-1; +findten: + context._inc(context.ah); + context._sub(context.al, 10); + if (!context.flags.c()) goto findten; + context.cs.byte(context.di+1) = context.ah; + context._add(context.al, 10+'0'); + context.cs.byte(context.di+2) = context.al; + context.ax = context.pop(); + context.cl = '0'-1; +thousandsc: + context._inc(context.cl); + context._sub(context.ax, 1000); + if (!context.flags.c()) goto thousandsc; + context._add(context.ax, 1000); + context.cs.byte(context.di+4) = context.cl; + context.cl = '0'-1; +hundredsc: + context._inc(context.cl); + context._sub(context.ax, 100); + if (!context.flags.c()) goto hundredsc; + context._add(context.ax, 100); + context.cs.byte(context.di+5) = context.cl; + context.cl = '0'-1; +tensc: + context._inc(context.cl); + context._sub(context.ax, 10); + if (!context.flags.c()) goto tensc; + context._add(context.ax, 10); + context.cs.byte(context.di+6) = context.cl; + context._add(context.al, '0'); + context.cs.byte(context.di+7) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void trysoundalloc(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNeedsoundbuff), 1); + if (context.flags.z()) goto gotsoundbuff; + context._inc(context.data.byte(kSoundtimes)); + context.bx = (16384+2048)/16; + allocatemem(context); + context.data.word(kSoundbuffer) = context.ax; + context.push(context.ax); + context.al = context.ah; + context.cl = 4; + context._shr(context.al, context.cl); + context.data.byte(kSoundbufferpage) = context.al; + context.ax = context.pop(); + context.cl = 4; + context._shl(context.ax, context.cl); + context.data.word(kSoundbufferad) = context.ax; + context._cmp(context.ax, 0x0b7ff); + if (!context.flags.c()) goto soundfail; + context.es = context.data.word(kSoundbuffer); + context.di = 0; + context.cx = 16384/2; + context.ax = 0x7f7f; + while(context.cx--) context._stosw(); + context.data.byte(kNeedsoundbuff) = 1; + {assert(stack_depth == context.stack.size()); return; } +soundfail: + context.es = context.data.word(kSoundbuffer); + deallocatemem(context); +gotsoundbuff: + {assert(stack_depth == context.stack.size()); return; } +} + +void playchannel0(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSoundint), 255); + if (context.flags.z()) goto dontbother4; + context.push(context.es); + context.push(context.ds); + context.push(context.bx); + context.push(context.cx); + context.push(context.di); + context.push(context.si); + context.data.byte(kCh0playing) = context.al; + context.es = context.data.word(kSounddata); + context._cmp(context.al, 12); + if (context.flags.c()) goto notsecondbank; + context.es = context.data.word(kSounddata2); + context._sub(context.al, 12); +notsecondbank: + context.data.byte(kCh0repeat) = context.ah; + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx); + context.ah = 0; + context.data.word(kCh0emmpage) = context.ax; + context.ax = context.es.word(context.bx+1); + context.data.word(kCh0offset) = context.ax; + context.ax = context.es.word(context.bx+3); + context.data.word(kCh0blockstocopy) = context.ax; + context._cmp(context.data.byte(kCh0repeat), 0); + if (context.flags.z()) goto nosetloop; + context.ax = context.data.word(kCh0emmpage); + context.data.word(kCh0oldemmpage) = context.ax; + context.ax = context.data.word(kCh0offset); + context.data.word(kCh0oldoffset) = context.ax; + context.ax = context.data.word(kCh0blockstocopy); + context.data.word(kCh0oldblockstocopy) = context.ax; +nosetloop: + context.si = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); +dontbother4: + {assert(stack_depth == context.stack.size()); return; } +} + +void playchannel1(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kSoundint), 255); + if (context.flags.z()) goto dontbother5; + context._cmp(context.data.byte(kCh1playing), 7); + if (context.flags.z()) goto dontbother5; + context.push(context.es); + context.push(context.ds); + context.push(context.bx); + context.push(context.cx); + context.push(context.di); + context.push(context.si); + context.data.byte(kCh1playing) = context.al; + context.es = context.data.word(kSounddata); + context._cmp(context.al, 12); + if (context.flags.c()) goto notsecondbank1; + context.es = context.data.word(kSounddata2); + context._sub(context.al, 12); +notsecondbank1: + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx); + context.ah = 0; + context.data.word(kCh1emmpage) = context.ax; + context.ax = context.es.word(context.bx+1); + context.data.word(kCh1offset) = context.ax; + context.ax = context.es.word(context.bx+3); + context.data.word(kCh1blockstocopy) = context.ax; + context.si = context.pop(); + context.di = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); +dontbother5: + {assert(stack_depth == context.stack.size()); return; } +} + +void makenextblock(Context & context) { + uint stack_depth = context.stack.size(); + volumeadjust(context); + loopchannel0(context); + context._cmp(context.data.word(kCh1blockstocopy), 0); + if (context.flags.z()) goto mightbeonlych0; + context._cmp(context.data.word(kCh0blockstocopy), 0); + if (context.flags.z()) goto mightbeonlych1; + context._dec(context.data.word(kCh0blockstocopy)); + context._dec(context.data.word(kCh1blockstocopy)); + bothchannels(context); + {assert(stack_depth == context.stack.size()); return; } +mightbeonlych1: + context.data.byte(kCh0playing) = 255; + context._cmp(context.data.word(kCh1blockstocopy), 0); + if (context.flags.z()) goto notch1only; + context._dec(context.data.word(kCh1blockstocopy)); + channel1only(context); +notch1only: + {assert(stack_depth == context.stack.size()); return; } +mightbeonlych0: + context.data.byte(kCh1playing) = 255; + context._cmp(context.data.word(kCh0blockstocopy), 0); + if (context.flags.z()) goto notch0only; + context._dec(context.data.word(kCh0blockstocopy)); + channel0only(context); + {assert(stack_depth == context.stack.size()); return; } +notch0only: + context.es = context.data.word(kSoundbuffer); + context.di = context.data.word(kSoundbufferwrite); + context.cx = 1024; + context.ax = 0x7f7f; + while(context.cx--) context._stosw(); + context._and(context.di, 16384-1); + context.data.word(kSoundbufferwrite) = context.di; + {assert(stack_depth == context.stack.size()); return; } +} + +void volumeadjust(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kVolumedirection); + context._cmp(context.al, 0); + if (context.flags.z()) goto volok; + context.al = context.data.byte(kVolume); + context._cmp(context.al, context.data.byte(kVolumeto)); + if (context.flags.z()) goto volfinish; + context._add(context.data.byte(kVolumecount), 64); + if (!context.flags.z()) goto volok; + context.al = context.data.byte(kVolume); + context._add(context.al, context.data.byte(kVolumedirection)); + context.data.byte(kVolume) = context.al; + {assert(stack_depth == context.stack.size()); return; } +volfinish: + context.data.byte(kVolumedirection) = 0; +volok: + {assert(stack_depth == context.stack.size()); return; } +} + +void loopchannel0(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kCh0blockstocopy), 0); + if (!context.flags.z()) goto notloop; + context._cmp(context.data.byte(kCh0repeat), 0); + if (context.flags.z()) goto notloop; + context._cmp(context.data.byte(kCh0repeat), 255); + if (context.flags.z()) goto endlessloop; + context._dec(context.data.byte(kCh0repeat)); +endlessloop: + context.ax = context.data.word(kCh0oldemmpage); + context.data.word(kCh0emmpage) = context.ax; + context.ax = context.data.word(kCh0oldoffset); + context.data.word(kCh0offset) = context.ax; + context.ax = context.data.word(kCh0blockstocopy); + context._add(context.ax, context.data.word(kCh0oldblockstocopy)); + context.data.word(kCh0blockstocopy) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +notloop: + {assert(stack_depth == context.stack.size()); return; } +} + +void cancelch0(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCh0repeat) = 0; + context.data.word(kCh0blockstocopy) = 0; + context.data.byte(kCh0playing) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void cancelch1(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kCh1blockstocopy) = 0; + context.data.byte(kCh1playing) = 255; + {assert(stack_depth == context.stack.size()); return; } +} + +void channel0tran(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kVolume), 0); + if (!context.flags.z()) goto lowvolumetran; + context.cx = 1024; + while(context.cx--) context._movsw(); + {assert(stack_depth == context.stack.size()); return; } +lowvolumetran: + context.cx = 1024; + context.bh = context.data.byte(kVolume); + context.bl = 0; + context._add(context.bx, 16384-256); +volloop: + context._lodsw(); + context.bl = context.al; + context.al = context.es.byte(context.bx); + context.bl = context.ah; + context.ah = context.es.byte(context.bx); + context._stosw(); + if (--context.cx) goto volloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void domix(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kVolume), 0); + if (!context.flags.z()) goto lowvolumemix; +slow: + context._lodsb(); + context.ah = context.ds.byte(context.bx); + context._inc(context.bx); + context._cmp(context.al, context.dh); + if (!context.flags.c()) goto toplot; +botlot: + context._cmp(context.ah, context.dh); + if (!context.flags.c()) goto nodistort; + context._add(context.al, context.ah); + if (context.flags.s()) goto botok; + context._xor(context.al, context.al); + context._stosb(); + if (--context.cx) goto slow; + goto doneit; +botok: + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto slow; + goto doneit; +toplot: + context._cmp(context.ah, context.dh); + if (context.flags.c()) goto nodistort; + context._add(context.al, context.ah); + if (!context.flags.s()) goto topok; + context.al = context.dl; + context._stosb(); + if (--context.cx) goto slow; + goto doneit; +topok: + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto slow; + goto doneit; +nodistort: + context._add(context.al, context.ah); + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto slow; + goto doneit; +lowvolumemix: + context._lodsb(); + context.push(context.bx); + context.bh = context.data.byte(kVolume); + context._add(context.bh, 63); + context.bl = context.al; + context.al = context.es.byte(context.bx); + context.bx = context.pop(); + context.ah = context.ds.byte(context.bx); + context._inc(context.bx); + context._cmp(context.al, context.dh); + if (!context.flags.c()) goto toplotv; +botlotv: + context._cmp(context.ah, context.dh); + if (!context.flags.c()) goto nodistortv; + context._add(context.al, context.ah); + if (context.flags.s()) goto botokv; + context._xor(context.al, context.al); + context._stosb(); + if (--context.cx) goto lowvolumemix; + goto doneit; +botokv: + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto lowvolumemix; + goto doneit; +toplotv: + context._cmp(context.ah, context.dh); + if (context.flags.c()) goto nodistortv; + context._add(context.al, context.ah); + if (!context.flags.s()) goto topokv; + context.al = context.dl; + context._stosb(); + if (--context.cx) goto lowvolumemix; + goto doneit; +topokv: + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto lowvolumemix; + goto doneit; +nodistortv: + context._add(context.al, context.ah); + context._xor(context.al, context.dh); + context._stosb(); + if (--context.cx) goto lowvolumemix; +doneit: + {assert(stack_depth == context.stack.size()); return; } +} + +void entrytexts(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 21); + if (!context.flags.z()) goto notloc15; + context.al = 28; + context.cx = 60; + context.dx = 11; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notloc15: + context._cmp(context.data.byte(kLocation), 30); + if (!context.flags.z()) goto notloc43; + context.al = 27; + context.cx = 60; + context.dx = 11; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notloc43: + context._cmp(context.data.byte(kLocation), 23); + if (!context.flags.z()) goto notloc23; + context.al = 29; + context.cx = 60; + context.dx = 11; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notloc23: + context._cmp(context.data.byte(kLocation), 31); + if (!context.flags.z()) goto notloc44; + context.al = 30; + context.cx = 60; + context.dx = 11; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notloc44: + context._cmp(context.data.byte(kLocation), 20); + if (!context.flags.z()) goto notsarters2; + context.al = 31; + context.cx = 60; + context.dx = 11; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notsarters2: + context._cmp(context.data.byte(kLocation), 24); + if (!context.flags.z()) goto notedenlob; + context.al = 32; + context.cx = 60; + context.dx = 3; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +notedenlob: + context._cmp(context.data.byte(kLocation), 34); + if (!context.flags.z()) goto noteden2; + context.al = 33; + context.cx = 60; + context.dx = 3; + context.bl = 68; + context.bh = 64; + setuptimeduse(context); + {assert(stack_depth == context.stack.size()); return; } +noteden2: + {assert(stack_depth == context.stack.size()); return; } +} + +void entryanims(Context & context) { + uint stack_depth = context.stack.size(); + context.data.word(kReeltowatch) = -1; + context.data.byte(kWatchmode) = -1; + context._cmp(context.data.byte(kLocation), 33); + if (!context.flags.z()) goto notinthebeach; + switchryanoff(context); + context.data.word(kWatchingtime) = 76*2; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 76; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + {assert(stack_depth == context.stack.size()); return; } +notinthebeach: + context._cmp(context.data.byte(kLocation), 44); + if (!context.flags.z()) goto notsparkys; + context.al = 8; + resetlocation(context); + context.data.word(kWatchingtime) = 50*2; + context.data.word(kReeltowatch) = 247; + context.data.word(kEndwatchreel) = 297; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notsparkys: + context._cmp(context.data.byte(kLocation), 22); + if (!context.flags.z()) goto notinthelift; + context.data.word(kWatchingtime) = 31*2; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 30; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notinthelift: + context._cmp(context.data.byte(kLocation), 26); + if (!context.flags.z()) goto notunderchurch; + context.data.byte(kSymboltopnum) = 2; + context.data.byte(kSymbolbotnum) = 1; + {assert(stack_depth == context.stack.size()); return; } +notunderchurch: + context._cmp(context.data.byte(kLocation), 45); + if (!context.flags.z()) goto notenterdream; + context.data.byte(kKeeperflag) = 0; + context.data.word(kWatchingtime) = 296; + context.data.word(kReeltowatch) = 45; + context.data.word(kEndwatchreel) = 198; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notenterdream: + context._cmp(context.data.byte(kReallocation), 46); + if (!context.flags.z()) goto notcrystal; + context._cmp(context.data.byte(kSartaindead), 1); + if (!context.flags.z()) goto notcrystal; + context.al = 0; + removefreeobject(context); + {assert(stack_depth == context.stack.size()); return; } +notcrystal: + context._cmp(context.data.byte(kLocation), 9); + if (!context.flags.z()) goto nottopchurch; + context.al = 2; + checkifpathison(context); + if (context.flags.z()) goto nottopchurch; + context._cmp(context.data.byte(kAidedead), 0); + if (context.flags.z()) goto nottopchurch; + context.al = 3; + checkifpathison(context); + if (!context.flags.z()) goto makedoorsopen; + context.al = 2; + turnpathon(context); +makedoorsopen: + context.al = 4; + removesetobject(context); + context.al = 5; + placesetobject(context); + {assert(stack_depth == context.stack.size()); return; } +nottopchurch: + context._cmp(context.data.byte(kLocation), 47); + if (!context.flags.z()) goto notdreamcentre; + context.al = 4; + placesetobject(context); + context.al = 5; + placesetobject(context); + {assert(stack_depth == context.stack.size()); return; } +notdreamcentre: + context._cmp(context.data.byte(kLocation), 38); + if (!context.flags.z()) goto notcarpark; + context.data.word(kWatchingtime) = 57*2; + context.data.word(kReeltowatch) = 4; + context.data.word(kEndwatchreel) = 57; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notcarpark: + context._cmp(context.data.byte(kLocation), 32); + if (!context.flags.z()) goto notalley; + context.data.word(kWatchingtime) = 66*2; + context.data.word(kReeltowatch) = 0; + context.data.word(kEndwatchreel) = 66; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +notalley: + context._cmp(context.data.byte(kLocation), 24); + if (!context.flags.z()) goto notedensagain; + context.al = 2; + context.ah = context.data.byte(kRoomnum); + context._dec(context.ah); + turnanypathon(context); +notedensagain: + {assert(stack_depth == context.stack.size()); return; } +} + +void initialinv(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 24); + if (context.flags.z()) goto isedens; + {assert(stack_depth == context.stack.size()); return; } +isedens: + context.al = 11; + context.ah = 5; + pickupob(context); + context.al = 12; + context.ah = 6; + pickupob(context); + context.al = 13; + context.ah = 7; + pickupob(context); + context.al = 14; + context.ah = 8; + pickupob(context); + context.al = 18; + context.al = 18; + context.ah = 0; + pickupob(context); + context.al = 19; + context.ah = 1; + pickupob(context); + context.al = 20; + context.ah = 9; + pickupob(context); + context.al = 16; + context.ah = 2; + pickupob(context); + context.data.byte(kWatchmode) = 1; + context.data.word(kReeltohold) = 0; + context.data.word(kEndofholdreel) = 6; + context.data.byte(kWatchspeed) = 1; + context.data.byte(kSpeedcount) = 1; + switchryanoff(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void pickupob(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kLastinvpos) = context.ah; + context.data.byte(kObjecttype) = 2; + context.data.byte(kItemframe) = context.al; + context.data.byte(kCommand) = context.al; + getanyad(context); + transfertoex(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkforemm(Context & context) { + uint stack_depth = context.stack.size(); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkbasemem(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = context.data.word(kHowmuchalloc); + context._cmp(context.bx, 0x9360); + if (!context.flags.c()) goto enoughmem; + context.data.byte(kGameerror) = 5; + { quickquit(context); return; }; +enoughmem: + {assert(stack_depth == context.stack.size()); return; } +} + +void allocatebuffers(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/16; + allocatemem(context); + context.data.word(kExtras) = context.ax; + trysoundalloc(context); + context.bx = (0+(66*60))/16; + allocatemem(context); + context.data.word(kMapdata) = context.ax; + trysoundalloc(context); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534+68-0)/16; + allocatemem(context); + context.data.word(kBuffers) = context.ax; + trysoundalloc(context); + context.bx = (16*80)/16; + allocatemem(context); + context.data.word(kFreedat) = context.ax; + trysoundalloc(context); + context.bx = (64*128)/16; + allocatemem(context); + context.data.word(kSetdat) = context.ax; + trysoundalloc(context); + context.bx = (22*8*20*8)/16; + allocatemem(context); + context.data.word(kMapstore) = context.ax; + allocatework(context); + context.bx = 2048/16; + allocatemem(context); + context.data.word(kSounddata) = context.ax; + context.bx = 2048/16; + allocatemem(context); + context.data.word(kSounddata2) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void clearbuffers(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.cx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534+68-0)/2; + context.ax = 0; + context.di = 0; + while(context.cx--) context._stosw(); + context.es = context.data.word(kExtras); + context.cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2; + context.ax = 0x0ffff; + context.di = 0; + while(context.cx--) context._stosw(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)); + context.ds = context.cs; + context.si = 534; + context.cx = (991-534); + while(context.cx--) context._movsb(); + context.es = context.data.word(kBuffers); + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534); + context.ds = context.cs; + context.si = 0; + context.cx = (68-0); + while(context.cx--) context._movsb(); + clearchanges(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearchanges(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.cx = (250)*2; + context.ax = 0x0ffff; + context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); + while(context.cx--) context._stosw(); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)); + context.es = context.cs; + context.di = 534; + context.cx = (991-534); + while(context.cx--) context._movsb(); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534); + context.es = context.cs; + context.di = 0; + context.cx = (68-0); + while(context.cx--) context._movsb(); + context.data.byte(kExpos) = 0; + context.data.word(kExframepos) = 0; + context.data.word(kExtextpos) = 0; + context.es = context.data.word(kExtras); + context.cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2; + context.ax = 0x0ffff; + context.di = 0; + while(context.cx--) context._stosw(); + context.es = context.cs; + context.di = 8011; + context.al = 1; + context._stosb(); + context._stosb(); + context.al = 0; + context._stosb(); + context.al = 1; + context._stosb(); + context.ax = 0; + context.cx = 6; + while(context.cx--) context._stosw(); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearbeforeload(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRoomloaded), 1); + if (!context.flags.z()) goto noclear; + clearreels(context); + clearrest(context); + context.data.byte(kRoomloaded) = 0; +noclear: + {assert(stack_depth == context.stack.size()); return; } +} + +void clearreels(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kReel1); + deallocatemem(context); + context.es = context.data.word(kReel2); + deallocatemem(context); + context.es = context.data.word(kReel3); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void clearrest(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kMapdata); + context.cx = (66*60)/2; + context.ax = 0; + context.di = (0); + while(context.cx--) context._stosw(); + context.es = context.data.word(kBackdrop); + deallocatemem(context); + context.es = context.data.word(kSetframes); + deallocatemem(context); + context.es = context.data.word(kReels); + deallocatemem(context); + context.es = context.data.word(kPeople); + deallocatemem(context); + context.es = context.data.word(kSetdesc); + deallocatemem(context); + context.es = context.data.word(kBlockdesc); + deallocatemem(context); + context.es = context.data.word(kRoomdesc); + deallocatemem(context); + context.es = context.data.word(kFreeframes); + deallocatemem(context); + context.es = context.data.word(kFreedesc); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void parseblaster(Context & context) { + uint stack_depth = context.stack.size(); +lookattail: + context.al = context.es.byte(context.bx); + context._cmp(context.al, 0); + if (context.flags.z()) goto endtail; + context._cmp(context.al, 13); + if (context.flags.z()) goto endtail; + context._cmp(context.al, 'i'); + if (context.flags.z()) goto issoundint; + context._cmp(context.al, 'I'); + if (context.flags.z()) goto issoundint; + context._cmp(context.al, 'b'); + if (context.flags.z()) goto isbright; + context._cmp(context.al, 'B'); + if (context.flags.z()) goto isbright; + context._cmp(context.al, 'a'); + if (context.flags.z()) goto isbaseadd; + context._cmp(context.al, 'A'); + if (context.flags.z()) goto isbaseadd; + context._cmp(context.al, 'n'); + if (context.flags.z()) goto isnosound; + context._cmp(context.al, 'N'); + if (context.flags.z()) goto isnosound; + context._cmp(context.al, 'd'); + if (context.flags.z()) goto isdma; + context._cmp(context.al, 'D'); + if (context.flags.z()) goto isdma; + context._inc(context.bx); + if (--context.cx) goto lookattail; + {assert(stack_depth == context.stack.size()); return; } +issoundint: + context.al = context.es.byte(context.bx+1); + context._sub(context.al, '0'); + context.data.byte(kSoundint) = context.al; + context._inc(context.bx); + goto lookattail; +isdma: + context.al = context.es.byte(context.bx+1); + context._sub(context.al, '0'); + context.data.byte(kSounddmachannel) = context.al; + context._inc(context.bx); + goto lookattail; +isbaseadd: + context.push(context.cx); + context.al = context.es.byte(context.bx+2); + context._sub(context.al, '0'); + context.ah = 0; + context.cl = 4; + context._shl(context.ax, context.cl); + context._add(context.ax, 0x200); + context.data.word(kSoundbaseadd) = context.ax; + context.cx = context.pop(); + context._inc(context.bx); + goto lookattail; +isbright: + context.data.byte(kBrightness) = 1; + context._inc(context.bx); + goto lookattail; +isnosound: + context.data.byte(kSoundint) = 255; + context._inc(context.bx); + goto lookattail; +endtail: + {assert(stack_depth == context.stack.size()); return; } +} + +void startup(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCurrentkey) = 0; + context.data.byte(kMainmode) = 0; + createpanel(context); + context.data.byte(kNewobs) = 1; + drawfloor(context); + showicon(context); + getunderzoom(context); + spriteupdate(context); + printsprites(context); + undertextline(context); + reelsonscreen(context); + atmospheres(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void startup1(Context & context) { + uint stack_depth = context.stack.size(); + clearpalette(context); + context.data.byte(kThroughdoor) = 0; + context.data.byte(kCurrentkey) = '0'; + context.data.byte(kMainmode) = 0; + createpanel(context); + context.data.byte(kNewobs) = 1; + drawfloor(context); + showicon(context); + getunderzoom(context); + spriteupdate(context); + printsprites(context); + undertextline(context); + reelsonscreen(context); + atmospheres(context); + worktoscreen(context); + fadescreenup(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void screenupdate(Context & context) { + uint stack_depth = context.stack.size(); + newplace(context); + mainscreen(context); + animpointer(context); + showpointer(context); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto iswatchingmode; + context._cmp(context.data.byte(kNewlocation), 255); + if (!context.flags.z()) goto finishearly; +iswatchingmode: + vsync(context); + readmouse1(context); + dumppointer(context); + dumptextline(context); + delpointer(context); + autolook(context); + spriteupdate(context); + watchcount(context); + zoom(context); + showpointer(context); + context._cmp(context.data.byte(kWongame), 0); + if (!context.flags.z()) goto finishearly; + vsync(context); + readmouse2(context); + dumppointer(context); + dumpzoom(context); + delpointer(context); + deleverything(context); + printsprites(context); + reelsonscreen(context); + afternewroom(context); + showpointer(context); + vsync(context); + readmouse3(context); + dumppointer(context); + dumpmap(context); + dumptimedtext(context); + delpointer(context); + showpointer(context); + vsync(context); + readmouse4(context); + dumppointer(context); + dumpwatch(context); + delpointer(context); +finishearly: + {assert(stack_depth == context.stack.size()); return; } +} + +void watchreel(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kReeltowatch), -1); + if (context.flags.z()) goto notplayingreel; + context.al = context.data.byte(kManspath); + context._cmp(context.al, context.data.byte(kFinaldest)); + if (!context.flags.z()) goto waitstopwalk; + context.al = context.data.byte(kTurntoface); + context._cmp(context.al, context.data.byte(kFacing)); + if (context.flags.z()) goto notwatchpath; +waitstopwalk: + {assert(stack_depth == context.stack.size()); return; } +notwatchpath: + context._dec(context.data.byte(kSpeedcount)); + context._cmp(context.data.byte(kSpeedcount), -1); + if (!context.flags.z()) goto showwatchreel; + context.al = context.data.byte(kWatchspeed); + context.data.byte(kSpeedcount) = context.al; + context.ax = context.data.word(kReeltowatch); + context._cmp(context.ax, context.data.word(kEndwatchreel)); + if (!context.flags.z()) goto ismorereel; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto showwatchreel; + context.data.word(kReeltowatch) = -1; + context.data.byte(kWatchmode) = -1; + context._cmp(context.data.word(kReeltohold), -1); + if (context.flags.z()) goto nomorereel; + context.data.byte(kWatchmode) = 1; + goto notplayingreel; +ismorereel: + context._inc(context.data.word(kReeltowatch)); +showwatchreel: + context.ax = context.data.word(kReeltowatch); + context.data.word(kReelpointer) = context.ax; + plotreel(context); + context.ax = context.data.word(kReelpointer); + context.data.word(kReeltowatch) = context.ax; + checkforshake(context); +nomorereel: + {assert(stack_depth == context.stack.size()); return; } +notplayingreel: + context._cmp(context.data.byte(kWatchmode), 1); + if (!context.flags.z()) goto notholdingreel; + context.ax = context.data.word(kReeltohold); + context.data.word(kReelpointer) = context.ax; + plotreel(context); + {assert(stack_depth == context.stack.size()); return; } +notholdingreel: + context._cmp(context.data.byte(kWatchmode), 2); + if (!context.flags.z()) goto notreleasehold; + context._dec(context.data.byte(kSpeedcount)); + context._cmp(context.data.byte(kSpeedcount), -1); + if (!context.flags.z()) goto notlastspeed2; + context.al = context.data.byte(kWatchspeed); + context.data.byte(kSpeedcount) = context.al; + context._inc(context.data.word(kReeltohold)); +notlastspeed2: + context.ax = context.data.word(kReeltohold); + context._cmp(context.ax, context.data.word(kEndofholdreel)); + if (!context.flags.z()) goto ismorereel2; + context.data.word(kReeltohold) = -1; + context.data.byte(kWatchmode) = -1; + context.al = context.data.byte(kDestafterhold); + context.data.byte(kDestination) = context.al; + context.data.byte(kFinaldest) = context.al; + autosetwalk(context); + {assert(stack_depth == context.stack.size()); return; } +ismorereel2: + context.ax = context.data.word(kReeltohold); + context.data.word(kReelpointer) = context.ax; + plotreel(context); + {assert(stack_depth == context.stack.size()); return; } +notreleasehold: + {assert(stack_depth == context.stack.size()); return; } +} + +void checkforshake(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 26); + if (!context.flags.z()) goto notstartshake; + context._cmp(context.ax, 104); + if (!context.flags.z()) goto notstartshake; + context.data.byte(kShakecounter) = -1; +notstartshake: + {assert(stack_depth == context.stack.size()); return; } +} + +void watchcount(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchon), 0); + if (context.flags.z()) goto nowatchworn; + context._inc(context.data.byte(kTimercount)); + context._cmp(context.data.byte(kTimercount), 9); + if (context.flags.z()) goto flashdots; + context._cmp(context.data.byte(kTimercount), 18); + if (context.flags.z()) goto uptime; +nowatchworn: + {assert(stack_depth == context.stack.size()); return; } +flashdots: + context.ax = 91*3+21; + context.di = 268+4; + context.bx = 21; + context.ds = context.data.word(kCharset1); + showframe(context); + goto finishwatch; +uptime: + context.data.byte(kTimercount) = 0; + context._add(context.data.byte(kSecondcount), 1); + context._cmp(context.data.byte(kSecondcount), 60); + if (!context.flags.z()) goto finishtime; + context.data.byte(kSecondcount) = 0; + context._inc(context.data.byte(kMinutecount)); + context._cmp(context.data.byte(kMinutecount), 60); + if (!context.flags.z()) goto finishtime; + context.data.byte(kMinutecount) = 0; + context._inc(context.data.byte(kHourcount)); + context._cmp(context.data.byte(kHourcount), 24); + if (!context.flags.z()) goto finishtime; + context.data.byte(kHourcount) = 0; +finishtime: + showtime(context); +finishwatch: + context.data.byte(kWatchdump) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void showtime(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchon), 0); + if (context.flags.z()) goto nowatch; + context.al = context.data.byte(kSecondcount); + context.cl = 0; + twodigitnum(context); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context._add(context.ax, 91*3+10); + context.ds = context.data.word(kCharset1); + context.di = 282+5; + context.bx = 21; + showframe(context); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, 91*3+10); + context.ds = context.data.word(kCharset1); + context.di = 282+9; + context.bx = 21; + showframe(context); + context.al = context.data.byte(kMinutecount); + context.cl = 0; + twodigitnum(context); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context._add(context.ax, 91*3); + context.ds = context.data.word(kCharset1); + context.di = 270+5; + context.bx = 21; + showframe(context); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, 91*3); + context.ds = context.data.word(kCharset1); + context.di = 270+11; + context.bx = 21; + showframe(context); + context.al = context.data.byte(kHourcount); + context.cl = 0; + twodigitnum(context); + context.push(context.ax); + context.al = context.ah; + context.ah = 0; + context._add(context.ax, 91*3); + context.ds = context.data.word(kCharset1); + context.di = 256+5; + context.bx = 21; + showframe(context); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, 91*3); + context.ds = context.data.word(kCharset1); + context.di = 256+11; + context.bx = 21; + showframe(context); + context.ax = 91*3+20; + context.ds = context.data.word(kCharset1); + context.di = 267+5; + context.bx = 21; + showframe(context); +nowatch: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpwatch(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchdump), 1); + if (!context.flags.z()) goto nodumpwatch; + context.di = 256; + context.bx = 21; + context.cl = 40; + context.ch = 12; + multidump(context); + context.data.byte(kWatchdump) = 0; +nodumpwatch: + {assert(stack_depth == context.stack.size()); return; } +} + +void showbyte(Context & context) { + uint stack_depth = context.stack.size(); + context.dl = context.al; + context._shr(context.dl, 1); + context._shr(context.dl, 1); + context._shr(context.dl, 1); + context._shr(context.dl, 1); + onedigit(context); + context.es.byte(context.di) = context.dl; + context.dl = context.al; + context._and(context.dl, 15); + onedigit(context); + context.es.byte(context.di+1) = context.dl; + context._add(context.di, 3); + {assert(stack_depth == context.stack.size()); return; } +} + +void onedigit(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.dl, 10); + if (!context.flags.c()) goto morethan10; + context._add(context.dl, '0'); + {assert(stack_depth == context.stack.size()); return; } +morethan10: + context._sub(context.dl, 10); + context._add(context.dl, 'A'); + {assert(stack_depth == context.stack.size()); return; } +} + +void twodigitnum(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = context.cl; + context._dec(context.ah); +numloop1: + context._inc(context.ah); + context._sub(context.al, 10); + if (!context.flags.c()) goto numloop1; + context._add(context.al, 10); + context._add(context.al, context.cl); + {assert(stack_depth == context.stack.size()); return; } +} + +void showword(Context & context) { + uint stack_depth = context.stack.size(); + context.ch = 0; + context.bx = 10000; + context.cl = 47; +word1: + context._inc(context.cl); + context._sub(context.ax, context.bx); + if (!context.flags.c()) goto word1; + context._add(context.ax, context.bx); + convnum(context); + context.cs.byte(context.di) = context.cl; + context.bx = 1000; + context.cl = 47; +word2: + context._inc(context.cl); + context._sub(context.ax, context.bx); + if (!context.flags.c()) goto word2; + context._add(context.ax, context.bx); + convnum(context); + context.cs.byte(context.di+1) = context.cl; + context.bx = 100; + context.cl = 47; +word3: + context._inc(context.cl); + context._sub(context.ax, context.bx); + if (!context.flags.c()) goto word3; + context._add(context.ax, context.bx); + convnum(context); + context.cs.byte(context.di+2) = context.cl; + context.bx = 10; + context.cl = 47; +word4: + context._inc(context.cl); + context._sub(context.ax, context.bx); + if (!context.flags.c()) goto word4; + context._add(context.ax, context.bx); + convnum(context); + context.cs.byte(context.di+3) = context.cl; + context._add(context.al, 48); + context.cl = context.al; + convnum(context); + context.cs.byte(context.di+4) = context.cl; + {assert(stack_depth == context.stack.size()); return; } +} + +void convnum(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.ch, 0); + if (!context.flags.z()) goto noconvnum; + context._cmp(context.cl, '0'); + if (!context.flags.z()) goto notzeronum; + context.cl = 32; + goto noconvnum; +notzeronum: + context.ch = 1; +noconvnum: + {assert(stack_depth == context.stack.size()); return; } +} + +void walkandexamine(Context & context) { + uint stack_depth = context.stack.size(); + finishedwalking(context); + if (!context.flags.z()) goto noobselect; + context.al = context.data.byte(kWalkexamtype); + context.data.byte(kCommandtype) = context.al; + context.al = context.data.byte(kWalkexamnum); + context.data.byte(kCommand) = context.al; + context.data.byte(kWalkandexam) = 0; + context._cmp(context.data.byte(kCommandtype), 5); + if (context.flags.z()) goto noobselect; + examineob(context); + {assert(stack_depth == context.stack.size()); return; } +wantstowalk: + setwalk(context); + context.data.byte(kReasseschanges) = 1; +noobselect: + {assert(stack_depth == context.stack.size()); return; } +diff: + context.data.byte(kCommand) = context.al; + context.data.byte(kCommandtype) = context.ah; +diff2: + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto middleofwalk; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto middleofwalk; + context.al = context.data.byte(kFacing); + context._cmp(context.al, context.data.byte(kTurntoface)); + if (!context.flags.z()) goto middleofwalk; + context._cmp(context.data.byte(kCommandtype), 3); + if (!context.flags.z()) goto notblock; + context.bl = context.data.byte(kManspath); + context._cmp(context.bl, context.data.byte(kPointerspath)); + if (!context.flags.z()) goto dontcheck; + context.cl = context.data.byte(kRyanx); + context._add(context.cl, 12); + context.ch = context.data.byte(kRyany); + context._add(context.ch, 12); + checkone(context); + context._cmp(context.cl, 2); + if (context.flags.c()) goto isblock; +dontcheck: + getflagunderp(context); + context._cmp(context.data.byte(kLastflag), 2); + if (context.flags.c()) goto isblock; + context._cmp(context.data.byte(kLastflag), 128); + if (!context.flags.c()) goto isblock; + goto toofaraway; +notblock: + context.bl = context.data.byte(kManspath); + context._cmp(context.bl, context.data.byte(kPointerspath)); + if (!context.flags.z()) goto toofaraway; + context._cmp(context.data.byte(kCommandtype), 3); + if (context.flags.z()) goto isblock; + context._cmp(context.data.byte(kCommandtype), 5); + if (context.flags.z()) goto isaperson; + examineobtext(context); + {assert(stack_depth == context.stack.size()); return; } +middleofwalk: + blocknametext(context); + {assert(stack_depth == context.stack.size()); return; } +isblock: + blocknametext(context); + {assert(stack_depth == context.stack.size()); return; } +isaperson: + personnametext(context); + {assert(stack_depth == context.stack.size()); return; } +toofaraway: + walktotext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void mainscreen(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kInmaparea) = 0; + context.bx = 5122; + context._cmp(context.data.byte(kWatchon), 1); + if (context.flags.z()) goto checkmain; + context.bx = 5184; +checkmain: + checkcoords(context); + context._cmp(context.data.byte(kWalkandexam), 0); + if (context.flags.z()) goto finishmain; + walkandexamine(context); +finishmain: + {assert(stack_depth == context.stack.size()); return; } +} + +void madmanrun(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 14); + if (!context.flags.z()) { identifyob(context); return; }; + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) { identifyob(context); return; }; + context._cmp(context.data.byte(kPointermode), 2); + if (!context.flags.z()) { identifyob(context); return; }; + context._cmp(context.data.byte(kMadmanflag), 0); + if (!context.flags.z()) { identifyob(context); return; }; + context._cmp(context.data.byte(kCommandtype), 211); + if (context.flags.z()) goto alreadyrun; + context.data.byte(kCommandtype) = 211; + context.al = 52; + commandonly(context); +alreadyrun: + context._cmp(context.data.word(kMousebutton), 1); + if (!context.flags.z()) goto norun; + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, context.data.word(kOldbutton)); + if (context.flags.z()) goto norun; + context.data.byte(kLastweapon) = 8; +norun: + {assert(stack_depth == context.stack.size()); return; } +} + +void checkcoords(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNewlocation), 255); + if (context.flags.z()) goto loop048; + {assert(stack_depth == context.stack.size()); return; } +loop048: + context.ax = context.cs.word(context.bx); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto nonefound; + context.push(context.bx); + context._cmp(context.data.word(kMousex), context.ax); + if (context.flags.l()) goto over045; + context.ax = context.cs.word(context.bx+2); + context._cmp(context.data.word(kMousex), context.ax); + if (!context.flags.l()) goto over045; + context.ax = context.cs.word(context.bx+4); + context._cmp(context.data.word(kMousey), context.ax); + if (context.flags.l()) goto over045; + context.ax = context.cs.word(context.bx+6); + context._cmp(context.data.word(kMousey), context.ax); + if (!context.flags.l()) goto over045; + context.ax = context.cs.word(context.bx+8); + __dispatch_call(context, context.ax); +finished: + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +over045: + context.bx = context.pop(); + context._add(context.bx, 10); + goto loop048; +nonefound: + {assert(stack_depth == context.stack.size()); return; } +} + +void identifyob(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) { blank(context); return; }; + context.ax = context.data.word(kMousex); + context._sub(context.ax, context.data.word(kMapadx)); + context._cmp(context.ax, 22*8); + if (context.flags.c()) goto notover1; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +notover1: + context.bx = context.data.word(kMousey); + context._sub(context.bx, context.data.word(kMapady)); + context._cmp(context.bx, 20*8); + if (context.flags.c()) goto notover2; + blank(context); + {assert(stack_depth == context.stack.size()); return; } +notover2: + context.data.byte(kInmaparea) = 1; + context.ah = context.bl; + context.push(context.ax); + findpathofpoint(context); + context.data.byte(kPointerspath) = context.dl; + context.ax = context.pop(); + context.push(context.ax); + findfirstpath(context); + context.data.byte(kPointerfirstpath) = context.al; + context.ax = context.pop(); + checkifex(context); + if (!context.flags.z()) goto finishidentify; + checkiffree(context); + if (!context.flags.z()) goto finishidentify; + checkifperson(context); + if (!context.flags.z()) goto finishidentify; + checkifset(context); + if (!context.flags.z()) goto finishidentify; + context.ax = context.data.word(kMousex); + context._sub(context.ax, context.data.word(kMapadx)); + context.cl = context.al; + context.ax = context.data.word(kMousey); + context._sub(context.ax, context.data.word(kMapady)); + context.ch = context.al; + checkone(context); + context._cmp(context.al, 0); + if (context.flags.z()) goto nothingund; + context._cmp(context.data.byte(kMandead), 1); + if (context.flags.z()) goto nothingund; + context.ah = 3; + obname(context); +finishidentify: + {assert(stack_depth == context.stack.size()); return; } +nothingund: + blank(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void checkifperson(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)); + context.cx = 12; +identifyreel: + context.push(context.cx); + context._cmp(context.es.byte(context.bx+4), 255); + if (context.flags.z()) goto notareelid; + context.push(context.es); + context.push(context.bx); + context.push(context.ax); + context.ax = context.es.word(context.bx+0); + context.data.word(kReelpointer) = context.ax; + getreelstart(context); + context._cmp(context.es.word(context.si+2), 0x0ffff); + if (!context.flags.z()) goto notblankpers; + context._add(context.si, 5); +notblankpers: + context.cx = context.es.word(context.si+2); + context.ax = context.es.word(context.si+0); + context.push(context.cx); + getreelframeax(context); + context.cx = context.pop(); + context._add(context.cl, context.es.byte(context.bx+4)); + context._add(context.ch, context.es.byte(context.bx+5)); + context.dx = context.cx; + context._add(context.dl, context.es.byte(context.bx+0)); + context._add(context.dh, context.es.byte(context.bx+1)); + context.ax = context.pop(); + context.bx = context.pop(); + context.es = context.pop(); + context._cmp(context.al, context.cl); + if (context.flags.c()) goto notareelid; + context._cmp(context.ah, context.ch); + if (context.flags.c()) goto notareelid; + context._cmp(context.al, context.dl); + if (!context.flags.c()) goto notareelid; + context._cmp(context.ah, context.dh); + if (!context.flags.c()) goto notareelid; + context.cx = context.pop(); + context.ax = context.es.word(context.bx+2); + context.data.word(kPersondata) = context.ax; + context.al = context.es.byte(context.bx+4); + context.ah = 5; + obname(context); + context.al = 0; + context._cmp(context.al, 1); + {assert(stack_depth == context.stack.size()); return; } +notareelid: + context.cx = context.pop(); + context._add(context.bx, 5); + context._dec(context.cx); + if (!context.flags.z()) goto identifyreel; + {assert(stack_depth == context.stack.size()); return; } +} + +void checkifset(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32))+(127*5); + context.cx = 127; +identifyset: + context._cmp(context.es.byte(context.bx+4), 255); + if (context.flags.z()) goto notasetid; + context._cmp(context.al, context.es.byte(context.bx)); + if (context.flags.c()) goto notasetid; + context._cmp(context.al, context.es.byte(context.bx+2)); + if (!context.flags.c()) goto notasetid; + context._cmp(context.ah, context.es.byte(context.bx+1)); + if (context.flags.c()) goto notasetid; + context._cmp(context.ah, context.es.byte(context.bx+3)); + if (!context.flags.c()) goto notasetid; + pixelcheckset(context); + if (context.flags.z()) goto notasetid; + isitdescribed(context); + if (context.flags.z()) goto notasetid; + context.al = context.es.byte(context.bx+4); + context.ah = 1; + obname(context); + context.al = 0; + context._cmp(context.al, 1); + {assert(stack_depth == context.stack.size()); return; } +notasetid: + context._sub(context.bx, 5); + context._dec(context.cx); + context._cmp(context.cx, -1); + if (!context.flags.z()) goto identifyset; + {assert(stack_depth == context.stack.size()); return; } +} + +void checkifex(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5))+(99*5); + context.cx = 99; +identifyex: + context._cmp(context.es.byte(context.bx+4), 255); + if (context.flags.z()) goto notanexid; + context._cmp(context.al, context.es.byte(context.bx)); + if (context.flags.c()) goto notanexid; + context._cmp(context.al, context.es.byte(context.bx+2)); + if (!context.flags.c()) goto notanexid; + context._cmp(context.ah, context.es.byte(context.bx+1)); + if (context.flags.c()) goto notanexid; + context._cmp(context.ah, context.es.byte(context.bx+3)); + if (!context.flags.c()) goto notanexid; + context.al = context.es.byte(context.bx+4); + context.ah = 4; + obname(context); + context.al = 1; + context._cmp(context.al, 0); + {assert(stack_depth == context.stack.size()); return; } +notanexid: + context._sub(context.bx, 5); + context._dec(context.cx); + context._cmp(context.cx, -1); + if (!context.flags.z()) goto identifyex; + {assert(stack_depth == context.stack.size()); return; } +} + +void checkiffree(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBuffers); + context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5))+(79*5); + context.cx = 79; +identifyfree: + context._cmp(context.es.byte(context.bx+4), 255); + if (context.flags.z()) goto notafreeid; + context._cmp(context.al, context.es.byte(context.bx)); + if (context.flags.c()) goto notafreeid; + context._cmp(context.al, context.es.byte(context.bx+2)); + if (!context.flags.c()) goto notafreeid; + context._cmp(context.ah, context.es.byte(context.bx+1)); + if (context.flags.c()) goto notafreeid; + context._cmp(context.ah, context.es.byte(context.bx+3)); + if (!context.flags.c()) goto notafreeid; + context.al = context.es.byte(context.bx+4); + context.ah = 2; + obname(context); + context.al = 0; + context._cmp(context.al, 1); + {assert(stack_depth == context.stack.size()); return; } +notafreeid: + context._sub(context.bx, 5); + context._dec(context.cx); + context._cmp(context.cx, -1); + if (!context.flags.z()) goto identifyfree; + {assert(stack_depth == context.stack.size()); return; } +} + +void isitdescribed(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.cx); + context.push(context.es); + context.push(context.bx); + context.al = context.es.byte(context.bx+4); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kSetdesc); + context._add(context.bx, (0)); + context.ax = context.es.word(context.bx); + context._add(context.ax, (0+(130*2))); + context.bx = context.ax; + context.dl = context.es.byte(context.bx); + context.bx = context.pop(); + context.es = context.pop(); + context.cx = context.pop(); + context.ax = context.pop(); + context._cmp(context.dl, 0); + {assert(stack_depth == context.stack.size()); return; } +} + +void findpathofpoint(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.bx = (0); + context.es = context.data.word(kReels); + context.al = context.data.byte(kRoomnum); + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.cx = context.pop(); + context.dl = 0; +pathloop: + context.al = context.es.byte(context.bx+6); + context._cmp(context.al, 255); + if (!context.flags.z()) goto flunkedit; + context.ax = context.es.word(context.bx+2); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto flunkedit; + context._cmp(context.cl, context.al); + if (context.flags.c()) goto flunkedit; + context._cmp(context.ch, context.ah); + if (context.flags.c()) goto flunkedit; + context.ax = context.es.word(context.bx+4); + context._cmp(context.cl, context.al); + if (!context.flags.c()) goto flunkedit; + context._cmp(context.ch, context.ah); + if (!context.flags.c()) goto flunkedit; + goto gotvalidpath; +flunkedit: + context._add(context.bx, 8); + context._inc(context.dl); + context._cmp(context.dl, 12); + if (!context.flags.z()) goto pathloop; + context.dl = 255; +gotvalidpath: + {assert(stack_depth == context.stack.size()); return; } +} + +void findfirstpath(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.bx = (0); + context.es = context.data.word(kReels); + context.al = context.data.byte(kRoomnum); + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context._add(context.bx, context.ax); + context.cx = context.pop(); + context.dl = 0; +fpathloop: + context.ax = context.es.word(context.bx+2); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto nofirst; + context._cmp(context.cl, context.al); + if (context.flags.c()) goto nofirst; + context._cmp(context.ch, context.ah); + if (context.flags.c()) goto nofirst; + context.ax = context.es.word(context.bx+4); + context._cmp(context.cl, context.al); + if (!context.flags.c()) goto nofirst; + context._cmp(context.ch, context.ah); + if (!context.flags.c()) goto nofirst; + goto gotfirst; +nofirst: + context._add(context.bx, 8); + context._inc(context.dl); + context._cmp(context.dl, 12); + if (!context.flags.z()) goto fpathloop; + context.al = 0; + {assert(stack_depth == context.stack.size()); return; } +gotfirst: + context.al = context.es.byte(context.bx+6); + {assert(stack_depth == context.stack.size()); return; } +} + +void turnpathon(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.cl = 255; + context.ch = context.data.byte(kRoomnum); + context._add(context.ch, 100); + findormake(context); + context.ax = context.pop(); + getroomspaths(context); + context.ax = context.pop(); + context._cmp(context.al, 255); + if (context.flags.z()) goto nopathon; + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = 255; + context.es.byte(context.bx+6) = context.al; +nopathon: + {assert(stack_depth == context.stack.size()); return; } +} + +void turnpathoff(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.cl = 0; + context.ch = context.data.byte(kRoomnum); + context._add(context.ch, 100); + findormake(context); + context.ax = context.pop(); + getroomspaths(context); + context.ax = context.pop(); + context._cmp(context.al, 255); + if (context.flags.z()) goto nopathoff; + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = 0; + context.es.byte(context.bx+6) = context.al; +nopathoff: + {assert(stack_depth == context.stack.size()); return; } +} + +void turnanypathon(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.cl = 255; + context.ch = context.ah; + context._add(context.ch, 100); + findormake(context); + context.ax = context.pop(); + context.al = context.ah; + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context.es = context.data.word(kReels); + context.bx = (0); + context._add(context.bx, context.ax); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = 255; + context.es.byte(context.bx+6) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void turnanypathoff(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.cl = 0; + context.ch = context.ah; + context._add(context.ch, 100); + findormake(context); + context.ax = context.pop(); + context.al = context.ah; + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context.es = context.data.word(kReels); + context.bx = (0); + context._add(context.bx, context.ax); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = 0; + context.es.byte(context.bx+6) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void checkifpathison(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + getroomspaths(context); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx+6); + context._cmp(context.al, 255); + {assert(stack_depth == context.stack.size()); return; } +} + +void afternewroom(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNowinnewroom), 0); + if (context.flags.z()) goto notnew; + context.data.word(kTimecount) = 0; + createpanel(context); + context.data.byte(kCommandtype) = 0; + findroominloc(context); + context._cmp(context.data.byte(kRyanon), 1); + if (context.flags.z()) goto ryansoff; + context.al = context.data.byte(kRyanx); + context._add(context.al, 12); + context.ah = context.data.byte(kRyany); + context._add(context.ah, 12); + findpathofpoint(context); + context.data.byte(kManspath) = context.dl; + findxyfrompath(context); + context.data.byte(kResetmanxy) = 1; +ryansoff: + context.data.byte(kNewobs) = 1; + drawfloor(context); + context.data.word(kLookcounter) = 160; + context.data.byte(kNowinnewroom) = 0; + showicon(context); + spriteupdate(context); + printsprites(context); + undertextline(context); + reelsonscreen(context); + mainscreen(context); + getunderzoom(context); + zoom(context); + worktoscreenm(context); + walkintoroom(context); + reminders(context); + atmospheres(context); +notnew: + {assert(stack_depth == context.stack.size()); return; } +} + +void atmospheres(Context & context) { + uint stack_depth = context.stack.size(); + context.cl = context.data.byte(kMapx); + context.ch = context.data.byte(kMapy); + context.bx = 5246; +nextatmos: + context.al = context.cs.byte(context.bx); + context._cmp(context.al, 255); + if (context.flags.z()) goto nomoreatmos; + context._cmp(context.al, context.data.byte(kReallocation)); + if (!context.flags.z()) goto wrongatmos; + context.ax = context.cs.word(context.bx+1); + context._cmp(context.ax, context.cx); + if (!context.flags.z()) goto wrongatmos; + context.ax = context.cs.word(context.bx+3); + context._cmp(context.al, context.data.byte(kCh0playing)); + if (context.flags.z()) goto playingalready; + context._cmp(context.data.byte(kLocation), 45); + if (!context.flags.z()) goto notweb; + context._cmp(context.data.word(kReeltowatch), 45); + if (context.flags.z()) goto wrongatmos; +notweb: + playchannel0(context); + context._cmp(context.data.byte(kReallocation), 2); + context._cmp(context.data.byte(kMapy), 0); + if (context.flags.z()) goto fullvol; + if (!context.flags.z()) goto notlouisvol; + context._cmp(context.data.byte(kMapy), 10); + if (!context.flags.z()) goto notlouisvol; + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) goto notlouisvol; + context.data.byte(kVolume) = 5; +notlouisvol: + context._cmp(context.data.byte(kReallocation), 14); + if (!context.flags.z()) goto notmad1; + context._cmp(context.data.byte(kMapx), 33); + if (context.flags.z()) goto ismad2; + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) goto notmad1; + context.data.byte(kVolume) = 5; + {assert(stack_depth == context.stack.size()); return; } +ismad2: + context.data.byte(kVolume) = 0; + {assert(stack_depth == context.stack.size()); return; } +notmad1: +playingalready: + context._cmp(context.data.byte(kReallocation), 2); + if (!context.flags.z()) goto notlouisvol2; + context._cmp(context.data.byte(kMapx), 22); + if (context.flags.z()) goto louisvol; + context._cmp(context.data.byte(kMapx), 11); + if (!context.flags.z()) goto notlouisvol2; +fullvol: + context.data.byte(kVolume) = 0; +notlouisvol2: + {assert(stack_depth == context.stack.size()); return; } +louisvol: + context.data.byte(kVolume) = 5; + {assert(stack_depth == context.stack.size()); return; } +wrongatmos: + context._add(context.bx, 5); + goto nextatmos; +nomoreatmos: + cancelch0(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void walkintoroom(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLocation), 14); + if (!context.flags.z()) goto notlair; + context._cmp(context.data.byte(kMapx), 22); + if (!context.flags.z()) goto notlair; + context.data.byte(kDestination) = 1; + context.data.byte(kFinaldest) = 1; + autosetwalk(context); +notlair: + {assert(stack_depth == context.stack.size()); return; } +} + +void afterintroroom(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNowinnewroom), 0); + if (context.flags.z()) goto notnewintro; + clearwork(context); + findroominloc(context); + context.data.byte(kNewobs) = 1; + drawfloor(context); + reelsonscreen(context); + spriteupdate(context); + printsprites(context); + worktoscreen(context); + context.data.byte(kNowinnewroom) = 0; +notnewintro: + {assert(stack_depth == context.stack.size()); return; } +} + +void obname(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReasseschanges), 0); + if (context.flags.z()) goto notnewpath; + context.data.byte(kReasseschanges) = 0; + goto diff; +notnewpath: + context._cmp(context.ah, context.data.byte(kCommandtype)); + if (context.flags.z()) goto notdiffob; + goto diff; +notdiffob: + context._cmp(context.al, context.data.byte(kCommand)); + if (!context.flags.z()) goto diff; + context._cmp(context.data.byte(kWalkandexam), 1); + if (context.flags.z()) goto walkandexamine; + context._cmp(context.data.word(kMousebutton), 0); + if (context.flags.z()) goto noobselect; + context._cmp(context.data.byte(kCommandtype), 3); + if (!context.flags.z()) goto isntblock; + context._cmp(context.data.byte(kLastflag), 2); + if (context.flags.c()) goto noobselect; +isntblock: + context.bl = context.data.byte(kManspath); + context._cmp(context.bl, context.data.byte(kPointerspath)); + if (!context.flags.z()) goto wantstowalk; + context._cmp(context.data.byte(kCommandtype), 3); + if (context.flags.z()) goto wantstowalk; + finishedwalking(context); + if (!context.flags.z()) goto noobselect; + context._cmp(context.data.byte(kCommandtype), 5); + if (context.flags.z()) goto wantstotalk; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto noobselect; + examineob(context); + {assert(stack_depth == context.stack.size()); return; } +wantstotalk: + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto noobselect; + talk(context); + {assert(stack_depth == context.stack.size()); return; } +walkandexamine: + finishedwalking(context); + if (!context.flags.z()) goto noobselect; + context.al = context.data.byte(kWalkexamtype); + context.data.byte(kCommandtype) = context.al; + context.al = context.data.byte(kWalkexamnum); + context.data.byte(kCommand) = context.al; + context.data.byte(kWalkandexam) = 0; + context._cmp(context.data.byte(kCommandtype), 5); + if (context.flags.z()) goto noobselect; + examineob(context); + {assert(stack_depth == context.stack.size()); return; } +wantstowalk: + setwalk(context); + context.data.byte(kReasseschanges) = 1; +noobselect: + {assert(stack_depth == context.stack.size()); return; } +diff: + context.data.byte(kCommand) = context.al; + context.data.byte(kCommandtype) = context.ah; +diff2: + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto middleofwalk; + context._cmp(context.data.word(kWatchingtime), 0); + if (!context.flags.z()) goto middleofwalk; + context.al = context.data.byte(kFacing); + context._cmp(context.al, context.data.byte(kTurntoface)); + if (!context.flags.z()) goto middleofwalk; + context._cmp(context.data.byte(kCommandtype), 3); + if (!context.flags.z()) goto notblock; + context.bl = context.data.byte(kManspath); + context._cmp(context.bl, context.data.byte(kPointerspath)); + if (!context.flags.z()) goto dontcheck; + context.cl = context.data.byte(kRyanx); + context._add(context.cl, 12); + context.ch = context.data.byte(kRyany); + context._add(context.ch, 12); + checkone(context); + context._cmp(context.cl, 2); + if (context.flags.c()) goto isblock; +dontcheck: + getflagunderp(context); + context._cmp(context.data.byte(kLastflag), 2); + if (context.flags.c()) goto isblock; + context._cmp(context.data.byte(kLastflag), 128); + if (!context.flags.c()) goto isblock; + goto toofaraway; +notblock: + context.bl = context.data.byte(kManspath); + context._cmp(context.bl, context.data.byte(kPointerspath)); + if (!context.flags.z()) goto toofaraway; + context._cmp(context.data.byte(kCommandtype), 3); + if (context.flags.z()) goto isblock; + context._cmp(context.data.byte(kCommandtype), 5); + if (context.flags.z()) goto isaperson; + examineobtext(context); + {assert(stack_depth == context.stack.size()); return; } +middleofwalk: + blocknametext(context); + {assert(stack_depth == context.stack.size()); return; } +isblock: + blocknametext(context); + {assert(stack_depth == context.stack.size()); return; } +isaperson: + personnametext(context); + {assert(stack_depth == context.stack.size()); return; } +toofaraway: + walktotext(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void finishedwalking(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto iswalking; + context.al = context.data.byte(kFacing); + context._cmp(context.al, context.data.byte(kTurntoface)); +iswalking: + {assert(stack_depth == context.stack.size()); return; } +} + +void examineobtext(Context & context) { + uint stack_depth = context.stack.size(); + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kCommandtype); + context.al = 1; + commandwithob(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void commandwithob(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.ax); + context.push(context.bx); + context.push(context.cx); + context.push(context.dx); + context.push(context.es); + context.push(context.ds); + context.push(context.si); + context.push(context.di); + deltextline(context); + context.di = context.pop(); + context.si = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); + context.dx = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); + context.push(context.bx); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kCommandtext); + context.ax = context.es.word(context.bx); + context._add(context.ax, (66*2)); + context.si = context.ax; + context.di = context.data.word(kTextaddressx); + context.bx = context.data.word(kTextaddressy); + context.dl = context.data.byte(kTextlen); + context.al = 0; + context.ah = 0; + printdirect(context); + context.ax = context.pop(); + context.di = 5847; + copyname(context); + context.ax = context.pop(); + context.di = context.data.word(kLastxpos); + context._cmp(context.al, 0); + if (context.flags.z()) goto noadd; + context._add(context.di, 5); +noadd: + context.bx = context.data.word(kTextaddressy); + context.es = context.cs; + context.si = 5847; + context.dl = context.data.byte(kTextlen); + context.al = 0; + context.ah = 0; + printdirect(context); + context.data.byte(kNewtextline) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void commandonly(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.push(context.bx); + context.push(context.cx); + context.push(context.dx); + context.push(context.es); + context.push(context.ds); + context.push(context.si); + context.push(context.di); + deltextline(context); + context.di = context.pop(); + context.si = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); + context.dx = context.pop(); + context.cx = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kCommandtext); + context.ax = context.es.word(context.bx); + context._add(context.ax, (66*2)); + context.si = context.ax; + context.di = context.data.word(kTextaddressx); + context.bx = context.data.word(kTextaddressy); + context.dl = context.data.byte(kTextlen); + context.al = 0; + context.ah = 0; + printdirect(context); + context.data.byte(kNewtextline) = 1; + {assert(stack_depth == context.stack.size()); return; } +} + +void printmessage(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.push(context.bx); + context.push(context.di); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kCommandtext); + context.ax = context.es.word(context.bx); + context._add(context.ax, (66*2)); + context.si = context.ax; + context.di = context.pop(); + context.bx = context.pop(); + context.dx = context.pop(); + context.al = 0; + context.ah = 0; + printdirect(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void printmessage2(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.dx); + context.push(context.bx); + context.push(context.di); + context.push(context.ax); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.es = context.data.word(kCommandtext); + context.ax = context.es.word(context.bx); + context._add(context.ax, (66*2)); + context.si = context.ax; + context.ax = context.pop(); +searchmess: + context.push(context.ax); + findnextcolon(context); + context.ax = context.pop(); + context._dec(context.ah); + if (!context.flags.z()) goto searchmess; + context.di = context.pop(); + context.bx = context.pop(); + context.dx = context.pop(); + context.al = 0; + context.ah = 0; + printdirect(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void blocknametext(Context & context) { + uint stack_depth = context.stack.size(); + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kCommandtype); + context.al = 0; + commandwithob(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void personnametext(Context & context) { + uint stack_depth = context.stack.size(); + context.bl = context.data.byte(kCommand); + context._and(context.bl, 127); + context.bh = context.data.byte(kCommandtype); + context.al = 2; + commandwithob(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void walktotext(Context & context) { + uint stack_depth = context.stack.size(); + context.bl = context.data.byte(kCommand); + context.bh = context.data.byte(kCommandtype); + context.al = 3; + commandwithob(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getflagunderp(Context & context) { + uint stack_depth = context.stack.size(); + context.cx = context.data.word(kMousex); + context._sub(context.cx, context.data.word(kMapadx)); + context.ax = context.data.word(kMousey); + context._sub(context.ax, context.data.word(kMapady)); + context.ch = context.al; + checkone(context); + context.data.byte(kLastflag) = context.cl; + context.data.byte(kLastflagex) = context.ch; + {assert(stack_depth == context.stack.size()); return; } +} + +void setwalk(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kLinepointer), 254); + if (!context.flags.z()) goto alreadywalking; + context.al = context.data.byte(kPointerspath); + context._cmp(context.al, context.data.byte(kManspath)); + if (context.flags.z()) goto cantwalk2; + context._cmp(context.data.byte(kWatchmode), 1); + if (context.flags.z()) goto holdingreel; + context._cmp(context.data.byte(kWatchmode), 2); + if (context.flags.z()) goto cantwalk; + context.data.byte(kDestination) = context.al; + context.data.byte(kFinaldest) = context.al; + context._cmp(context.data.word(kMousebutton), 2); + if (!context.flags.z()) goto notwalkandexam; + context._cmp(context.data.byte(kCommandtype), 3); + if (context.flags.z()) goto notwalkandexam; + context.data.byte(kWalkandexam) = 1; + context.al = context.data.byte(kCommandtype); + context.data.byte(kWalkexamtype) = context.al; + context.al = context.data.byte(kCommand); + context.data.byte(kWalkexamnum) = context.al; +notwalkandexam: + autosetwalk(context); +cantwalk: + {assert(stack_depth == context.stack.size()); return; } +cantwalk2: + facerightway(context); + {assert(stack_depth == context.stack.size()); return; } +alreadywalking: + context.al = context.data.byte(kPointerspath); + context.data.byte(kFinaldest) = context.al; + {assert(stack_depth == context.stack.size()); return; } +holdingreel: + context.data.byte(kDestafterhold) = context.al; + context.data.byte(kWatchmode) = 2; + {assert(stack_depth == context.stack.size()); return; } +} + +void autosetwalk(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kManspath); + context._cmp(context.data.byte(kFinaldest), context.al); + if (!context.flags.z()) goto notsamealready; + {assert(stack_depth == context.stack.size()); return; } +notsamealready: + getroomspaths(context); + checkdest(context); + context.push(context.bx); + context.al = context.data.byte(kManspath); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx); + context.ah = 0; + context._sub(context.ax, 12); + context.data.word(kLinestartx) = context.ax; + context.al = context.es.byte(context.bx+1); + context.ah = 0; + context._sub(context.ax, 12); + context.data.word(kLinestarty) = context.ax; + context.bx = context.pop(); + context.al = context.data.byte(kDestination); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = context.es.byte(context.bx); + context.ah = 0; + context._sub(context.ax, 12); + context.data.word(kLineendx) = context.ax; + context.al = context.es.byte(context.bx+1); + context.ah = 0; + context._sub(context.ax, 12); + context.data.word(kLineendy) = context.ax; + bresenhams(context); + context._cmp(context.data.byte(kLinedirection), 0); + if (context.flags.z()) goto normalline; + context.al = context.data.byte(kLinelength); + context._dec(context.al); + context.data.byte(kLinepointer) = context.al; + context.data.byte(kLinedirection) = 1; + {assert(stack_depth == context.stack.size()); return; } +normalline: + context.data.byte(kLinepointer) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void checkdest(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.bx); + context._add(context.bx, 12*8); + context.ah = context.data.byte(kManspath); + context.cl = 4; + context._shl(context.ah, context.cl); + context.al = context.data.byte(kDestination); + context.cl = 24; + context.ch = context.data.byte(kDestination); +checkdestloop: + context.dh = context.es.byte(context.bx); + context._and(context.dh, 0xf0); + context.dl = context.es.byte(context.bx); + context._and(context.dl, 0xf); + context._cmp(context.ax, context.dx); + if (!context.flags.z()) goto nextcheck; + context.al = context.es.byte(context.bx+1); + context._and(context.al, 15); + context.data.byte(kDestination) = context.al; + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +nextcheck: + context.dl = context.es.byte(context.bx); + context._and(context.dl, 0xf0); + context._shr(context.dl, 1); + context._shr(context.dl, 1); + context._shr(context.dl, 1); + context._shr(context.dl, 1); + context.dh = context.es.byte(context.bx); + context._and(context.dh, 0xf); + context._shl(context.dh, 1); + context._shl(context.dh, 1); + context._shl(context.dh, 1); + context._shl(context.dh, 1); + context._cmp(context.ax, context.dx); + if (!context.flags.z()) goto nextcheck2; + context.ch = context.es.byte(context.bx+1); + context._and(context.ch, 15); +nextcheck2: + context._add(context.bx, 2); + context._dec(context.cl); + if (!context.flags.z()) goto checkdestloop; + context.data.byte(kDestination) = context.ch; + context.bx = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void bresenhams(Context & context) { + uint stack_depth = context.stack.size(); + workoutframes(context); + context.dx = context.data; + context.es = context.dx; + context.di = 8173; + context.si = 1; + context.data.byte(kLinedirection) = 0; + context.cx = context.data.word(kLineendx); + context._sub(context.cx, context.data.word(kLinestartx)); + if (context.flags.z()) goto vertline; + if (!context.flags.s()) goto line1; + context._neg(context.cx); + context.bx = context.data.word(kLineendx); + context._xchg(context.bx, context.data.word(kLinestartx)); + context.data.word(kLineendx) = context.bx; + context.bx = context.data.word(kLineendy); + context._xchg(context.bx, context.data.word(kLinestarty)); + context.data.word(kLineendy) = context.bx; + context.data.byte(kLinedirection) = 1; +line1: + context.bx = context.data.word(kLineendy); + context._sub(context.bx, context.data.word(kLinestarty)); + if (context.flags.z()) goto horizline; + if (!context.flags.s()) goto line3; + context._neg(context.bx); + context._neg(context.si); +line3: + context.push(context.si); + context.data.byte(kLineroutine) = 0; + context._cmp(context.bx, context.cx); + if (context.flags.le()) goto line4; + context.data.byte(kLineroutine) = 1; + context._xchg(context.bx, context.cx); +line4: + context._shl(context.bx, 1); + context.data.word(kIncrement1) = context.bx; + context._sub(context.bx, context.cx); + context.si = context.bx; + context._sub(context.bx, context.cx); + context.data.word(kIncrement2) = context.bx; + context.ax = context.data.word(kLinestartx); + context.bx = context.data.word(kLinestarty); + context.ah = context.bl; + context._inc(context.cx); + context.bx = context.pop(); + context._cmp(context.data.byte(kLineroutine), 1); + if (context.flags.z()) goto hislope; + goto loslope; +vertline: + context.ax = context.data.word(kLinestarty); + context.bx = context.data.word(kLineendy); + context.cx = context.bx; + context._sub(context.cx, context.ax); + if (!context.flags.l()) goto line31; + context._neg(context.cx); + context.ax = context.bx; + context.data.byte(kLinedirection) = 1; +line31: + context._inc(context.cx); + context.bx = context.data.word(kLinestartx); + context._xchg(context.ax, context.bx); + context.ah = context.bl; + context.bx = context.si; +line32: + context._stosw(); + context._add(context.ah, context.bl); + if (--context.cx) goto line32; + goto lineexit; +horizline: + context.ax = context.data.word(kLinestartx); + context.bx = context.data.word(kLinestarty); + context.ah = context.bl; + context._inc(context.cx); +horizloop: + context._stosw(); + context._inc(context.al); + if (--context.cx) goto horizloop; + goto lineexit; +loslope: +loloop: + context._stosw(); + context._inc(context.al); + context._or(context.si, context.si); + if (!context.flags.s()) goto line12; + context._add(context.si, context.data.word(kIncrement1)); + if (--context.cx) goto loloop; + goto lineexit; +line12: + context._add(context.si, context.data.word(kIncrement2)); + context._add(context.ah, context.bl); + if (--context.cx) goto loloop; + goto lineexit; +hislope: +hiloop: + context._stosw(); + context._add(context.ah, context.bl); + context._or(context.si, context.si); + if (!context.flags.s()) goto line23; + context._add(context.si, context.data.word(kIncrement1)); + if (--context.cx) goto hiloop; + goto lineexit; +line23: + context._add(context.si, context.data.word(kIncrement2)); + context._inc(context.al); + if (--context.cx) goto hiloop; +lineexit: + context._sub(context.di, 8173); + context.ax = context.di; + context._shr(context.ax, 1); + context.data.byte(kLinelength) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void workoutframes(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = context.data.word(kLinestartx); + context._add(context.bx, 32); + context.ax = context.data.word(kLineendx); + context._add(context.ax, 32); + context._sub(context.bx, context.ax); + if (!context.flags.c()) goto notneg1; + context._neg(context.bx); +notneg1: + context.cx = context.data.word(kLinestarty); + context._add(context.cx, 32); + context.ax = context.data.word(kLineendy); + context._add(context.ax, 32); + context._sub(context.cx, context.ax); + if (!context.flags.c()) goto notneg2; + context._neg(context.cx); +notneg2: + context._cmp(context.bx, context.cx); + if (!context.flags.c()) goto tendstohoriz; + context.dl = 2; + context.ax = context.cx; + context._shr(context.ax, 1); + context._cmp(context.bx, context.ax); + if (context.flags.c()) goto gotquad; + context.dl = 1; + goto gotquad; +tendstohoriz: + context.dl = 0; + context.ax = context.bx; + context._shr(context.ax, 1); + context._cmp(context.cx, context.ax); + if (context.flags.c()) goto gotquad; + context.dl = 1; + goto gotquad; +gotquad: + context.bx = context.data.word(kLinestartx); + context._add(context.bx, 32); + context.ax = context.data.word(kLineendx); + context._add(context.ax, 32); + context._sub(context.bx, context.ax); + if (context.flags.c()) goto isinright; +isinleft: + context.cx = context.data.word(kLinestarty); + context._add(context.cx, 32); + context.ax = context.data.word(kLineendy); + context._add(context.ax, 32); + context._sub(context.cx, context.ax); + if (!context.flags.c()) goto topleft; + context._cmp(context.dl, 1); + if (context.flags.z()) goto noswap1; + context._xor(context.dl, 2); +noswap1: + context._add(context.dl, 4); + goto success; +topleft: + context._add(context.dl, 6); + goto success; +isinright: + context.cx = context.data.word(kLinestarty); + context._add(context.cx, 32); + context.ax = context.data.word(kLineendy); + context._add(context.ax, 32); + context._sub(context.cx, context.ax); + if (!context.flags.c()) goto botright; + context._add(context.dl, 2); + goto success; +botright: + context._cmp(context.dl, 1); + if (context.flags.z()) goto noswap2; + context._xor(context.dl, 2); +noswap2: +success: + context._and(context.dl, 7); + context.data.byte(kTurntoface) = context.dl; + context.data.byte(kTurndirection) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void getroomspaths(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kRoomnum); + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context.es = context.data.word(kReels); + context.bx = (0); + context._add(context.bx, context.ax); + {assert(stack_depth == context.stack.size()); return; } +} + +void copyname(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.di); + findobname(context); + context.di = context.pop(); + context.es = context.cs; +copytext: + context.cx = 28; +make: + context._lodsb(); + context._cmp(context.al, ':'); + if (context.flags.z()) goto finishmakename; + context._cmp(context.al, 0); + if (context.flags.z()) goto finishmakename; + context._stosb(); + if (--context.cx) goto make; +finishmakename: + context._inc(context.cx); + context.al = 0; + context._stosb(); + {assert(stack_depth == context.stack.size()); return; } + context.al = 255; + while(context.cx--) context._stosb(); + {assert(stack_depth == context.stack.size()); return; } +} + +void findobname(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ax); + context.ah = 0; + context._add(context.ax, context.ax); + context.bx = context.ax; + context.ax = context.pop(); + context._cmp(context.ah, 5); + if (!context.flags.z()) goto notpersonname; + context.push(context.ax); + context._and(context.al, 127); + context.ah = 0; + context.bx = 64*2; + context._mul(context.bx); + context.si = context.ax; + context.ds = context.data.word(kPeople); + context._add(context.si, (0+24)); + context.cx = (0+24+(1026*2)); + context.ax = context.ds.word(context.si); + context._add(context.ax, context.cx); + context.si = context.ax; + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +notpersonname: + context._cmp(context.ah, 4); + if (!context.flags.z()) goto notextraname; + context.ds = context.data.word(kExtras); + context._add(context.bx, (0+2080+30000+(16*114))); + context.ax = context.ds.word(context.bx); + context._add(context.ax, (0+2080+30000+(16*114)+((114+2)*2))); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +notextraname: + context._cmp(context.ah, 2); + if (!context.flags.z()) goto notfreename; + context.ds = context.data.word(kFreedesc); + context._add(context.bx, (0)); + context.ax = context.ds.word(context.bx); + context._add(context.ax, (0+(82*2))); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +notfreename: + context._cmp(context.ah, 1); + if (!context.flags.z()) goto notsetname; + context.ds = context.data.word(kSetdesc); + context._add(context.bx, (0)); + context.ax = context.ds.word(context.bx); + context._add(context.ax, (0+(130*2))); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +notsetname: + context.ds = context.data.word(kBlockdesc); + context._add(context.bx, (0)); + context.ax = context.ds.word(context.bx); + context._add(context.ax, (0+(98*2))); + context.si = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void showicon(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kReallocation), 50); + if (!context.flags.c()) goto isdream1; + showpanel(context); + showman(context); + roomname(context); + panelicons1(context); + zoomicon(context); + {assert(stack_depth == context.stack.size()); return; } +isdream1: + context.ds = context.data.word(kTempsprites); + context.di = 72; + context.bx = 2; + context.al = 45; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 72+47; + context.bx = 2; + context.al = 46; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 69-10; + context.bx = 21; + context.al = 49; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 160+88; + context.bx = 2; + context.al = 45; + context.ah = 4; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 160+43; + context.bx = 2; + context.al = 46; + context.ah = 4; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 160+101; + context.bx = 21; + context.al = 49; + context.ah = 4; + showframe(context); + middlepanel(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void middlepanel(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kTempsprites); + context.di = 72+47+20; + context.bx = 0; + context.al = 48; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 72+19; + context.bx = 21; + context.al = 47; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 160+23; + context.bx = 0; + context.al = 48; + context.ah = 4; + showframe(context); + context.ds = context.data.word(kTempsprites); + context.di = 160+71; + context.bx = 21; + context.al = 47; + context.ah = 4; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showman(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kIcons1); + context.di = 0; + context.bx = 0; + context.al = 0; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kIcons1); + context.di = 0; + context.bx = 114; + context.al = 1; + context.ah = 0; + showframe(context); + context._cmp(context.data.byte(kShadeson), 0); + if (context.flags.z()) goto notverycool; + context.ds = context.data.word(kIcons1); + context.di = 28; + context.bx = 25; + context.al = 2; + context.ah = 0; + showframe(context); +notverycool: + {assert(stack_depth == context.stack.size()); return; } +} + +void showpanel(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kIcons1); + context.di = 72; + context.bx = 0; + context.al = 19; + context.ah = 0; + showframe(context); + context.ds = context.data.word(kIcons1); + context.di = 192; + context.bx = 0; + context.al = 19; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void roomname(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 88; + context.bx = 18; + context.al = 53; + context.dl = 240; + printmessage(context); + context.bl = context.data.byte(kRoomnum); + context._cmp(context.bl, 32); + if (context.flags.c()) goto notover32; + context._sub(context.bl, 32); +notover32: + context.bh = 0; + context._add(context.bx, context.bx); + context.es = context.data.word(kRoomdesc); + context._add(context.bx, (0)); + context.ax = context.es.word(context.bx); + context._add(context.ax, (0+(38*2))); + context.si = context.ax; + context.data.word(kLinespacing) = 7; + context.di = 88; + context.bx = 25; + context.dl = 120; + context._cmp(context.data.byte(kWatchon), 1); + if (context.flags.z()) goto gotpl; + context.dl = 160; +gotpl: + context.al = 0; + context.ah = 0; + printdirect(context); + context.data.word(kLinespacing) = 10; + usecharset1(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void usecharset1(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kCharset1); + context.data.word(kCurrentset) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void usetempcharset(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kTempcharset); + context.data.word(kCurrentset) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void showexit(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.data.word(kIcons1); + context.di = 274; + context.bx = 154; + context.al = 11; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void panelicons1(Context & context) { + uint stack_depth = context.stack.size(); + context.di = 0; + context._cmp(context.data.byte(kWatchon), 1); + if (context.flags.z()) goto watchison; + context.di = 48; +watchison: + context.push(context.di); + context.ds = context.data.word(kIcons2); + context._add(context.di, 204); + context.bx = 4; + context.al = 2; + context.ah = 0; + showframe(context); + context.di = context.pop(); + context.push(context.di); + context._cmp(context.data.byte(kZoomon), 1); + if (context.flags.z()) goto zoomisoff; + context.ds = context.data.word(kIcons1); + context._add(context.di, 228); + context.bx = 8; + context.al = 5; + context.ah = 0; + showframe(context); +zoomisoff: + context.di = context.pop(); + showwatch(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showwatch(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kWatchon), 0); + if (context.flags.z()) goto nowristwatch; + context.ds = context.data.word(kIcons1); + context.di = 250; + context.bx = 1; + context.al = 6; + context.ah = 0; + showframe(context); + showtime(context); +nowristwatch: + {assert(stack_depth == context.stack.size()); return; } +} + +void zoomicon(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kZoomon), 0); + if (context.flags.z()) goto nozoom1; + context.ds = context.data.word(kIcons1); + context.di = (8); + context.bx = (132)-1; + context.al = 8; + context.ah = 0; + showframe(context); +nozoom1: + {assert(stack_depth == context.stack.size()); return; } +} + +void showblink(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kManisoffscreen), 1); + if (context.flags.z()) goto finblink1; + context._inc(context.data.byte(kBlinkcount)); + context._cmp(context.data.byte(kShadeson), 0); + if (!context.flags.z()) goto finblink1; + context._cmp(context.data.byte(kReallocation), 50); + if (!context.flags.c()) goto eyesshut; + context.al = context.data.byte(kBlinkcount); + context._cmp(context.al, 3); + if (!context.flags.z()) goto finblink1; + context.data.byte(kBlinkcount) = 0; + context.al = context.data.byte(kBlinkframe); + context._inc(context.al); + context.data.byte(kBlinkframe) = context.al; + context._cmp(context.al, 6); + if (context.flags.c()) goto nomorethan6; + context.al = 6; +nomorethan6: + context.ah = 0; + context.bx = 5888; + context._add(context.bx, context.ax); + context.al = context.cs.byte(context.bx); + context.ds = context.data.word(kIcons1); + context.di = 44; + context.bx = 32; + context.ah = 0; + showframe(context); +finblink1: + {assert(stack_depth == context.stack.size()); return; } +eyesshut: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpblink(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kShadeson), 0); + if (!context.flags.z()) goto nodumpeye; + context._cmp(context.data.byte(kBlinkcount), 0); + if (!context.flags.z()) goto nodumpeye; + context.al = context.data.byte(kBlinkframe); + context._cmp(context.al, 6); + if (!context.flags.c()) goto nodumpeye; + context.push(context.ds); + context.di = 44; + context.bx = 32; + context.cl = 16; + context.ch = 12; + multidump(context); + context.ds = context.pop(); +nodumpeye: + {assert(stack_depth == context.stack.size()); return; } +} + +void worktoscreenm(Context & context) { + uint stack_depth = context.stack.size(); + animpointer(context); + readmouse(context); + showpointer(context); + vsync(context); + worktoscreen(context); + delpointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void blank(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 199); + if (context.flags.z()) goto alreadyblnk; + context.data.byte(kCommandtype) = 199; + context.al = 0; + commandonly(context); +alreadyblnk: + {assert(stack_depth == context.stack.size()); return; } +} + +void allpointer(Context & context) { + uint stack_depth = context.stack.size(); + readmouse(context); + showpointer(context); + dumppointer(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void hangonp(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + context._add(context.cx, context.cx); + context.ax = context.pop(); + context._add(context.cx, context.ax); + context.data.word(kMaintimer) = 0; + context.al = context.data.byte(kPointerframe); + context.ah = context.data.byte(kPickup); + context.push(context.ax); + context.data.byte(kPointermode) = 3; + context.data.byte(kPickup) = 0; + context.push(context.cx); + context.data.byte(kCommandtype) = 255; + readmouse(context); + animpointer(context); + showpointer(context); + vsync(context); + dumppointer(context); + context.cx = context.pop(); +hangloop: + context.push(context.cx); + delpointer(context); + readmouse(context); + animpointer(context); + showpointer(context); + vsync(context); + dumppointer(context); + context.cx = context.pop(); + context.ax = context.data.word(kMousebutton); + context._cmp(context.ax, 0); + if (context.flags.z()) goto notpressed; + context._cmp(context.ax, context.data.word(kOldbutton)); + if (!context.flags.z()) goto getoutofit; +notpressed: + if (--context.cx) goto hangloop; +getoutofit: + delpointer(context); + context.ax = context.pop(); + context.data.byte(kPointerframe) = context.al; + context.data.byte(kPickup) = context.ah; + context.data.byte(kPointermode) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void hangonw(Context & context) { + uint stack_depth = context.stack.size(); +hangloopw: + context.push(context.cx); + delpointer(context); + readmouse(context); + animpointer(context); + showpointer(context); + vsync(context); + dumppointer(context); + context.cx = context.pop(); + if (--context.cx) goto hangloopw; + {assert(stack_depth == context.stack.size()); return; } +} + +void hangoncurs(Context & context) { + uint stack_depth = context.stack.size(); +monloop1: + context.push(context.cx); + printcurs(context); + vsync(context); + delcurs(context); + context.cx = context.pop(); + if (--context.cx) goto monloop1; + {assert(stack_depth == context.stack.size()); return; } +} + +void getunderzoom(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (8)+5; + context.bx = (132)+4; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)); + context.cl = 46; + context.ch = 40; + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumpzoom(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kZoomon), 1); + if (!context.flags.z()) goto notzoomon; + context.di = (8)+5; + context.bx = (132)+4; + context.cl = 46; + context.ch = 40; + multidump(context); +notzoomon: + {assert(stack_depth == context.stack.size()); return; } +} + +void putunderzoom(Context & context) { + uint stack_depth = context.stack.size(); + context.di = (8)+5; + context.bx = (132)+4; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)); + context.cl = 46; + context.ch = 40; + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void crosshair(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kCommandtype), 3); + if (context.flags.z()) goto nocross; + context._cmp(context.data.byte(kCommandtype), 10); + if (!context.flags.c()) goto nocross; + context.es = context.data.word(kWorkspace); + context.ds = context.data.word(kIcons1); + context.di = (8)+24; + context.bx = (132)+19; + context.al = 9; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +nocross: + context.es = context.data.word(kWorkspace); + context.ds = context.data.word(kIcons1); + context.di = (8)+24; + context.bx = (132)+19; + context.al = 29; + context.ah = 0; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void showpointer(Context & context) { + uint stack_depth = context.stack.size(); + showblink(context); + context.di = context.data.word(kMousex); + context.data.word(kOldpointerx) = context.di; + context.bx = context.data.word(kMousey); + context.data.word(kOldpointery) = context.bx; + context._cmp(context.data.byte(kPickup), 1); + if (context.flags.z()) goto itsanobject; + context.push(context.bx); + context.push(context.di); + context.ds = context.data.word(kIcons1); + context.al = context.data.byte(kPointerframe); + context._add(context.al, 20); + context.ah = 0; + context._add(context.ax, context.ax); + context.si = context.ax; + context._add(context.ax, context.ax); + context._add(context.si, context.ax); + context.cx = context.ds.word(context.si); + context._cmp(context.cl, 12); + if (!context.flags.c()) goto notsmallx; + context.cl = 12; +notsmallx: + context._cmp(context.ch, 12); + if (!context.flags.c()) goto notsmally; + context.ch = 12; +notsmally: + context.data.byte(kPointerxs) = context.cl; + context.data.byte(kPointerys) = context.ch; + context.push(context.ds); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60); + multiget(context); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.push(context.di); + context.push(context.bx); + context.al = context.data.byte(kPointerframe); + context._add(context.al, 20); + context.ah = 0; + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +itsanobject: + context.al = context.data.byte(kItemframe); + context.ds = context.data.word(kExtras); + context._cmp(context.data.byte(kObjecttype), 4); + if (context.flags.z()) goto itsfrominv; + context.ds = context.data.word(kFreeframes); +itsfrominv: + context.cl = context.al; + context._add(context.al, context.al); + context._add(context.al, context.cl); + context._inc(context.al); + context.ah = 0; + context.push(context.ax); + context._add(context.ax, context.ax); + context.si = context.ax; + context._add(context.ax, context.ax); + context._add(context.si, context.ax); + context.ax = 2080; + context.cx = context.ds.word(context.si); + context._cmp(context.cl, 12); + if (!context.flags.c()) goto notsmallx2; + context.cl = 12; +notsmallx2: + context._cmp(context.ch, 12); + if (!context.flags.c()) goto notsmally2; + context.ch = 12; +notsmally2: + context.data.byte(kPointerxs) = context.cl; + context.data.byte(kPointerys) = context.ch; + context.ax = context.pop(); + context.push(context.di); + context.push(context.bx); + context.push(context.ax); + context.push(context.bx); + context.push(context.di); + context.push(context.ds); + context.al = context.cl; + context.ah = 0; + context._shr(context.ax, 1); + context._sub(context.data.word(kOldpointerx), context.ax); + context._sub(context.di, context.ax); + context.al = context.ch; + context._shr(context.ax, 1); + context._sub(context.data.word(kOldpointery), context.ax); + context._sub(context.bx, context.ax); + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60); + multiget(context); + context.ds = context.pop(); + context.di = context.pop(); + context.bx = context.pop(); + context.ax = context.pop(); + context.ah = 128; + showframe(context); + context.bx = context.pop(); + context.di = context.pop(); + context.ds = context.data.word(kIcons1); + context.al = 3; + context.ah = 128; + showframe(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void delpointer(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kOldpointerx); + context._cmp(context.ax, 0x0ffff); + if (context.flags.z()) goto nevershown; + context.data.word(kDelherex) = context.ax; + context.ax = context.data.word(kOldpointery); + context.data.word(kDelherey) = context.ax; + context.cl = context.data.byte(kPointerxs); + context.data.byte(kDelxs) = context.cl; + context.ch = context.data.byte(kPointerys); + context.data.byte(kDelys) = context.ch; + context.ds = context.data.word(kBuffers); + context.si = (0+(180*10)+32+60); + context.di = context.data.word(kDelherex); + context.bx = context.data.word(kDelherey); + multiput(context); +nevershown: + {assert(stack_depth == context.stack.size()); return; } +} + +void dumppointer(Context & context) { + uint stack_depth = context.stack.size(); + dumpblink(context); + context.cl = context.data.byte(kDelxs); + context.ch = context.data.byte(kDelys); + context.di = context.data.word(kDelherex); + context.bx = context.data.word(kDelherey); + multidump(context); + context.bx = context.data.word(kOldpointery); + context.di = context.data.word(kOldpointerx); + context._cmp(context.di, context.data.word(kDelherex)); + if (!context.flags.z()) goto difffound; + context._cmp(context.bx, context.data.word(kDelherey)); + if (context.flags.z()) goto notboth; +difffound: + context.cl = context.data.byte(kPointerxs); + context.ch = context.data.byte(kPointerys); + multidump(context); +notboth: + {assert(stack_depth == context.stack.size()); return; } +} + +void undertextline(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kTextaddressx); + context.bx = context.data.word(kTextaddressy); + context.ds = context.data.word(kBuffers); + context.si = (0); + context.cl = (180); + context.ch = (10); + multiget(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void deltextline(Context & context) { + uint stack_depth = context.stack.size(); + context.di = context.data.word(kTextaddressx); + context.bx = context.data.word(kTextaddressy); + context.ds = context.data.word(kBuffers); + context.si = (0); + context.cl = (180); + context.ch = (10); + multiput(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void dumptextline(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kNewtextline), 1); + if (!context.flags.z()) goto nodumptextline; + context.data.byte(kNewtextline) = 0; + context.di = context.data.word(kTextaddressx); + context.bx = context.data.word(kTextaddressy); + context.cl = (180); + context.ch = (10); + multidump(context); +nodumptextline: + {assert(stack_depth == context.stack.size()); return; } +} + +void animpointer(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kPointermode), 2); + if (context.flags.z()) goto combathand; + context._cmp(context.data.byte(kPointermode), 3); + if (context.flags.z()) goto mousehand; + context._cmp(context.data.word(kWatchingtime), 0); + if (context.flags.z()) goto notwatchpoint; + context.data.byte(kPointerframe) = 11; + {assert(stack_depth == context.stack.size()); return; } +notwatchpoint: + context.data.byte(kPointerframe) = 0; + context._cmp(context.data.byte(kInmaparea), 0); + if (context.flags.z()) goto gothand; + context._cmp(context.data.byte(kPointerfirstpath), 0); + if (context.flags.z()) goto gothand; +arrow: + getflagunderp(context); + context._cmp(context.cl, 2); + if (context.flags.c()) goto gothand; + context._cmp(context.cl, 128); + if (!context.flags.c()) goto gothand; + context.data.byte(kPointerframe) = 3; + context._test(context.cl, 4); + if (!context.flags.z()) goto gothand; + context.data.byte(kPointerframe) = 4; + context._test(context.cl, 16); + if (!context.flags.z()) goto gothand; + context.data.byte(kPointerframe) = 5; + context._test(context.cl, 2); + if (!context.flags.z()) goto gothand; + context.data.byte(kPointerframe) = 6; + context._test(context.cl, 8); + if (!context.flags.z()) goto gothand; + context.data.byte(kPointerframe) = 8; +gothand: + {assert(stack_depth == context.stack.size()); return; } +mousehand: + context._cmp(context.data.byte(kPointerspeed), 0); + if (context.flags.z()) goto rightspeed3; + context._dec(context.data.byte(kPointerspeed)); + goto finflashmouse; +rightspeed3: + context.data.byte(kPointerspeed) = 5; + context._inc(context.data.byte(kPointercount)); + context._cmp(context.data.byte(kPointercount), 16); + if (!context.flags.z()) goto finflashmouse; + context.data.byte(kPointercount) = 0; +finflashmouse: + context.al = context.data.byte(kPointercount); + context.ah = 0; + context.bx = 5895; + context._add(context.bx, context.ax); + context.al = context.cs.byte(context.bx); + context.data.byte(kPointerframe) = context.al; + {assert(stack_depth == context.stack.size()); return; } +combathand: + context.data.byte(kPointerframe) = 0; + context._cmp(context.data.byte(kReallocation), 14); + if (!context.flags.z()) goto notarrow; + context._cmp(context.data.byte(kCommandtype), 211); + if (!context.flags.z()) goto notarrow; + context.data.byte(kPointerframe) = 5; +notarrow: + {assert(stack_depth == context.stack.size()); return; } +} + +void readmouse(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousebutton); + context.data.word(kOldbutton) = context.ax; + context.ax = context.data.word(kMousex); + context.data.word(kOldx) = context.ax; + context.ax = context.data.word(kMousey); + context.data.word(kOldy) = context.ax; + mousecall(context); + context.data.word(kMousex) = context.cx; + context.data.word(kMousey) = context.dx; + context.data.word(kMousebutton) = context.bx; + {assert(stack_depth == context.stack.size()); return; } +} + +void readmouse1(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousex); + context.data.word(kOldx) = context.ax; + context.ax = context.data.word(kMousey); + context.data.word(kOldy) = context.ax; + mousecall(context); + context.data.word(kMousex) = context.cx; + context.data.word(kMousey) = context.dx; + context.data.word(kMousebutton1) = context.bx; + {assert(stack_depth == context.stack.size()); return; } +} + +void readmouse2(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousex); + context.data.word(kOldx) = context.ax; + context.ax = context.data.word(kMousey); + context.data.word(kOldy) = context.ax; + mousecall(context); + context.data.word(kMousex) = context.cx; + context.data.word(kMousey) = context.dx; + context.data.word(kMousebutton2) = context.bx; + {assert(stack_depth == context.stack.size()); return; } +} + +void readmouse3(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousex); + context.data.word(kOldx) = context.ax; + context.ax = context.data.word(kMousey); + context.data.word(kOldy) = context.ax; + mousecall(context); + context.data.word(kMousex) = context.cx; + context.data.word(kMousey) = context.dx; + context.data.word(kMousebutton3) = context.bx; + {assert(stack_depth == context.stack.size()); return; } +} + +void readmouse4(Context & context) { + uint stack_depth = context.stack.size(); + context.ax = context.data.word(kMousebutton); + context.data.word(kOldbutton) = context.ax; + context.ax = context.data.word(kMousex); + context.data.word(kOldx) = context.ax; + context.ax = context.data.word(kMousey); + context.data.word(kOldy) = context.ax; + mousecall(context); + context.data.word(kMousex) = context.cx; + context.data.word(kMousey) = context.dx; + context.ax = context.data.word(kMousebutton1); + context._or(context.ax, context.data.word(kMousebutton2)); + context._or(context.ax, context.data.word(kMousebutton3)); + context._or(context.bx, context.ax); + context.data.word(kMousebutton) = context.bx; + {assert(stack_depth == context.stack.size()); return; } +} + +void readkey(Context & context) { + uint stack_depth = context.stack.size(); + context.bx = context.data.word(kBufferout); + context._cmp(context.bx, context.data.word(kBufferin)); + if (context.flags.z()) goto nokey; + context._inc(context.bx); + context._and(context.bx, 15); + context.data.word(kBufferout) = context.bx; + context.di = 5912; + context._add(context.di, context.bx); + context.al = context.cs.byte(context.di); + context.data.byte(kCurrentkey) = context.al; + {assert(stack_depth == context.stack.size()); return; } +nokey: + context.data.byte(kCurrentkey) = 0; + {assert(stack_depth == context.stack.size()); return; } +} + +void convertkey(Context & context) { + uint stack_depth = context.stack.size(); + context._and(context.al, 127); + context.ah = 0; + context.di = 5928; + context._add(context.di, context.ax); + context.al = context.cs.byte(context.di); + {assert(stack_depth == context.stack.size()); return; } +} + +void randomnum1(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ds); + context.push(context.es); + context.push(context.di); + context.push(context.bx); + context.push(context.cx); + randomnumber(context); + context.cx = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.es = context.pop(); + context.ds = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void randomnum2(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.ds); + context.push(context.es); + context.push(context.di); + context.push(context.bx); + context.push(context.ax); + randomnumber(context); + context.cl = context.al; + context.ax = context.pop(); + context.bx = context.pop(); + context.di = context.pop(); + context.es = context.pop(); + context.ds = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void hangon(Context & context) { + uint stack_depth = context.stack.size(); +hangonloop: + context.push(context.cx); + vsync(context); + context.cx = context.pop(); + if (--context.cx) goto hangonloop; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadtraveltext(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 2234; + standardload(context); + context.data.word(kTraveltext) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadintotemp(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.cs; + standardload(context); + context.data.word(kTempgraphics) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadintotemp2(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.cs; + standardload(context); + context.data.word(kTempgraphics2) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadintotemp3(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.cs; + standardload(context); + context.data.word(kTempgraphics3) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadtempcharset(Context & context) { + uint stack_depth = context.stack.size(); + standardload(context); + context.data.word(kTempcharset) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void standardload(Context & context) { + uint stack_depth = context.stack.size(); + openfile(context); + readheader(context); + context.bx = context.es.word(context.di); + context.push(context.bx); + context.cl = 4; + context._shr(context.bx, context.cl); + allocatemem(context); + context.ds = context.ax; + context.cx = context.pop(); + context.push(context.ax); + context.dx = 0; + readfromfile(context); + closefile(context); + context.ax = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadtemptext(Context & context) { + uint stack_depth = context.stack.size(); + standardload(context); + context.data.word(kTextfile1) = context.ax; + {assert(stack_depth == context.stack.size()); return; } +} + +void loadroom(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kRoomloaded) = 1; + context.data.word(kTimecount) = 0; + context.data.word(kMaintimer) = 0; + context.data.word(kMapoffsetx) = 104; + context.data.word(kMapoffsety) = 38; + context.data.word(kTextaddressx) = 13; + context.data.word(kTextaddressy) = 182; + context.data.byte(kTextlen) = 240; + context.al = context.data.byte(kNewlocation); + context.data.byte(kLocation) = context.al; + getroomdata(context); + startloading(context); + loadroomssample(context); + switchryanon(context); + drawflags(context); + getdimension(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void loadroomssample(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kRoomssample); + context._cmp(context.al, 255); + if (context.flags.z()) goto loadedalready; + context._cmp(context.al, context.data.byte(kCurrentsample)); + if (context.flags.z()) goto loadedalready; + context.data.byte(kCurrentsample) = context.al; + context.al = context.data.byte(kCurrentsample); + context.cl = '0'; + twodigitnum(context); + context.di = 1896; + context._xchg(context.al, context.ah); + context.cs.word(context.di+10) = context.ax; + context.dx = context.di; + loadsecondsample(context); +loadedalready: + {assert(stack_depth == context.stack.size()); return; } +} + +void getridofreels(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRoomloaded), 0); + if (context.flags.z()) goto dontgetrid; + context.es = context.data.word(kReel1); + deallocatemem(context); + context.es = context.data.word(kReel2); + deallocatemem(context); + context.es = context.data.word(kReel3); + deallocatemem(context); +dontgetrid: + {assert(stack_depth == context.stack.size()); return; } +} + +void getridofall(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kBackdrop); + deallocatemem(context); + context.es = context.data.word(kSetframes); + deallocatemem(context); + context.es = context.data.word(kReel1); + deallocatemem(context); + context.es = context.data.word(kReel2); + deallocatemem(context); + context.es = context.data.word(kReel3); + deallocatemem(context); + context.es = context.data.word(kReels); + deallocatemem(context); + context.es = context.data.word(kPeople); + deallocatemem(context); + context.es = context.data.word(kSetdesc); + deallocatemem(context); + context.es = context.data.word(kBlockdesc); + deallocatemem(context); + context.es = context.data.word(kRoomdesc); + deallocatemem(context); + context.es = context.data.word(kFreeframes); + deallocatemem(context); + context.es = context.data.word(kFreedesc); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void restorereels(Context & context) { + uint stack_depth = context.stack.size(); + context._cmp(context.data.byte(kRoomloaded), 0); + if (context.flags.z()) goto dontrestore; + context.al = context.data.byte(kReallocation); + getroomdata(context); + context.dx = context.bx; + openfile(context); + readheader(context); + dontloadseg(context); + dontloadseg(context); + dontloadseg(context); + dontloadseg(context); + allocateload(context); + context.data.word(kReel1) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel2) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel3) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + closefile(context); +dontrestore: + {assert(stack_depth == context.stack.size()); return; } +} + +void restoreall(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kLocation); + getroomdata(context); + context.dx = context.bx; + openfile(context); + readheader(context); + allocateload(context); + context.ds = context.ax; + context.data.word(kBackdrop) = context.ax; + context.dx = (0); + loadseg(context); + context.ds = context.data.word(kWorkspace); + context.dx = (0); + context.cx = 132*66; + context.al = 0; + fillspace(context); + loadseg(context); + sortoutmap(context); + allocateload(context); + context.data.word(kSetframes) = context.ax; + context.ds = context.ax; + context.dx = (0); + loadseg(context); + dontloadseg(context); + allocateload(context); + context.data.word(kReel1) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel2) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel3) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReels) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kPeople) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kSetdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kBlockdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kRoomdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kFreeframes) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + dontloadseg(context); + allocateload(context); + context.data.word(kFreedesc) = context.ax; + context.ds = context.ax; + context.dx = (0); + loadseg(context); + closefile(context); + setallchanges(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void sortoutmap(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.di); + context.ds = context.data.word(kWorkspace); + context.si = 0; + context.es = context.data.word(kMapdata); + context.di = 0; + context.cx = (60); +blimey: + context.push(context.cx); + context.push(context.si); + context.cx = (66); + while(context.cx--) context._movsb(); + context.si = context.pop(); + context.cx = context.pop(); + context._add(context.si, 132); + if (--context.cx) goto blimey; + context.di = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void startloading(Context & context) { + uint stack_depth = context.stack.size(); + context.data.byte(kCombatcount) = 0; + context.al = context.cs.byte(context.bx+13); + context.data.byte(kRoomssample) = context.al; + context.al = context.cs.byte(context.bx+15); + context.data.byte(kMapx) = context.al; + context.al = context.cs.byte(context.bx+16); + context.data.byte(kMapy) = context.al; + context.al = context.cs.byte(context.bx+20); + context.data.byte(kLiftflag) = context.al; + context.al = context.cs.byte(context.bx+21); + context.data.byte(kManspath) = context.al; + context.data.byte(kDestination) = context.al; + context.data.byte(kFinaldest) = context.al; + context.al = context.cs.byte(context.bx+22); + context.data.byte(kFacing) = context.al; + context.data.byte(kTurntoface) = context.al; + context.al = context.cs.byte(context.bx+23); + context.data.byte(kCounttoopen) = context.al; + context.al = context.cs.byte(context.bx+24); + context.data.byte(kLiftpath) = context.al; + context.al = context.cs.byte(context.bx+25); + context.data.byte(kDoorpath) = context.al; + context.data.byte(kLastweapon) = -1; + context.al = context.cs.byte(context.bx+27); + context.push(context.ax); + context.al = context.cs.byte(context.bx+31); + context.ah = context.data.byte(kReallocation); + context.data.byte(kReallocation) = context.al; + context.dx = context.bx; + openfile(context); + readheader(context); + allocateload(context); + context.ds = context.ax; + context.data.word(kBackdrop) = context.ax; + context.dx = (0); + loadseg(context); + context.ds = context.data.word(kWorkspace); + context.dx = (0); + context.cx = 132*66; + context.al = 0; + fillspace(context); + loadseg(context); + sortoutmap(context); + allocateload(context); + context.data.word(kSetframes) = context.ax; + context.ds = context.ax; + context.dx = (0); + loadseg(context); + context.ds = context.data.word(kSetdat); + context.dx = 0; + context.cx = (64*128); + context.al = 255; + fillspace(context); + loadseg(context); + allocateload(context); + context.data.word(kReel1) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel2) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReel3) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kReels) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kPeople) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kSetdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kBlockdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kRoomdesc) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + allocateload(context); + context.data.word(kFreeframes) = context.ax; + context.ds = context.ax; + context.dx = 0; + loadseg(context); + context.ds = context.data.word(kFreedat); + context.dx = 0; + context.cx = (16*80); + context.al = 255; + fillspace(context); + loadseg(context); + allocateload(context); + context.data.word(kFreedesc) = context.ax; + context.ds = context.ax; + context.dx = (0); + loadseg(context); + closefile(context); + findroominloc(context); + deletetaken(context); + setallchanges(context); + autoappear(context); + context.al = context.data.byte(kNewlocation); + getroomdata(context); + context.data.byte(kLastweapon) = -1; + context.data.byte(kMandead) = 0; + context.data.word(kLookcounter) = 160; + context.data.byte(kNewlocation) = 255; + context.data.byte(kLinepointer) = 254; + context.ax = context.pop(); + context._cmp(context.al, 255); + if (context.flags.z()) goto dontwalkin; + context.data.byte(kManspath) = context.al; + context.push(context.bx); + autosetwalk(context); + context.bx = context.pop(); +dontwalkin: + findxyfrompath(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void disablepath(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.cx); + context._xchg(context.al, context.ah); + context.cx = -6; +looky2: + context._add(context.cx, 6); + context._sub(context.al, 10); + if (!context.flags.c()) goto looky2; + context.al = context.ah; + context._dec(context.cx); +lookx2: + context._inc(context.cx); + context._sub(context.al, 11); + if (!context.flags.c()) goto lookx2; + context.al = context.cl; + context.ah = 0; + context.cx = 144; + context._mul(context.cx); + context.es = context.data.word(kReels); + context.bx = (0); + context._add(context.bx, context.ax); + context.ax = context.pop(); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.al = 0; + context.es.byte(context.bx+6) = context.al; + {assert(stack_depth == context.stack.size()); return; } +} + +void findxyfrompath(Context & context) { + uint stack_depth = context.stack.size(); + getroomspaths(context); + context.al = context.data.byte(kManspath); + context.ah = 0; + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.ax, context.ax); + context._add(context.bx, context.ax); + context.ax = context.es.word(context.bx); + context._sub(context.al, 12); + context._sub(context.ah, 12); + context.data.byte(kRyanx) = context.al; + context.data.byte(kRyany) = context.ah; + {assert(stack_depth == context.stack.size()); return; } +} + +void findroominloc(Context & context) { + uint stack_depth = context.stack.size(); + context.al = context.data.byte(kMapy); + context.cx = -6; +looky: + context._add(context.cx, 6); + context._sub(context.al, 10); + if (!context.flags.c()) goto looky; + context.al = context.data.byte(kMapx); + context._dec(context.cx); +lookx: + context._inc(context.cx); + context._sub(context.al, 11); + if (!context.flags.c()) goto lookx; + context.data.byte(kRoomnum) = context.cl; + {assert(stack_depth == context.stack.size()); return; } +} + +void getroomdata(Context & context) { + uint stack_depth = context.stack.size(); + context.ah = 0; + context.cx = 32; + context._mul(context.cx); + context.bx = 6187; + context._add(context.bx, context.ax); + {assert(stack_depth == context.stack.size()); return; } +} + +void readheader(Context & context) { + uint stack_depth = context.stack.size(); + context.ds = context.cs; + context.dx = 6091; + context.cx = (6187-6091); + readfromfile(context); + context.es = context.cs; + context.di = 6141; + {assert(stack_depth == context.stack.size()); return; } +} + +void allocateload(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.di); + context.bx = context.es.word(context.di); + context.cl = 4; + context._shr(context.bx, context.cl); + allocatemem(context); + context.di = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void fillspace(Context & context) { + uint stack_depth = context.stack.size(); + context.push(context.es); + context.push(context.ds); + context.push(context.dx); + context.push(context.di); + context.push(context.bx); + context.di = context.dx; + context.es = context.ds; + while(context.cx--) context._stosb(); + context.bx = context.pop(); + context.di = context.pop(); + context.dx = context.pop(); + context.ds = context.pop(); + context.es = context.pop(); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftemp(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTempgraphics); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftemptext(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTextfile1); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftemp2(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTempgraphics2); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftemp3(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTempgraphics3); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftempcharset(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTempcharset); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void getridoftempsp(Context & context) { + uint stack_depth = context.stack.size(); + context.es = context.data.word(kTempsprites); + deallocatemem(context); + {assert(stack_depth == context.stack.size()); return; } +} + +void readsetdata(Context & context) { + uint stack_depth = context.stack.size(); + context.dx = 1857; + standardload(context); + context.data.word(kCharset1) = context.ax; + context.dx = 1922; + standardload(context); + context.data.word(kIcons1) = context.ax; + context.dx = 1935; + standardload(context); + context.data.word(kIcons2) = context.ax; + context.dx = 1819; + standardload(context); + context.data.word(kMainsprites) = context.ax; + context.dx = 2221; + standardload(context); + context.data.word(kPuzzletext) = context.ax; + context.dx = 2273; + standardload(context); + context.data.word(kCommandtext) = context.ax; + context.ax = context.data.word(kCharset1); + context.data.word(kCurrentset) = context.ax; + context._cmp(context.data.byte(kSoundint), 255); + if (context.flags.z()) goto novolumeload; + context.dx = 2286; + openfile(context); + context.cx = 2048-256; + context.ds = context.data.word(kSoundbuffer); + context.dx = 16384; + readfromfile(context); + closefile(context); +novolumeload: + {assert(stack_depth == context.stack.size()); return; } +} + +void makename(Context & context) { + uint stack_depth = context.stack.size(); + context.si = context.dx; + context.di = 6061; +transfer: + context.al = context.cs.byte(context.si); + context.cs.byte(context.di) = context.al; + context._inc(context.si); + context._inc(context.di); + context._cmp(context.al, 0); + if (!context.flags.z()) goto transfer; + context.dx = 6059; + {assert(stack_depth == context.stack.size()); return; } +} + +void dreamweb(Context & context) { + uint stack_depth = context.stack.size(); + seecommandtail(context); + checkbasemem(context); + soundstartup(context); + setkeyboardint(context); + setupemm(context); + allocatebuffers(context); + setmouse(context); + fadedos(context); + gettime(context); + clearbuffers(context); + clearpalette(context); + set16colpalette(context); + readsetdata(context); + context.data.byte(kWongame) = 0; + context.dx = 1909; + loadsample(context); + setsoundoff(context); + scanfornames(context); + context._cmp(context.al, 0); + if (!context.flags.z()) goto dodecisions; + setmode(context); + loadpalfromiff(context); + titles(context); + credits(context); + goto playgame; +dodecisions: + cls(context); + setmode(context); + decide(context); + context._cmp(context.data.byte(kGetback), 4); + if (context.flags.z()) goto mainloop; + titles(context); + credits(context); +playgame: + clearchanges(context); + setmode(context); + loadpalfromiff(context); + context.data.byte(kLocation) = 255; + context.data.byte(kRoomafterdream) = 1; + context.data.byte(kNewlocation) = 35; + context.data.byte(kVolume) = 7; + loadroom(context); + clearsprites(context); + initman(context); + entrytexts(context); + entryanims(context); + context.data.byte(kDestpos) = 3; + initialinv(context); + context.data.byte(kLastflag) = 32; + startup1(context); + context.data.byte(kVolumeto) = 0; + context.data.byte(kVolumedirection) = -1; + context.data.byte(kCommandtype) = 255; + goto mainloop; +loadnew: + clearbeforeload(context); + loadroom(context); + clearsprites(context); + initman(context); + entrytexts(context); + entryanims(context); + context.data.byte(kNewlocation) = 255; + startup(context); + context.data.byte(kCommandtype) = 255; + worktoscreenm(context); + goto mainloop; +alreadyloaded: + context.data.byte(kNewlocation) = 255; + clearsprites(context); + initman(context); + startup(context); + context.data.byte(kCommandtype) = 255; +mainloop: + screenupdate(context); + context._cmp(context.data.byte(kWongame), 0); + if (!context.flags.z()) goto endofgame; + context._cmp(context.data.byte(kMandead), 1); + if (context.flags.z()) goto gameover; + context._cmp(context.data.byte(kMandead), 2); + if (context.flags.z()) goto gameover; + context._cmp(context.data.word(kWatchingtime), 0); + if (context.flags.z()) goto notwatching; + context.al = context.data.byte(kFinaldest); + context._cmp(context.al, context.data.byte(kManspath)); + if (!context.flags.z()) goto mainloop; + context._dec(context.data.word(kWatchingtime)); + if (!context.flags.z()) goto mainloop; +notwatching: + context._cmp(context.data.byte(kMandead), 4); + if (context.flags.z()) goto gameover; + context._cmp(context.data.byte(kNewlocation), 255); + if (!context.flags.z()) goto loadnew; + goto mainloop; +gameover: + clearbeforeload(context); + showgun(context); + fadescreendown(context); + context.cx = 100; + hangon(context); + goto dodecisions; +endofgame: + clearbeforeload(context); + fadescreendowns(context); + context.cx = 200; + hangon(context); + endgame(context); + { quickquit2(context); return; }; +} + + + +void __start(Context &context) { + static const uint8 src[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0xff, 0x00, + 0xff, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0xb6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, + 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, + 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, + 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, + 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, + 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, + 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, + 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, + 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, + 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, + 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, + 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, + 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, + 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, + 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, + 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, + 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, + 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, + 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, + 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, + 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, + 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, + 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, + 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x7c, + 0xc0, 0x80, 0xc0, 0x1c, 0xc0, 0x20, 0xc0, 0x00, 0xc1, 0x10, 0xc0, 0x18, 0xc0, 0xf4, 0xc0, 0x0c, + 0xc0, 0x24, 0xc0, 0x28, 0xc0, 0x2c, 0xc0, 0x30, 0xc0, 0x54, 0xc0, 0x78, 0xc0, 0x50, 0xc0, 0x74, + 0xc0, 0x34, 0xc0, 0x38, 0xc0, 0x40, 0xc0, 0x44, 0xc0, 0x48, 0xc0, 0x3c, 0xc0, 0x14, 0xc0, 0x88, + 0xc0, 0x8c, 0xc0, 0x90, 0xc0, 0x70, 0xc0, 0xfc, 0xc0, 0x6c, 0xc0, 0x58, 0xc0, 0x68, 0xc0, 0x04, + 0xc1, 0x64, 0xc0, 0x60, 0xc0, 0x5c, 0xc0, 0x94, 0xc0, 0x04, 0xc0, 0xa4, 0xc0, 0x9c, 0xc0, 0xa0, + 0xc0, 0xa8, 0xc0, 0xac, 0xc0, 0x98, 0xc0, 0xb0, 0xc0, 0xb4, 0xc0, 0xc8, 0xc0, 0xcc, 0xc0, 0xd4, + 0xc0, 0xdc, 0xc0, 0xd8, 0xc0, 0x00, 0xc0, 0x08, 0xc0, 0x84, 0xc0, 0x84, 0xc0, 0x84, 0xc0, 0x84, + 0xc0, 0x00, 0x3c, 0x21, 0x47, 0x0b, 0x52, 0x16, 0x5d, 0x01, 0x2c, 0x0a, 0x10, 0x04, 0x0b, 0x1e, + 0x0e, 0x04, 0x16, 0x1e, 0x0e, 0x03, 0x21, 0x0a, 0x0e, 0x0a, 0x21, 0x1e, 0x0e, 0x0a, 0x16, 0x1e, + 0x18, 0x09, 0x16, 0x0a, 0x0e, 0x02, 0x21, 0x00, 0x0e, 0x02, 0x16, 0x00, 0x0e, 0x06, 0x0b, 0x1e, + 0x0e, 0x07, 0x0b, 0x14, 0x12, 0x07, 0x00, 0x14, 0x12, 0x07, 0x00, 0x1e, 0x12, 0x37, 0x2c, 0x00, + 0x0e, 0x05, 0x16, 0x1e, 0x0e, 0x08, 0x00, 0x0a, 0x12, 0x08, 0x0b, 0x0a, 0x12, 0x08, 0x16, 0x0a, + 0x12, 0x08, 0x21, 0x0a, 0x12, 0x08, 0x21, 0x14, 0x12, 0x08, 0x21, 0x1e, 0x12, 0x08, 0x21, 0x28, + 0x12, 0x08, 0x16, 0x28, 0x12, 0x08, 0x0b, 0x28, 0x12, 0x15, 0x2c, 0x14, 0x12, 0xff, 0x2e, 0x05, + 0x2f, 0x05, 0x33, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x46, 0x05, 0x2e, 0x05, 0x4d, 0x05, + 0x5d, 0x05, 0x64, 0x05, 0x68, 0x05, 0x6c, 0x05, 0x70, 0x05, 0x7d, 0x05, 0x2e, 0x05, 0x2e, 0x05, + 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x9f, 0x05, 0x2e, 0x05, 0xb5, 0x05, 0xd4, 0x05, 0x2e, 0x05, + 0xe1, 0x05, 0xf7, 0x05, 0x0d, 0x06, 0x26, 0x06, 0x39, 0x06, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, + 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, + 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x49, 0x06, 0x50, 0x06, 0x75, 0x06, 0x2e, 0x05, + 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x82, 0x06, 0x86, 0x06, 0x2e, 0x05, 0x8d, 0x06, 0xff, 0x0f, + 0x01, 0x01, 0xff, 0x0c, 0x05, 0x00, 0x0d, 0x15, 0x00, 0x0f, 0x23, 0x00, 0x11, 0x32, 0x00, 0x12, + 0x67, 0x00, 0x13, 0x6c, 0x00, 0xff, 0x12, 0x13, 0x00, 0x13, 0x17, 0x00, 0xff, 0x0c, 0x33, 0x00, + 0x0d, 0x35, 0x00, 0x0e, 0x0e, 0x00, 0x0f, 0x14, 0x00, 0x00, 0x4e, 0x00, 0xff, 0x0c, 0x77, 0x00, + 0x0c, 0x91, 0x00, 0xff, 0x0d, 0x10, 0x00, 0xff, 0x0d, 0x14, 0x00, 0xff, 0x0e, 0x10, 0x00, 0xff, + 0x0f, 0x04, 0x00, 0x10, 0x08, 0x00, 0x11, 0x86, 0x00, 0x12, 0x99, 0x00, 0xff, 0x0d, 0x6c, 0x00, + 0x0f, 0x46, 0x01, 0x0f, 0x4b, 0x01, 0x0f, 0x50, 0x01, 0x0f, 0x56, 0x01, 0x0f, 0x5c, 0x01, 0x0f, + 0x62, 0x01, 0x12, 0x9f, 0x00, 0x12, 0xb2, 0x00, 0x93, 0xd9, 0x00, 0x54, 0xe4, 0x00, 0xff, 0x0d, + 0x14, 0x00, 0x0d, 0x15, 0x00, 0x0f, 0x22, 0x00, 0x0d, 0x34, 0x00, 0x0d, 0x37, 0x00, 0x19, 0x39, + 0x00, 0x15, 0x49, 0x00, 0xff, 0x0d, 0xc4, 0x00, 0x0d, 0xea, 0x00, 0x0d, 0x9c, 0x00, 0x0e, 0x81, + 0x00, 0x0d, 0x7c, 0x00, 0x0f, 0xa2, 0x00, 0x0f, 0xc8, 0x00, 0x0f, 0xef, 0x00, 0x11, 0x63, 0x00, + 0x0c, 0x34, 0x00, 0xff, 0x0f, 0x38, 0x00, 0x10, 0x40, 0x00, 0x13, 0x16, 0x00, 0x14, 0x21, 0x00, + 0xff, 0x14, 0x0b, 0x00, 0x14, 0x0f, 0x00, 0x0f, 0x1c, 0x00, 0x0d, 0x50, 0x00, 0x15, 0x52, 0x00, + 0x93, 0x57, 0x00, 0x57, 0x80, 0x00, 0xff, 0x0c, 0x0d, 0x00, 0x0e, 0x27, 0x00, 0x0c, 0x43, 0x00, + 0x0c, 0x4b, 0x00, 0x0c, 0x53, 0x00, 0x0c, 0x5b, 0x00, 0x0f, 0x66, 0x00, 0xff, 0x16, 0x24, 0x00, + 0x0d, 0x7d, 0x00, 0x12, 0x58, 0x00, 0x0f, 0x6b, 0x00, 0x0e, 0x7f, 0x00, 0x0e, 0x9a, 0x00, 0x93, + 0xaa, 0x00, 0x57, 0xe8, 0x00, 0xff, 0x15, 0x10, 0x00, 0x15, 0x48, 0x00, 0x15, 0xcd, 0x00, 0x16, + 0x3f, 0x00, 0x97, 0x63, 0x00, 0x58, 0x9e, 0x00, 0xff, 0x0d, 0x15, 0x00, 0x0e, 0x18, 0x00, 0x93, + 0x32, 0x00, 0x57, 0x4b, 0x00, 0x18, 0x80, 0x00, 0xff, 0x53, 0x2e, 0x00, 0x10, 0xa7, 0x00, 0xff, + 0x10, 0x13, 0x00, 0x0e, 0x24, 0x00, 0x10, 0x32, 0x00, 0x0e, 0x41, 0x00, 0x10, 0x51, 0x00, 0x0e, + 0x60, 0x00, 0x10, 0x72, 0x00, 0x0e, 0x81, 0x00, 0x10, 0x93, 0x00, 0x0e, 0xa2, 0x00, 0x10, 0xb1, + 0x00, 0x0e, 0xbf, 0x00, 0xff, 0x0d, 0x30, 0x00, 0x0e, 0x29, 0x00, 0x0f, 0x4e, 0x00, 0x10, 0x5c, + 0x00, 0xff, 0x10, 0x73, 0x00, 0xff, 0x15, 0x67, 0x00, 0x14, 0xc7, 0x00, 0xff, 0x11, 0x35, 0x00, + 0x11, 0x36, 0x00, 0x11, 0x37, 0x00, 0x11, 0x38, 0x00, 0x11, 0x39, 0x00, 0x11, 0x3a, 0x00, 0x11, + 0x3b, 0x00, 0x11, 0x3d, 0x00, 0x11, 0x3f, 0x00, 0x11, 0x40, 0x00, 0x11, 0x41, 0x00, 0xff, 0x9c, + 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, + 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, + 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, + 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, + 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, + 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, + 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9c, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x53, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, + 0x2e, 0x53, 0x30, 0x32, 0x00, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x2e, 0x44, 0x41, 0x54, + 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x30, 0x00, 0x44, 0x52, + 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, + 0x2e, 0x56, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, + 0x39, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x30, 0x00, 0x44, + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, + 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + 0x42, 0x2e, 0x47, 0x30, 0x38, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, + 0x30, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x37, 0x00, + 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45, + 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, + 0x45, 0x42, 0x2e, 0x47, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, + 0x47, 0x31, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x30, 0x31, + 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x30, 0x32, 0x00, 0x44, 0x52, + 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, + 0x2e, 0x54, 0x31, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31, + 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x30, 0x00, 0x44, + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, + 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + 0x42, 0x2e, 0x54, 0x32, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, + 0x32, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x35, 0x30, 0x00, + 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x35, 0x31, 0x00, 0x44, 0x52, 0x45, + 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, + 0x45, 0x42, 0x2e, 0x54, 0x38, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, + 0x54, 0x38, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x33, + 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x34, 0x00, 0x44, 0x52, + 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x4f, 0x4c, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x39, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, + 0x2e, 0x47, 0x31, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, + 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x32, 0x00, 0x44, + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, + 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + 0x42, 0x2e, 0x49, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, + 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x32, 0x00, + 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x33, 0x00, 0x44, 0x52, 0x45, + 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, + 0x45, 0x42, 0x2e, 0x49, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, + 0x49, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x37, + 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x50, 0x41, 0x4c, 0x00, 0x11, 0x01, + 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x44, 0xc3, 0x04, 0x01, 0x2c, 0x01, 0x00, 0x00, 0x2c, 0x00, + 0x80, 0xc5, 0xd2, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x2c, 0x00, 0xdc, 0xc3, 0x90, 0x00, 0xb0, 0x00, + 0x40, 0x00, 0x60, 0x00, 0x80, 0xc3, 0x00, 0x00, 0x32, 0x00, 0x32, 0x00, 0xc8, 0x00, 0x84, 0xc3, + 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, + 0x9d, 0x00, 0xc6, 0x00, 0x44, 0xc3, 0xff, 0x00, 0x26, 0x01, 0x00, 0x00, 0x18, 0x00, 0xc8, 0xc3, + 0xf7, 0x00, 0x2d, 0x01, 0x28, 0x00, 0x38, 0x00, 0x48, 0xc3, 0x50, 0x00, 0x00, 0x01, 0x9e, 0x00, + 0xca, 0x00, 0xe0, 0xc3, 0x50, 0x00, 0x2c, 0x01, 0x3a, 0x00, 0x92, 0x00, 0x98, 0xc3, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, + 0xc6, 0x00, 0x44, 0xc3, 0xf7, 0x00, 0x2d, 0x01, 0x28, 0x00, 0x38, 0x00, 0x48, 0xc3, 0x50, 0x00, + 0x2c, 0x01, 0x3a, 0x00, 0x92, 0x00, 0xbc, 0xc6, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, + 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0xf0, 0x00, + 0x22, 0x01, 0x02, 0x00, 0x2c, 0x00, 0x94, 0xc4, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, + 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xee, 0x00, 0x02, 0x01, 0x04, 0x00, + 0x2c, 0x00, 0xc8, 0xc4, 0x68, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x2c, 0x00, 0xcc, 0xc4, 0x18, 0x01, + 0x34, 0x01, 0x04, 0x00, 0x2c, 0x00, 0xb0, 0xc4, 0x68, 0x00, 0xd8, 0x00, 0x8a, 0x00, 0xc0, 0x00, + 0xd0, 0xc4, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0x00, 0x00, 0x40, 0x01, + 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x45, 0x58, 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, + 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, + 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, + 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x4e, 0x45, 0x54, 0x57, 0xe8, 0xc4, 0x45, 0x4c, + 0x56, 0x41, 0x8c, 0xc6, 0x45, 0x4c, 0x56, 0x42, 0x9c, 0xc6, 0x45, 0x4c, 0x56, 0x43, 0x94, 0xc6, + 0x45, 0x4c, 0x56, 0x45, 0x98, 0xc6, 0x45, 0x4c, 0x56, 0x46, 0xa0, 0xc6, 0x43, 0x47, 0x41, 0x54, + 0x30, 0xc7, 0x52, 0x45, 0x4d, 0x4f, 0xa8, 0xc6, 0x42, 0x55, 0x54, 0x41, 0x3c, 0xc7, 0x43, 0x42, + 0x4f, 0x58, 0x44, 0xc7, 0x4c, 0x49, 0x54, 0x45, 0x5c, 0xc6, 0x50, 0x4c, 0x41, 0x54, 0x40, 0xc7, + 0x4c, 0x49, 0x46, 0x54, 0x7c, 0xc6, 0x57, 0x49, 0x52, 0x45, 0x84, 0xc6, 0x48, 0x4e, 0x44, 0x4c, + 0x88, 0xc6, 0x48, 0x41, 0x43, 0x48, 0x80, 0xc6, 0x44, 0x4f, 0x4f, 0x52, 0xb4, 0xc6, 0x43, 0x53, + 0x48, 0x52, 0x70, 0xc6, 0x47, 0x55, 0x4e, 0x41, 0x34, 0xc7, 0x43, 0x52, 0x41, 0x41, 0x64, 0xc6, + 0x43, 0x52, 0x42, 0x42, 0x68, 0xc6, 0x43, 0x52, 0x43, 0x43, 0x6c, 0xc6, 0x53, 0x45, 0x41, 0x54, + 0xf8, 0xc5, 0x4d, 0x45, 0x4e, 0x55, 0x98, 0xc7, 0x43, 0x4f, 0x4f, 0x4b, 0xac, 0xc6, 0x45, 0x4c, + 0x43, 0x41, 0x4c, 0xc6, 0x45, 0x44, 0x43, 0x41, 0x50, 0xc6, 0x44, 0x44, 0x43, 0x41, 0x54, 0xc6, + 0x41, 0x4c, 0x54, 0x52, 0x04, 0xc6, 0x4c, 0x4f, 0x4b, 0x41, 0x3c, 0xc6, 0x4c, 0x4f, 0x4b, 0x42, + 0x40, 0xc6, 0x45, 0x4e, 0x54, 0x41, 0x10, 0xc6, 0x45, 0x4e, 0x54, 0x42, 0x24, 0xc6, 0x45, 0x4e, + 0x54, 0x45, 0x28, 0xc6, 0x45, 0x4e, 0x54, 0x43, 0x18, 0xc6, 0x45, 0x4e, 0x54, 0x44, 0x2c, 0xc6, + 0x45, 0x4e, 0x54, 0x48, 0x30, 0xc6, 0x57, 0x57, 0x41, 0x54, 0xf0, 0xc5, 0x50, 0x4f, 0x4f, 0x4c, + 0x58, 0xc6, 0x57, 0x53, 0x48, 0x44, 0xf4, 0xc5, 0x47, 0x52, 0x41, 0x46, 0x44, 0xc6, 0x54, 0x52, + 0x41, 0x50, 0x48, 0xc6, 0x43, 0x44, 0x50, 0x45, 0x28, 0xc7, 0x44, 0x4c, 0x4f, 0x4b, 0x08, 0xc6, + 0x48, 0x4f, 0x4c, 0x45, 0x00, 0xc6, 0x44, 0x52, 0x59, 0x52, 0x0c, 0xc6, 0x48, 0x4f, 0x4c, 0x59, + 0xfc, 0xc5, 0x57, 0x41, 0x4c, 0x4c, 0x2c, 0xc7, 0x42, 0x4f, 0x4f, 0x4b, 0x08, 0xc8, 0x41, 0x58, + 0x45, 0x44, 0xb0, 0xc6, 0x53, 0x48, 0x4c, 0x44, 0x38, 0xc7, 0x42, 0x43, 0x4e, 0x59, 0xe8, 0xc5, + 0x4c, 0x49, 0x44, 0x43, 0xe4, 0xc5, 0x4c, 0x49, 0x44, 0x55, 0xe0, 0xc5, 0x4c, 0x49, 0x44, 0x4f, + 0xec, 0xc5, 0x50, 0x49, 0x50, 0x45, 0xa8, 0xc5, 0x42, 0x41, 0x4c, 0x43, 0x20, 0xc6, 0x57, 0x49, + 0x4e, 0x44, 0x1c, 0xc6, 0x50, 0x41, 0x50, 0x52, 0xb4, 0xc7, 0x55, 0x57, 0x54, 0x41, 0xa0, 0xc5, + 0x55, 0x57, 0x54, 0x42, 0xa0, 0xc5, 0x53, 0x54, 0x41, 0x54, 0xd8, 0xc7, 0x54, 0x4c, 0x49, 0x44, + 0x9c, 0xc5, 0x53, 0x4c, 0x41, 0x42, 0xd8, 0xc5, 0x43, 0x41, 0x52, 0x54, 0xdc, 0xc5, 0x46, 0x43, + 0x41, 0x52, 0xac, 0xc5, 0x53, 0x4c, 0x42, 0x41, 0xc0, 0xc5, 0x53, 0x4c, 0x42, 0x42, 0xc4, 0xc5, + 0x53, 0x4c, 0x42, 0x43, 0xcc, 0xc5, 0x53, 0x4c, 0x42, 0x44, 0xc8, 0xc5, 0x53, 0x4c, 0x42, 0x45, + 0xd0, 0xc5, 0x53, 0x4c, 0x42, 0x46, 0xd4, 0xc5, 0x50, 0x4c, 0x49, 0x4e, 0xb0, 0xc5, 0x4c, 0x41, + 0x44, 0x44, 0xb8, 0xc5, 0x4c, 0x41, 0x44, 0x42, 0xbc, 0xc5, 0x47, 0x55, 0x4d, 0x41, 0xb4, 0xc5, + 0x53, 0x51, 0x45, 0x45, 0x88, 0xc5, 0x54, 0x41, 0x50, 0x50, 0x8c, 0xc5, 0x47, 0x55, 0x49, 0x54, + 0x90, 0xc5, 0x43, 0x4f, 0x4e, 0x54, 0x94, 0xc5, 0x42, 0x45, 0x4c, 0x4c, 0x98, 0xc5, 0x8c, 0x8c, + 0x8c, 0x8c, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x9d, 0x00, 0xb2, 0x00, 0x51, 0x00, + 0x5e, 0x00, 0x58, 0xc7, 0xb3, 0x00, 0xc8, 0x00, 0x51, 0x00, 0x5e, 0x00, 0x5c, 0xc7, 0xc9, 0x00, + 0xde, 0x00, 0x51, 0x00, 0x5e, 0x00, 0x60, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x5f, 0x00, 0x70, 0x00, + 0x64, 0xc7, 0xb3, 0x00, 0xc8, 0x00, 0x5f, 0x00, 0x70, 0x00, 0x68, 0xc7, 0xc9, 0x00, 0xde, 0x00, + 0x5f, 0x00, 0x70, 0x00, 0x6c, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x71, 0x00, 0x82, 0x00, 0x70, 0xc7, + 0xb3, 0x00, 0xc8, 0x00, 0x71, 0x00, 0x82, 0x00, 0x74, 0xc7, 0xc9, 0x00, 0xde, 0x00, 0x71, 0x00, + 0x82, 0x00, 0x78, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x83, 0x00, 0x91, 0x00, 0x7c, 0xc7, 0xb3, 0x00, + 0xde, 0x00, 0x83, 0x00, 0x91, 0x00, 0x80, 0xc7, 0xdc, 0x00, 0xea, 0x00, 0x98, 0x00, 0xa6, 0x00, + 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xae, 0x00, + 0xbc, 0x00, 0x84, 0x00, 0x94, 0x00, 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, + 0xa0, 0xca, 0xff, 0xff, 0x18, 0x01, 0x40, 0x01, 0xa0, 0x00, 0xc8, 0x00, 0x50, 0xc7, 0x8f, 0x00, + 0x2c, 0x01, 0x06, 0x00, 0xc2, 0x00, 0xb8, 0xc7, 0x00, 0x00, 0x8f, 0x00, 0x06, 0x00, 0xc2, 0x00, + 0xc0, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x68, 0x00, + 0x80, 0x00, 0x3a, 0x00, 0x48, 0x00, 0xdc, 0xc7, 0x40, 0x00, 0x74, 0x00, 0x4c, 0x00, 0x6a, 0x00, + 0xe0, 0xc7, 0x74, 0x00, 0xa8, 0x00, 0x4c, 0x00, 0x6a, 0x00, 0xe4, 0xc7, 0x40, 0x00, 0x74, 0x00, + 0x6a, 0x00, 0x88, 0x00, 0xe8, 0xc7, 0x74, 0x00, 0xa8, 0x00, 0x6a, 0x00, 0x88, 0x00, 0xec, 0xc7, + 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xba, 0x00, 0xca, 0x00, + 0x9d, 0x00, 0xad, 0x00, 0x1c, 0xc8, 0xf3, 0x00, 0x03, 0x01, 0x83, 0x00, 0x93, 0x00, 0x18, 0xc8, + 0x0c, 0x01, 0x1c, 0x01, 0xa8, 0x00, 0xb8, 0x00, 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, + 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x77, 0x00, 0xae, 0x00, 0x52, 0x00, 0x80, 0x00, 0x34, 0xc8, + 0x46, 0x00, 0x89, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0x80, 0xc8, 0xbc, 0x00, 0xfa, 0x00, 0x44, 0x00, + 0x98, 0x00, 0x4c, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, + 0xec, 0x00, 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0xbc, 0x00, 0xfa, 0x00, 0x40, 0x00, + 0x98, 0x00, 0x58, 0xc8, 0x3e, 0x00, 0x98, 0x00, 0x38, 0x00, 0x85, 0x00, 0x74, 0xc8, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x77, 0x00, 0xae, 0x00, 0x52, 0x00, + 0x80, 0x00, 0x44, 0xc8, 0x46, 0x00, 0x8b, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0x50, 0xc8, 0xec, 0x00, + 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, + 0xa0, 0xca, 0xff, 0xff, 0xec, 0x00, 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0xbc, 0x00, + 0xfa, 0x00, 0x40, 0x00, 0x98, 0x00, 0x54, 0xc8, 0x3e, 0x00, 0x98, 0x00, 0x38, 0x00, 0x85, 0x00, + 0x74, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x0d, 0x0a, + 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, + 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x55, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x20, 0x45, 0x78, 0x70, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x2e, 0x0d, 0x0a, 0x0d, + 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, + 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x53, 0x6f, + 0x75, 0x6e, 0x64, 0x20, 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x63, 0x61, 0x72, 0x64, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x61, 0x74, 0x20, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30, 0x20, 0x48, 0x65, 0x78, 0x2e, 0x0d, 0x0a, + 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, + 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x4f, + 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x42, 0x61, 0x73, 0x65, 0x20, 0x4d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, + 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x3a, 0x0d, 0x0a, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2e, 0x0d, + 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, + 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, + 0x41, 0x74, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x20, 0x35, 0x39, 0x30, 0x4b, 0x20, 0x6f, 0x66, + 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20, + 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, + 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, + 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x20, + 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, + 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x75, 0x70, 0x74, 0x20, 0x30, 0x0d, + 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, + 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, + 0x55, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x20, 0x45, 0x4d, 0x4d, 0x20, 0x70, 0x61, 0x67, 0x65, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d, + 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, + 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x20, + 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x63, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, + 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x73, 0x20, 0x66, + 0x6f, 0x72, 0x20, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72, + 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x0d, + 0x0a, 0x74, 0x68, 0x65, 0x20, 0x42, 0x4c, 0x41, 0x53, 0x54, 0x45, 0x52, 0x20, 0x65, 0x6e, 0x76, + 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x20, 0x28, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x41, 0x55, 0x54, 0x4f, 0x45, + 0x58, 0x45, 0x43, 0x2e, 0x42, 0x41, 0x54, 0x29, 0x0d, 0x0a, 0x0d, 0x0a, 0x49, 0x66, 0x20, 0x74, + 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, + 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x37, 0x2c, 0x20, 0x44, 0x4d, 0x41, + 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x20, 0x31, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, + 0x61, 0x73, 0x65, 0x0d, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30, + 0x68, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x2e, 0x0d, 0x0a, + 0x0d, 0x0a, 0x54, 0x6f, 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6f, + 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6e, 0x20, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x0d, 0x0a, 0x6f, 0x6e, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x69, 0x6e, + 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x0d, + 0x0a, 0x0d, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x20, 0x20, 0x20, 0x20, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x20, 0x49, 0x37, 0x20, 0x41, 0x32, 0x32, 0x30, 0x20, 0x44, 0x31, 0x20, 0x20, + 0x20, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, + 0x62, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x37, 0x2c, 0x20, 0x44, 0x4d, 0x41, 0x0d, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x20, 0x31, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x61, + 0x73, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30, 0x68, 0x0d, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + 0x42, 0x20, 0x49, 0x35, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, + 0x6f, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x35, 0x20, 0x61, 0x6e, 0x64, 0x0d, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20, + 0x32, 0x32, 0x30, 0x68, 0x2c, 0x20, 0x44, 0x4d, 0x41, 0x20, 0x31, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, + 0x0d, 0x0a, 0x0d, 0x0a, 0x54, 0x72, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x44, 0x72, 0x65, 0x61, + 0x6d, 0x77, 0x65, 0x62, 0x20, 0x43, 0x44, 0x20, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, + 0x73, 0x74, 0x65, 0x72, 0x65, 0x6f, 0x2e, 0x2e, 0x2e, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x0d, 0x0a, + 0x24, 0x81, 0x00, 0xb8, 0x00, 0x52, 0x00, 0x80, 0x00, 0xc0, 0xc8, 0x50, 0x00, 0x93, 0x00, 0x3e, + 0x00, 0x6f, 0x00, 0x80, 0xc8, 0xb7, 0x00, 0xfa, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0xc4, 0xc8, 0x00, + 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x53, 0x50, 0x45, 0x45, 0x43, + 0x48, 0x52, 0x32, 0x34, 0x43, 0x30, 0x30, 0x30, 0x35, 0x2e, 0x52, 0x41, 0x57, 0x00, 0x87, 0x83, + 0x81, 0x82, 0x2c, 0x00, 0x46, 0x00, 0x20, 0x00, 0x2e, 0x00, 0x70, 0xc4, 0x00, 0x00, 0x32, 0x00, + 0x00, 0x00, 0xb4, 0x00, 0x7c, 0xc3, 0xe2, 0x00, 0xf4, 0x00, 0x0a, 0x00, 0x1a, 0x00, 0x28, 0xc8, + 0xe2, 0x00, 0xf4, 0x00, 0x1a, 0x00, 0x28, 0x00, 0x2c, 0xc8, 0xf0, 0x00, 0x04, 0x01, 0x64, 0x00, + 0x7c, 0x00, 0xcc, 0xc9, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xd4, 0xc9, 0xff, 0xff, + 0x2c, 0x00, 0x46, 0x00, 0x20, 0x00, 0x2e, 0x00, 0x70, 0xc4, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, + 0xb4, 0x00, 0x7c, 0xc3, 0x12, 0x01, 0x24, 0x01, 0x0a, 0x00, 0x1a, 0x00, 0x28, 0xc8, 0x12, 0x01, + 0x24, 0x01, 0x1a, 0x00, 0x28, 0x00, 0x2c, 0xc8, 0xf0, 0x00, 0x04, 0x01, 0x64, 0x00, 0x7c, 0x00, + 0xcc, 0xc9, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xd4, 0xc9, 0xff, 0xff, 0x00, 0x21, + 0x0a, 0x0f, 0xff, 0x00, 0x16, 0x0a, 0x0f, 0xff, 0x00, 0x16, 0x00, 0x0f, 0xff, 0x00, 0x0b, 0x00, + 0x0f, 0xff, 0x00, 0x0b, 0x0a, 0x0f, 0xff, 0x00, 0x00, 0x0a, 0x0f, 0xff, 0x01, 0x2c, 0x0a, 0x06, + 0xff, 0x01, 0x2c, 0x00, 0x0d, 0xff, 0x02, 0x21, 0x00, 0x06, 0xff, 0x02, 0x16, 0x00, 0x05, 0xff, + 0x02, 0x16, 0x0a, 0x10, 0xff, 0x02, 0x0b, 0x0a, 0x10, 0xff, 0x03, 0x2c, 0x00, 0x0f, 0xff, 0x03, + 0x21, 0x0a, 0x06, 0xff, 0x03, 0x21, 0x00, 0x05, 0xff, 0x04, 0x0b, 0x1e, 0x06, 0xff, 0x04, 0x16, + 0x1e, 0x05, 0xff, 0x04, 0x16, 0x14, 0x0d, 0xff, 0x0a, 0x21, 0x1e, 0x06, 0xff, 0x0a, 0x16, 0x1e, + 0x06, 0xff, 0x09, 0x16, 0x0a, 0x06, 0xff, 0x09, 0x16, 0x14, 0x10, 0xff, 0x09, 0x16, 0x1e, 0x10, + 0xff, 0x09, 0x16, 0x28, 0x10, 0xff, 0x09, 0x16, 0x32, 0x10, 0xff, 0x06, 0x0b, 0x1e, 0x06, 0xff, + 0x06, 0x00, 0x0a, 0x0f, 0xff, 0x06, 0x00, 0x14, 0x0f, 0xff, 0x06, 0x0b, 0x14, 0x0f, 0xff, 0x06, + 0x16, 0x14, 0x0f, 0xff, 0x07, 0x0b, 0x14, 0x06, 0xff, 0x07, 0x00, 0x14, 0x06, 0xff, 0x07, 0x00, + 0x1e, 0x06, 0xff, 0x37, 0x2c, 0x00, 0x05, 0xff, 0x37, 0x2c, 0x0a, 0x05, 0xff, 0x05, 0x16, 0x1e, + 0x06, 0xff, 0x05, 0x16, 0x14, 0x0f, 0xff, 0x05, 0x16, 0x0a, 0x0f, 0xff, 0x18, 0x16, 0x00, 0x0f, + 0xff, 0x18, 0x21, 0x00, 0x0f, 0xff, 0x18, 0x2c, 0x00, 0x0f, 0xff, 0x18, 0x21, 0x0a, 0x0f, 0xff, + 0x08, 0x00, 0x0a, 0x06, 0xff, 0x08, 0x0b, 0x0a, 0x06, 0xff, 0x08, 0x16, 0x0a, 0x06, 0xff, 0x08, + 0x21, 0x0a, 0x06, 0xff, 0x08, 0x21, 0x14, 0x06, 0xff, 0x08, 0x21, 0x1e, 0x06, 0xff, 0x08, 0x21, + 0x28, 0x06, 0xff, 0x08, 0x16, 0x28, 0x06, 0xff, 0x08, 0x0b, 0x28, 0x06, 0xff, 0x0b, 0x0b, 0x14, + 0x0c, 0xff, 0x0b, 0x0b, 0x1e, 0x0c, 0xff, 0x0b, 0x16, 0x14, 0x0c, 0xff, 0x0b, 0x16, 0x1e, 0x0c, + 0xff, 0x0c, 0x16, 0x14, 0x0c, 0xff, 0x0d, 0x16, 0x14, 0x0c, 0xff, 0x0d, 0x21, 0x14, 0x0c, 0xff, + 0x0e, 0x2c, 0x14, 0x0c, 0xff, 0x0e, 0x21, 0x00, 0x0c, 0xff, 0x0e, 0x21, 0x0a, 0x0c, 0xff, 0x0e, + 0x21, 0x14, 0x0c, 0xff, 0x0e, 0x21, 0x1e, 0x0c, 0xff, 0x0e, 0x21, 0x28, 0x0c, 0xff, 0x0e, 0x16, + 0x00, 0x10, 0xff, 0x13, 0x00, 0x00, 0x0c, 0xff, 0x14, 0x00, 0x14, 0x10, 0xff, 0x14, 0x00, 0x1e, + 0x10, 0xff, 0x14, 0x0b, 0x1e, 0x10, 0xff, 0x14, 0x00, 0x28, 0x10, 0xff, 0x14, 0x0b, 0x28, 0x10, + 0xff, 0x15, 0x0b, 0x0a, 0x0f, 0xff, 0x15, 0x0b, 0x14, 0x0f, 0xff, 0x15, 0x00, 0x14, 0x0f, 0xff, + 0x15, 0x16, 0x14, 0x0f, 0xff, 0x15, 0x21, 0x14, 0x0f, 0xff, 0x15, 0x2c, 0x14, 0x0f, 0xff, 0x15, + 0x2c, 0x0a, 0x0f, 0xff, 0x16, 0x16, 0x0a, 0x10, 0xff, 0x16, 0x16, 0x14, 0x10, 0xff, 0x17, 0x16, + 0x1e, 0x0d, 0xff, 0x17, 0x16, 0x28, 0x0d, 0xff, 0x17, 0x21, 0x28, 0x0d, 0xff, 0x17, 0x0b, 0x28, + 0x0d, 0xff, 0x17, 0x00, 0x28, 0x0d, 0xff, 0x17, 0x00, 0x32, 0x0d, 0xff, 0x19, 0x0b, 0x28, 0x10, + 0xff, 0x19, 0x0b, 0x32, 0x10, 0xff, 0x19, 0x00, 0x32, 0x10, 0xff, 0x1b, 0x0b, 0x14, 0x10, 0xff, + 0x1b, 0x0b, 0x1e, 0x10, 0xff, 0x1d, 0x0b, 0x0a, 0x10, 0xff, 0x2d, 0x16, 0x1e, 0x0c, 0xff, 0x2d, + 0x16, 0x28, 0x0c, 0xff, 0x2d, 0x16, 0x32, 0x0c, 0xff, 0x2e, 0x16, 0x28, 0x0c, 0xff, 0x2e, 0x0b, + 0x32, 0x0c, 0xff, 0x2e, 0x16, 0x32, 0x0c, 0xff, 0x2e, 0x21, 0x32, 0x0c, 0xff, 0x2f, 0x00, 0x00, + 0x0c, 0xff, 0x1a, 0x16, 0x14, 0x10, 0xff, 0x1a, 0x21, 0x0a, 0x10, 0xff, 0x1a, 0x21, 0x14, 0x10, + 0xff, 0x1a, 0x21, 0x1e, 0x10, 0xff, 0x1a, 0x2c, 0x1e, 0x10, 0xff, 0x1a, 0x16, 0x1e, 0x10, 0xff, + 0x1a, 0x0b, 0x1e, 0x10, 0xff, 0x1a, 0x0b, 0x14, 0x10, 0xff, 0x1a, 0x00, 0x14, 0x10, 0xff, 0x1a, + 0x0b, 0x28, 0x10, 0xff, 0x1a, 0x00, 0x28, 0x10, 0xff, 0x1a, 0x16, 0x28, 0x10, 0xff, 0x1a, 0x0b, + 0x32, 0x10, 0xff, 0x1c, 0x00, 0x1e, 0x0f, 0xff, 0x1c, 0x00, 0x14, 0x0f, 0xff, 0x1c, 0x00, 0x28, + 0x0f, 0xff, 0x1c, 0x0b, 0x1e, 0x0f, 0xff, 0x1c, 0x0b, 0x14, 0x0f, 0xff, 0x1c, 0x16, 0x1e, 0x0f, + 0xff, 0x1c, 0x16, 0x14, 0x0f, 0xff, 0xff, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, + 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x30, 0x2d, 0x00, 0x08, 0x00, 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, + 0x4f, 0x50, 0x00, 0x00, 0x0d, 0x00, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x3a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x46, 0x49, 0x4c, 0x45, 0x20, 0x43, 0x4f, + 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x31, 0x39, 0x39, 0x32, 0x20, 0x43, 0x52, 0x45, + 0x41, 0x54, 0x49, 0x56, 0x45, 0x20, 0x52, 0x45, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x30, 0x00, 0x05, 0xff, 0x21, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x06, 0x02, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x31, 0x00, 0x01, 0xff, 0x2c, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x07, 0x02, 0xff, 0xff, 0xff, 0xff, 0x06, 0xff, 0xff, 0xff, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x32, 0x00, 0x02, 0xff, 0x21, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x00, 0xff, 0xff, 0x01, 0xff, 0x03, 0xff, 0xff, 0xff, 0x02, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x33, 0x00, 0x05, 0xff, 0x21, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x02, 0x02, 0x00, 0x02, 0x04, 0xff, 0x00, 0xff, 0xff, 0xff, 0x03, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x34, 0x00, 0x17, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x00, 0x05, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x04, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x35, 0x00, 0x05, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x02, 0x00, 0x04, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x05, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x36, 0x00, 0x05, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x00, 0x00, 0x01, 0x02, 0xff, 0x00, 0xff, 0xff, 0xff, 0x06, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x37, 0x00, 0xff, 0xff, 0x00, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x07, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x38, 0x00, 0x08, 0xff, 0x00, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0b, 0x28, 0x00, 0x08, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x39, 0x00, 0x09, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x04, 0x06, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x09, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x30, 0x00, 0x0a, 0xff, 0x21, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x02, 0x00, 0xff, 0xff, 0x02, 0x02, 0x04, 0x16, 0x1e, 0xff, 0x0a, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x31, 0x00, 0x0b, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x32, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x33, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0d, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x34, 0x00, 0x0e, 0xff, 0x2c, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x39, 0x00, 0x13, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x30, 0x00, 0x16, 0xff, 0x00, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x14, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x31, 0x00, 0x05, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x02, 0x0f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x33, 0x00, 0x17, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x02, 0x0f, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x34, 0x00, 0x05, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x06, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x18, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x35, 0x00, 0x16, 0xff, 0x0b, 0x28, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x19, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x36, 0x00, 0x09, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x37, 0x00, 0x16, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1b, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x38, 0x00, 0x05, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x39, 0x00, 0x16, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x35, 0x00, 0x05, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x01, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x05, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x34, 0x00, 0x17, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x30, 0x00, 0x0a, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x03, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x32, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x33, 0x00, 0x05, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x06, 0x02, 0xff, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x34, 0x00, 0x05, 0xff, 0x16, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x03, 0x06, 0x00, 0xff, 0xff, 0xff, 0xff, 0x21, 0x00, 0x03, 0x18, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x31, 0x00, 0x0b, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x38, 0x00, 0x05, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x06, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x31, 0x00, 0x05, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x01, 0x04, 0x02, 0x0f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x36, 0x00, 0x09, 0xff, 0x00, 0x28, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x39, 0x00, 0x13, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x38, 0x00, 0x08, 0xff, 0x0b, 0x28, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x08, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x31, 0x00, 0x01, 0xff, 0x2c, 0x0a, 0xff, 0xff, 0xff, 0x00, + 0x03, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x35, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x36, 0x00, 0x23, 0xff, 0x16, 0x28, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2e, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x37, 0x00, 0x23, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2f, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x35, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x36, 0x00, 0x23, 0xff, 0x16, 0x32, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2e, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x30, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x32, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x31, 0x00, 0x23, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x32, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x34, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x33, 0x00, 0x23, 0xff, 0x21, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x35, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x34, 0x00, 0x23, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x36, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x35, 0x00, 0x0e, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, + 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, + 0x45, 0x42, 0x2e, 0x44, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, + 0x44, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x32, + 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x33, 0x00, 0x44, 0x52, + 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, + 0x2e, 0x44, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x45, + 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, }; + context.ds.assign(src, src + sizeof(src)); +dreamweb(context); +} + +void __dispatch_call(Context &context, unsigned addr) { + switch(addr) { + case 0xc000: alleybarksound(context); break; + case 0xc004: intromusic(context); break; + case 0xc008: foghornsound(context); break; + case 0xc00c: receptionist(context); break; + case 0xc010: smokebloke(context); break; + case 0xc014: attendant(context); break; + case 0xc018: manasleep(context); break; + case 0xc01c: eden(context); break; + case 0xc020: edeninbath(context); break; + case 0xc024: malefan(context); break; + case 0xc028: femalefan(context); break; + case 0xc02c: louis(context); break; + case 0xc030: louischair(context); break; + case 0xc034: manasleep2(context); break; + case 0xc038: mansatstill(context); break; + case 0xc03c: tattooman(context); break; + case 0xc040: drinker(context); break; + case 0xc044: bartender(context); break; + case 0xc048: othersmoker(context); break; + case 0xc04c: barwoman(context); break; + case 0xc050: interviewer(context); break; + case 0xc054: soldier1(context); break; + case 0xc058: rockstar(context); break; + case 0xc05c: helicopter(context); break; + case 0xc060: mugger(context); break; + case 0xc064: aide(context); break; + case 0xc068: businessman(context); break; + case 0xc06c: poolguard(context); break; + case 0xc070: security(context); break; + case 0xc074: heavy(context); break; + case 0xc078: bossman(context); break; + case 0xc07c: gamer(context); break; + case 0xc080: sparkydrip(context); break; + case 0xc084: carparkdrip(context); break; + case 0xc088: keeper(context); break; + case 0xc08c: candles1(context); break; + case 0xc090: smallcandle(context); break; + case 0xc094: intromagic1(context); break; + case 0xc098: candles(context); break; + case 0xc09c: candles2(context); break; + case 0xc0a0: gates(context); break; + case 0xc0a4: intromagic2(context); break; + case 0xc0a8: intromagic3(context); break; + case 0xc0ac: intromonks1(context); break; + case 0xc0b0: intromonks2(context); break; + case 0xc0b4: handclap(context); break; + case 0xc0b8: monks2text(context); break; + case 0xc0bc: intro1text(context); break; + case 0xc0c0: intro2text(context); break; + case 0xc0c4: intro3text(context); break; + case 0xc0c8: monkandryan(context); break; + case 0xc0cc: endgameseq(context); break; + case 0xc0d0: rollendcredits(context); break; + case 0xc0d4: priest(context); break; + case 0xc0d8: madmanstelly(context); break; + case 0xc0dc: madman(context); break; + case 0xc0e0: madmantext(context); break; + case 0xc0e4: madmode(context); break; + case 0xc0e8: priesttext(context); break; + case 0xc0ec: textforend(context); break; + case 0xc0f0: textformonk(context); break; + case 0xc0f4: drunk(context); break; + case 0xc0f8: advisor(context); break; + case 0xc0fc: copper(context); break; + case 0xc100: sparky(context); break; + case 0xc104: train(context); break; + case 0xc108: addtopeoplelist(context); break; + case 0xc10c: showgamereel(context); break; + case 0xc110: checkspeed(context); break; + case 0xc114: clearsprites(context); break; + case 0xc118: makesprite(context); break; + case 0xc11c: delsprite(context); break; + case 0xc120: spriteupdate(context); break; + case 0xc124: printsprites(context); break; + case 0xc128: printasprite(context); break; + case 0xc12c: checkone(context); break; + case 0xc130: findsource(context); break; + case 0xc134: initman(context); break; + case 0xc138: mainman(context); break; + case 0xc13c: aboutturn(context); break; + case 0xc140: walking(context); break; + case 0xc144: facerightway(context); break; + case 0xc148: checkforexit(context); break; + case 0xc14c: adjustdown(context); break; + case 0xc150: adjustup(context); break; + case 0xc154: adjustleft(context); break; + case 0xc158: adjustright(context); break; + case 0xc15c: reminders(context); break; + case 0xc160: initrain(context); break; + case 0xc164: splitintolines(context); break; + case 0xc168: getblockofpixel(context); break; + case 0xc16c: showrain(context); break; + case 0xc170: backobject(context); break; + case 0xc174: liftsprite(context); break; + case 0xc178: liftnoise(context); break; + case 0xc17c: random(context); break; + case 0xc180: steady(context); break; + case 0xc184: constant(context); break; + case 0xc188: doorway(context); break; + case 0xc18c: widedoor(context); break; + case 0xc190: dodoor(context); break; + case 0xc194: lockeddoorway(context); break; + case 0xc198: updatepeople(context); break; + case 0xc19c: getreelframeax(context); break; + case 0xc1a0: reelsonscreen(context); break; + case 0xc1a4: plotreel(context); break; + case 0xc1a8: soundonreels(context); break; + case 0xc1ac: reconstruct(context); break; + case 0xc1b0: dealwithspecial(context); break; + case 0xc1b4: movemap(context); break; + case 0xc1b8: getreelstart(context); break; + case 0xc1bc: showreelframe(context); break; + case 0xc1c0: deleverything(context); break; + case 0xc1c4: dumpeverything(context); break; + case 0xc1c8: allocatework(context); break; + case 0xc1cc: showpcx(context); break; + case 0xc1d0: readabyte(context); break; + case 0xc1d4: readoneblock(context); break; + case 0xc1d8: loadpalfromiff(context); break; + case 0xc1dc: setmode(context); break; + case 0xc1ec: paneltomap(context); break; + case 0xc1f0: maptopanel(context); break; + case 0xc1f4: dumpmap(context); break; + case 0xc1f8: pixelcheckset(context); break; + case 0xc1fc: createpanel(context); break; + case 0xc200: createpanel2(context); break; + case 0xc204: clearwork(context); break; + case 0xc208: vsync(context); break; + case 0xc20c: doshake(context); break; + case 0xc210: zoom(context); break; + case 0xc214: delthisone(context); break; + case 0xc224: width160(context); break; + case 0xc228: doblocks(context); break; + case 0xc22c: showframe(context); break; + case 0xc230: frameoutv(context); break; + case 0xc238: frameoutbh(context); break; + case 0xc23c: frameoutfx(context); break; + case 0xc240: transferinv(context); break; + case 0xc244: transfermap(context); break; + case 0xc248: fadedos(context); break; + case 0xc24c: dofade(context); break; + case 0xc250: clearendpal(context); break; + case 0xc254: clearpalette(context); break; + case 0xc258: fadescreenup(context); break; + case 0xc25c: fadetowhite(context); break; + case 0xc260: fadefromwhite(context); break; + case 0xc264: fadescreenups(context); break; + case 0xc268: fadescreendownhalf(context); break; + case 0xc26c: fadescreenuphalf(context); break; + case 0xc270: fadescreendown(context); break; + case 0xc274: fadescreendowns(context); break; + case 0xc278: clearstartpal(context); break; + case 0xc27c: showgun(context); break; + case 0xc280: rollendcredits2(context); break; + case 0xc284: rollem(context); break; + case 0xc288: fadecalculation(context); break; + case 0xc28c: greyscalesum(context); break; + case 0xc290: showgroup(context); break; + case 0xc294: paltostartpal(context); break; + case 0xc298: endpaltostart(context); break; + case 0xc29c: startpaltoend(context); break; + case 0xc2a0: paltoendpal(context); break; + case 0xc2a4: allpalette(context); break; + case 0xc2a8: dumpcurrent(context); break; + case 0xc2ac: fadedownmon(context); break; + case 0xc2b0: fadeupmon(context); break; + case 0xc2b4: fadeupmonfirst(context); break; + case 0xc2b8: fadeupyellows(context); break; + case 0xc2bc: initialmoncols(context); break; + case 0xc2c0: titles(context); break; + case 0xc2c4: endgame(context); break; + case 0xc2c8: monkspeaking(context); break; + case 0xc2cc: showmonk(context); break; + case 0xc2d0: gettingshot(context); break; + case 0xc2d4: credits(context); break; + case 0xc2d8: biblequote(context); break; + case 0xc2dc: hangone(context); break; + case 0xc2e0: intro(context); break; + case 0xc2e4: runintroseq(context); break; + case 0xc2e8: runendseq(context); break; + case 0xc2ec: loadintroroom(context); break; + case 0xc2f0: mode640x480(context); break; + case 0xc2f4: set16colpalette(context); break; + case 0xc2f8: realcredits(context); break; + case 0xc2fc: printchar(context); break; + case 0xc300: kernchars(context); break; + case 0xc304: printslow(context); break; + case 0xc308: waitframes(context); break; + case 0xc30c: printboth(context); break; + case 0xc310: printdirect(context); break; + case 0xc314: monprint(context); break; + case 0xc318: getnumber(context); break; + case 0xc31c: getnextword(context); break; + case 0xc320: fillryan(context); break; + case 0xc324: fillopen(context); break; + case 0xc328: findallryan(context); break; + case 0xc32c: findallopen(context); break; + case 0xc330: obtoinv(context); break; + case 0xc334: isitworn(context); break; + case 0xc338: makeworn(context); break; + case 0xc33c: examineob(context); break; + case 0xc340: makemainscreen(context); break; + case 0xc344: getbackfromob(context); break; + case 0xc348: incryanpage(context); break; + case 0xc34c: openinv(context); break; + case 0xc350: showryanpage(context); break; + case 0xc354: openob(context); break; + case 0xc358: obicons(context); break; + case 0xc35c: examicon(context); break; + case 0xc360: obpicture(context); break; + case 0xc364: describeob(context); break; + case 0xc368: additionaltext(context); break; + case 0xc36c: obsthatdothings(context); break; + case 0xc370: getobtextstart(context); break; + case 0xc374: searchforsame(context); break; + case 0xc378: findnextcolon(context); break; + case 0xc37c: inventory(context); break; + case 0xc380: setpickup(context); break; + case 0xc384: examinventory(context); break; + case 0xc388: reexfrominv(context); break; + case 0xc38c: reexfromopen(context); break; + case 0xc390: swapwithinv(context); break; + case 0xc394: swapwithopen(context); break; + case 0xc398: intoinv(context); break; + case 0xc39c: deletetaken(context); break; + case 0xc3a0: outofinv(context); break; + case 0xc3a4: getfreead(context); break; + case 0xc3a8: getexad(context); break; + case 0xc3ac: geteitherad(context); break; + case 0xc3b0: getanyad(context); break; + case 0xc3b4: getanyaddir(context); break; + case 0xc3b8: getopenedsize(context); break; + case 0xc3bc: getsetad(context); break; + case 0xc3c0: findinvpos(context); break; + case 0xc3c4: findopenpos(context); break; + case 0xc3c8: dropobject(context); break; + case 0xc3cc: droperror(context); break; + case 0xc3d0: cantdrop(context); break; + case 0xc3d4: wornerror(context); break; + case 0xc3d8: removeobfrominv(context); break; + case 0xc3dc: selectopenob(context); break; + case 0xc3e0: useopened(context); break; + case 0xc3e4: errormessage1(context); break; + case 0xc3e8: errormessage2(context); break; + case 0xc3ec: errormessage3(context); break; + case 0xc3f0: checkobjectsize(context); break; + case 0xc3f4: outofopen(context); break; + case 0xc3f8: transfertoex(context); break; + case 0xc3fc: pickupconts(context); break; + case 0xc400: transfercontoex(context); break; + case 0xc404: transfertext(context); break; + case 0xc408: getexpos(context); break; + case 0xc40c: purgealocation(context); break; + case 0xc410: emergencypurge(context); break; + case 0xc414: purgeanitem(context); break; + case 0xc418: deleteexobject(context); break; + case 0xc41c: deleteexframe(context); break; + case 0xc420: deleteextext(context); break; + case 0xc424: blockget(context); break; + case 0xc428: drawfloor(context); break; + case 0xc42c: calcmapad(context); break; + case 0xc430: getdimension(context); break; + case 0xc434: addalong(context); break; + case 0xc438: addlength(context); break; + case 0xc43c: drawflags(context); break; + case 0xc440: eraseoldobs(context); break; + case 0xc444: showallobs(context); break; + case 0xc448: makebackob(context); break; + case 0xc44c: showallfree(context); break; + case 0xc450: showallex(context); break; + case 0xc454: calcfrframe(context); break; + case 0xc458: finalframe(context); break; + case 0xc45c: adjustlen(context); break; + case 0xc460: getmapad(context); break; + case 0xc464: getxad(context); break; + case 0xc468: getyad(context); break; + case 0xc46c: autolook(context); break; + case 0xc470: look(context); break; + case 0xc474: dolook(context); break; + case 0xc478: redrawmainscrn(context); break; + case 0xc47c: getback1(context); break; + case 0xc480: talk(context); break; + case 0xc484: convicons(context); break; + case 0xc488: getpersframe(context); break; + case 0xc48c: starttalk(context); break; + case 0xc490: getpersontext(context); break; + case 0xc494: moretalk(context); break; + case 0xc498: dosometalk(context); break; + case 0xc49c: hangonpq(context); break; + case 0xc4a0: redes(context); break; + case 0xc4a4: newplace(context); break; + case 0xc4a8: selectlocation(context); break; + case 0xc4ac: showcity(context); break; + case 0xc4b0: lookatplace(context); break; + case 0xc4b4: getundercentre(context); break; + case 0xc4b8: putundercentre(context); break; + case 0xc4bc: locationpic(context); break; + case 0xc4c0: getdestinfo(context); break; + case 0xc4c4: showarrows(context); break; + case 0xc4c8: nextdest(context); break; + case 0xc4cc: lastdest(context); break; + case 0xc4d0: destselect(context); break; + case 0xc4d4: getlocation(context); break; + case 0xc4d8: setlocation(context); break; + case 0xc4dc: resetlocation(context); break; + case 0xc4e0: readdesticon(context); break; + case 0xc4e4: readcitypic(context); break; + case 0xc4e8: usemon(context); break; + case 0xc4ec: printoutermon(context); break; + case 0xc4f0: loadpersonal(context); break; + case 0xc4f4: loadnews(context); break; + case 0xc4f8: loadcart(context); break; + case 0xc4fc: lookininterface(context); break; + case 0xc500: turnonpower(context); break; + case 0xc504: randomaccess(context); break; + case 0xc508: powerlighton(context); break; + case 0xc50c: powerlightoff(context); break; + case 0xc510: accesslighton(context); break; + case 0xc514: accesslightoff(context); break; + case 0xc518: locklighton(context); break; + case 0xc51c: locklightoff(context); break; + case 0xc520: input(context); break; + case 0xc524: makecaps(context); break; + case 0xc528: delchar(context); break; + case 0xc52c: execcommand(context); break; + case 0xc530: neterror(context); break; + case 0xc534: dircom(context); break; + case 0xc538: searchforfiles(context); break; + case 0xc53c: signon(context); break; + case 0xc540: showkeys(context); break; + case 0xc544: read(context); break; + case 0xc548: dirfile(context); break; + case 0xc54c: getkeyandlogo(context); break; + case 0xc550: searchforstring(context); break; + case 0xc554: parser(context); break; + case 0xc558: scrollmonitor(context); break; + case 0xc55c: lockmon(context); break; + case 0xc560: monitorlogo(context); break; + case 0xc564: printlogo(context); break; + case 0xc568: showcurrentfile(context); break; + case 0xc56c: monmessage(context); break; + case 0xc570: processtrigger(context); break; + case 0xc574: triggermessage(context); break; + case 0xc578: printcurs(context); break; + case 0xc57c: delcurs(context); break; + case 0xc580: useobject(context); break; + case 0xc584: useroutine(context); break; + case 0xc588: wheelsound(context); break; + case 0xc58c: runtap(context); break; + case 0xc590: playguitar(context); break; + case 0xc594: hotelcontrol(context); break; + case 0xc598: hotelbell(context); break; + case 0xc59c: opentomb(context); break; + case 0xc5a0: usetrainer(context); break; + case 0xc5a4: nothelderror(context); break; + case 0xc5a8: usepipe(context); break; + case 0xc5ac: usefullcart(context); break; + case 0xc5b0: useplinth(context); break; + case 0xc5b4: chewy(context); break; + case 0xc5b8: useladder(context); break; + case 0xc5bc: useladderb(context); break; + case 0xc5c0: slabdoora(context); break; + case 0xc5c4: slabdoorb(context); break; + case 0xc5c8: slabdoord(context); break; + case 0xc5cc: slabdoorc(context); break; + case 0xc5d0: slabdoore(context); break; + case 0xc5d4: slabdoorf(context); break; + case 0xc5d8: useslab(context); break; + case 0xc5dc: usecart(context); break; + case 0xc5e0: useclearbox(context); break; + case 0xc5e4: usecoveredbox(context); break; + case 0xc5e8: userailing(context); break; + case 0xc5ec: useopenbox(context); break; + case 0xc5f0: wearwatch(context); break; + case 0xc5f4: wearshades(context); break; + case 0xc5f8: sitdowninbar(context); break; + case 0xc5fc: usechurchhole(context); break; + case 0xc600: usehole(context); break; + case 0xc604: usealtar(context); break; + case 0xc608: opentvdoor(context); break; + case 0xc60c: usedryer(context); break; + case 0xc610: openlouis(context); break; + case 0xc614: nextcolon(context); break; + case 0xc618: openyourneighbour(context); break; + case 0xc61c: usewindow(context); break; + case 0xc620: usebalcony(context); break; + case 0xc624: openryan(context); break; + case 0xc628: openpoolboss(context); break; + case 0xc62c: openeden(context); break; + case 0xc630: opensarters(context); break; + case 0xc634: isitright(context); break; + case 0xc638: drawitall(context); break; + case 0xc63c: openhoteldoor(context); break; + case 0xc640: openhoteldoor2(context); break; + case 0xc644: grafittidoor(context); break; + case 0xc648: trapdoor(context); break; + case 0xc64c: callhotellift(context); break; + case 0xc650: calledenslift(context); break; + case 0xc654: calledensdlift(context); break; + case 0xc658: usepoolreader(context); break; + case 0xc65c: uselighter(context); break; + case 0xc660: showseconduse(context); break; + case 0xc664: usecardreader1(context); break; + case 0xc668: usecardreader2(context); break; + case 0xc66c: usecardreader3(context); break; + case 0xc670: usecashcard(context); break; + case 0xc674: lookatcard(context); break; + case 0xc678: moneypoke(context); break; + case 0xc67c: usecontrol(context); break; + case 0xc680: usehatch(context); break; + case 0xc684: usewire(context); break; + case 0xc688: usehandle(context); break; + case 0xc68c: useelevator1(context); break; + case 0xc690: showfirstuse(context); break; + case 0xc694: useelevator3(context); break; + case 0xc698: useelevator4(context); break; + case 0xc69c: useelevator2(context); break; + case 0xc6a0: useelevator5(context); break; + case 0xc6a4: usekey(context); break; + case 0xc6a8: usestereo(context); break; + case 0xc6ac: usecooker(context); break; + case 0xc6b0: useaxe(context); break; + case 0xc6b4: useelvdoor(context); break; + case 0xc6b8: withwhat(context); break; + case 0xc6bc: selectob(context); break; + case 0xc6c0: compare(context); break; + case 0xc6c4: findsetobject(context); break; + case 0xc6c8: findexobject(context); break; + case 0xc6cc: isryanholding(context); break; + case 0xc6d0: checkinside(context); break; + case 0xc6d4: usetext(context); break; + case 0xc6d8: putbackobstuff(context); break; + case 0xc6dc: showpuztext(context); break; + case 0xc6e0: findpuztext(context); break; + case 0xc6e4: placesetobject(context); break; + case 0xc6e8: removesetobject(context); break; + case 0xc6ec: issetobonmap(context); break; + case 0xc6f0: placefreeobject(context); break; + case 0xc6f4: removefreeobject(context); break; + case 0xc6f8: findormake(context); break; + case 0xc6fc: switchryanon(context); break; + case 0xc700: switchryanoff(context); break; + case 0xc704: setallchanges(context); break; + case 0xc708: dochange(context); break; + case 0xc70c: autoappear(context); break; + case 0xc710: getundertimed(context); break; + case 0xc714: putundertimed(context); break; + case 0xc718: dumptimedtext(context); break; + case 0xc71c: setuptimeduse(context); break; + case 0xc720: setuptimedtemp(context); break; + case 0xc724: usetimedtext(context); break; + case 0xc728: edenscdplayer(context); break; + case 0xc72c: usewall(context); break; + case 0xc730: usechurchgate(context); break; + case 0xc734: usegun(context); break; + case 0xc738: useshield(context); break; + case 0xc73c: usebuttona(context); break; + case 0xc740: useplate(context); break; + case 0xc744: usewinch(context); break; + case 0xc748: entercode(context); break; + case 0xc74c: loadkeypad(context); break; + case 0xc750: quitkey(context); break; + case 0xc754: addtopresslist(context); break; + case 0xc758: buttonone(context); break; + case 0xc75c: buttontwo(context); break; + case 0xc760: buttonthree(context); break; + case 0xc764: buttonfour(context); break; + case 0xc768: buttonfive(context); break; + case 0xc76c: buttonsix(context); break; + case 0xc770: buttonseven(context); break; + case 0xc774: buttoneight(context); break; + case 0xc778: buttonnine(context); break; + case 0xc77c: buttonnought(context); break; + case 0xc780: buttonenter(context); break; + case 0xc784: buttonpress(context); break; + case 0xc788: showouterpad(context); break; + case 0xc78c: showkeypad(context); break; + case 0xc790: singlekey(context); break; + case 0xc794: dumpkeypad(context); break; + case 0xc798: usemenu(context); break; + case 0xc79c: dumpmenu(context); break; + case 0xc7a0: getundermenu(context); break; + case 0xc7a4: putundermenu(context); break; + case 0xc7a8: showoutermenu(context); break; + case 0xc7ac: showmenu(context); break; + case 0xc7b0: loadmenu(context); break; + case 0xc7b4: viewfolder(context); break; + case 0xc7b8: nextfolder(context); break; + case 0xc7bc: folderhints(context); break; + case 0xc7c0: lastfolder(context); break; + case 0xc7c4: loadfolder(context); break; + case 0xc7c8: showfolder(context); break; + case 0xc7cc: folderexit(context); break; + case 0xc7d0: showleftpage(context); break; + case 0xc7d4: showrightpage(context); break; + case 0xc7d8: entersymbol(context); break; + case 0xc7dc: quitsymbol(context); break; + case 0xc7e0: settopleft(context); break; + case 0xc7e4: settopright(context); break; + case 0xc7e8: setbotleft(context); break; + case 0xc7ec: setbotright(context); break; + case 0xc7f0: dumpsymbol(context); break; + case 0xc7f4: showsymbol(context); break; + case 0xc7f8: nextsymbol(context); break; + case 0xc7fc: updatesymboltop(context); break; + case 0xc800: updatesymbolbot(context); break; + case 0xc804: dumpsymbox(context); break; + case 0xc808: usediary(context); break; + case 0xc80c: showdiary(context); break; + case 0xc810: showdiarykeys(context); break; + case 0xc814: dumpdiarykeys(context); break; + case 0xc818: diarykeyp(context); break; + case 0xc81c: diarykeyn(context); break; + case 0xc820: showdiarypage(context); break; + case 0xc824: findtext1(context); break; + case 0xc828: zoomonoff(context); break; + case 0xc82c: saveload(context); break; + case 0xc830: dosaveload(context); break; + case 0xc834: getbackfromops(context); break; + case 0xc838: showmainops(context); break; + case 0xc83c: showdiscops(context); break; + case 0xc840: loadsavebox(context); break; + case 0xc844: loadgame(context); break; + case 0xc848: getbacktoops(context); break; + case 0xc84c: discops(context); break; + case 0xc850: savegame(context); break; + case 0xc854: actualsave(context); break; + case 0xc858: actualload(context); break; + case 0xc85c: selectslot2(context); break; + case 0xc860: checkinput(context); break; + case 0xc864: getnamepos(context); break; + case 0xc868: showopbox(context); break; + case 0xc86c: showloadops(context); break; + case 0xc870: showsaveops(context); break; + case 0xc874: selectslot(context); break; + case 0xc878: showslots(context); break; + case 0xc87c: shownames(context); break; + case 0xc880: dosreturn(context); break; + case 0xc884: error(context); break; + case 0xc888: namestoold(context); break; + case 0xc88c: oldtonames(context); break; + case 0xc890: savefilewrite(context); break; + case 0xc894: savefileread(context); break; + case 0xc898: saveposition(context); break; + case 0xc89c: loadposition(context); break; + case 0xc8a0: loadseg(context); break; + case 0xc8a4: makeheader(context); break; + case 0xc8a8: storeit(context); break; + case 0xc8ac: saveseg(context); break; + case 0xc8b0: findlen(context); break; + case 0xc8b4: scanfornames(context); break; + case 0xc8b8: decide(context); break; + case 0xc8bc: showdecisions(context); break; + case 0xc8c0: newgame(context); break; + case 0xc8c4: loadold(context); break; + case 0xc8c8: loadspeech(context); break; + case 0xc8cc: createname(context); break; + case 0xc8d0: loadsample(context); break; + case 0xc8d4: loadsecondsample(context); break; + case 0xc8d8: soundstartup(context); break; + case 0xc8dc: trysoundalloc(context); break; + case 0xc8e0: setsoundoff(context); break; + case 0xc8e4: checksoundint(context); break; + case 0xc8e8: enablesoundint(context); break; + case 0xc8ec: disablesoundint(context); break; + case 0xc8f0: interupttest(context); break; + case 0xc8f4: soundend(context); break; + case 0xc8f8: out22c(context); break; + case 0xc8fc: playchannel0(context); break; + case 0xc900: playchannel1(context); break; + case 0xc904: makenextblock(context); break; + case 0xc908: volumeadjust(context); break; + case 0xc90c: loopchannel0(context); break; + case 0xc910: cancelch0(context); break; + case 0xc914: cancelch1(context); break; + case 0xc918: channel0only(context); break; + case 0xc91c: channel1only(context); break; + case 0xc920: channel0tran(context); break; + case 0xc924: bothchannels(context); break; + case 0xc928: saveems(context); break; + case 0xc92c: restoreems(context); break; + case 0xc930: domix(context); break; + case 0xc934: dmaend(context); break; + case 0xc938: startdmablock(context); break; + case 0xc93c: setuppit(context); break; + case 0xc940: getridofpit(context); break; + case 0xc944: pitinterupt(context); break; + case 0xc948: dreamweb(context); break; + case 0xc94c: entrytexts(context); break; + case 0xc950: entryanims(context); break; + case 0xc954: initialinv(context); break; + case 0xc958: pickupob(context); break; + case 0xc95c: setupemm(context); break; + case 0xc960: removeemm(context); break; + case 0xc964: checkforemm(context); break; + case 0xc968: checkbasemem(context); break; + case 0xc96c: allocatebuffers(context); break; + case 0xc970: clearbuffers(context); break; + case 0xc974: clearchanges(context); break; + case 0xc978: clearbeforeload(context); break; + case 0xc97c: clearreels(context); break; + case 0xc980: clearrest(context); break; + case 0xc984: deallocatemem(context); break; + case 0xc988: allocatemem(context); break; + case 0xc990: parseblaster(context); break; + case 0xc994: startup(context); break; + case 0xc998: startup1(context); break; + case 0xc99c: screenupdate(context); break; + case 0xc9a0: watchreel(context); break; + case 0xc9a4: checkforshake(context); break; + case 0xc9a8: watchcount(context); break; + case 0xc9ac: showtime(context); break; + case 0xc9b0: dumpwatch(context); break; + case 0xc9b4: showbyte(context); break; + case 0xc9b8: onedigit(context); break; + case 0xc9bc: twodigitnum(context); break; + case 0xc9c0: showword(context); break; + case 0xc9c4: convnum(context); break; + case 0xc9c8: mainscreen(context); break; + case 0xc9cc: madmanrun(context); break; + case 0xc9d0: checkcoords(context); break; + case 0xc9d4: identifyob(context); break; + case 0xc9d8: checkifperson(context); break; + case 0xc9dc: checkifset(context); break; + case 0xc9e0: checkifex(context); break; + case 0xc9e4: checkiffree(context); break; + case 0xc9e8: isitdescribed(context); break; + case 0xc9ec: findpathofpoint(context); break; + case 0xc9f0: findfirstpath(context); break; + case 0xc9f4: turnpathon(context); break; + case 0xc9f8: turnpathoff(context); break; + case 0xc9fc: turnanypathon(context); break; + case 0xca00: turnanypathoff(context); break; + case 0xca04: checkifpathison(context); break; + case 0xca08: afternewroom(context); break; + case 0xca0c: atmospheres(context); break; + case 0xca10: walkintoroom(context); break; + case 0xca14: afterintroroom(context); break; + case 0xca18: obname(context); break; + case 0xca1c: finishedwalking(context); break; + case 0xca20: examineobtext(context); break; + case 0xca24: commandwithob(context); break; + case 0xca28: commandonly(context); break; + case 0xca2c: printmessage(context); break; + case 0xca30: printmessage2(context); break; + case 0xca34: blocknametext(context); break; + case 0xca38: personnametext(context); break; + case 0xca3c: walktotext(context); break; + case 0xca40: getflagunderp(context); break; + case 0xca44: setwalk(context); break; + case 0xca48: autosetwalk(context); break; + case 0xca4c: checkdest(context); break; + case 0xca50: bresenhams(context); break; + case 0xca54: workoutframes(context); break; + case 0xca58: getroomspaths(context); break; + case 0xca5c: copyname(context); break; + case 0xca60: findobname(context); break; + case 0xca64: showicon(context); break; + case 0xca68: middlepanel(context); break; + case 0xca6c: showman(context); break; + case 0xca70: showpanel(context); break; + case 0xca74: roomname(context); break; + case 0xca78: usecharset1(context); break; + case 0xca7c: usetempcharset(context); break; + case 0xca80: showexit(context); break; + case 0xca84: panelicons1(context); break; + case 0xca88: showwatch(context); break; + case 0xca8c: gettime(context); break; + case 0xca90: zoomicon(context); break; + case 0xca94: showblink(context); break; + case 0xca98: dumpblink(context); break; + case 0xca9c: worktoscreenm(context); break; + case 0xcaa0: blank(context); break; + case 0xcaa4: allpointer(context); break; + case 0xcaa8: hangonp(context); break; + case 0xcaac: hangonw(context); break; + case 0xcab0: hangoncurs(context); break; + case 0xcab4: getunderzoom(context); break; + case 0xcab8: dumpzoom(context); break; + case 0xcabc: putunderzoom(context); break; + case 0xcac0: crosshair(context); break; + case 0xcac4: showpointer(context); break; + case 0xcac8: delpointer(context); break; + case 0xcacc: dumppointer(context); break; + case 0xcad0: undertextline(context); break; + case 0xcad4: deltextline(context); break; + case 0xcad8: dumptextline(context); break; + case 0xcadc: animpointer(context); break; + case 0xcae0: setmouse(context); break; + case 0xcae4: readmouse(context); break; + case 0xcae8: mousecall(context); break; + case 0xcaec: readmouse1(context); break; + case 0xcaf0: readmouse2(context); break; + case 0xcaf4: readmouse3(context); break; + case 0xcaf8: readmouse4(context); break; + case 0xcafc: readkey(context); break; + case 0xcb00: convertkey(context); break; + case 0xcb04: randomnum1(context); break; + case 0xcb08: randomnum2(context); break; + case 0xcb10: hangon(context); break; + case 0xcb14: loadtraveltext(context); break; + case 0xcb18: loadintotemp(context); break; + case 0xcb1c: loadintotemp2(context); break; + case 0xcb20: loadintotemp3(context); break; + case 0xcb24: loadtempcharset(context); break; + case 0xcb28: standardload(context); break; + case 0xcb2c: loadtemptext(context); break; + case 0xcb30: loadroom(context); break; + case 0xcb34: loadroomssample(context); break; + case 0xcb38: getridofreels(context); break; + case 0xcb3c: getridofall(context); break; + case 0xcb40: restorereels(context); break; + case 0xcb44: restoreall(context); break; + case 0xcb48: sortoutmap(context); break; + case 0xcb4c: startloading(context); break; + case 0xcb50: disablepath(context); break; + case 0xcb54: findxyfrompath(context); break; + case 0xcb58: findroominloc(context); break; + case 0xcb5c: getroomdata(context); break; + case 0xcb60: readheader(context); break; + case 0xcb64: dontloadseg(context); break; + case 0xcb68: allocateload(context); break; + case 0xcb6c: fillspace(context); break; + case 0xcb70: getridoftemp(context); break; + case 0xcb74: getridoftemptext(context); break; + case 0xcb78: getridoftemp2(context); break; + case 0xcb7c: getridoftemp3(context); break; + case 0xcb80: getridoftempcharset(context); break; + case 0xcb84: getridoftempsp(context); break; + case 0xcb88: readsetdata(context); break; + case 0xcb8c: createfile(context); break; + case 0xcb90: openfile(context); break; + case 0xcb94: openfilefromc(context); break; + case 0xcb98: makename(context); break; + case 0xcb9c: openfilenocheck(context); break; + case 0xcba0: openforsave(context); break; + case 0xcba4: closefile(context); break; + case 0xcba8: readfromfile(context); break; + case 0xcbac: setkeyboardint(context); break; + case 0xcbb0: resetkeyboard(context); break; + case 0xcbb4: keyboardread(context); break; + case 0xcbb8: walkandexamine(context); break; + case 0xcbbc: doload(context); break; + case 0xcbc0: generalerror(context); break; + default: ::error("invalid call to %04x dispatched", (uint16)context.ax); + } +} + +} /*namespace*/ diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h new file mode 100644 index 0000000000..a09fb7b08c --- /dev/null +++ b/engines/dreamweb/dreamgen.h @@ -0,0 +1,648 @@ +#ifndef TASMRECOVER_DREAMGEN_STUBS_H__ +#define TASMRECOVER_DREAMGEN_STUBS_H__ + +# include "runtime.h" + +namespace dreamgen { + + void __dispatch_call(Context &context, unsigned addr); + void __start(Context &context); + + void randomnumber(Context &context); + void quickquit(Context &context); + void quickquit2(Context &context); + void seecommandtail(Context &context); + void multiget(Context &context); + void multiput(Context &context); + void multidump(Context &context); + void frameoutnm(Context &context); + void cls(Context &context); + void printundermon(Context &context); + void worktoscreen(Context &context); + void keyboardread(Context &context); + void resetkeyboard(Context &context); + void setkeyboardint(Context &context); + void readfromfile(Context &context); + void closefile(Context &context); + void openforsave(Context &context); + void openfilenocheck(Context &context); + void openfilefromc(Context &context); + void openfile(Context &context); + void createfile(Context &context); + void dontloadseg(Context &context); + void mousecall(Context &context); + void setmouse(Context &context); + void gettime(Context &context); + void allocatemem(Context &context); + void deallocatemem(Context &context); + void removeemm(Context &context); + void setupemm(Context &context); + void pitinterupt(Context &context); + void getridofpit(Context &context); + void setuppit(Context &context); + void startdmablock(Context &context); + void dmaend(Context &context); + void restoreems(Context &context); + void saveems(Context &context); + void bothchannels(Context &context); + void channel1only(Context &context); + void channel0only(Context &context); + void out22c(Context &context); + void soundend(Context &context); + void interupttest(Context &context); + void disablesoundint(Context &context); + void enablesoundint(Context &context); + void checksoundint(Context &context); + void setsoundoff(Context &context); + void soundstartup(Context &context); + void loadsecondsample(Context &context); + void loadsample(Context &context); + void loadspeech(Context &context); + void saveseg(Context &context); + void loadseg(Context &context); + void savefileread(Context &context); + void savefilewrite(Context &context); + void error(Context &context); + void generalerror(Context &context); + void dosreturn(Context &context); + void set16colpalette(Context &context); + void mode640x480(Context &context); + void showgroup(Context &context); + void fadedos(Context &context); + void doshake(Context &context); + void vsync(Context &context); + void setmode(Context &context); + void readoneblock(Context &context); + void showpcx(Context &context); + + const static uint16 kStartvars = 0; + const static uint16 kProgresspoints = 1; + const static uint16 kWatchon = 2; + const static uint16 kShadeson = 3; + const static uint16 kSecondcount = 4; + const static uint16 kMinutecount = 5; + const static uint16 kHourcount = 6; + const static uint16 kZoomon = 7; + const static uint16 kLocation = 8; + const static uint16 kExpos = 9; + const static uint16 kExframepos = 10; + const static uint16 kExtextpos = 12; + const static uint16 kCard1money = 14; + const static uint16 kListpos = 16; + const static uint16 kRyanpage = 18; + const static uint16 kWatchingtime = 19; + const static uint16 kReeltowatch = 21; + const static uint16 kEndwatchreel = 23; + const static uint16 kSpeedcount = 25; + const static uint16 kWatchspeed = 26; + const static uint16 kReeltohold = 27; + const static uint16 kEndofholdreel = 29; + const static uint16 kWatchmode = 31; + const static uint16 kDestafterhold = 32; + const static uint16 kNewsitem = 33; + const static uint16 kLiftflag = 34; + const static uint16 kLiftpath = 35; + const static uint16 kLockstatus = 36; + const static uint16 kDoorpath = 37; + const static uint16 kCounttoopen = 38; + const static uint16 kCounttoclose = 39; + const static uint16 kRockstardead = 40; + const static uint16 kGeneraldead = 41; + const static uint16 kSartaindead = 42; + const static uint16 kAidedead = 43; + const static uint16 kBeenmugged = 44; + const static uint16 kGunpassflag = 45; + const static uint16 kCanmovealtar = 46; + const static uint16 kTalkedtoattendant = 47; + const static uint16 kTalkedtosparky = 48; + const static uint16 kTalkedtoboss = 49; + const static uint16 kTalkedtorecep = 50; + const static uint16 kCardpassflag = 51; + const static uint16 kMadmanflag = 52; + const static uint16 kKeeperflag = 53; + const static uint16 kLasttrigger = 54; + const static uint16 kMandead = 55; + const static uint16 kSeed = 56; + const static uint16 kNeedtotravel = 59; + const static uint16 kThroughdoor = 60; + const static uint16 kNewobs = 61; + const static uint16 kRyanon = 62; + const static uint16 kCombatcount = 63; + const static uint16 kLastweapon = 64; + const static uint16 kDreamnumber = 65; + const static uint16 kRoomafterdream = 66; + const static uint16 kShakecounter = 67; + const static uint16 kSpeechcount = 68; + const static uint16 kCharshift = 69; + const static uint16 kKerning = 71; + const static uint16 kBrightness = 72; + const static uint16 kRoomloaded = 73; + const static uint16 kDidzoom = 74; + const static uint16 kLinespacing = 75; + const static uint16 kTextaddressx = 77; + const static uint16 kTextaddressy = 79; + const static uint16 kTextlen = 81; + const static uint16 kLastxpos = 82; + const static uint16 kIcontop = 84; + const static uint16 kIconleft = 86; + const static uint16 kItemframe = 88; + const static uint16 kItemtotran = 89; + const static uint16 kRoomad = 90; + const static uint16 kOldsubject = 92; + const static uint16 kWithobject = 94; + const static uint16 kWithtype = 95; + const static uint16 kLookcounter = 96; + const static uint16 kCommand = 98; + const static uint16 kCommandtype = 99; + const static uint16 kOldcommandtype = 100; + const static uint16 kObjecttype = 101; + const static uint16 kGetback = 102; + const static uint16 kInvopen = 103; + const static uint16 kMainmode = 104; + const static uint16 kPickup = 105; + const static uint16 kLastinvpos = 106; + const static uint16 kExamagain = 107; + const static uint16 kNewtextline = 108; + const static uint16 kOpenedob = 109; + const static uint16 kOpenedtype = 110; + const static uint16 kOldmapadx = 111; + const static uint16 kOldmapady = 113; + const static uint16 kMapadx = 115; + const static uint16 kMapady = 117; + const static uint16 kMapoffsetx = 119; + const static uint16 kMapoffsety = 121; + const static uint16 kMapxstart = 123; + const static uint16 kMapystart = 125; + const static uint16 kMapxsize = 127; + const static uint16 kMapysize = 128; + const static uint16 kHavedoneobs = 129; + const static uint16 kManisoffscreen = 130; + const static uint16 kRainspace = 131; + const static uint16 kFacing = 132; + const static uint16 kLeavedirection = 133; + const static uint16 kTurntoface = 134; + const static uint16 kTurndirection = 135; + const static uint16 kMaintimer = 136; + const static uint16 kIntrocount = 138; + const static uint16 kArrowad = 139; + const static uint16 kCurrentkey = 141; + const static uint16 kOldkey = 142; + const static uint16 kUseddirection = 143; + const static uint16 kCurrentkey2 = 144; + const static uint16 kTimercount = 145; + const static uint16 kOldtimercount = 146; + const static uint16 kMapx = 147; + const static uint16 kMapy = 148; + const static uint16 kNewscreen = 149; + const static uint16 kRyanx = 150; + const static uint16 kRyany = 151; + const static uint16 kLastflag = 152; + const static uint16 kLastflagex = 153; + const static uint16 kFlagx = 154; + const static uint16 kFlagy = 155; + const static uint16 kCurrentex = 156; + const static uint16 kCurrentfree = 157; + const static uint16 kCurrentframe = 158; + const static uint16 kFramesad = 160; + const static uint16 kDataad = 162; + const static uint16 kFrsegment = 164; + const static uint16 kObjectx = 166; + const static uint16 kObjecty = 168; + const static uint16 kOffsetx = 170; + const static uint16 kOffsety = 172; + const static uint16 kSavesize = 174; + const static uint16 kSavesource = 176; + const static uint16 kSavex = 178; + const static uint16 kSavey = 179; + const static uint16 kCurrentob = 180; + const static uint16 kPriority = 181; + const static uint16 kDestpos = 182; + const static uint16 kReallocation = 183; + const static uint16 kRoomnum = 184; + const static uint16 kNowinnewroom = 185; + const static uint16 kResetmanxy = 186; + const static uint16 kNewlocation = 187; + const static uint16 kAutolocation = 188; + const static uint16 kMustload = 189; + const static uint16 kAnswered = 190; + const static uint16 kSaidno = 191; + const static uint16 kDoorcheck1 = 192; + const static uint16 kDoorcheck2 = 193; + const static uint16 kDoorcheck3 = 194; + const static uint16 kDoorcheck4 = 195; + const static uint16 kMousex = 196; + const static uint16 kMousey = 198; + const static uint16 kMousebutton = 200; + const static uint16 kMousebutton1 = 202; + const static uint16 kMousebutton2 = 204; + const static uint16 kMousebutton3 = 206; + const static uint16 kMousebutton4 = 208; + const static uint16 kOldbutton = 210; + const static uint16 kOldx = 212; + const static uint16 kOldy = 214; + const static uint16 kLastbutton = 216; + const static uint16 kOldpointerx = 218; + const static uint16 kOldpointery = 220; + const static uint16 kDelherex = 222; + const static uint16 kDelherey = 224; + const static uint16 kPointerxs = 226; + const static uint16 kPointerys = 227; + const static uint16 kDelxs = 228; + const static uint16 kDelys = 229; + const static uint16 kPointerframe = 230; + const static uint16 kPointerpower = 231; + const static uint16 kAuxpointerframe = 232; + const static uint16 kPointermode = 233; + const static uint16 kPointerspeed = 234; + const static uint16 kPointercount = 235; + const static uint16 kInmaparea = 236; + const static uint16 kReelpointer = 237; + const static uint16 kSlotdata = 239; + const static uint16 kThisslot = 240; + const static uint16 kSlotflags = 241; + const static uint16 kTakeoff = 242; + const static uint16 kTalkmode = 244; + const static uint16 kTalkpos = 245; + const static uint16 kCharacter = 246; + const static uint16 kPersondata = 247; + const static uint16 kTalknum = 249; + const static uint16 kNumberinroom = 250; + const static uint16 kCurrentcel = 251; + const static uint16 kOldselection = 252; + const static uint16 kStopwalking = 253; + const static uint16 kMouseon = 254; + const static uint16 kPlayed = 255; + const static uint16 kTimer1 = 257; + const static uint16 kTimer2 = 258; + const static uint16 kTimer3 = 259; + const static uint16 kWholetimer = 260; + const static uint16 kTimer1to = 262; + const static uint16 kTimer2to = 263; + const static uint16 kTimer3to = 264; + const static uint16 kWatchdump = 265; + const static uint16 kCurrentset = 266; + const static uint16 kLogonum = 268; + const static uint16 kOldlogonum = 269; + const static uint16 kNewlogonum = 270; + const static uint16 kNetseg = 271; + const static uint16 kNetpoint = 273; + const static uint16 kKeynum = 275; + const static uint16 kCursorstate = 276; + const static uint16 kPressed = 277; + const static uint16 kPresspointer = 278; + const static uint16 kGraphicpress = 280; + const static uint16 kPresscount = 281; + const static uint16 kKeypadax = 282; + const static uint16 kKeypadcx = 284; + const static uint16 kLightcount = 286; + const static uint16 kFolderpage = 287; + const static uint16 kDiarypage = 288; + const static uint16 kMenucount = 289; + const static uint16 kSymboltopx = 290; + const static uint16 kSymboltopnum = 291; + const static uint16 kSymboltopdir = 292; + const static uint16 kSymbolbotx = 293; + const static uint16 kSymbolbotnum = 294; + const static uint16 kSymbolbotdir = 295; + const static uint16 kSymboltolight = 296; + const static uint16 kSymbol1 = 297; + const static uint16 kSymbol2 = 298; + const static uint16 kSymbol3 = 299; + const static uint16 kSymbolnum = 300; + const static uint16 kDumpx = 301; + const static uint16 kDumpy = 303; + const static uint16 kWalkandexam = 305; + const static uint16 kWalkexamtype = 306; + const static uint16 kWalkexamnum = 307; + const static uint16 kCursloc = 308; + const static uint16 kCurslocx = 310; + const static uint16 kCurslocy = 312; + const static uint16 kCurpos = 314; + const static uint16 kMonadx = 316; + const static uint16 kMonady = 318; + const static uint16 kGotfrom = 320; + const static uint16 kMonsource = 322; + const static uint16 kNumtodo = 324; + const static uint16 kTimecount = 326; + const static uint16 kCounttotimed = 328; + const static uint16 kTimedseg = 330; + const static uint16 kTimedoffset = 332; + const static uint16 kTimedy = 334; + const static uint16 kTimedx = 335; + const static uint16 kNeedtodumptimed = 336; + const static uint16 kHandle = 337; + const static uint16 kLoadingorsave = 339; + const static uint16 kCurrentslot = 340; + const static uint16 kCursorpos = 341; + const static uint16 kColourpos = 342; + const static uint16 kFadedirection = 343; + const static uint16 kNumtofade = 344; + const static uint16 kFadecount = 345; + const static uint16 kAddtogreen = 346; + const static uint16 kAddtored = 347; + const static uint16 kAddtoblue = 348; + const static uint16 kLastsoundreel = 349; + const static uint16 kSoundbuffer = 351; + const static uint16 kSoundbufferad = 353; + const static uint16 kSoundbufferpage = 355; + const static uint16 kSoundtimes = 356; + const static uint16 kNeedsoundbuff = 357; + const static uint16 kOldint9seg = 358; + const static uint16 kOldint9add = 360; + const static uint16 kOldint8seg = 362; + const static uint16 kOldint8add = 364; + const static uint16 kOldsoundintseg = 366; + const static uint16 kOldsoundintadd = 368; + const static uint16 kSoundbaseadd = 370; + const static uint16 kDsp_status = 372; + const static uint16 kDsp_write = 374; + const static uint16 kDmaaddress = 376; + const static uint16 kSoundint = 377; + const static uint16 kSounddmachannel = 378; + const static uint16 kSampleplaying = 379; + const static uint16 kTestresult = 380; + const static uint16 kCurrentirq = 381; + const static uint16 kSpeechloaded = 382; + const static uint16 kSpeechlength = 383; + const static uint16 kVolume = 385; + const static uint16 kVolumeto = 386; + const static uint16 kVolumedirection = 387; + const static uint16 kVolumecount = 388; + const static uint16 kPlayblock = 389; + const static uint16 kWongame = 390; + const static uint16 kLasthardkey = 391; + const static uint16 kBufferin = 392; + const static uint16 kBufferout = 394; + const static uint16 kExtras = 396; + const static uint16 kWorkspace = 398; + const static uint16 kMapstore = 400; + const static uint16 kCharset1 = 402; + const static uint16 kTempcharset = 404; + const static uint16 kIcons1 = 406; + const static uint16 kIcons2 = 408; + const static uint16 kBuffers = 410; + const static uint16 kMainsprites = 412; + const static uint16 kBackdrop = 414; + const static uint16 kMapdata = 416; + const static uint16 kSounddata = 418; + const static uint16 kSounddata2 = 420; + const static uint16 kRecordspace = 422; + const static uint16 kFreedat = 424; + const static uint16 kSetdat = 426; + const static uint16 kReel1 = 428; + const static uint16 kReel2 = 430; + const static uint16 kReel3 = 432; + const static uint16 kRoomdesc = 434; + const static uint16 kFreedesc = 436; + const static uint16 kSetdesc = 438; + const static uint16 kBlockdesc = 440; + const static uint16 kSetframes = 442; + const static uint16 kFreeframes = 444; + const static uint16 kPeople = 446; + const static uint16 kReels = 448; + const static uint16 kCommandtext = 450; + const static uint16 kPuzzletext = 452; + const static uint16 kTraveltext = 454; + const static uint16 kTempgraphics = 456; + const static uint16 kTempgraphics2 = 458; + const static uint16 kTempgraphics3 = 460; + const static uint16 kTempsprites = 462; + const static uint16 kTextfile1 = 464; + const static uint16 kTextfile2 = 466; + const static uint16 kTextfile3 = 468; + const static uint16 kBlinkframe = 470; + const static uint16 kBlinkcount = 471; + const static uint16 kReasseschanges = 472; + const static uint16 kPointerspath = 473; + const static uint16 kManspath = 474; + const static uint16 kPointerfirstpath = 475; + const static uint16 kFinaldest = 476; + const static uint16 kDestination = 477; + const static uint16 kLinestartx = 478; + const static uint16 kLinestarty = 480; + const static uint16 kLineendx = 482; + const static uint16 kLineendy = 484; + const static uint16 kIncrement1 = 486; + const static uint16 kIncrement2 = 488; + const static uint16 kLineroutine = 490; + const static uint16 kLinepointer = 491; + const static uint16 kLinedirection = 492; + const static uint16 kLinelength = 493; + const static uint16 kLiftsoundcount = 494; + const static uint16 kEmmhandle = 495; + const static uint16 kEmmpageframe = 497; + const static uint16 kEmmhardwarepage = 499; + const static uint16 kCh0emmpage = 500; + const static uint16 kCh0offset = 502; + const static uint16 kCh0blockstocopy = 504; + const static uint16 kCh0playing = 506; + const static uint16 kCh0repeat = 507; + const static uint16 kCh0oldemmpage = 508; + const static uint16 kCh0oldoffset = 510; + const static uint16 kCh0oldblockstocopy = 512; + const static uint16 kCh1playing = 514; + const static uint16 kCh1emmpage = 515; + const static uint16 kCh1offset = 517; + const static uint16 kCh1blockstocopy = 519; + const static uint16 kCh1blocksplayed = 521; + const static uint16 kSoundbufferwrite = 523; + const static uint16 kSoundemmpage = 525; + const static uint16 kSpeechemmpage = 527; + const static uint16 kCurrentsample = 529; + const static uint16 kRoomssample = 530; + const static uint16 kGameerror = 531; + const static uint16 kHowmuchalloc = 532; + const static uint16 kReelroutines = 534; + const static uint16 kReelcalls = 991; + const static uint16 kRoombyroom = 1214; + const static uint16 kR0 = 1326; + const static uint16 kR1 = 1327; + const static uint16 kR2 = 1331; + const static uint16 kR6 = 1350; + const static uint16 kR8 = 1357; + const static uint16 kR9 = 1373; + const static uint16 kR10 = 1380; + const static uint16 kR11 = 1384; + const static uint16 kR12 = 1388; + const static uint16 kR13 = 1392; + const static uint16 kR14 = 1405; + const static uint16 kR20 = 1439; + const static uint16 kR22 = 1461; + const static uint16 kR23 = 1492; + const static uint16 kR25 = 1505; + const static uint16 kR26 = 1527; + const static uint16 kR27 = 1549; + const static uint16 kR28 = 1574; + const static uint16 kR29 = 1593; + const static uint16 kR45 = 1609; + const static uint16 kR46 = 1616; + const static uint16 kR47 = 1653; + const static uint16 kR52 = 1666; + const static uint16 kR53 = 1670; + const static uint16 kR55 = 1677; + const static uint16 kSpritename1 = 1819; + const static uint16 kSpritename3 = 1832; + const static uint16 kIdname = 1845; + const static uint16 kCharacterset1 = 1857; + const static uint16 kCharacterset2 = 1870; + const static uint16 kCharacterset3 = 1883; + const static uint16 kSamplename = 1896; + const static uint16 kBasicsample = 1909; + const static uint16 kIcongraphics0 = 1922; + const static uint16 kIcongraphics1 = 1935; + const static uint16 kExtragraphics1 = 1948; + const static uint16 kIcongraphics8 = 1961; + const static uint16 kMongraphicname = 1974; + const static uint16 kMongraphics2 = 1987; + const static uint16 kCityname = 2000; + const static uint16 kTravelgraphic1 = 2013; + const static uint16 kTravelgraphic2 = 2026; + const static uint16 kDiarygraphic = 2039; + const static uint16 kMonitorfile1 = 2052; + const static uint16 kMonitorfile2 = 2065; + const static uint16 kMonitorfile10 = 2078; + const static uint16 kMonitorfile11 = 2091; + const static uint16 kMonitorfile12 = 2104; + const static uint16 kMonitorfile13 = 2117; + const static uint16 kMonitorfile20 = 2130; + const static uint16 kMonitorfile21 = 2143; + const static uint16 kMonitorfile22 = 2156; + const static uint16 kMonitorfile23 = 2169; + const static uint16 kMonitorfile24 = 2182; + const static uint16 kFoldertext = 2195; + const static uint16 kDiarytext = 2208; + const static uint16 kPuzzletextname = 2221; + const static uint16 kTraveltextname = 2234; + const static uint16 kIntrotextname = 2247; + const static uint16 kEndtextname = 2260; + const static uint16 kCommandtextname = 2273; + const static uint16 kVolumetabname = 2286; + const static uint16 kFoldergraphic1 = 2299; + const static uint16 kFoldergraphic2 = 2312; + const static uint16 kFoldergraphic3 = 2325; + const static uint16 kSymbolgraphic = 2338; + const static uint16 kGungraphic = 2351; + const static uint16 kMonkface = 2364; + const static uint16 kTitle0graphics = 2377; + const static uint16 kTitle1graphics = 2390; + const static uint16 kTitle2graphics = 2403; + const static uint16 kTitle3graphics = 2416; + const static uint16 kTitle4graphics = 2429; + const static uint16 kTitle5graphics = 2442; + const static uint16 kTitle6graphics = 2455; + const static uint16 kTitle7graphics = 2468; + const static uint16 kPalettescreen = 2481; + const static uint16 kCurrentfile = 2970; + const static uint16 kDmaaddresses = 5118; + const static uint16 kFileheader = 6091; + const static uint16 kFiledata = 6141; + const static uint16 kExtradata = 6181; + const static uint16 kRoomdata = 6187; + const static uint16 kMadeuproomdat = 7979; + const static uint16 kRoomscango = 8011; + const static uint16 kRoompics = 8027; + const static uint16 kOplist = 8042; + const static uint16 kInputline = 8045; + const static uint16 kLinedata = 8173; + const static uint16 kPresslist = 8573; + const static uint16 kSavenames = 8579; + const static uint16 kSavefiles = 8698; + const static uint16 kRecname = 8789; + const static uint16 kStak = 8802; + const static uint16 kBlocktextdat = (0); + const static uint16 kPersonframes = (0); + const static uint16 kDebuglevel1 = (0); + const static uint16 kDebuglevel2 = (0); + const static uint16 kPlayback = (0); + const static uint16 kMap = (0); + const static uint16 kSettextdat = (0); + const static uint16 kSpanish = (0); + const static uint16 kFramedata = (0); + const static uint16 kRecording = (0); + const static uint16 kFlags = (0); + const static uint16 kGerman = (0); + const static uint16 kTextunder = (0); + const static uint16 kForeign = (0); + const static uint16 kPathdata = (0); + const static uint16 kDemo = (0); + const static uint16 kExframedata = (0); + const static uint16 kIntextdat = (0); + const static uint16 kFreetextdat = (0); + const static uint16 kFrframedata = (0); + const static uint16 kSettext = (0+(130*2)); + const static uint16 kOpeninvlist = (0+(180*10)); + const static uint16 kRyaninvlist = (0+(180*10)+32); + const static uint16 kPointerback = (0+(180*10)+32+60); + const static uint16 kMapflags = (0+(180*10)+32+60+(32*32)); + const static uint16 kStartpal = (0+(180*10)+32+60+(32*32)+(11*10*3)); + const static uint16 kEndpal = (0+(180*10)+32+60+(32*32)+(11*10*3)+768); + const static uint16 kMaingamepal = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768); + const static uint16 kSpritetable = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768); + const static uint16 kSetlist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)); + const static uint16 kFreelist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)); + const static uint16 kExlist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)); + const static uint16 kPeoplelist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)); + const static uint16 kZoomspace = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)); + const static uint16 kPrintedlist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)); + const static uint16 kListofchanges = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); + const static uint16 kUndertimedtext = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); + const static uint16 kRainlist = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)); + const static uint16 kInitialreelrouts = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)); + const static uint16 kInitialvars = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534); + const static uint16 kLengthofbuffer = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534+68-0); + const static uint16 kReellist = (0+(36*144)); + const static uint16 kIntext = (0+(38*2)); + const static uint16 kLengthofmap = (0+(66*60)); + const static uint16 kFreetext = (0+(82*2)); + const static uint16 kBlocktext = (0+(98*2)); + const static uint16 kBlocks = (0+192); + const static uint16 kFrframes = (0+2080); + const static uint16 kExframes = (0+2080); + const static uint16 kFrames = (0+2080); + const static uint16 kExdata = (0+2080+30000); + const static uint16 kExtextdat = (0+2080+30000+(16*114)); + const static uint16 kExtext = (0+2080+30000+(16*114)+((114+2)*2)); + const static uint16 kLengthofextra = (0+2080+30000+(16*114)+((114+2)*2)+18000); + const static uint16 kPersontxtdat = (0+24); + const static uint16 kPersontext = (0+24+(1026*2)); + const static uint16 kInputport = (0x63); + const static uint16 kCd = (1); + const static uint16 kUndertextsizey = (10); + const static uint16 kNumexobjects = (114); + const static uint16 kZoomy = (132); + const static uint16 kFreedatlen = (16*80); + const static uint16 kUndertextsizex = (180); + const static uint16 kExtextlen = (18000); + const static uint16 kLenofmapstore = (22*8*20*8); + const static uint16 kUndertimedysize = (24); + const static uint16 kNumchanges = (250); + const static uint16 kExframeslen = (30000); + const static uint16 kTablesize = (32); + const static uint16 kScreenwidth = (320); + const static uint16 kKeypadx = (36+112); + const static uint16 kItempicsize = (44); + const static uint16 kDiaryy = (48+12); + const static uint16 kOpsy = (52); + const static uint16 kSymboly = (56); + const static uint16 kInventy = (58); + const static uint16 kMenuy = (60); + const static uint16 kOpsx = (60); + const static uint16 kMaplength = (60); + const static uint16 kHeaderlen = (6187-6091); + const static uint16 kSymbolx = (64); + const static uint16 kSetdatlen = (64*128); + const static uint16 kMapwidth = (66); + const static uint16 kTextstart = (66*2); + const static uint16 kMaplen = (66*60); + const static uint16 kDiaryx = (68+24); + const static uint16 kLengthofvars = (68-0); + const static uint16 kKeypady = (72); + const static uint16 kZoomx = (8); + const static uint16 kInventx = (80); + const static uint16 kMenux = (80+40); + const static uint16 kLenofreelrouts = (991-534); + + +} + +#endif diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp new file mode 100644 index 0000000000..19bb6b09cb --- /dev/null +++ b/engines/dreamweb/dreamweb.cpp @@ -0,0 +1,1101 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/dreamweb.cpp $ + * $Id: dreamweb.cpp 79 2011-06-05 08:26:54Z eriktorbjorn $ + * + */ + +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "common/events.h" +#include "common/EventRecorder.h" +#include "common/file.h" +#include "common/func.h" +#include "common/system.h" +#include "common/timer.h" +#include "common/util.h" + +#include "engines/util.h" + +#include "audio/mixer.h" +#include "audio/decoders/raw.h" + +#include "graphics/palette.h" +#include "graphics/surface.h" + +#include "dreamweb/dreamweb.h" +#include "dreamweb/dreamgen.h" + +namespace dreamgen { + void doshake(dreamgen::Context &context); + void dofade(dreamgen::Context &context); + void volumeadjust(dreamgen::Context &context); +} + +namespace DreamWeb { + +DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) : + Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb") { + + _context.engine = this; + // Setup mixer + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); + + _vSyncInterrupt = false; + + _console = 0; + DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag"); + DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function"); + _outSaveFile = 0; + _inSaveFile = 0; + _speed = 1; + _turbo = false; + _oldMouseState = 0; + _channel0 = 0; + _channel1 = 0; +} + +DreamWebEngine::~DreamWebEngine() { + DebugMan.clearAllDebugChannels(); + delete _console; +} + +static void vSyncInterrupt(void *refCon) { + DreamWebEngine *vm = (DreamWebEngine *)refCon; + + if (!vm->isPaused()) { + vm->setVSyncInterrupt(true); + } +} + +void DreamWebEngine::setVSyncInterrupt(bool flag) { + _vSyncInterrupt = flag; +} + +void DreamWebEngine::waitForVSync() { + processEvents(); + + if (!_turbo) { + while (!_vSyncInterrupt) { + _system->delayMillis(10); + } + setVSyncInterrupt(false); + } + + dreamgen::doshake(_context); + dreamgen::dofade(_context); + _system->updateScreen(); +} + +void DreamWebEngine::quit() { + warning("Engine should quit gracefully (but doesn't yet)"); + g_system->quit(); +} + +void DreamWebEngine::processEvents() { + Common::EventManager *event_manager = _system->getEventManager(); + if (event_manager->shouldQuit()) { + quit(); + return; + } + soundHandler(); + Common::Event event; + int softKey, hardKey; + while (event_manager->pollEvent(event)) { + switch(event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.flags & Common::KBD_CTRL) { + switch (event.kbd.keycode) { + + case Common::KEYCODE_d: + _console->attach(); + _console->onFrame(); + break; + + case Common::KEYCODE_f: + setSpeed(_speed != 20? 20: 1); + break; + + case Common::KEYCODE_g: + _turbo = !_turbo; + break; + + case Common::KEYCODE_c: //skip statue puzzle + _context.data.byte(dreamgen::kSymbolbotnum) = 3; + _context.data.byte(dreamgen::kSymboltopnum) = 5; + break; + + default: + break; + } + + return; //do not pass ctrl + key to the engine + } + + // Some parts of the ASM code uses the hardware key + // code directly. We don't have that code, so we fake + // it for the keys where it's needed and assume it's + // 0 (which is actually an invalid value, as far as I + // know) otherwise. + + hardKey = 0; + + switch (event.kbd.keycode) { + case Common::KEYCODE_ESCAPE: + hardKey = 1; + break; + case Common::KEYCODE_SPACE: + hardKey = 57; + break; + default: + hardKey = 0; + break; + } + + _context.data.byte(dreamgen::kLasthardkey) = hardKey; + + // The rest of the keys are converted to ASCII. This + // is fairly restrictive, and eventually we may want + // to let through more keys. I think this is mostly to + // keep weird glyphs out of savegame names. + + softKey = 0; + + if (event.kbd.keycode >= Common::KEYCODE_a && event.kbd.keycode <= Common::KEYCODE_z) { + softKey = event.kbd.ascii & ~0x20; + } else if (event.kbd.keycode == Common::KEYCODE_MINUS || + event.kbd.keycode == Common::KEYCODE_SPACE || + (event.kbd.keycode >= Common::KEYCODE_0 && event.kbd.keycode <= Common::KEYCODE_9)) { + softKey = event.kbd.ascii; + } else if (event.kbd.keycode >= Common::KEYCODE_KP0 && event.kbd.keycode <= Common::KEYCODE_KP9) { + softKey = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; + } else if (event.kbd.keycode == Common::KEYCODE_KP_MINUS) { + softKey = '-'; + } else if (event.kbd.keycode == Common::KEYCODE_BACKSPACE || + event.kbd.keycode == Common::KEYCODE_DELETE) { + softKey = 8; + } else if (event.kbd.keycode == Common::KEYCODE_RETURN + || event.kbd.keycode == Common::KEYCODE_KP_ENTER) { + softKey = 13; + } + + if (softKey) + keyPressed(softKey); + break; + default: + break; + } + } +} + + +Common::Error DreamWebEngine::run() { + _console = new DreamWebConsole(this); + + getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this); + //http://martin.hinner.info/vga/timing.html + + dreamgen::__start(_context); + + getTimerManager()->removeTimerProc(vSyncInterrupt); + + return Common::kNoError; +} + +void DreamWebEngine::setSpeed(uint speed) { + debug(0, "setting speed %u", speed); + _speed = speed; + getTimerManager()->removeTimerProc(vSyncInterrupt); + getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this); +} + +void DreamWebEngine::openFile(const Common::String &name) { + processEvents(); + closeFile(); + if (_file.open(name)) + return; + _inSaveFile = _system->getSavefileManager()->openForLoading(name); + if (_inSaveFile) + return; + error("cannot open file %s", name.c_str()); +} + +uint32 DreamWebEngine::skipBytes(uint32 bytes) { + if (!_file.seek(bytes, SEEK_CUR)) + error("seek failed"); + return _file.pos(); +} + +uint32 DreamWebEngine::readFromFile(uint8 *dst, unsigned size) { + processEvents(); + if (_file.isOpen()) + return _file.read(dst, size); + if (_inSaveFile) + return _inSaveFile->read(dst, size); + error("file was not opened (read before open)"); +} + +void DreamWebEngine::closeFile() { + processEvents(); + if (_file.isOpen()) + _file.close(); + delete _inSaveFile; + _inSaveFile = 0; + delete _outSaveFile; + _outSaveFile = 0; +} + +void DreamWebEngine::openSaveFileForWriting(const Common::String &name) { + processEvents(); + delete _outSaveFile; + _outSaveFile = _system->getSavefileManager()->openForSaving(name); +} + +bool DreamWebEngine::openSaveFileForReading(const Common::String &name) { + processEvents(); + delete _inSaveFile; + _inSaveFile = _system->getSavefileManager()->openForLoading(name); + return _inSaveFile != 0; +} + +uint DreamWebEngine::writeToSaveFile(const uint8 *data, uint size) { + processEvents(); + if (!_outSaveFile) + error("save file was not opened for writing"); + return _outSaveFile->write(data, size); +} + +uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) { + processEvents(); + if (!_inSaveFile) + error("save file was not opened for reading"); + return _inSaveFile->read(data, size); +} + + +void DreamWebEngine::keyPressed(uint16 ascii) { + debug(2, "key pressed = %04x", ascii); + uint8* keybuf = _context.data.ptr(5912, 16); //fixme: some hardcoded offsets are not added as consts + uint16 in = (_context.data.word(dreamgen::kBufferin) + 1) & 0x0f; + uint16 out = _context.data.word(dreamgen::kBufferout); + if (in == out) { + warning("keyboard buffer is full"); + return; + } + _context.data.word(dreamgen::kBufferin) = in; + keybuf[in] = ascii; +} + +void DreamWebEngine::mouseCall() { + processEvents(); + Common::EventManager *eventMan = _system->getEventManager(); + Common::Point pos = eventMan->getMousePos(); + if (pos.x > 298) + pos.x = 298; + if (pos.x < 15) + pos.x = 15; + if (pos.y < 15) + pos.y = 15; + if (pos.y > 184) + pos.y = 184; + _context.cx = pos.x; + _context.dx = pos.y; + + unsigned state = eventMan->getButtonState(); + _context.bx = state == _oldMouseState? 0: state; + _oldMouseState = state; + _context.flags._c = false; +} + +void DreamWebEngine::setGraphicsMode() { + processEvents(); + initGraphics(320, 200, false); +} + +void DreamWebEngine::fadeDos() { + _context.ds = _context.es = _context.data.word(dreamgen::kBuffers); + return; //fixme later + waitForVSync(); + //processEvents will be called from vsync + uint8 *dst = _context.es.ptr(dreamgen::kStartpal, 768); + getPalette(dst, 0, 64); + for(int fade = 0; fade < 64; ++fade) { + for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors + if (dst[c]) { + --dst[c]; + } + } + setPalette(dst, 0, 64); + waitForVSync(); + } +} + +void DreamWebEngine::setPalette() { + processEvents(); + unsigned n = (uint16)_context.cx; + uint8 *src = _context.ds.ptr(_context.si, n * 3); + setPalette(src, _context.al, n); + _context.si += n * 3; + _context.cx = 0; +} + +void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) { + _system->getPaletteManager()->grabPalette(data, start, count); + while(count--) + *data++ >>= 2; +} + +void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) { + assert(start + count <= 256); + uint8 fixed[768]; + for(uint i = 0; i < count * 3; ++i) { + fixed[i] = data[i] << 2; + } + _system->getPaletteManager()->setPalette(fixed, start, count); +} + + +void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) { + if (y + h > 200) + h = 200 - y; + if (x + w > 320) + w = 320 - x; + if (h <= 0 || w <= 0) + return; + _system->copyRectToScreen(src, pitch, x, y, w, h); +} + +void DreamWebEngine::printUnderMonitor() { + _context.es = _context.data.word(dreamgen::kWorkspace); + _context.di = dreamgen::kScreenwidth * 43 + 76; + _context.si = _context.di + 8 * dreamgen::kScreenwidth; + + Graphics::Surface *s = _system->lockScreen(); + if (!s) + error("lockScreen failed"); + + for(uint y = 0; y < 104; ++y) { + uint8 *src = (uint8 *)s->getBasePtr(76, 43 + 8 + y); + uint8 *dst = _context.es.ptr(_context.di, 170); + for(uint x = 0; x < 170; ++x) { + if (*src < 231) + *dst++ = *src++; + else { + ++dst; ++src; + } + } + _context._add(_context.di, dreamgen::kScreenwidth); + _context._add(_context.si, dreamgen::kScreenwidth); + } + _context.cx = 0; + _system->unlockScreen(); +} + +void DreamWebEngine::cls() { + _system->fillScreen(0); +} + +void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) { + debug(1, "playSound(%u, %u, %u)", channel, id, loops); + const SoundData &data = _soundData[id >= 12? 1: 0]; + + Audio::Mixer::SoundType type; + bool speech = id == 62; //actually 50 + if (id >= 12) { + id -= 12; + type = Audio::Mixer::kSFXSoundType; + } else if (speech) + type = Audio::Mixer::kSpeechSoundType; + else + type = Audio::Mixer::kMusicSoundType; + + Audio::SeekableAudioStream *raw; + if (!speech) { + if (id >= data.samples.size() || data.samples[id].size == 0) { + warning("invalid sample #%u played", id); + return; + } + + const Sample &sample = data.samples[id]; + uint8 *buffer = (uint8 *)malloc(sample.size); + if (!buffer) + error("out of memory: cannot allocate memory for sound(%u bytes)", sample.size); + memcpy(buffer, data.data.begin() + sample.offset, sample.size); + + raw = Audio::makeRawStream( + buffer, + sample.size, 22050, Audio::FLAG_UNSIGNED); + } else { + uint8 *buffer = (uint8 *)malloc(_speechData.size()); + memcpy(buffer, _speechData.begin(), _speechData.size()); + if (!buffer) + error("out of memory: cannot allocate memory for sound(%u bytes)", _speechData.size()); + raw = Audio::makeRawStream( + buffer, + _speechData.size(), 22050, Audio::FLAG_UNSIGNED); + + } + + Audio::AudioStream *stream; + if (loops > 1) { + stream = new Audio::LoopingAudioStream(raw, loops < 255? loops: 0); + } else + stream = raw; + + if (_mixer->isSoundHandleActive(_channelHandle[channel])) + _mixer->stopHandle(_channelHandle[channel]); + _mixer->playStream(type, &_channelHandle[channel], stream); +} + +bool DreamWebEngine::loadSpeech(const Common::String &filename) { + Common::File file; + if (!file.open("speech/" + filename)) + return false; + + debug(1, "loadSpeech(%s)", filename.c_str()); + + uint size = file.size(); + _speechData.resize(size); + file.read(_speechData.begin(), size); + file.close(); + return true; +} + + +void DreamWebEngine::soundHandler() { + _context.push(_context.ax); + volumeadjust(_context); + _context.ax = _context.pop(); + + uint volume = _context.data.byte(dreamgen::kVolume); + //.vol file loaded into soundbuf:0x4000 + //volume table at (volume * 0x100 + 0x3f00) + //volume value could be from 1 to 7 + //1 - 0x10-0xff + //2 - 0x1f-0xdf + //3 - 0x2f-0xd0 + //4 - 0x3e-0xc1 + //5 - 0x4d-0xb2 + //6 - 0x5d-0xa2 + //7 - 0x6f-0x91 + if (volume >= 8) + volume = 7; + volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8; + _mixer->setChannelVolume(_channelHandle[0], volume); + + uint8 ch0 = _context.data.byte(dreamgen::kCh0playing); + if (ch0 == 255) + ch0 = 0; + uint8 ch1 = _context.data.byte(dreamgen::kCh1playing); + if (ch1 == 255) + ch1 = 0; + uint8 ch0loop = _context.data.byte(dreamgen::kCh0repeat); + + if (_channel0 != ch0) { + _channel0 = ch0; + if (ch0) { + playSound(0, ch0, ch0loop); + } + } + if (_channel1 != ch1) { + _channel1 = ch1; + if (ch1) { + playSound(1, ch1, 1); + } + } + if (!_mixer->isSoundHandleActive(_channelHandle[0])) { + _context.data.byte(dreamgen::kCh0playing) = 255; + _channel0 = 0; + } + if (!_mixer->isSoundHandleActive(_channelHandle[1])) { + _context.data.byte(dreamgen::kCh1playing) = 255; + _channel1 = 0; + } + +} + +void DreamWebEngine::loadSounds(uint bank, const Common::String &filename) { + debug(1, "loadSounds(%u, %s)", bank, filename.c_str()); + Common::File file; + if (!file.open(filename)) { + warning("cannot open %s", filename.c_str()); + return; + } + + uint8 header[0x60]; + file.read(header, sizeof(header)); + uint tablesize = READ_LE_UINT16(header + 0x32); + debug(1, "table size = %u", tablesize); + + SoundData &soundData = _soundData[bank]; + soundData.samples.resize(tablesize / 6); + uint total = 0; + for(uint i = 0; i < tablesize / 6; ++i) { + uint8 entry[6]; + Sample &sample = soundData.samples[i]; + file.read(entry, sizeof(entry)); + sample.offset = entry[0] * 0x4000 + READ_LE_UINT16(entry + 1); + sample.size = READ_LE_UINT16(entry + 3) * 0x800; + total += sample.size; + debug(1, "offset: %08x, size: %u", sample.offset, sample.size); + } + soundData.data.resize(total); + file.read(soundData.data.begin(), total); + file.close(); +} + + +} // End of namespace DreamWeb + + +namespace dreamgen { + +Common::String getFilename(Context &context) { + uint16 name_ptr = context.dx; + Common::String name; + uint8 c; + while((c = context.cs.byte(name_ptr++)) != 0) + name += (char)c; + return name; +} + +void multiget(Context &context) { + unsigned w = (uint8)context.cl, h = (uint8)context.ch; + unsigned x = (uint16)context.di, y = (uint16)context.bx; + unsigned src = x + y * kScreenwidth; + unsigned dst = (uint16)context.si; + context.es = context.ds; + context.ds = context.data.word(kWorkspace); + if (y + h > 200) + h = 200 - y; + if (x + w > 320) + w = 320 - x; + //debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)context.ds, (uint16)context.es); + for(unsigned l = 0; l < h; ++l) { + uint8 *src_p = context.ds.ptr(src + kScreenwidth * l, w); + uint8 *dst_p = context.es.ptr(dst + w * l, w); + memcpy(dst_p, src_p, w); + } + context.si += w * h; + context.di = src + kScreenwidth * h; + context.cx = 0; +} + +void multiput(Context &context) { + unsigned w = (uint8)context.cl, h = (uint8)context.ch; + unsigned x = (uint16)context.di, y = (uint16)context.bx; + unsigned src = (uint16)context.si; + unsigned dst = x + y * kScreenwidth; + context.es = context.data.word(kWorkspace); + if (y + h > 200) + h = 200 - y; + if (x + w > 320) + w = 320 - x; + //debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)context.ds, (uint16)context.es); + for(unsigned l = 0; l < h; ++l) { + uint8 *src_p = context.ds.ptr(src + w * l, w); + uint8 *dst_p = context.es.ptr(dst + kScreenwidth * l, w); + memcpy(dst_p, src_p, w); + } + context.si += w * h; + context.di = dst + kScreenwidth * h; + context.cx = 0; +} + +void multidump(Context &context) { + context.ds = context.data.word(kWorkspace); + int w = (uint8)context.cl, h = (uint8)context.ch; + int x = (int16)context.di, y = (int16)context.bx; + unsigned offset = x + y * kScreenwidth; + //debug(1, "multidump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)context.ds, x, y, offset); + context.engine->blit(context.ds.ptr(offset, w * h), kScreenwidth, x, y, w, h); + context.si = context.di = offset + h * kScreenwidth; + context.cx = 0; +} + +void worktoscreen(Context &context) { + context.ds = context.data.word(kWorkspace); + uint size = 320 * 200; + context.engine->blit(context.ds.ptr(0, size), 320, 0, 0, 320, 200); + context.di = context.si = size; + context.cx = 0; +} + +void printundermon(Context &context) { + context.engine->printUnderMonitor(); +} + +void cls(Context &context) { + context.engine->cls(); +} + +void frameoutnm(Context &context) { + unsigned w = (uint8)context.cl, h = (uint8)context.ch; + unsigned pitch = (uint16)context.dx; + unsigned src = (uint16)context.si; + int x = (uint16)context.di, y = (uint16)context.bx; + unsigned dst = x + y * pitch; + //debug(1, "framenm %ux%u[pitch: %u]-> %d,%d, segment: %04x->%04x", w, h, pitch, x, y, (uint16)context.ds, (uint16)context.es); + for(unsigned l = 0; l < h; ++l) { + uint8 *src_p = context.ds.ptr(src + w * l, w); + uint8 *dst_p = context.es.ptr(dst + pitch * l, w); + memcpy(dst_p, src_p, w); + } + context.di += dst + pitch * h; + context.si += w * h; + context.cx = 0; +} + +void seecommandtail(Context &context) { + context.data.word(kSoundbaseadd) = 0x220; + context.data.byte(kSoundint) = 5; + context.data.byte(kSounddmachannel) = 1; + context.data.byte(kBrightness) = 1; + context.data.word(kHowmuchalloc) = 0x9360; +} + +void randomnumber(Context &context) { + context.al = context.engine->randomNumber(); +} + +void quickquit(Context &context) { + context.engine->quit(); +} + +void quickquit2(Context &context) { + context.engine->quit(); +} + +void keyboardread(Context &context) { + ::error("keyboardread"); //this keyboard int handler, must never be called +} + +void resetkeyboard(Context &context) { +} + +void setkeyboardint(Context &context) { +} + +void readfromfile(Context &context) { + uint16 dst_offset = context.dx; + uint16 size = context.cx; + debug(1, "readfromfile(%04x:%u, %u)", (uint16)context.ds, dst_offset, size); + context.ax = context.engine->readFromFile(context.ds.ptr(dst_offset, size), size); + context.flags._c = false; +} + +void closefile(Context &context) { + context.engine->closeFile(); + context.data.byte(kHandle) = 0; +} + +void openforsave(Context &context) { + const char *name = (const char *)context.ds.ptr(context.dx, 13); + debug(1, "openforsave(%s)", name); + context.engine->openSaveFileForWriting(name); +} + +void openfilenocheck(Context &context) { + const char *name = (const char *)context.ds.ptr(context.dx, 13); + debug(1, "checksavefile(%s)", name); + bool ok = context.engine->openSaveFileForReading(name); + context.flags._c = !ok; +} + +void openfilefromc(Context &context) { + openfilenocheck(context); +} + +void openfile(Context &context) { + Common::String name = getFilename(context); + debug(1, "opening file: %s", name.c_str()); + context.engine->openFile(name); + context.cs.word(kHandle) = 1; //only one handle + context.flags._c = false; +} + +void createfile(Context &context) { + ::error("createfile"); +} + +void dontloadseg(Context &context) { + context.ax = context.es.word(context.di); + context._add(context.di, 2); + context.dx = context.ax; + context.cx = 0; + unsigned pos = context.engine->skipBytes(context.dx); + context.dx = pos >> 16; + context.ax = pos & 0xffff; + context.flags._c = false; +} + +void mousecall(Context &context) { + context.engine->mouseCall(); +} + +void setmouse(Context &context) { + context.data.word(kOldpointerx) = 0xffff; + //warning("setmouse: fixme: add range setting"); + //set vertical range to 15-184 + //set horizontal range to 15-298*2 +} + +void gettime(Context &context) { + TimeDate t; + g_system->getTimeAndDate(t); + debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec); + context.ch = t.tm_hour; + context.cl = t.tm_min; + context.dh = t.tm_sec; + context.data.byte(kSecondcount) = context.dh; + context.data.byte(kMinutecount) = context.cl; + context.data.byte(kHourcount) = context.ch; +} + +void allocatemem(Context &context) { + uint size = (context.bx + 2) * 16; + debug(1, "allocate mem, %u bytes", size); + context.flags._c = false; + SegmentRef seg = context.allocateSegment(size); + context.ax = (uint16)seg; + debug(1, "\tsegment address -> %04x", (uint16)context.ax); +} + +void deallocatemem(Context &context) { + uint16 id = (uint16)context.es; + debug(1, "deallocating segment %04x", id); + context.deallocateSegment(id); + + //fixing invalid entries in the sprite table + context.es = context.data; + uint tsize = 16 * 32; + uint16 bseg = context.data.word(kBuffers); + if (!bseg) + return; + SegmentRef buffers(&context); + buffers = bseg; + uint8 *ptr = buffers.ptr(kSpritetable, tsize); + for(uint i = 0; i < tsize; i += 32) { + uint16 seg = READ_LE_UINT16(ptr + i + 6); + //debug(1, "sprite segment = %04x", seg); + if (seg == id) + memset(ptr + i, 0xff, 32); + } +} + +void removeemm(Context &context) { + ::error("removeemm"); +} + +void setupemm(Context &context) { + //fixme: double check this, but it seems that emm pages used only for sound +} + +void pitinterupt(Context &context) { + ::error("pitinterupt"); +} + +void getridofpit(Context &context) { + ::error("getridofpit"); +} + +void setuppit(Context &context) { + ::error("setuppit"); +} + +void startdmablock(Context &context) { + ::error("startdmablock"); +} + +void dmaend(Context &context) { + ::error("dmaend"); +} + +void restoreems(Context &context) { + ::error("restoreems"); +} + +void saveems(Context &context) { + ::error("saveems"); +} + +void bothchannels(Context &context) { + ::error("bothchannels"); +} + +void channel1only(Context &context) { + ::error("channel1only"); +} + +void channel0only(Context &context) { + ::error("channel0only"); +} + +void out22c(Context &context) { + ::error("out22c"); +} + +void soundstartup(Context &context) { +} + +void soundend(Context &context) { +} + +void interupttest(Context &context) { + ::error("interupttest"); +} + +void disablesoundint(Context &context) { + warning("disablesoundint: STUB"); +} + +void enablesoundint(Context &context) { + warning("enablesoundint: STUB"); +} + +void checksoundint(Context &context) { + context.data.byte(kTestresult) = 1; + warning("checksoundint: STUB"); +} + +void setsoundoff(Context &context) { + warning("setsoundoff: STUB"); +} + +void readheader(Context &context); + +void loadsample(Context &context) { + context.engine->loadSounds(0, (const char *)context.data.ptr(context.dx, 13)); +} + +void cancelch0(Context &context); +void cancelch1(Context &context); + +void loadsecondsample(Context &context) { + uint8 ch0 = context.data.byte(kCh0playing); + if (ch0 >= 12 && ch0 != 255) + cancelch0(context); + uint8 ch1 = context.data.byte(kCh1playing); + if (ch1 >= 12) + cancelch1(context); + context.engine->loadSounds(1, (const char *)context.data.ptr(context.dx, 13)); +} + +void createname(Context &context); + +void loadspeech(Context &context) { + cancelch1(context); + context.data.byte(kSpeechloaded) = 0; + createname(context); + const char *name = (const char *)context.data.ptr(context.di, 13); + //warning("name = %s", name); + if (context.engine->loadSpeech(name)) + context.data.byte(kSpeechloaded) = 1; +} + +void saveseg(Context &context) { + context.cx = context.es.word(context.di); + context._add(context.di, 2); + savefilewrite(context); +} + +void savefilewrite(Context &context) { + context.ax = context.engine->writeToSaveFile(context.ds.ptr(context.dx, context.cx), context.cx); +} + +void savefileread(Context &context) { + context.ax = context.engine->readFromSaveFile(context.ds.ptr(context.dx, context.cx), context.cx); +} + +void loadseg(Context &context) { + context.ax = context.es.word(context.di); + context.di += 2; + + uint16 dst_offset = context.dx; + uint16 size = context.ax; + + debug(1, "loadseg(%04x:%u, %u)", (uint16)context.ds, dst_offset, size); + context.ax = context.engine->readFromFile(context.ds.ptr(dst_offset, size), size); + context.flags._c = false; +} + +void error(Context &context) { + ::error("error"); +} + +void generalerror(Context &context) { + ::error("generalerror"); +} + +void commandonly(Context &context); + +void dosreturn(Context &context) { + context._cmp(context.data.byte(kCommandtype), 250); + if (context.flags.z()) goto alreadydos; + context.data.byte(kCommandtype) = 250; + context.al = 46; + commandonly(context); +alreadydos: + context.ax = context.data.word(kMousebutton); + context._and(context.ax, 1); + if (context.flags.z()) return; + + quickquit2(context); + quickquit(context); +} + +void set16colpalette(Context &context) { +} + +void mode640x480(Context &context) { + // Video mode 12h: 640x480 pixels, 16 colors, I believe + context.al = 0x12 + 128; + context.ah = 0; + initGraphics(640, 480, true); +} + +void showgroup(Context &context) { + context.engine->setPalette(); +} + +void fadedos(Context &context) { + context.engine->fadeDos(); +} + +void doshake(Context &context) { + uint8 &counter = context.data.byte(kShakecounter); + context._cmp(counter, 48); + if (context.flags.z()) + return; + + context._add(counter, 1); + static const int shakeTable[] = { + 0, -2, 3, -2, 0, 2, 4, -1, + 1, -3, 3, 2, 0, -2, 3, -2, + 0, 2, 4, -1, 1, -3, 3, 2, + 0, -2, 3, -2, 0, 2, 4, -1, + + 1, -3, 3, 2, 0, -2, 3, -2, + 0, 2, 4, -1, 1, -3, 3, 2, + 0, -2, 3, -2, 0, 2, 4, -1, + 1, -3, 3, 2, 0, -2, 3, -2, + + 0, 2, 4, -1, 1, -3, 3, 2, + 0, -2, 3, -2, 0, 2, 4, -1, + 1, -3, 3, 2, 0, -2, 3, -2, + 0, 2, 4, -1, 1, -3, 3, 2, + + 0, -2, 3, -2, 0, 2, 4, -1, + 1, -3, 3, 0, + }; + int offset = shakeTable[counter]; + context.engine->setShakePos(offset >= 0? offset: -offset); +} + +void vsync(Context &context) { + context.engine->waitForVSync(); +} + +void setmode(Context &context) { + vsync(context); + context.engine->setGraphicsMode(); +} + +void readoneblock(Context &context) { + context.ds = context.data.word(kWorkspace); + context.cx = 30000; + context.dx = 0; + readfromfile(context); +} + +void showpcx(Context &context) { + Common::String name = getFilename(context); + Common::File pcxFile; + + if (!pcxFile.open(name)) { + warning("showpcx: Could not open '%s'", name.c_str()); + return; + } + + uint8 *maingamepal; + int i, j; + + // Read the 16-color palette into the 'maingamepal' buffer. Note that + // the color components have to be adjusted from 8 to 6 bits. + + pcxFile.seek(16, SEEK_SET); + context.es = context.data.word(kBuffers); + maingamepal = context.es.ptr(4782, 768); //fixme: hardcoded offset + pcxFile.read(maingamepal, 48); + + memset(maingamepal + 48, 0xff, 720); + for (i = 0; i < 48; i++) { + maingamepal[i] >>= 2; + } + + // Decode the image data. + + Graphics::Surface *s = g_system->lockScreen(); + Common::Rect rect(640, 480); + + s->fillRect(rect, 0); + pcxFile.seek(128, SEEK_SET); + + for (int y = 0; y < 480; y++) { + byte *dst = (byte *)s->getBasePtr(0, y); + int decoded = 0; + + while (decoded < 320) { + byte col = pcxFile.readByte(); + byte len; + + if ((col & 0xc0) == 0xc0) { + len = col & 0x3f; + col = pcxFile.readByte(); + } else { + len = 1; + } + + // The image uses 16 colors and is stored as four bit + // planes, one for each bit of the color, least + // significant bit plane first. + + for (i = 0; i < len; i++) { + int plane = decoded / 80; + int pos = decoded % 80; + + for (j = 0; j < 8; j++) { + byte bit = (col >> (7 - j)) & 1; + dst[8 * pos + j] |= (bit << plane); + } + + decoded++; + } + } + } + + g_system->unlockScreen(); + pcxFile.close(); +} + +} /*namespace dreamgen */ diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h new file mode 100644 index 0000000000..0f5e5bdc98 --- /dev/null +++ b/engines/dreamweb/dreamweb.h @@ -0,0 +1,147 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://svn.scummvm.org:4444/svn/dreamweb/dreamweb.h $ + * $Id: dreamweb.h 77 2011-05-18 14:26:43Z digitall $ + * + */ + +#ifndef DREAMWEB_H +#define DREAMWEB_H + +#include "common/error.h" +#include "common/file.h" +#include "common/random.h" +#include "common/rect.h" +#include "common/savefile.h" +#include "common/scummsys.h" + +#include "audio/audiostream.h" +#include "audio/mixer.h" + +#include "engines/engine.h" +#include "dreamweb/dreamgen.h" +#include "dreamweb/console.h" + +namespace DreamWeb { + +// Engine Debug Flags +enum { + kDebugAnimation = (1 << 0), + kDebugSaveLoad = (1 << 1) +}; + +struct DreamWebGameDescription; + +class DreamWebEngine : public Engine { +private: + DreamWebConsole *_console; + bool _vSyncInterrupt; + +protected: + // Engine APIs + virtual Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; + +public: + DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc); + virtual ~DreamWebEngine(); + + void setVSyncInterrupt(bool flag); + void waitForVSync(); + + Common::Error loadGameState(int slot); + Common::Error saveGameState(int slot, const char *desc); + + bool canLoadGameStateCurrently(); + bool canSaveGameStateCurrently(); + +//dreamgen public api: + uint8 randomNumber() { return _rnd.getRandomNumber(255); } + + void openFile(const Common::String &name); + uint32 readFromFile(uint8 *data, unsigned size); + uint32 skipBytes(uint32 bytes); + void closeFile(); + + void mouseCall(); //fill mouse pos and button state + void processEvents(); + void setGraphicsMode(); + void setPalette(); + void fadeDos(); + void blit(const uint8 *src, int pitch, int x, int y, int w, int h); + void cls(); + + void getPalette(uint8 *data, uint start, uint count); + void setPalette(const uint8 *data, uint start, uint count); + + void openSaveFileForWriting(const Common::String &name); + uint writeToSaveFile(const uint8 *data, uint size); + + bool openSaveFileForReading(const Common::String &name); + uint readFromSaveFile(uint8 *data, uint size); + + void setShakePos(int pos) { _system->setShakePos(pos); } + void printUnderMonitor(); + + void quit(); + + void loadSounds(uint bank, const Common::String &file); + bool loadSpeech(const Common::String &filename); + +private: + void keyPressed(uint16 ascii); + void setSpeed(uint speed); + void soundHandler(); + void playSound(uint8 channel, uint8 id, uint8 loops); + + const DreamWebGameDescription *_gameDescription; + Common::RandomSource _rnd; + + Common::File _file; + Common::OutSaveFile *_outSaveFile; + Common::InSaveFile *_inSaveFile; + + uint _speed; + bool _turbo; + uint _oldMouseState; + + struct Sample { + uint offset; + uint size; + Sample(): offset(), size() {} + }; + + struct SoundData { + Common::Array<Sample> samples; + Common::Array<uint8> data; + }; + SoundData _soundData[2]; + Common::Array<uint8> _speechData; + + Audio::SoundHandle _channelHandle[2]; + uint8 _channel0, _channel1; + + dreamgen::Context _context; +}; + +} // End of namespace DreamWeb + +#endif diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk new file mode 100644 index 0000000000..d39270bde6 --- /dev/null +++ b/engines/dreamweb/module.mk @@ -0,0 +1,15 @@ +MODULE := engines/dreamweb + +MODULE_OBJS := \ + console.o \ + detection.o \ + dreamweb.o \ + dreamgen.o + +# This module can be built as a plugin +ifeq ($(ENABLE_DREAMWEB), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h new file mode 100644 index 0000000000..e9caf37368 --- /dev/null +++ b/engines/dreamweb/runtime.h @@ -0,0 +1,511 @@ +#ifndef ENGINES_DREAMGEN_RUNTIME_H__ +#define ENGINES_DREAMGEN_RUNTIME_H__ + +#include <assert.h> +#include "common/scummsys.h" +#include "common/array.h" +#include "common/debug.h" +#include "common/hashmap.h" +#include "common/list.h" +#include "common/ptr.h" + +namespace DreamWeb { + class DreamWebEngine; +} + +namespace dreamgen { + +//fixme: name clash +#undef random + +struct Register { + union { + uint16 _value; + uint8 _part[2]; + }; + inline Register(): _value() {} + inline Register& operator=(uint16 v) { _value = v; return *this; } + inline operator uint16&() { return _value; } + inline void cbw() { + if (_value & 0x80) + _value |= 0xff00; + else + _value &= 0x7f; + } +}; + +template<int kIndex> //from low to high +struct RegisterPart { + uint8 &_value; + + explicit inline RegisterPart(Register ®) : _value(reg._part[kIndex]) {} + + inline operator uint8&() { + return _value; + } + + inline RegisterPart& operator=(const RegisterPart& o) { + _value = o._value; + return *this; + } + + inline RegisterPart& operator=(uint8 v) { + _value = v; + return *this; + } +}; + +#ifdef SCUMM_LITTLE_ENDIAN + typedef RegisterPart<0> LowPartOfRegister; + typedef RegisterPart<1> HighPartOfRegister; +#else + typedef RegisterPart<1> LowPartOfRegister; + typedef RegisterPart<0> HighPartOfRegister; +#endif + +class WordRef { + uint8 *_data; + unsigned _index; + uint16 _value; + +public: + inline WordRef(Common::Array<uint8> &data, unsigned index) : _data(data.begin() + index), _index(index) { + assert(index + 1 < data.size()); + _value = _data[0] | (_data[1] << 8); + } + + inline WordRef& operator=(const WordRef &ref) { + _value = ref._value; + return *this; + } + + inline WordRef& operator=(uint16 v) { + _value = v; + return *this; + } + + inline operator uint16&() { + return _value; + } + + inline ~WordRef() { + _data[0] = _value & 0xff; + _data[1] = _value >> 8; + _value = _data[0] | (_data[1] << 8); + } +}; + +struct Segment { + Common::Array<uint8> data; + + inline void assign(const uint8 *b, const uint8 *e) { + data.assign(b, e); + } + + inline uint8 &byte(unsigned index) { + assert(index < data.size()); + return data[index]; + } + + inline WordRef word(unsigned index) { + return WordRef(data, index); + } + + inline uint8* ptr(unsigned index, unsigned size) { + assert(index + size <= data.size()); + return data.begin() + index; + } +}; + +typedef Common::SharedPtr<Segment> SegmentPtr; + +class Context; + +class SegmentRef { + Context *_context; + uint16 _value; + SegmentPtr _segment; + +public: + SegmentRef(Context *ctx, uint16 value = 0, SegmentPtr segment = SegmentPtr()): _context(ctx), _value(value), _segment(segment) { + } + + inline void reset(uint16 value); + + inline SegmentRef& operator=(const uint16 id) { + reset(id); + return *this; + } + + inline SegmentRef& operator=(const SegmentRef &ref) { + _context = ref._context; + _value = ref._value; + _segment = ref._segment; + return *this; + } + + inline uint8 &byte(unsigned index) { + assert(_segment != 0); + return _segment->byte(index); + } + + inline operator uint16() const { + return _value; + } + + inline WordRef word(unsigned index) { + //debug(1, "getting word ref for %04x:%d", _value, index); + assert(_segment != 0); + return _segment->word(index); + } + + inline void assign(const uint8 *b, const uint8 *e) { + assert(_segment != 0); + _segment->assign(b, e); + } + + inline uint8* ptr(unsigned index, unsigned size) { + assert(_segment != 0); + return _segment->ptr(index, size); + } +}; + +struct Flags { + bool _z, _c, _s, _o; + inline Flags(): _z(true), _c(false), _s(false), _o(false) {} + + inline bool z() const { return _z; } + inline bool c() const { return _c; } + inline bool s() const { return _s; } + + inline bool l() const { return _o != _s; } + inline bool le() const { return _o != _s|| _z; } + + inline void update_zs(uint8 v) { + _s = v & 0x80; + _z = v == 0; + } + + inline void update_zs(uint16 v) { + _s = v & 0x8000; + _z = v == 0; + } + + inline void update_o(uint8 v, uint8 a, uint8 b) { + uint8 s1 = a & 0x80, s2 = b & 0x80; + _o = (s1 == s2) && (v & 0x80) != s1; + } + + inline void update_o(uint16 v, uint16 a, uint16 b) { + uint16 s1 = a & 0x8000, s2 = b & 0x8000; + _o = (s1 == s2) && (v & 0x8000) != s1; + } +}; + +class Context { + typedef Common::HashMap<uint16, SegmentPtr> SegmentMap; + SegmentMap _segments; + + typedef Common::List<uint16> FreeSegmentList; + FreeSegmentList _freeSegments; + +public: + DreamWeb::DreamWebEngine *engine; + + enum { kDefaultDataSegment = 0x1000 }; + + Register ax, dx, bx, cx, si, di; + LowPartOfRegister al; + HighPartOfRegister ah; + LowPartOfRegister bl; + HighPartOfRegister bh; + LowPartOfRegister cl; + HighPartOfRegister ch; + LowPartOfRegister dl; + HighPartOfRegister dh; + + SegmentRef cs, ds, es, data; + //data == fake segment register always pointing to data segment + Flags flags; + + inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx), + cs(this), ds(this), es(this), data(this) { + _segments[kDefaultDataSegment] = SegmentPtr(new Segment()); + cs.reset(kDefaultDataSegment); + ds.reset(kDefaultDataSegment); + es.reset(kDefaultDataSegment); + data.reset(kDefaultDataSegment); + } + + SegmentRef getSegment(uint16 value) { + SegmentMap::iterator i = _segments.find(value); + assert(i != _segments.end()); + return SegmentRef(this, value, i->_value); + } + + SegmentRef allocateSegment(uint size) { + unsigned id; + if (_freeSegments.empty()) + id = kDefaultDataSegment + _segments.size(); + else { + id = _freeSegments.front(); + _freeSegments.pop_front(); + } + assert(!_segments.contains(id)); + SegmentPtr seg(new Segment()); + seg->data.resize(size); + _segments[id] = seg; + return SegmentRef(this, id, seg); + } + + void deallocateSegment(uint16 id) { + SegmentMap::iterator i = _segments.find(id); + assert(i != _segments.end()); + _segments.erase(i); + _freeSegments.push_back(id); + } + + inline void _cmp(uint8 a, uint8 b) { + _sub(a, b); + } + + inline void _cmp(uint16 a, uint16 b) { + _sub(a, b); + } + + inline void _test(uint8 a, uint8 b) { + _and(a, b); + } + + inline void _test(uint16 a, uint16 b) { + _and(a, b); + } + + inline void _add(uint8 &dst, uint8 src) { + unsigned r = (unsigned)dst + src; + flags.update_o((uint8)r, dst, src); + flags._c = r >= 0x100; + dst = r; + flags.update_zs(dst); + } + + inline void _add(uint16 &dst, uint16 src) { + unsigned r = (unsigned)dst + src; + flags.update_o((uint16)r, dst, src); + flags._c = r >= 0x10000; + dst = r; + flags.update_zs(dst); + } + + inline void _sub(uint8 &dst, uint8 src) { + flags.update_o(uint8(dst - src), dst, (uint8)-src); + flags._c = dst < src; + dst -= src; + flags.update_zs(dst); + } + + inline void _sub(uint16 &dst, uint16 src) { + flags.update_o(uint16(dst - src), dst, (uint16)-src); + flags._c = dst < src; + dst -= src; + flags.update_zs(dst); + } + + inline void _inc(uint8 &dst) { + flags.update_o((uint8)(dst + 1), dst, 1); + ++dst; + flags.update_zs(dst); + } + + inline void _inc(uint16 &dst) { + flags.update_o((uint16)(dst + 1), dst, 1); + ++dst; + flags.update_zs(dst); + } + + inline void _dec(uint8 &dst) { + flags.update_o(uint8(dst - 1), dst, 1); + --dst; + flags.update_zs(dst); + } + + inline void _dec(uint16 &dst) { + flags.update_o(uint16(dst - 1), dst, 1); + --dst; + flags.update_zs(dst); + } + + inline void _and(uint8 &dst, uint8 src) { + dst &= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _and(uint16 &dst, uint16 src) { + dst &= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _or(uint8 &dst, uint8 src) { + dst |= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _or(uint16 &dst, uint16 src) { + dst |= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _xor(uint8 &dst, uint8 src) { + dst ^= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _xor(uint16 &dst, uint16 src) { + dst ^= src; + flags.update_zs(dst); + flags._c = flags._o = false; + } + + inline void _shr(uint8 &dst, uint8 src) { + src &= 0x1f; + if (src > 0) { + dst >>= (src - 1); + flags._c = dst & 1; + dst >>= 1; + flags.update_zs(dst); + } + if (src == 1) + flags._o = dst & 0x80; + } + + inline void _shr(uint16 &dst, uint8 src) { + src &= 0x1f; + if (src > 0) { + dst >>= (src - 1); + flags._c = dst & 1; + dst >>= 1; + flags.update_zs(dst); + } + if (src == 1) + flags._o = dst & 0x8000; + } + + inline void _shl(uint8 &dst, uint8 src) { + src &= 0x1f; + if (src > 0) { + dst <<= (src - 1); + flags._c = dst & 0x80; + dst <<= 1; + flags.update_zs(dst); + } + if (src == 1) + flags._o = ((dst & 0x80) != 0) == flags._c; + } + inline void _shl(uint16 &dst, uint8 src) { + src &= 0x1f; + if (src > 0) { + dst <<= (src - 1); + flags._c = dst & 0x8000; + dst <<= 1; + flags.update_zs(dst); + } + if (src == 1) + flags._o = ((dst & 0x8000) != 0) == flags._c; + } + + inline void _mul(uint8 src) { + unsigned r = unsigned(al) * src; + ax = (uint16)r; + flags._c = r >= 0x10000; + flags._z = r == 0; + flags._s = r & 0x8000; + flags._o = ah != 0; + } + + inline void _mul(uint16 src) { + unsigned r = unsigned(ax) * src; //assuming here that we have at least 32 bits + dx = (r >> 16) & 0xffff; + ax = r & 0xffff; + flags._c = false; + flags._z = r == 0; + flags._s = r & 0x80000000; + flags._o = dx != 0; + } + + inline void _neg(uint8 &src) { + uint8 r = 0; + _sub(r, src); + src = r; + } + + inline void _neg(uint16 &src) { + uint16 r = 0; + _sub(r, src); + src = r; + } + + inline void _movsb() { + es.byte(di++) = ds.byte(si++); + } + + inline void _movsw() { + _movsb(); + _movsb(); + } + + inline void _lodsb() { + al = ds.byte(si++); + } + + inline void _lodsw() { + ax = ds.word(si); + si += 2; + } + + inline void _stosb() { + es.byte(di++) = al; + } + + inline void _stosw() { + es.word(di) = ax; + di += 2; + } + + inline void _xchg(uint16 &a, uint16 &b) { + uint16 x = a; + a = b; + b = x; + } + + inline void _xchg(uint8 &a, uint8 &b) { + uint8 t = a; + a = b; + b = t; + } + + Common::Array<uint16> stack; + inline void push(uint16 v) { + stack.push_back(v); + } + + inline uint16 pop() { + assert(!stack.empty()); + uint16 v = stack.back(); + stack.pop_back(); + return v; + } +}; + +inline void SegmentRef::reset(uint16 value) { + *this = _context->getSegment(value); +} + +} + +#endif + |