aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2011-06-15 09:04:07 -0700
committerEugene Sandulenko2011-06-15 09:04:07 -0700
commit624042eedd0f2e86308173c995e9760b4cd8de3f (patch)
treeb411f99a03f4f3379c5c5e542a90a7514d059a9f
parent5b7754e3f095eb8a469dd4b7de5a6379f8e13c27 (diff)
parent9599894a4b2f79672fc3e2ca5a93ef9c7d457c08 (diff)
downloadscummvm-rg350-624042eedd0f2e86308173c995e9760b4cd8de3f.tar.gz
scummvm-rg350-624042eedd0f2e86308173c995e9760b4cd8de3f.tar.bz2
scummvm-rg350-624042eedd0f2e86308173c995e9760b4cd8de3f.zip
Merge pull request #45 from fuzzie/dreamweb
DREAMWEB: Merge in engine
-rw-r--r--base/plugins.cpp3
-rw-r--r--common/array.h7
-rwxr-xr-xconfigure1
-rw-r--r--devtools/tasmrecover/.gitignore4
-rw-r--r--devtools/tasmrecover/dreamweb/LICENSE339
-rw-r--r--devtools/tasmrecover/dreamweb/backdrop.asm877
-rw-r--r--devtools/tasmrecover/dreamweb/debug.asm382
-rw-r--r--devtools/tasmrecover/dreamweb/dreamweb.asm6262
-rw-r--r--devtools/tasmrecover/dreamweb/keypad.asm1758
-rw-r--r--devtools/tasmrecover/dreamweb/look.asm167
-rw-r--r--devtools/tasmrecover/dreamweb/monitor.asm1496
-rw-r--r--devtools/tasmrecover/dreamweb/newplace.asm581
-rw-r--r--devtools/tasmrecover/dreamweb/object.asm2608
-rw-r--r--devtools/tasmrecover/dreamweb/print.asm591
-rw-r--r--devtools/tasmrecover/dreamweb/saveload.asm1495
-rw-r--r--devtools/tasmrecover/dreamweb/sblaster.asm1293
-rw-r--r--devtools/tasmrecover/dreamweb/sprite.asm5034
-rw-r--r--devtools/tasmrecover/dreamweb/talk.asm580
-rw-r--r--devtools/tasmrecover/dreamweb/titles.asm583
-rw-r--r--devtools/tasmrecover/dreamweb/use.asm3810
-rw-r--r--devtools/tasmrecover/dreamweb/vars.asm564
-rw-r--r--devtools/tasmrecover/dreamweb/vgafades.asm867
-rw-r--r--devtools/tasmrecover/dreamweb/vgagrafx.asm1763
-rwxr-xr-xdevtools/tasmrecover/tasm-recover23
-rw-r--r--devtools/tasmrecover/tasm/__init__.py0
-rw-r--r--devtools/tasmrecover/tasm/cpp.py576
-rw-r--r--devtools/tasmrecover/tasm/lex.py52
-rw-r--r--devtools/tasmrecover/tasm/op.py406
-rw-r--r--devtools/tasmrecover/tasm/parser.py259
-rw-r--r--devtools/tasmrecover/tasm/proc.py84
-rw-r--r--engines/dreamweb/console.cpp36
-rw-r--r--engines/dreamweb/console.h46
-rw-r--r--engines/dreamweb/detection.cpp124
-rw-r--r--engines/dreamweb/detection_tables.h69
-rw-r--r--engines/dreamweb/dreamgen.cpp22792
-rw-r--r--engines/dreamweb/dreamgen.h648
-rw-r--r--engines/dreamweb/dreamweb.cpp1101
-rw-r--r--engines/dreamweb/dreamweb.h147
-rw-r--r--engines/dreamweb/module.mk15
-rw-r--r--engines/dreamweb/runtime.h511
-rw-r--r--engines/engines.mk5
41 files changed, 57959 insertions, 0 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 4a3b201714..8ce7b53254 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -106,6 +106,9 @@ public:
#if PLUGIN_ENABLED_STATIC(DRASCULA)
LINK_PLUGIN(DRASCULA)
#endif
+ #if PLUGIN_ENABLED_STATIC(DREAMWEB)
+ LINK_PLUGIN(DREAMWEB)
+ #endif
#if PLUGIN_ENABLED_STATIC(GOB)
LINK_PLUGIN(GOB)
#endif
diff --git a/common/array.h b/common/array.h
index 7ab4a1b042..ff32d3d94c 100644
--- a/common/array.h
+++ b/common/array.h
@@ -252,6 +252,13 @@ public:
_size = newSize;
}
+ void assign(const T *srcBegin, const T *srcEnd) {
+ resize(distance(srcBegin, srcEnd)); //fixme: ineffective?
+ T *dst = _storage;
+ while(srcBegin != srcEnd)
+ *dst++ = *srcBegin++;
+ }
+
protected:
static uint roundUpCapacity(uint capacity) {
// Round up capacity to the next power of 2;
diff --git a/configure b/configure
index b012ccc7bd..e7a4335a52 100755
--- a/configure
+++ b/configure
@@ -83,6 +83,7 @@ add_engine cine "Cinematique evo 1" yes
add_engine cruise "Cinematique evo 2" yes
add_engine draci "Dragon History" yes
add_engine drascula "Drascula: The Vampire Strikes Back" yes
+add_engine dreamweb "Dreamweb" no
add_engine gob "Gobli*ns" yes
add_engine groovie "Groovie" yes "groovie2"
add_engine groovie2 "Groovie 2 games" no
diff --git a/devtools/tasmrecover/.gitignore b/devtools/tasmrecover/.gitignore
new file mode 100644
index 0000000000..f2bff8e8d9
--- /dev/null
+++ b/devtools/tasmrecover/.gitignore
@@ -0,0 +1,4 @@
+*.pyc
+dreamgen.*
+_stubs*
+
diff --git a/devtools/tasmrecover/dreamweb/LICENSE b/devtools/tasmrecover/dreamweb/LICENSE
new file mode 100644
index 0000000000..d159169d10
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/LICENSE
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/devtools/tasmrecover/dreamweb/backdrop.asm b/devtools/tasmrecover/dreamweb/backdrop.asm
new file mode 100644
index 0000000000..189199db91
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/backdrop.asm
@@ -0,0 +1,877 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;----------------------------------------------Code to draw floor and panel----
+
+Blockget proc near
+
+ mov ah,al
+ mov al,0
+ mov ds,backdrop
+ mov si,blocks
+ add si,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;--------------------------------------------------------Background display----
+
+
+
+
+
+
+
+
+Drawfloor proc near
+
+ push es bx ;in case this was called during
+ call eraseoldobs ;some sprite update.
+ call drawflags
+ call calcmapad
+ call doblocks
+ call showallobs
+ call showallfree
+ call showallex
+ call paneltomap
+ call initrain
+ mov newobs,0
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Calcmapad proc near
+
+ call getdimension
+
+ push cx dx
+
+ mov al,11
+ sub al,dl
+ sub al,cl
+ sub al,cl
+ cbw
+ mov bx,8
+ mul bx
+ add ax,mapoffsetx
+ mov mapadx,ax
+ pop dx cx
+
+ mov al,10
+ sub al,dh
+ sub al,ch
+ sub al,ch
+ cbw
+ mov bx,8
+ mul bx
+ add ax,mapoffsety
+ mov mapady,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Getdimension proc near ;Routine finds width, length
+ ;and top corner of room
+
+ mov es,buffers
+ mov bx,mapflags
+ mov ch,0
+dimloop1: call addalong
+ cmp al,0
+ jnz finishdim1
+ inc ch
+ jmp dimloop1 ;ch holds y of top corner
+
+finishdim1: mov bx,mapflags
+ mov cl,0
+dimloop2: push bx
+ call addlength
+ pop bx
+ cmp al,0
+ jnz finishdim2
+ inc cl
+ add bx,3
+ jmp dimloop2 ;cl holds x of top corner
+
+finishdim2: mov bx,mapflags+(11*3*9)
+ mov dh,10
+dimloop3: push bx
+ call addalong
+ pop bx
+ cmp al,0
+ jnz finishdim3
+ dec dh
+ sub bx,11*3
+ jmp dimloop3 ;dh holds y of bottom corner
+
+finishdim3: mov bx,mapflags+(3*10)
+ mov dl,11
+dimloop4: push bx
+ call addlength
+ pop bx
+ cmp al,0
+ jnz finishdim4
+ dec dl
+ sub bx,3
+ jmp dimloop4 ;dl holds x of bottom corner
+
+finishdim4: mov al,cl ;cl holds x start
+ mov ah,0
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ mov mapxstart,ax
+ mov al,ch ;ch holds y start
+ mov ah,0
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ mov mapystart,ax
+
+ sub dl,cl
+ sub dh,ch
+ ;dx holds x and y size of room
+ mov al,dl ;dl holds x size
+ mov ah,0
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ mov mapxsize,al
+ mov al,dh ;dh holds y size
+ mov ah,0
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ shl ax,1
+ mov mapysize,al ;cx still holds top left corner
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Addalong proc near
+
+ mov ah,11
+addloop: cmp byte ptr [es:bx],0
+ jnz gotalong
+ add bx,3
+ dec ah
+ jnz addloop
+ mov al,0
+ ret
+gotalong: mov al,1
+ ret
+
+ endp
+
+
+
+
+
+Addlength proc near
+
+ mov ah,10
+addloop2: cmp byte ptr [es:bx],0
+ jnz gotlength
+ add bx,3*11
+ dec ah
+ jnz addloop2
+ mov al,0
+ ret
+gotlength: mov al,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Drawflags proc near
+
+ mov es,buffers
+ mov di,mapflags
+ mov al,mapy
+ mov ah,0
+ mov cx,mapwidth
+ mul cx
+ mov bl,mapx
+ mov bh,0
+ add ax,bx
+ mov si,map
+ add si,ax
+
+ mov cx,10
+$28: push cx
+ mov cx,11
+$28a: mov ds,mapdata
+ lodsb
+ mov ds,backdrop
+ push si ax
+ mov ah,0
+ add ax,ax
+ mov si,flags
+ add si,ax
+ movsw
+ pop ax
+ stosb
+ pop si
+ loop $28a
+ add si,mapwidth-11
+ pop cx
+ loop $28
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;-------------------------------------------------------Set object printing----
+
+Eraseoldobs proc near
+
+ cmp newobs,0
+ jz donterase
+
+ mov es,buffers
+ mov bx,spritetable
+
+ mov cx,16
+oberase: push cx bx
+ mov ax,[es:bx+20]
+ cmp ax,0ffffh
+ jz notthisob
+ mov di,bx
+ mov al,255
+ mov cx,tablesize
+ rep stosb
+notthisob: pop bx cx
+ add bx,tablesize
+ loop oberase
+
+donterase: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showallobs proc near
+
+ mov es,buffers
+ mov bx,setlist
+ mov listpos,bx
+ mov di,bx
+ mov cx,128*5
+ mov al,255
+ rep stosb
+
+ mov es,setframes
+ mov frsegment,es
+ mov ax,framedata
+ mov dataad,ax
+ mov ax,frames
+ mov framesad,ax
+ mov currentob,0
+
+ mov ds,setdat
+ mov si,0
+
+ mov cx,128
+showobsloop: push cx si
+
+ push si
+ add si,58
+ mov es,setdat
+ call getmapad
+ pop si
+ cmp ch,0
+ jz blankframe
+
+ mov al,[es:si+18]
+ mov ah,0
+ mov currentframe,ax
+ cmp al,255
+ jz blankframe
+
+ push es si
+ call calcfrframe
+ call finalframe
+ pop si es
+
+ mov al,[es:si+18]
+ mov [es:si+17],al
+ cmp byte ptr [es:si+8],0
+ jnz animating
+ cmp byte ptr [es:si+5],5
+ jz animating
+ cmp byte ptr [es:si+5],6
+ jz animating
+ mov ax,currentframe
+ mov ah,0
+ add di,mapadx
+ add bx,mapady
+ call showframe
+ jmp drawnsetob
+
+animating: call makebackob
+
+drawnsetob: mov si,listpos
+ mov es,buffers
+ mov al,savex
+ mov ah,savey
+ mov [es:si],ax
+ mov cx,ax
+ mov ax,savesize
+ add al,cl
+ add ah,ch
+ mov [es:si+2],ax
+ mov al,currentob
+ mov [es:si+4],al
+ add si,5
+ mov listpos,si
+
+blankframe: inc currentob
+ pop si cx
+ add si,64
+ dec cx
+ jz finishedsetobs
+ jmp showobsloop
+
+finishedsetobs: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Makebackob proc near
+
+ cmp newobs,0
+ jz nomake
+
+ mov al,[es:si+5] ; priority
+ mov ah,[es:si+8] ; type - steady, constant,random,door etc.
+ push si ax si
+ mov ax,objectx
+ mov bx,objecty
+ mov ah,bl
+ mov si,ax
+ mov cx,offset cs:backobject
+ mov dx,setframes
+ mov di,framedata
+ call makesprite
+ pop ax
+ mov [es:bx+20],ax
+ pop ax
+ cmp al,255
+ jnz usedpriority ; forgotten to specify priority
+ mov al,0
+usedpriority: mov [es:bx+23],al
+ mov [es:bx+30],ah
+ mov byte ptr [es:bx+16],0
+ mov byte ptr [es:bx+18],0
+ mov byte ptr [es:bx+19],0
+ pop si
+nomake: ret
+
+ endp
+
+
+
+
+;------------------------------------------------------Free object printing----
+
+Showallfree proc near
+
+ mov es,buffers
+ mov bx,freelist
+ mov listpos,bx
+ mov di,freelist
+ mov cx,80*5
+ mov al,255
+ rep stosb
+
+ mov es,freeframes
+ mov frsegment,es
+ mov ax,frframedata
+ mov dataad,ax
+ mov ax,frframes
+ mov framesad,ax
+ mov al,0
+ mov currentfree,al
+
+ mov ds,freedat
+ mov si,2
+
+ mov cx,0
+loop127: push cx si
+
+ push si
+ mov es,freedat
+ call getmapad
+ pop si
+ cmp ch,0
+ jz over138
+
+ mov al,currentfree
+ mov ah,0
+ mov dx,ax
+ add ax,ax
+ add ax,dx
+ mov currentframe,ax
+
+ push es si
+ call calcfrframe
+ mov es,mapstore
+ mov ds,frsegment
+ call finalframe
+ pop si es
+ cmp cx,0
+ jz over138
+
+ mov ax,currentframe
+ mov ah,0
+ add di,mapadx
+ add bx,mapady
+ call showframe
+ mov si,listpos
+ mov es,buffers
+ mov al,savex
+ mov ah,savey
+ mov [es:si],ax
+ mov cx,ax
+ mov ax,savesize
+ add al,cl
+ add ah,ch
+ mov [es:si+2],ax
+ pop ax cx
+ push cx ax
+ mov [es:si+4],cl
+ add si,5
+ mov listpos,si
+
+over138: inc currentfree
+ pop si cx
+ add si,16
+ inc cx
+ cmp cx,80
+ jz finfree
+ jmp loop127
+
+finfree: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Showallex proc near
+
+ mov es,buffers
+ mov bx,exlist
+ mov listpos,bx
+ mov di,exlist
+ mov cx,100*5
+ mov al,255
+ rep stosb
+
+ mov es,extras
+ mov frsegment,es
+ mov ax,exframedata
+ mov dataad,ax
+ mov ax,exframes
+ mov framesad,ax
+ mov currentex,0
+
+ mov si,exdata+2
+
+ mov cx,0
+exloop: push cx si
+
+ mov es,extras
+
+ push si
+ mov ch,0
+ cmp byte ptr [es:si],255
+ jz notinroom
+ mov al,[es:si-2]
+ cmp al,reallocation
+ jnz notinroom
+ call getmapad
+notinroom: pop si
+ cmp ch,0
+ jz blankex
+
+ mov al,currentex
+ mov ah,0
+ mov dx,ax
+ add ax,ax
+ add ax,dx
+ mov currentframe,ax
+
+ push es si
+ call calcfrframe
+ mov es,mapstore
+ mov ds,frsegment
+ call finalframe
+ pop si es
+ cmp cx,0
+ jz blankex
+
+ mov ax,currentframe
+ mov ah,0
+ add di,mapadx
+ add bx,mapady
+ call showframe
+ mov si,listpos
+ mov es,buffers
+ mov al,savex
+ mov ah,savey
+ mov [es:si],ax
+ mov cx,ax
+ mov ax,savesize
+ add al,cl
+ add ah,ch
+ mov [es:si+2],ax
+ pop ax cx
+ push cx ax
+ mov [es:si+4],cl
+ add si,5
+ mov listpos,si
+
+blankex: inc currentex
+ pop si cx
+ add si,16
+ inc cx
+ cmp cx,100
+ jz finex
+ jmp exloop
+
+finex: ret
+
+ endp
+
+
+
+
+
+
+
+Calcfrframe proc near
+
+ mov dx,frsegment
+ mov ax,framesad
+ push ax
+ mov cx,dataad
+ mov ax,currentframe
+ mov ds,dx
+ mov bx,6
+ mul bx
+ add ax,cx
+ mov bx,ax
+ mov cx,[bx]
+ mov ax,[bx+2]
+ mov dx,[bx+4]
+ pop bx
+ push dx
+ add ax,bx ;ax=source add, cx=x,y
+ ;need this later
+ mov savesource,ax
+ mov savesize,cx
+ pop ax
+ push ax
+ mov ah,0
+ mov offsetx,ax
+ pop ax
+ mov al,ah
+ mov ah,0
+ mov offsety,ax
+ ret
+nullframe: pop ax
+ mov cx,0
+ mov savesize,cx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Finalframe proc near
+
+ mov ax,objecty
+ add ax,offsety
+ mov bx,objectx
+ add bx,offsetx
+ mov savex,bl
+ mov savey,al
+ mov di,objectx
+ mov bx,objecty
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+Adjustlen proc near
+
+ mov ah,al
+ add al,ch
+ cmp al,100
+ jc over242
+ mov al,224
+ sub al,ch
+ mov ch,al
+over242: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Getmapad proc near
+
+ call getxad
+ cmp ch,0
+ jz over146
+ mov objectx,ax
+ call getyad
+ cmp ch,0
+ jz over146
+ mov objecty,ax
+ mov ch,1
+over146: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Getxad proc near
+
+ mov cl,[es:si]
+ inc si
+ mov al,[es:si]
+ inc si
+ mov ah,[es:si]
+ inc si
+ cmp cl,0
+ jnz over148
+ sub al,mapx
+ jc over148
+ cmp al,11
+ jnc over148
+ mov cl,4
+ shl al,cl
+ or al,ah
+ mov ah,0
+ mov ch,1
+ ret
+over148: mov ch,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Getyad proc near
+
+ mov al,[es:si]
+ inc si
+ mov ah,[es:si]
+ inc si
+ sub al,mapy
+ jc over147
+ cmp al,10
+ jnc over147
+ mov cl,4
+ shl al,cl
+ or al,ah
+ mov ah,0
+ mov ch,1
+ ret
+
+over147: mov ch,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/debug.asm b/devtools/tasmrecover/dreamweb/debug.asm
new file mode 100644
index 0000000000..3c24913b2e
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/debug.asm
@@ -0,0 +1,382 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+
+ if debuglevel2
+
+
+Debugkeys proc near
+
+ ret
+
+ endp
+
+
+
+Debugstart proc near
+
+ call allpalette
+ mov reeltohold,-1
+ mov newlocation,23
+ mov dreamnumber,0
+ mov al,"W"
+ mov ah,"S"
+ mov cl,"H"
+ mov ch,"D"
+ call findexobject
+ mov byte ptr [es:bx+12],"S"-"A"
+ mov byte ptr [es:bx+13],"C"-"A"
+ mov byte ptr [es:bx+14],"R"-"A"
+ mov byte ptr [es:bx+15],"W"-"A"
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"A"
+ call findexobject
+ mov byte ptr [es:bx+12],"G"-"A"
+ mov byte ptr [es:bx+13],"U"-"A"
+ mov byte ptr [es:bx+14],"N"-"A"
+ mov byte ptr [es:bx+15],"A"-"A"
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"B"
+ call findexobject
+ mov byte ptr [es:bx+12],"S"-"A"
+ mov byte ptr [es:bx+13],"H"-"A"
+ mov byte ptr [es:bx+14],"L"-"A"
+ mov byte ptr [es:bx+15],"D"-"A"
+ mov card1money,12342
+
+ ret
+
+ endp
+
+
+
+
+
+Debuggreen proc near
+
+ push ax dx
+ mov al,0
+ mov dx,3c8h
+ out dx,al
+ mov dx,3c9h
+ mov al,0
+ out dx,al
+ mov al,63
+ out dx,al
+ mov al,0
+ out dx,al
+ pop dx ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Debugred proc near
+
+ push ax dx
+ mov al,0
+ mov dx,3c8h
+ out dx,al
+ mov dx,3c9h
+ mov al,63
+ out dx,al
+ mov al,0
+ out dx,al
+ mov al,0
+ out dx,al
+ pop dx ax
+ ret
+
+ endp
+
+
+
+
+Debugblue proc near
+
+ push ax dx
+ mov al,0
+ mov dx,3c8h
+ out dx,al
+ mov dx,3c9h
+ mov al,0
+ out dx,al
+ mov al,0
+ out dx,al
+ mov al,63
+ out dx,al
+ pop dx ax
+ ret
+
+ endp
+
+
+
+
+
+Debugblack proc near
+
+ push dx ax
+ mov al,0
+ mov dx,3c8h
+ out dx,al
+ mov dx,3c9h
+ mov al,0
+ out dx,al
+ mov al,0
+ out dx,al
+ mov al,0
+ out dx,al
+ pop ax dx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Debug proc near
+
+ push ds dx cx
+ mov ah,3ch
+ mov cx,0
+ mov dx,seg filenamed
+ mov ds,dx
+ mov dx,offset filenamed
+ int 21h
+ mov bx,ax
+ pop cx dx ds
+ push bx
+ mov ah,40h
+ int 21h
+ pop bx
+ mov ah,3eh
+ int 21h
+ ret
+
+filenamed db "DREAMWEB.TXT",0
+
+ endp
+
+
+
+
+
+
+
+
+Shout proc near
+
+ push ax bx cx dx si di es ds
+ call debugblue
+ mov cx,50
+ call hangon
+ call debugblack
+ mov cx,10
+ call hangon
+ pop ds es di si dx cx bx ax
+ ret
+
+ endp
+
+
+Shoutred proc near
+
+ push ax bx cx dx si di es ds
+ call debugred
+ mov cx,4
+ call hangon
+ call debugblack
+ mov cx,40
+ call hangon
+ pop ds es di si dx cx bx ax
+ ret
+
+ endp
+
+
+
+Shoutgreen proc near
+
+ push ax bx cx dx si di es ds
+ call debuggreen
+ mov cx,4
+ call hangon
+ call debugblack
+ mov cx,40
+ call hangon
+ pop ds es di si dx cx bx ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+;Checkmemingame proc near
+
+; cmp charset1,0
+; jz nodebug
+; mov bx,60000
+; mov ah,48h
+; int 21h
+; mov ax,bx
+; mov cl,6
+; shr ax,cl
+; mov di,offset cs:debugtextig
+; call showword
+
+; mov ax,soundbufferwrite
+; ;mov ax,exframepos
+; mov di,offset cs:debugtextex
+; call showword
+
+; ;mov ax,extextpos
+; ;mov di,offset cs:debugtextex2
+; ;call showword
+
+; push cs
+; pop es
+; mov si,offset cs:debugtextig
+; mov al,0
+; mov ah,0
+; mov dl,100
+; mov di,204
+; mov bx,14
+; call printdirect
+; push cs
+; pop es
+; mov si,offset cs:debugtextex
+; mov al,0
+; mov ah,0
+; mov dl,100
+; mov di,204
+; mov bx,22
+; call printdirect
+; push cs
+; pop es
+; mov si,offset cs:debugtextex2
+; mov al,0
+; mov ah,0
+; mov dl,100
+; mov di,204
+; mov bx,30
+; call printdirect
+; mov di,204
+; mov bx,14
+; mov cl,40
+; mov ch,24
+; call multidump
+;nodebug: ret
+
+ endp
+
+debugtextig: db "00000K",0
+
+debugtextex: db "00000b",0
+
+debugtextex2: db "00000b",0
+
+
+
+
+
+
+ if recording
+
+ mov ax,recordpos
+ mov di,offset cs:debugtextr
+ call showword
+
+ mov al,0
+ call print
+ dw 4,4,100
+debugtextr: db "00000",0
+
+ mov si,0
+ mov di,0
+ mov cl,40
+ mov ch,12
+ call multidump
+
+ endif
+
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;Debugax proc near
+;
+; push ax
+; call showpanel
+; pop ax
+; mov di,offset cs:debugaxtext
+; call showword
+;
+; mov di,204
+; mov bx,14
+; mov al,0
+; mov ah,0
+; mov dl,100
+; push cs
+; pop es
+; mov si,offset cs:debugaxtext
+; call printdirect
+; mov di,204
+; mov bx,14
+; mov cl,40
+; mov ch,24
+; call multidump
+; ret
+;
+;debugaxtext db "00000 ",0
+;
+; endp
+
+
+
+
+
+
+
+ endif
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/dreamweb.asm b/devtools/tasmrecover/dreamweb/dreamweb.asm
new file mode 100644
index 0000000000..2b98b97b34
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/dreamweb.asm
@@ -0,0 +1,6262 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+
+
+
+
+
+
+
+
+
+;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
+;³ ³
+;³ DREAMWEB ³
+;³ ³
+;³ ³
+;³ ³
+;³ ³
+;³ Written by Neil Dodwell. Graphics by Dave Dew. ³
+;³ ³
+;³ Started on Friday 28 December 1990 at 1:20 pm ³
+;³ ³
+;³ Copyright 1990/1991 Creative Reality ³ ³
+;³ ³
+;³ ³
+;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;----------------------------------------------------------Assembly options----
+
+JUMPS
+
+playback equ 0
+recording equ 0
+debuglevel1 equ 0 ;memory debug on
+debuglevel2 equ 0 ;debug keys on+shouts
+demo equ 0
+CD equ 1
+Foreign equ 0
+Spanish equ 0
+German equ 0
+
+;----------------------------------------------------------------Code start----
+
+DREAMWEBPROG segment para public 'CODE'
+
+ assume cs:DREAMWEBPROG,ss:STACKSPACE
+
+
+
+
+;------------------------------------------------------------------Includes----
+
+include \pc\dreamweb\vars.asm ;variables and equates
+include \pc\dreamweb\sprite.asm ;sprite routines
+include \pc\dreamweb\vgagrafx.asm ;screen routines for vga
+include \pc\dreamweb\vgafades.asm ;fade routines
+include \pc\dreamweb\titles.asm ;guess!
+include \pc\dreamweb\print.asm ;text printing routines
+include \pc\dreamweb\object.asm ;pickup
+include \pc\dreamweb\backdrop.asm ;draws floor etc.
+include \pc\dreamweb\look.asm ;look command
+include \pc\dreamweb\talk.asm ;conversations
+include \pc\dreamweb\newplace.asm ;travel
+include \pc\dreamweb\monitor.asm ;network machine
+include \pc\dreamweb\use.asm ;individual use routines
+include \pc\dreamweb\keypad.asm ;accept code with keypad
+include \pc\dreamweb\saveload.asm ;in game options
+include \pc\dreamweb\sblaster.asm
+ if debuglevel1
+include \pc\dreamweb\debug.asm
+ else
+ if debuglevel2
+include \pc\dreamweb\debug.asm
+ endif
+ endif
+
+;-----------------------------------------------------------------Main loop----
+
+
+Dreamweb proc near
+
+ call seecommandtail
+
+ call checkbasemem
+ call soundstartup
+ call setkeyboardint
+ call setupemm
+ call allocatebuffers
+ call setmouse
+ call fadedos
+ call gettime
+
+ call clearbuffers
+ call clearpalette
+ call set16colpalette
+ call readsetdata
+ if demo
+ call changeroomnums
+ endif
+ mov wongame,0
+
+ mov dx,offset cs:basicsample
+ call loadsample
+ call setsoundoff
+
+ if demo
+ else
+ call scanfornames
+ cmp al,0
+ jnz dodecisions
+ endif
+
+ call setmode
+ call loadpalfromiff
+
+ call titles
+ call credits
+ jmp playgame
+
+dodecisions: call cls
+ call setmode
+ call decide
+ cmp getback,4
+ jz mainloop
+
+ call titles
+ call credits
+
+playgame: call clearchanges
+ call setmode
+ call loadpalfromiff
+ mov location,255
+ mov roomafterdream,1
+ if demo
+ mov newlocation,5
+ else
+ mov newlocation,35
+ endif
+ mov volume,7
+ call loadroom
+ call clearsprites
+ call initman
+ call entrytexts
+ call entryanims
+ mov destpos,3
+ call initialinv
+ mov lastflag,32
+ call startup1
+ mov volumeto,0
+ mov volumedirection,-1
+ mov commandtype,255
+ jmp mainloop
+
+loadnew: if demo
+ cmp newlocation,27
+ jnz not27
+ call fadescreendowns
+ mov cx,260
+ call hangon
+ call clearbeforeload
+ jmp playgame
+not27:
+ endif
+ call clearbeforeload
+ call loadroom
+ call clearsprites
+ call initman
+ call entrytexts
+ call entryanims
+ mov newlocation,255
+ call startup
+ mov commandtype,255
+ call worktoscreenm
+ jmp mainloop
+
+alreadyloaded: mov newlocation,255
+ call clearsprites
+ call initman
+ call startup
+ mov commandtype,255
+
+mainloop: call screenupdate
+ cmp wongame,0
+ jnz endofgame
+ cmp mandead,1
+ jz gameover
+ cmp mandead,2
+ jz gameover
+ cmp watchingtime,0
+ jz notwatching
+ mov al,finaldest
+ cmp al,manspath
+ jnz mainloop
+ dec watchingtime
+ jnz mainloop
+
+notwatching: cmp mandead,4
+ jz gameover
+ cmp newlocation,255
+ jnz loadnew
+ jmp mainloop
+
+gameover: if demo
+ call fadescreendowns
+ mov cx,260
+ call hangon
+ call clearbeforeload
+ jmp playgame
+ endif
+ call clearbeforeload
+ call showgun
+ call fadescreendown
+ mov cx,100
+ call hangon
+ jmp dodecisions
+
+endofgame: call clearbeforeload
+ call fadescreendowns
+ mov cx,200
+ call hangon
+ call endgame
+ jmp quickquit2
+
+ endp
+
+
+
+
+ endp
+
+
+
+ if demo
+
+Changeroomnums proc near
+
+ mov di,offset cs:roomdata+10
+ mov cx,50
+changenumloop: mov al,[cs:di]
+ cmp al,"0"
+ jnz nochange
+ mov al,[cs:di+1]
+ cmp al,"5"
+ jnz nochange
+ mov al,"6"
+ mov ah,"0"
+ mov [cs:di],ax
+nochange: add di,32
+ loop changenumloop
+ ret
+
+ endp
+
+ endif
+
+
+
+
+Entrytexts proc near
+
+ cmp location,21
+ jnz notloc15
+ mov al,28
+ mov cx,60
+ mov dx,11
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notloc15: cmp location,30
+ jnz notloc43
+ mov al,27
+ mov cx,60
+ mov dx,11
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notloc43: cmp location,23
+ jnz notloc23
+ mov al,29
+ mov cx,60
+ mov dx,11
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notloc23: cmp location,31
+ jnz notloc44
+ mov al,30
+ mov cx,60
+ mov dx,11
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notloc44: cmp location,20
+ jnz notsarters2
+ mov al,31
+ mov cx,60
+ mov dx,11
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notsarters2: cmp location,24
+ jnz notedenlob
+ mov al,32
+ mov cx,60
+ mov dx,3
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+notedenlob: cmp location,34
+ jnz noteden2
+ mov al,33
+ mov cx,60
+ mov dx,3
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ ret
+noteden2: ret
+
+ endp
+
+
+
+
+
+
+
+
+Entryanims proc near
+
+ mov reeltowatch,-1
+ mov watchmode,-1
+ cmp location,33
+ jnz notinthebeach
+ call switchryanoff
+ mov watchingtime,76*2
+ mov reeltowatch,0
+ mov endwatchreel,76
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+notinthebeach: cmp location,44
+ jnz notsparkys
+ mov al,8
+ call resetlocation
+ mov watchingtime,50*2
+ mov reeltowatch,247
+ mov endwatchreel,297
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+notsparkys: cmp location,22
+ jnz notinthelift
+ mov watchingtime,31*2
+ mov reeltowatch,0
+ mov endwatchreel,30
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+notinthelift: cmp location,26
+ jnz notunderchurch
+ mov symboltopnum,2
+ mov symbolbotnum,1
+ ret
+notunderchurch: cmp location,45
+ jnz notenterdream
+ mov keeperflag,0
+ mov watchingtime,296
+ mov reeltowatch,45
+ mov endwatchreel,198
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+notenterdream: cmp reallocation,46
+ jnz notcrystal
+ cmp sartaindead,1
+ jnz notcrystal
+ mov al,0
+ call removefreeobject
+ ret
+notcrystal: cmp location,9
+ jnz nottopchurch
+ mov al,2
+ call checkifpathison
+ jz nottopchurch
+ cmp aidedead,0
+ jz nottopchurch
+ mov al,3
+ call checkifpathison
+ jnz makedoorsopen
+ mov al,2
+ call turnpathon
+makedoorsopen: mov al,4
+ call removesetobject
+ mov al,5
+ call placesetobject
+ ret
+nottopchurch: cmp location,47
+ jnz notdreamcentre
+ mov al,4
+ call placesetobject
+ mov al,5
+ call placesetobject
+ ret
+notdreamcentre: cmp location,38
+ jnz notcarpark
+ mov watchingtime,57*2
+ mov reeltowatch,4
+ mov endwatchreel,57
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+notcarpark: cmp location,32
+ jnz notalley
+ mov watchingtime,66*2
+ mov reeltowatch,0
+ mov endwatchreel,66
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+notalley: cmp location,24
+ jnz notedensagain
+ mov al,2
+ mov ah,roomnum
+ dec ah
+ call turnanypathon
+notedensagain: ret
+
+ endp
+
+
+
+
+
+
+ if demo
+Initialinv proc near
+
+ mov al,11
+ mov ah,5
+ call pickupob
+ mov al,12
+ mov ah,6
+ call pickupob
+ mov al,13
+ mov ah,7
+ call pickupob
+ mov al,14
+ mov ah,8
+ call pickupob
+ mov al,18
+ mov ah,0
+ call pickupob
+ mov al,19
+ mov ah,1
+ call pickupob
+ mov al,20
+ mov ah,9
+ call pickupob
+ mov al,16
+ mov ah,2
+ call pickupob
+
+ mov al,2
+ mov ah,4
+ call pickupob
+
+ mov al,29
+ mov ah,10
+ call pickupob
+ mov al,33
+ mov ah,11
+ call pickupob
+ mov al,44
+ mov ah,12
+ call pickupob
+ mov card1money,12342
+ ret
+
+ endp
+ else
+Initialinv proc near
+
+ cmp reallocation,24
+ jz isedens
+ ret
+
+isedens: mov al,11
+ mov ah,5
+ call pickupob
+ mov al,12
+ mov ah,6
+ call pickupob
+ mov al,13
+ mov ah,7
+ call pickupob
+ mov al,14
+ mov ah,8
+ call pickupob
+ mov al,18
+ mov al,18
+ mov ah,0
+ call pickupob
+ mov al,19
+ mov ah,1
+ call pickupob
+ mov al,20
+ mov ah,9
+ call pickupob
+ mov al,16
+ mov ah,2
+ call pickupob
+
+ mov watchmode,1
+ mov reeltohold,0
+ mov endofholdreel,6
+ mov watchspeed,1
+ mov speedcount,1
+ call switchryanoff
+ ret
+
+ endp
+
+ endif
+
+
+
+
+
+
+
+
+
+
+
+Pickupob proc near
+
+ mov lastinvpos,ah
+ mov objecttype,2
+ mov itemframe,al
+ mov command,al
+ call getanyad
+ call transfertoex
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;---------------------------------------------------------Memory allocation----
+
+
+
+
+Setupemm proc near
+
+ cmp soundint,255
+ jz noneedforemm
+ call checkforemm
+
+ mov ah,43h ;allocate handle and 160 pages
+ mov bx,176 ;was 176
+ int 67h
+ cmp ah,0
+ jnz emmerror1 ;if there's an error drop to DOS
+ mov emmhandle,dx
+ mov ah,41h ;get the page frame base address
+ int 67h
+ cmp ah,0
+ jnz emmerror1
+ mov emmpageframe,bx
+ mov ax,bx
+ mov cl,12
+ shr ax,cl
+ mov emmhardwarepage,al
+noneedforemm: ret
+emmerror1: mov gameerror,1
+ jmp quickquit2
+
+ endp
+
+
+
+
+
+
+
+
+Removeemm proc near
+
+ cmp soundint,255
+ jz noneedtoremove
+ mov ah,45h
+ mov dx,emmhandle
+ int 67h
+noneedtoremove: ret
+
+ endp
+
+
+
+
+
+Checkforemm proc near
+
+ ret
+
+ endp
+
+
+
+
+Checkbasemem proc near
+
+ mov bx,howmuchalloc
+ cmp bx,9360h
+ jnc enoughmem
+ mov gameerror,5
+ jmp quickquit
+enoughmem: ret
+
+ endp
+
+
+
+Allocatebuffers proc near
+
+ mov bx,lengthofextra/16
+ call allocatemem
+ mov extras,ax
+
+ call trysoundalloc
+ mov bx,lengthofmap/16
+ call allocatemem
+ mov mapdata,ax
+
+ call trysoundalloc
+ mov bx,lengthofbuffer/16
+ call allocatemem
+ mov buffers,ax
+
+ call trysoundalloc
+ mov bx,freedatlen/16
+ call allocatemem
+ mov freedat,ax
+
+ call trysoundalloc
+ mov bx,setdatlen/16
+ call allocatemem
+ mov setdat,ax
+
+ call trysoundalloc
+ mov bx,lenofmapstore/16
+ call allocatemem
+ mov mapstore,ax
+
+ if recording
+ mov bx,1028
+ call allocatemem
+ mov recordspace,ax
+ endif
+
+ if playback
+ mov bx,1028
+ call allocatemem
+ mov recordspace,ax
+ endif
+
+ call allocatework
+
+ mov bx,2048/16
+ call allocatemem
+ mov sounddata,ax
+
+ mov bx,2048/16
+ call allocatemem
+ mov sounddata2,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Clearbuffers proc near
+
+ mov es,buffers
+ mov cx,lengthofbuffer/2
+ mov ax,0
+ mov di,0
+ rep stosw
+
+ mov es,extras
+ mov cx,lengthofextra/2
+ mov ax,0ffffh
+ mov di,0
+ rep stosw
+
+ mov es,buffers
+ mov di,initialreelrouts
+ push cs
+ pop ds
+ mov si,offset cs:reelroutines
+ mov cx,lenofreelrouts
+ rep movsb
+
+ mov es,buffers
+ mov di,initialvars
+ push cs
+ pop ds
+ mov si,offset cs:startvars
+ mov cx,lengthofvars
+ rep movsb
+ call clearchanges
+ ret
+
+ endp
+
+
+
+
+
+
+Clearchanges proc near
+
+ mov es,buffers
+ mov cx,numchanges*2
+ mov ax,0ffffh
+ mov di,listofchanges
+ rep stosw
+ mov ds,buffers
+ mov si,initialreelrouts
+ push cs
+ pop es
+ mov di,offset cs:reelroutines
+ mov cx,lenofreelrouts
+ rep movsb
+
+ mov ds,buffers
+ mov si,initialvars
+ push cs
+ pop es
+ mov di,offset cs:startvars
+ mov cx,lengthofvars
+ rep movsb
+
+ mov expos,0
+ mov exframepos,0
+ mov extextpos,0
+ mov es,extras
+ mov cx,lengthofextra/2
+ mov ax,0ffffh
+ mov di,0
+ rep stosw
+
+ push cs
+ pop es
+ mov di,offset cs:roomscango
+ mov al,1
+ stosb
+ stosb
+ mov al,0
+ stosb
+ mov al,1
+ stosb
+ mov ax,0
+ mov cx,6
+ rep stosw
+ ret
+
+ endp
+
+
+
+
+
+
+
+Clearbeforeload proc near ;deallocates variable buffers
+ ;and clears out fixed ones
+ cmp roomloaded,1
+ jnz noclear
+ call clearreels
+ call clearrest
+ mov roomloaded,0
+noclear: ret
+
+ endp
+
+
+
+;Clearnoreels proc near
+;
+; cmp roomloaded,1
+; jnz noclear2
+; call clearrest
+; mov roomloaded,0
+;noclear2: ret
+;
+; endp
+
+
+
+
+
+
+Clearreels proc near
+
+ mov es,reel1
+ call deallocatemem
+ mov es,reel2
+ call deallocatemem
+ mov es,reel3
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+Clearrest proc near
+
+ mov es,mapdata
+ mov cx,maplen/2
+ mov ax,0
+ mov di,map
+ rep stosw
+
+ mov es,backdrop
+ call deallocatemem
+ mov es,setframes
+ call deallocatemem
+ mov es,reels
+ call deallocatemem
+ mov es,people
+ call deallocatemem
+ mov es,setdesc
+ call deallocatemem
+ mov es,blockdesc
+ call deallocatemem
+ mov es,roomdesc
+ call deallocatemem
+ mov es,freeframes
+ call deallocatemem
+ mov es,freedesc
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+
+
+
+Deallocatemem proc near
+
+ mov ah,49h
+ int 21h
+ jc deallerror
+ ret
+deallerror: mov gameerror,4
+ jmp quickquit2
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Allocatemem proc near
+
+ add bx,2
+ mov ah,48h
+ int 21h
+ jc memerror
+ ret
+
+memerror: mov gameerror,3
+ jmp quickquit2
+
+ endp
+
+
+
+
+Seecommandtail proc near
+
+ mov soundbaseadd,220h
+ mov soundint,5
+ mov sounddmachannel,1
+ mov brightness,0
+
+ mov bx,2
+ mov ax,[es:bx]
+ mov dx,es
+ sub ax,dx
+ mov howmuchalloc,ax
+
+ mov bx,02ch
+ mov ax,[es:bx]
+ push es bx
+
+ mov es,ax
+ mov bx,0
+findblaster: mov ax,[es:bx]
+ cmp ax,0
+ jz endofenvironment
+ cmp al,"B"
+ jnz notblast
+ cmp ah,"L"
+ jnz notblast
+ cmp byte ptr [es:bx+2],"A"
+ jnz notblast
+ cmp byte ptr [es:bx+3],"S"
+ jnz notblast
+ cmp byte ptr [es:bx+4],"T"
+ jnz notblast
+ cmp byte ptr [es:bx+5],"E"
+ jnz notblast
+ cmp byte ptr [es:bx+6],"R"
+ jnz notblast
+ add bx,7
+ call parseblaster
+ jmp endofenvironment
+notblast: inc bx
+ jmp findblaster
+
+endofenvironment: pop bx es
+ mov bx,81h
+ call parseblaster
+ ret
+
+ endp
+
+
+
+Parseblaster proc near
+
+lookattail: mov al,[es:bx]
+ cmp al,0
+ jz endtail
+ cmp al,13
+ jz endtail
+ cmp al,"i"
+ jz issoundint
+ cmp al,"I"
+ jz issoundint
+ cmp al,"b"
+ jz isbright
+ cmp al,"B"
+ jz isbright
+ cmp al,"a"
+ jz isbaseadd
+ cmp al,"A"
+ jz isbaseadd
+ cmp al,"n"
+ jz isnosound
+ cmp al,"N"
+ jz isnosound
+ cmp al,"d"
+ jz isdma
+ cmp al,"D"
+ jz isdma
+ inc bx
+ loop lookattail
+ ret
+
+issoundint: mov al,[es:bx+1]
+ sub al,"0"
+ mov soundint,al
+ inc bx
+ jmp lookattail
+isdma: mov al,[es:bx+1]
+ sub al,"0"
+ mov sounddmachannel,al
+ inc bx
+ jmp lookattail
+isbaseadd: push cx
+ mov al,[es:bx+2]
+ sub al,"0"
+ mov ah,0
+ mov cl,4
+ shl ax,cl
+ add ax,200h
+ mov soundbaseadd,ax
+ pop cx
+ inc bx
+ jmp lookattail
+isbright: mov brightness,1
+ inc bx
+ jmp lookattail
+isnosound: mov soundint,255
+ inc bx
+ jmp lookattail
+endtail: ret
+
+ endp
+
+
+
+
+;-------------------------------------------------------High level routines----
+
+Startup proc near
+
+ mov currentkey,0
+ mov mainmode,0
+ call createpanel
+ mov newobs,1
+ call drawfloor
+ call showicon
+ call getunderzoom
+ call spriteupdate
+ call printsprites
+ call undertextline
+ call reelsonscreen
+ call atmospheres
+ ret
+
+ endp
+
+
+
+
+Startup1 proc near
+
+
+ call clearpalette
+ mov throughdoor,0
+ mov currentkey,"0"
+ mov mainmode,0
+ call createpanel
+ mov newobs,1
+ call drawfloor
+
+ call showicon
+ call getunderzoom
+ call spriteupdate
+ call printsprites
+ call undertextline
+ call reelsonscreen
+ call atmospheres
+ call worktoscreen
+ call fadescreenup
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+;--------------------------------------------------Scroll location routines----
+
+
+
+
+
+Screenupdate proc near
+
+ call newplace
+ call mainscreen
+ call animpointer
+ call showpointer
+ cmp watchingtime,0
+ jnz iswatchingmode
+ cmp newlocation,255
+ jnz finishearly
+iswatchingmode: call vsync
+ call readmouse1
+ call dumppointer
+ call dumptextline
+ call delpointer
+ call autolook
+ call spriteupdate
+ call watchcount
+ call zoom
+ call showpointer
+ cmp wongame,0
+ jnz finishearly
+
+ call vsync
+ call readmouse2
+ call dumppointer
+ call dumpzoom
+ call delpointer
+ call deleverything
+ call printsprites
+ call reelsonscreen
+ call afternewroom
+ call showpointer
+
+ call vsync
+ call readmouse3
+ call dumppointer
+ call dumpmap
+ call dumptimedtext
+ call delpointer
+ call showpointer
+
+ call vsync
+ call readmouse4
+ call dumppointer
+ call dumpwatch
+ call delpointer
+
+finishearly: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Watchreel proc near
+
+ cmp reeltowatch,-1
+ jz notplayingreel
+ mov al,manspath
+ cmp al,finaldest
+ jnz waitstopwalk
+ mov al,turntoface
+ cmp al,facing
+ jz notwatchpath
+waitstopwalk: ret
+
+notwatchpath: dec speedcount
+ cmp speedcount,-1
+ jnz showwatchreel
+ mov al,watchspeed
+ mov speedcount,al
+ mov ax,reeltowatch
+ cmp ax,endwatchreel
+ jnz ismorereel
+ cmp watchingtime,0
+ jnz showwatchreel
+ mov reeltowatch,-1
+ mov watchmode,-1
+ cmp reeltohold,-1
+ jz nomorereel
+ mov watchmode,1
+ jmp notplayingreel
+ismorereel: inc reeltowatch
+showwatchreel: mov ax,reeltowatch
+ mov reelpointer,ax
+ call plotreel
+ mov ax,reelpointer
+ mov reeltowatch,ax
+ call checkforshake
+nomorereel: ret
+
+
+notplayingreel: cmp watchmode,1
+ jnz notholdingreel
+ mov ax,reeltohold
+ mov reelpointer,ax
+ call plotreel
+ ret
+
+notholdingreel: cmp watchmode,2
+ jnz notreleasehold
+ dec speedcount
+ cmp speedcount,-1
+ jnz notlastspeed2
+ mov al,watchspeed
+ mov speedcount,al
+ inc reeltohold
+notlastspeed2: mov ax,reeltohold
+ cmp ax,endofholdreel
+ jnz ismorereel2
+ mov reeltohold,-1
+ mov watchmode,-1
+ mov al,destafterhold
+ mov destination,al
+ mov finaldest,al
+ call autosetwalk
+ ret
+ismorereel2: mov ax,reeltohold
+ mov reelpointer,ax
+ call plotreel
+ ret
+
+notreleasehold: ret
+
+ endp
+
+
+
+
+
+Checkforshake proc near
+
+ cmp reallocation,26
+ jnz notstartshake
+ cmp ax,104
+ jnz notstartshake
+ mov shakecounter,-1
+notstartshake: ret
+
+ endp
+
+
+
+
+
+Watchcount proc near
+
+ cmp watchon,0
+ jz nowatchworn
+ inc timercount
+ cmp timercount,9
+ jz flashdots
+ cmp timercount,18
+ jz uptime
+nowatchworn: ret
+
+flashdots: mov ax,91*3+21
+ mov di,268+4
+ mov bx,21
+ mov ds,charset1
+ call showframe
+ jmp finishwatch
+
+uptime: mov timercount,0
+ add secondcount,1
+ cmp secondcount,60
+ jnz finishtime
+ mov secondcount,0
+ inc minutecount
+ cmp minutecount,60
+ jnz finishtime
+ mov minutecount,0
+ inc hourcount
+ cmp hourcount,24
+ jnz finishtime
+ mov hourcount,0
+
+finishtime: call showtime
+finishwatch: mov watchdump,1
+ ret
+
+ endp
+
+
+
+Showtime proc near
+
+ cmp watchon,0
+ jz nowatch
+
+ mov al,secondcount
+ mov cl,0
+ call twodigitnum
+ push ax
+ mov al,ah
+ mov ah,0
+ add ax,91*3+10
+ mov ds,charset1
+ mov di,282+5
+ mov bx,21
+ call showframe
+ pop ax
+ mov ah,0
+ add ax,91*3+10
+ mov ds,charset1
+ mov di,282+9
+ mov bx,21
+ call showframe
+
+ mov al,minutecount
+ mov cl,0
+ call twodigitnum
+ push ax
+ mov al,ah
+ mov ah,0
+ add ax,91*3
+ mov ds,charset1
+ mov di,270+5
+ mov bx,21
+ call showframe
+ pop ax
+ mov ah,0
+ add ax,91*3
+ mov ds,charset1
+ mov di,270+11
+ mov bx,21
+ call showframe
+
+ mov al,hourcount
+ mov cl,0
+ call twodigitnum
+ push ax
+ mov al,ah
+ mov ah,0
+ add ax,91*3
+ mov ds,charset1
+ mov di,256+5
+ mov bx,21
+ call showframe
+ pop ax
+ mov ah,0
+ add ax,91*3
+ mov ds,charset1
+ mov di,256+11
+ mov bx,21
+ call showframe
+
+ mov ax,91*3+20
+ mov ds,charset1
+ mov di,267+5
+ mov bx,21
+ call showframe
+nowatch: ret
+
+
+ endp
+
+
+
+
+Dumpwatch proc near
+
+ cmp watchdump,1
+ jnz nodumpwatch
+ mov di,256
+ mov bx,21
+ mov cl,40
+ mov ch,12
+ call multidump
+ mov watchdump,0
+nodumpwatch: ret
+
+ endp
+
+
+
+
+Showbyte proc near
+
+ mov dl,al
+ shr dl,1
+ shr dl,1
+ shr dl,1
+ shr dl,1
+ call onedigit
+ mov [es:di],dl
+ mov dl,al
+ and dl,15
+ call onedigit
+ mov [es:di+1],dl
+ add di,3
+ ret
+
+ endp
+
+
+Onedigit proc near
+
+ cmp dl,10
+ jnc morethan10
+ add dl,"0"
+ ret
+morethan10: sub dl,10
+ add dl,"A"
+ ret
+
+ endp
+
+
+
+
+
+Twodigitnum proc near
+
+ mov ah,cl
+ dec ah
+numloop1: inc ah
+ sub al,10
+ jnc numloop1
+ add al,10
+ add al,cl
+ ret
+
+ endp
+
+
+
+
+
+Showword proc near
+
+ mov ch,0
+ mov bx,10000
+ mov cl,47
+word1: inc cl
+ sub ax,bx
+ jnc word1
+ add ax,bx
+ call convnum
+ mov [cs:di],cl
+ mov bx,1000
+ mov cl,47
+word2: inc cl
+ sub ax,bx
+ jnc word2
+ add ax,bx
+ call convnum
+ mov [cs:di+1],cl
+ mov bx,100
+ mov cl,47
+word3: inc cl
+ sub ax,bx
+ jnc word3
+ add ax,bx
+ call convnum
+ mov [cs:di+2],cl
+ mov bx,10
+ mov cl,47
+word4: inc cl
+ sub ax,bx
+ jnc word4
+ add ax,bx
+ call convnum
+ mov [cs:di+3],cl
+ add al,48
+ mov cl,al
+ call convnum
+ mov [cs:di+4],cl
+ ret
+
+ endp
+
+
+
+
+Convnum proc near
+
+ cmp ch,0
+ jnz noconvnum
+ cmp cl,"0"
+ jnz notzeronum
+ mov cl,32
+ jmp noconvnum
+notzeronum: mov ch,1
+noconvnum: ret
+
+ endp
+
+
+
+
+
+
+
+
+;---------------------------------------------Handling of pointer on screen----
+
+Mainscreen proc near
+
+ mov inmaparea,0
+ mov bx,offset cs:mainlist
+ cmp watchon,1
+ jz checkmain
+ mov bx,offset cs:mainlist2
+checkmain: call checkcoords
+ cmp walkandexam,0
+ jz finishmain
+ call walkandexamine
+finishmain: ret
+
+mainlist: dw 44,70,32,46,look
+ dw 0,50,0,180,inventory
+ dw 226,244,10,26,zoomonoff
+ dw 226,244,26,40,saveload
+ dw 240,260,100,124,madmanrun
+ dw 0,320,0,200,identifyob
+ dw 0ffffh
+
+mainlist2: dw 44,70,32,46,look
+ dw 0,50,0,180,inventory
+ dw 226+48,244+48,10,26,zoomonoff
+ dw 226+48,244+48,26,40,saveload
+ dw 240,260,100,124,madmanrun
+ dw 0,320,0,200,identifyob
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+Madmanrun proc near
+
+ cmp location,14
+ jnz identifyob
+ cmp mapx,22
+ jnz identifyob
+ cmp pointermode,2
+ jnz identifyob
+ cmp madmanflag,0
+ jnz identifyob
+
+ cmp commandtype,211
+ jz alreadyrun
+ mov commandtype,211
+ mov al,52
+ call commandonly
+alreadyrun: cmp mousebutton,1
+ jnz norun
+ mov ax,mousebutton
+ cmp ax,oldbutton
+ jz norun
+ mov lastweapon,8
+norun: ret
+
+ endp
+
+
+
+
+
+
+Checkcoords proc near
+ cmp newlocation,255 ;objects keep enumerated even in loading state, fixme
+ jz loop048
+ ret
+
+loop048: mov ax,[cs:bx]
+ cmp ax,0ffffh
+ jz nonefound
+ push bx
+ cmp mousex,ax
+ jl over045
+ mov ax,[cs:bx+2]
+ cmp mousex,ax
+ jge over045
+ mov ax,[cs:bx+4]
+ cmp mousey,ax
+ jl over045
+ mov ax,[cs:bx+6]
+ cmp mousey,ax
+ jge over045
+ mov ax,[cs:bx+8]
+ call ax
+finished: pop ax
+ ret
+over045: pop bx
+ add bx,10
+ jmp loop048
+nonefound: ret
+
+ endp
+
+
+
+
+
+;-------------------------------------------Printing of icons during scroll----
+
+
+
+
+
+Identifyob proc near
+
+ cmp watchingtime,0
+ jnz blank
+
+ mov ax,mousex
+ sub ax,mapadx
+ cmp ax,22*8
+ jc notover1
+ call blank
+ ret
+
+notover1: mov bx,mousey
+ sub bx,mapady
+ cmp bx,20*8
+ jc notover2
+ call blank
+ ret
+
+notover2: mov inmaparea,1
+ mov ah,bl
+ push ax
+ call findpathofpoint
+ mov pointerspath,dl
+ pop ax
+ push ax
+ call findfirstpath
+ mov pointerfirstpath,al
+ pop ax
+
+ call checkifex
+ jnz finishidentify
+ call checkiffree
+ jnz finishidentify
+ call checkifperson
+ jnz finishidentify
+ call checkifset
+ jnz finishidentify
+
+ mov ax,mousex
+ sub ax,mapadx
+ mov cl,al
+ mov ax,mousey
+ sub ax,mapady
+ mov ch,al
+ call checkone
+ cmp al,0
+ jz nothingund
+ ;cmp watchingtime,0
+ ;jnz nothingund
+ cmp mandead,1
+ jz nothingund
+ mov ah,3
+ call obname
+finishidentify: ret
+
+nothingund: call blank
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Checkifperson proc near
+
+ mov es,buffers
+ mov bx,peoplelist
+ mov cx,12
+identifyreel: push cx
+
+ cmp byte ptr [es:bx+4],255
+ jz notareelid
+
+ push es bx ax
+ mov ax,[es:bx+0]
+ mov reelpointer,ax
+ call getreelstart
+ cmp [es:si+2],0ffffh
+ jnz notblankpers
+ add si,5
+notblankpers: mov cx,[es:si+2] ;x,y of reel slot
+ mov ax,[es:si+0] ;frame number
+ push cx
+ call getreelframeax
+ pop cx
+ add cl,[es:bx+4]
+ add ch,[es:bx+5]
+ mov dx,cx
+ add dl,[es:bx+0]
+ add dh,[es:bx+1]
+ pop ax bx es
+
+ cmp al,cl
+ jc notareelid
+ cmp ah,ch
+ jc notareelid
+ cmp al,dl
+ jnc notareelid
+ cmp ah,dh
+ jnc notareelid
+
+ pop cx
+ mov ax,[es:bx+2]
+ mov persondata,ax
+ mov al,[es:bx+4]
+ mov ah,5
+ call obname
+ mov al,0
+ cmp al,1
+ ret
+
+notareelid: pop cx
+ add bx,5
+ dec cx
+ jnz identifyreel
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Checkifset proc near
+
+ mov es,buffers
+ mov bx,setlist+(127*5)
+ mov cx,127
+identifyset: cmp byte ptr [es:bx+4],255
+ jz notasetid
+ cmp al,[es:bx]
+ jc notasetid
+ cmp al,[es:bx+2]
+ jnc notasetid
+ cmp ah,[es:bx+1]
+ jc notasetid
+ cmp ah,[es:bx+3]
+ jnc notasetid
+ call pixelcheckset
+ jz notasetid
+ call isitdescribed
+ jz notasetid
+ mov al,[es:bx+4]
+ mov ah,1
+ call obname
+ mov al,0
+ cmp al,1
+ ret
+notasetid: sub bx,5
+ dec cx
+ cmp cx,-1
+ jnz identifyset
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Checkifex proc near
+
+ mov es,buffers
+ mov bx,exlist+(99*5)
+ mov cx,99
+identifyex: cmp byte ptr [es:bx+4],255
+ jz notanexid
+ cmp al,[es:bx]
+ jc notanexid
+ cmp al,[es:bx+2]
+ jnc notanexid
+ cmp ah,[es:bx+1]
+ jc notanexid
+ cmp ah,[es:bx+3]
+ jnc notanexid
+ mov al,[es:bx+4]
+ mov ah,4
+ call obname
+ mov al,1
+ cmp al,0
+ ret
+notanexid: sub bx,5
+ dec cx
+ cmp cx,-1
+ jnz identifyex
+ ret
+
+ endp
+
+
+
+
+
+
+Checkiffree proc near
+
+ mov es,buffers
+ mov bx,freelist+(79*5)
+ mov cx,79
+identifyfree: cmp byte ptr [es:bx+4],255
+ jz notafreeid
+ cmp al,[es:bx]
+ jc notafreeid
+ cmp al,[es:bx+2]
+ jnc notafreeid
+ cmp ah,[es:bx+1]
+ jc notafreeid
+ cmp ah,[es:bx+3]
+ jnc notafreeid
+ mov al,[es:bx+4]
+ mov ah,2
+ call obname
+ mov al,0
+ cmp al,1
+ ret
+notafreeid: sub bx,5
+ dec cx
+ cmp cx,-1
+ jnz identifyfree
+ ret
+
+ endp
+
+
+
+
+
+
+Isitdescribed proc near
+
+ push ax cx es bx
+ mov al,[es:bx+4] ;get object number
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,setdesc
+ add bx,settextdat
+ mov ax,[es:bx]
+ add ax,settext
+ mov bx,ax
+ mov dl,[es:bx]
+ pop bx es cx ax
+ cmp dl,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+;Getcurrentpath proc near ;routine finds out which path
+; ;block the pointer is in.
+; push ax ;used to see if an object is
+; call findpathofpoint ;close or not
+; pop ax
+; mov pointerspath,dl
+; ret
+;
+; endp
+
+
+
+
+
+Findpathofpoint proc near
+
+ push ax
+ mov bx,pathdata
+ mov es,reels
+ mov al,roomnum
+ mov ah,0
+ mov cx,144
+ mul cx
+ add bx,ax
+ pop cx
+
+ mov dl,0
+pathloop: mov al,[es:bx+6]
+ cmp al,255
+ jnz flunkedit
+ mov ax,[es:bx+2]
+ cmp ax,0ffffh
+ jz flunkedit
+ cmp cl,al
+ jc flunkedit
+ cmp ch,ah
+ jc flunkedit
+ mov ax,[es:bx+4]
+ cmp cl,al
+ jnc flunkedit
+ cmp ch,ah
+ jnc flunkedit
+ jmp gotvalidpath
+flunkedit: add bx,8
+ inc dl
+ cmp dl,12
+ jnz pathloop
+ mov dl,255
+gotvalidpath: ret
+
+ endp
+
+
+
+
+
+Findfirstpath proc near ;similar to last routine, but it
+ ;searches each path to see if
+ push ax ;pointer is within it, regardless
+ mov bx,pathdata ;of whether the path is on or off
+ mov es,reels ;it returns the on or off state in
+ mov al,roomnum ;al (255=on 0=off) 0 if no path
+ mov ah,0
+ mov cx,144
+ mul cx
+ add bx,ax
+ pop cx
+
+ mov dl,0
+fpathloop: mov ax,[es:bx+2]
+ cmp ax,0ffffh
+ jz nofirst
+ cmp cl,al
+ jc nofirst
+ cmp ch,ah
+ jc nofirst
+ mov ax,[es:bx+4]
+ cmp cl,al
+ jnc nofirst
+ cmp ch,ah
+ jnc nofirst
+ jmp gotfirst
+nofirst: add bx,8
+ inc dl
+ cmp dl,12
+ jnz fpathloop
+ mov al,0
+ ret
+gotfirst: mov al,[es:bx+6]
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Turnpathon proc near ;turns path on permanently
+
+ push ax ax
+ mov cl,255
+ mov ch,roomnum
+ add ch,100
+ call findormake
+ pop ax
+ call getroomspaths
+ pop ax
+ cmp al,255
+ jz nopathon
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,255
+ mov [es:bx+6],al
+nopathon: ret
+
+ endp
+
+
+
+
+
+
+
+Turnpathoff proc near ;turns path on permanently
+
+ push ax ax
+ mov cl,0
+ mov ch,roomnum
+ add ch,100
+ call findormake
+ pop ax
+ call getroomspaths
+ pop ax
+ cmp al,255
+ jz nopathoff
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,0
+ mov [es:bx+6],al
+nopathoff: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Turnanypathon proc near
+
+ push ax ax
+ mov cl,255
+ mov ch,ah
+ add ch,100
+ call findormake
+ pop ax
+ mov al,ah
+ mov ah,0
+ mov cx,144
+ mul cx
+ mov es,reels
+ mov bx,pathdata
+ add bx,ax
+ pop ax
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,255
+ mov [es:bx+6],al
+ ret
+
+ endp
+
+
+
+
+
+
+Turnanypathoff proc near
+
+ push ax ax
+ mov cl,0
+ mov ch,ah
+ add ch,100
+ call findormake
+ pop ax
+ mov al,ah
+ mov ah,0
+ mov cx,144
+ mul cx
+ mov es,reels
+ mov bx,pathdata
+ add bx,ax
+ pop ax
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,0
+ mov [es:bx+6],al
+ ret
+
+ endp
+
+
+
+
+
+Checkifpathison proc near
+
+ push ax
+ call getroomspaths
+ pop ax
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,[es:bx+6]
+ cmp al,255
+ ret
+
+ endp
+
+
+
+
+
+Afternewroom proc near
+
+ cmp nowinnewroom,0
+ jz notnew
+ mov timecount,0
+ call createpanel
+ mov commandtype,0
+ call findroominloc
+
+ cmp ryanon,1
+ jz ryansoff
+
+ mov al,ryanx
+ add al,12
+ mov ah,ryany
+ add ah,12
+ call findpathofpoint
+ mov manspath,dl
+ call findxyfrompath
+ mov resetmanxy,1
+
+ryansoff: mov newobs,1
+ call drawfloor
+ mov lookcounter,160
+ mov nowinnewroom,0
+
+ call showicon
+ call spriteupdate
+ call printsprites
+ call undertextline
+ call reelsonscreen
+ call mainscreen
+ call getunderzoom
+ call zoom
+ call worktoscreenm
+ call walkintoroom
+ call reminders
+ call atmospheres
+notnew: ret
+
+ endp
+
+
+
+
+
+
+Atmospheres proc near
+
+ mov cl,mapx
+ mov ch,mapy
+ mov bx,offset cs:atmospherelist
+nextatmos: mov al,[cs:bx]
+ cmp al,255
+ jz nomoreatmos
+ cmp al,reallocation
+ jnz wrongatmos
+ mov ax,[cs:bx+1]
+ cmp ax,cx
+ jnz wrongatmos
+ mov ax,[cs:bx+3]
+ cmp al,ch0playing
+ jz playingalready
+ cmp location,45
+ jnz notweb
+ cmp reeltowatch,45
+ jz wrongatmos
+notweb: call playchannel0
+ cmp reallocation,2
+ cmp mapy,0
+ jz fullvol
+ jnz notlouisvol
+ cmp mapy,10
+ jnz notlouisvol
+ cmp mapx,22
+ jnz notlouisvol
+ mov volume,5
+notlouisvol: if cd
+ cmp reallocation,14
+ jnz notmad1
+ cmp mapx,33
+ jz ismad2
+ cmp mapx,22
+ jnz notmad1
+ mov volume,5
+ ret
+ismad2: mov volume,0
+ ret
+notmad1: endif
+playingalready: cmp reallocation,2
+ jnz notlouisvol2
+ cmp mapx,22
+ jz louisvol
+ cmp mapx,11
+ jnz notlouisvol2
+fullvol: mov volume,0
+notlouisvol2: ret
+louisvol: mov volume,5
+ ret
+wrongatmos: add bx,5
+ jmp nextatmos
+nomoreatmos: call cancelch0
+ ret
+
+atmospherelist: db 0,33,10,15,255
+ db 0,22,10,15,255
+ db 0,22,0,15,255
+ db 0,11,0,15,255
+ db 0,11,10,15,255
+ db 0,0,10,15,255
+
+ db 1,44,10,6,255 ;location,map x,y,sound,repeat
+ db 1,44,0,13,255
+
+ db 2,33,0,6,255
+ db 2,22,0,5,255
+ db 2,22,10,16,255
+ db 2,11,10,16,255
+
+ db 3,44,0,15,255
+ db 3,33,10,6,255
+ db 3,33,0,5,255
+
+ db 4,11,30,6,255
+ db 4,22,30,5,255
+ db 4,22,20,13,255
+
+ db 10,33,30,6,255
+ db 10,22,30,6,255
+
+ db 9,22,10,6,255
+ db 9,22,20,16,255
+ db 9,22,30,16,255
+ db 9,22,40,16,255
+ db 9,22,50,16,255
+
+ db 6,11,30,6,255
+ db 6,0,10,15,255
+ db 6,0,20,15,255
+ db 6,11,20,15,255
+ db 6,22,20,15,255
+
+ db 7,11,20,6,255
+ db 7,0,20,6,255
+ db 7,0,30,6,255
+
+ db 55,44,0,5,255
+ db 55,44,10,5,255
+
+ db 5,22,30,6,255
+ if demo
+ db 5,22,20,16,255
+ db 5,22,10,16,255
+ else
+ db 5,22,20,15,255
+ db 5,22,10,15,255
+ endif
+
+ db 24,22,0,15,255
+ db 24,33,0,15,255
+ db 24,44,0,15,255
+ db 24,33,10,15,255
+
+ db 8,0,10,6,255
+ db 8,11,10,6,255
+ db 8,22,10,6,255
+ db 8,33,10,6,255
+ db 8,33,20,6,255
+ db 8,33,30,6,255
+ db 8,33,40,6,255
+ db 8,22,40,6,255
+ db 8,11,40,6,255
+
+ db 11,11,20,12,255
+ db 11,11,30,12,255
+ db 11,22,20,12,255
+ db 11,22,30,12,255
+
+ db 12,22,20,12,255
+ db 13,22,20,12,255
+ db 13,33,20,12,255
+
+ db 14,44,20,12,255
+ db 14,33,0,12,255
+ db 14,33,10,12,255
+ db 14,33,20,12,255
+ db 14,33,30,12,255
+ db 14,33,40,12,255
+ db 14,22,0,16,255
+
+ db 19,0,0,12,255
+
+ db 20,0,20,16,255
+ db 20,0,30,16,255
+ db 20,11,30,16,255
+ db 20,0,40,16,255
+ db 20,11,40,16,255
+
+ if demo
+ db 21,11,10,16,255
+ db 21,11,20,16,255
+ db 21,0,20,16,255
+ db 21,22,20,16,255
+ db 21,33,20,16,255
+ db 21,44,20,16,255
+ db 21,44,10,16,255
+ else
+ db 21,11,10,15,255
+ db 21,11,20,15,255
+ db 21,0,20,15,255
+ db 21,22,20,15,255
+ db 21,33,20,15,255
+ db 21,44,20,15,255
+ db 21,44,10,15,255
+ endif
+
+ db 22,22,10,16,255
+ db 22,22,20,16,255
+
+ db 23,22,30,13,255
+ db 23,22,40,13,255
+ db 23,33,40,13,255
+ db 23,11,40,13,255
+ db 23,0,40,13,255
+ db 23,0,50,13,255
+
+ db 25,11,40,16,255
+ db 25,11,50,16,255
+ db 25,0,50,16,255
+
+ db 27,11,20,16,255
+ db 27,11,30,16,255
+
+ db 29,11,10,16,255
+
+ db 45,22,30,12,255
+ db 45,22,40,12,255
+ db 45,22,50,12,255
+
+ db 46,22,40,12,255
+ db 46,11,50,12,255
+ db 46,22,50,12,255
+ db 46,33,50,12,255
+
+ db 47,0,0,12,255
+
+ db 26,22,20,16,255
+ db 26,33,10,16,255
+ db 26,33,20,16,255
+ db 26,33,30,16,255
+ db 26,44,30,16,255
+ db 26,22,30,16,255
+ db 26,11,30,16,255
+ db 26,11,20,16,255
+ db 26,0,20,16,255
+ db 26,11,40,16,255
+ db 26,0,40,16,255
+ db 26,22,40,16,255
+ db 26,11,50,16,255
+
+ db 28,0,30,15,255
+ db 28,0,20,15,255
+ db 28,0,40,15,255
+ db 28,11,30,15,255
+ db 28,11,20,15,255
+ db 28,22,30,15,255
+ db 28,22,20,15,255
+
+ db 255
+
+ endp
+
+
+
+
+
+
+Walkintoroom proc near
+
+ cmp location,14
+ jnz notlair
+ cmp mapx,22
+ jnz notlair
+ mov destination,1
+ mov finaldest,1
+ call autosetwalk
+notlair: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Afterintroroom proc near
+
+ cmp nowinnewroom,0
+ jz notnewintro
+ call clearwork
+ call findroominloc
+ mov newobs,1
+ call drawfloor
+ call reelsonscreen
+ call spriteupdate
+ call printsprites
+ call worktoscreen
+ mov nowinnewroom,0
+notnewintro: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Obname proc near
+
+ cmp reasseschanges,0
+ jz notnewpath
+ mov reasseschanges,0
+ jmp diff
+
+notnewpath: cmp ah,commandtype
+ jz notdiffob
+ jmp diff
+notdiffob: cmp al,command
+ jnz diff
+ cmp walkandexam,1
+ jz walkandexamine
+ cmp mousebutton,0
+ jz noobselect
+ cmp commandtype,3
+ jnz isntblock
+ cmp lastflag,2
+ jc noobselect
+isntblock: mov bl,manspath
+ cmp bl,pointerspath
+ jnz wantstowalk
+ cmp commandtype,3
+ jz wantstowalk
+ call finishedwalking
+ jnz noobselect
+ cmp commandtype,5
+ jz wantstotalk
+ cmp watchingtime,0
+ jnz noobselect
+ call examineob
+ ret
+wantstotalk: cmp watchingtime,0
+ jnz noobselect
+ call talk
+ ret
+walkandexamine: call finishedwalking
+ jnz noobselect
+ mov al,walkexamtype
+ mov commandtype,al
+ mov al,walkexamnum
+ mov command,al
+ mov walkandexam,0
+ cmp commandtype,5
+ jz noobselect
+ call examineob
+ ret
+wantstowalk: call setwalk
+ mov reasseschanges,1
+noobselect: ret
+
+
+diff: mov command,al
+ mov commandtype,ah
+diff2: cmp linepointer,254
+ jnz middleofwalk
+ cmp watchingtime,0
+ jnz middleofwalk
+ mov al,facing
+ cmp al,turntoface
+ jnz middleofwalk
+ cmp commandtype,3
+ jnz notblock
+ mov bl,manspath
+ cmp bl,pointerspath
+ jnz dontcheck
+ mov cl,ryanx ;look under feet to see if
+ add cl,12 ;any flags are there
+ mov ch,ryany
+ add ch,12
+ call checkone
+ cmp cl,2
+ jc isblock
+dontcheck: call getflagunderp
+ cmp lastflag,2
+ jc isblock
+ cmp lastflag,128
+ jnc isblock
+ jmp toofaraway ; only here for turning on doorstep
+notblock: mov bl,manspath
+ cmp bl,pointerspath
+ jnz toofaraway
+ cmp commandtype,3
+ jz isblock
+ cmp commandtype,5
+ jz isaperson
+ call examineobtext
+ ret
+middleofwalk: call blocknametext
+ ret
+isblock: call blocknametext
+ ret
+isaperson: call personnametext
+ ret
+toofaraway: call walktotext
+ ret
+
+ endp
+
+
+
+
+
+
+
+Finishedwalking proc near
+
+ cmp linepointer,254
+ jnz iswalking
+ mov al,facing
+ cmp al,turntoface
+iswalking: ret
+
+ endp
+
+
+
+
+
+
+
+Examineobtext proc near
+
+ mov bl,command
+ mov bh,commandtype
+ mov al,1
+ call commandwithob
+ ret
+
+ endp
+
+
+
+
+
+Commandwithob proc near
+
+ push ax
+ push ax bx cx dx es ds si di
+ call deltextline
+ pop di si ds es dx cx bx ax
+
+ push bx
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,commandtext
+ mov ax,[es:bx]
+ add ax,textstart
+ mov si,ax
+
+ mov di,textaddressx
+ mov bx,textaddressy
+ mov dl,textlen
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ pop ax
+ mov di,offset cs:commandline
+ call copyname
+ pop ax
+
+ mov di,lastxpos
+ cmp al,0
+ jz noadd
+ add di,5
+noadd: mov bx,textaddressy
+ push cs
+ pop es
+ mov si,offset cs:commandline
+ mov dl,textlen
+ mov al,0
+ mov ah,0
+ call printdirect
+ mov newtextline,1
+ ret
+
+commandline: db "OBJECT NAME ONE ",0
+
+ endp
+
+
+
+
+Commandonly proc near
+
+ push ax bx cx dx es ds si di
+ call deltextline
+ pop di si ds es dx cx bx ax
+
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,commandtext
+ mov ax,[es:bx]
+ add ax,textstart
+ mov si,ax
+
+ mov di,textaddressx
+ mov bx,textaddressy
+ mov dl,textlen
+ mov al,0
+ mov ah,0
+ call printdirect
+ mov newtextline,1
+ ret
+
+ endp
+
+
+
+
+
+Printmessage proc near
+
+ push dx bx di
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,commandtext
+ mov ax,[es:bx]
+ add ax,textstart
+ mov si,ax
+ pop di bx dx
+ mov al,0
+ mov ah,0
+ call printdirect
+ ret
+
+ endp
+
+
+
+Printmessage2 proc near
+
+ push dx bx di
+ push ax
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,commandtext
+ mov ax,[es:bx]
+ add ax,textstart
+ mov si,ax
+ pop ax
+
+searchmess: push ax
+ call findnextcolon
+ pop ax
+ dec ah
+ jnz searchmess
+
+ pop di bx dx
+ mov al,0
+ mov ah,0
+ call printdirect
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Blocknametext proc near
+
+ mov bl,command
+ mov bh,commandtype
+ mov al,0
+ call commandwithob
+ ret
+
+ endp
+
+
+
+
+Personnametext proc near
+
+ mov bl,command
+ and bl,127
+ mov bh,commandtype
+ mov al,2
+ call commandwithob
+ ret
+
+ endp
+
+
+
+
+
+
+
+Walktotext proc near
+
+ mov bl,command
+ mov bh,commandtype
+ mov al,3
+ call commandwithob
+ ret
+
+ endp
+
+
+
+
+
+Getflagunderp proc near
+
+ mov cx,mousex
+ sub cx,mapadx
+ mov ax,mousey
+ sub ax,mapady
+ mov ch,al
+ call checkone
+ mov lastflag,cl
+ mov lastflagex,ch
+ ret
+
+ endp
+
+
+
+
+
+Setwalk proc near
+
+ cmp linepointer,254
+ jnz alreadywalking
+ mov al,pointerspath
+ cmp al,manspath
+ jz cantwalk2
+ cmp watchmode,1
+ jz holdingreel
+ cmp watchmode,2
+ jz cantwalk
+ mov destination,al
+ mov finaldest,al
+ cmp mousebutton,2
+ jnz notwalkandexam
+ cmp commandtype,3
+ jz notwalkandexam
+ mov walkandexam,1
+ mov al,commandtype
+ mov walkexamtype,al
+ mov al,command
+ mov walkexamnum,al
+notwalkandexam: call autosetwalk
+cantwalk: ret
+cantwalk2: call facerightway
+ ret
+alreadywalking: mov al,pointerspath
+ mov finaldest,al
+ ret
+
+holdingreel: mov destafterhold,al
+ mov watchmode,2
+ ret
+
+ endp
+
+
+
+
+
+
+
+Autosetwalk proc near
+
+ mov al,manspath
+ cmp finaldest,al
+ jnz notsamealready
+ ret
+notsamealready: call getroomspaths
+ call checkdest
+ push bx
+ mov al,manspath
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,[es:bx]
+ mov ah,0
+ sub ax,12
+ mov linestartx,ax
+ mov al,[es:bx+1]
+ mov ah,0
+ sub ax,12
+ mov linestarty,ax
+ pop bx
+
+ mov al,destination
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,[es:bx]
+ mov ah,0
+ sub ax,12
+ mov lineendx,ax
+ mov al,[es:bx+1]
+ mov ah,0
+ sub ax,12
+ mov lineendy,ax
+ call bresenhams
+
+ cmp linedirection,0
+ jz normalline
+ mov al,linelength
+ dec al
+ mov linepointer,al
+ mov linedirection,1
+ ret
+
+normalline: mov linepointer,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Checkdest proc near
+
+ push bx
+ add bx,12*8
+ mov ah,manspath
+ mov cl,4
+ shl ah,cl
+ mov al,destination
+
+ mov cl,24
+ mov ch,destination
+checkdestloop: mov dh,[es:bx]
+ and dh,11110000b
+ mov dl,[es:bx]
+ and dl,00001111b
+ cmp ax,dx
+ jnz nextcheck
+ mov al,[es:bx+1]
+ and al,15
+ mov destination,al
+ pop bx
+ ret
+nextcheck: mov dl,[es:bx]
+ and dl,11110000b
+ shr dl,1
+ shr dl,1
+ shr dl,1
+ shr dl,1
+ mov dh,[es:bx]
+ and dh,00001111b
+ shl dh,1
+ shl dh,1
+ shl dh,1
+ shl dh,1
+ cmp ax,dx
+ jnz nextcheck2
+ mov ch,[es:bx+1]
+ and ch,15
+nextcheck2: add bx,2
+ dec cl
+ jnz checkdestloop
+ mov destination,ch
+ pop bx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Bresenhams proc near
+
+ call workoutframes
+
+ mov dx,seg linedata
+ mov es,dx
+ mov di,offset es:linedata
+ mov si,1
+ mov linedirection,0
+
+ mov cx,lineendx
+ sub cx,linestartx
+ jz vertline
+ jns line1
+
+ neg cx
+ mov bx,lineendx
+ xchg bx,linestartx
+ mov lineendx,bx
+
+ mov bx,lineendy
+ xchg bx,linestarty
+ mov lineendy,bx
+ mov linedirection,1
+
+line1: mov bx,lineendy
+ sub bx,linestarty
+ jz horizline
+ jns line3
+
+ neg bx
+ neg si
+
+line3: push si
+ mov lineroutine,0 ; means lo slope
+ cmp bx,cx
+ jle line4
+ mov lineroutine,1 ; means hi slope
+ xchg bx,cx
+
+line4: shl bx,1
+ mov increment1,bx
+ sub bx,cx
+ mov si,bx
+ sub bx,cx
+ mov increment2,bx
+
+ mov ax,linestartx
+ mov bx,linestarty
+ mov ah,bl
+ inc cx
+ pop bx
+ cmp lineroutine,1
+ jz hislope
+ jmp loslope
+
+vertline: mov ax,linestarty
+ mov bx,lineendy
+ mov cx,bx
+ sub cx,ax
+ jge line31
+
+ neg cx
+ mov ax,bx
+ mov linedirection,1
+
+line31: inc cx
+ mov bx,linestartx
+ xchg ax,bx
+ mov ah,bl
+ mov bx,si
+line32: stosw
+ add ah,bl
+ loop line32
+ jmp lineexit
+
+
+horizline: mov ax,linestartx
+ mov bx,linestarty
+ mov ah,bl
+ inc cx
+horizloop: stosw
+ inc al
+ loop horizloop
+ jmp lineexit
+
+
+loslope:
+loloop: stosw
+ inc al
+ or si,si
+ jns line12
+ add si,increment1
+ loop loloop
+ jmp lineexit
+
+line12: add si,increment2
+ add ah,bl
+ loop loloop
+ jmp lineexit
+
+
+
+hislope:
+hiloop: stosw
+ add ah,bl
+ or si,si
+ jns line23
+ add si,increment1
+ loop hiloop
+ jmp lineexit
+
+line23: add si,increment2
+ inc al
+ loop hiloop
+
+lineexit: sub di,offset es:linedata
+ mov ax,di
+ shr ax,1
+ mov linelength,al
+ ret
+
+ endp
+
+
+
+
+
+
+
+Workoutframes proc near
+
+ mov bx,linestartx
+ add bx,32
+ mov ax,lineendx
+ add ax,32
+ sub bx,ax
+ jnc notneg1
+ neg bx
+notneg1: mov cx,linestarty
+ add cx,32
+ mov ax,lineendy
+ add ax,32
+ sub cx,ax
+ jnc notneg2
+ neg cx
+notneg2: cmp bx,cx
+ jnc tendstohoriz
+ mov dl,2
+ mov ax,cx
+ shr ax,1
+ cmp bx,ax
+ jc gotquad
+ mov dl,1
+ jmp gotquad
+tendstohoriz: mov dl,0
+ mov ax,bx
+ shr ax,1
+ cmp cx,ax
+ jc gotquad
+ mov dl,1
+ jmp gotquad
+
+gotquad: mov bx,linestartx
+ add bx,32
+ mov ax,lineendx
+ add ax,32
+ sub bx,ax
+ jc isinright
+isinleft: mov cx,linestarty
+ add cx,32
+ mov ax,lineendy
+ add ax,32
+ sub cx,ax
+ jnc topleft
+ cmp dl,1
+ jz noswap1
+ xor dl,2
+noswap1: add dl,4
+ jmp success
+topleft: add dl,6
+ jmp success
+
+isinright: mov cx,linestarty
+ add cx,32
+ mov ax,lineendy
+ add ax,32
+ sub cx,ax
+ jnc botright
+ add dl,2
+ jmp success
+botright: cmp dl,1
+ jz noswap2
+ xor dl,2
+noswap2:
+
+success: and dl,7
+ mov turntoface,dl
+ mov turndirection,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;Multiply8 proc near
+;
+; mov ah,0
+; mov cx,8
+; mul cx
+; ret
+;
+; endp
+
+
+
+
+
+
+Getroomspaths proc near
+
+ mov al,roomnum
+ mov ah,0
+ mov cx,144
+ mul cx
+ mov es,reels
+ mov bx,pathdata
+ add bx,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Copyname proc near
+
+ push di
+ call findobname
+ pop di
+ push cs
+ pop es
+
+copytext: mov cx,28
+make: lodsb
+ cmp al,":"
+ jz finishmakename
+ cmp al,0
+ jz finishmakename
+ stosb
+ loop make
+
+finishmakename: inc cx
+ mov al,0
+ stosb
+ ret
+ mov al,255
+ rep stosb
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Findobname proc near
+
+ push ax
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ pop ax
+
+ cmp ah,5
+ jnz notpersonname
+
+ push ax
+ and al,127
+ mov ah,0
+ mov bx,64*2
+ mul bx
+ mov si,ax
+ mov ds,people
+ add si,persontxtdat
+ mov cx,persontext
+ mov ax,[si]
+ add ax,cx
+ mov si,ax
+ pop ax
+ ret
+
+notpersonname: cmp ah,4
+ jnz notextraname
+ mov ds,extras
+ add bx,extextdat
+ mov ax,[bx]
+ add ax,extext
+ mov si,ax
+ ret
+
+notextraname: cmp ah,2
+ jnz notfreename
+ mov ds,freedesc
+ add bx,freetextdat
+ mov ax,[bx]
+ add ax,freetext
+ mov si,ax
+ ret
+
+notfreename: cmp ah,1
+ jnz notsetname
+ mov ds,setdesc
+ add bx,settextdat
+ mov ax,[bx]
+ add ax,settext
+ mov si,ax
+ ret
+
+notsetname: mov ds,blockdesc
+ add bx,blocktextdat
+ mov ax,[bx]
+ add ax,blocktext
+ mov si,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+;-------------------------------------------Printing of non scrolling icons----
+
+Showicon proc near
+
+ cmp reallocation,50
+ jnc isdream1
+ call showpanel
+ call showman
+ call roomname
+ call panelicons1
+ call zoomicon
+ ret
+
+isdream1: mov ds,tempsprites
+ mov di,72
+ mov bx,2
+ mov al,45
+ mov ah,0
+ call showframe
+ mov ds,tempsprites
+ mov di,72+47
+ mov bx,2
+ mov al,46
+ mov ah,0
+ call showframe
+ mov ds,tempsprites
+ mov di,69-10
+ mov bx,21
+ mov al,49
+ mov ah,0
+ call showframe
+
+ mov ds,tempsprites
+ mov di,160+88
+ mov bx,2
+ mov al,45
+ mov ah,4
+ call showframe
+ mov ds,tempsprites
+ mov di,160+43
+ mov bx,2
+ mov al,46
+ mov ah,4
+ call showframe
+ mov ds,tempsprites
+ mov di,160+101
+ mov bx,21
+ mov al,49
+ mov ah,4
+ call showframe
+ call middlepanel
+ ret
+
+ endp
+
+
+
+
+
+Middlepanel proc near
+
+ mov ds,tempsprites
+ mov di,72+47+20
+ mov bx,0
+ mov al,48
+ mov ah,0
+ call showframe
+ mov ds,tempsprites
+ mov di,72+19
+ mov bx,21
+ mov al,47
+ mov ah,0
+ call showframe
+ mov ds,tempsprites
+ mov di,160+23
+ mov bx,0
+ mov al,48
+ mov ah,4
+ call showframe
+ mov ds,tempsprites
+ mov di,160+71
+ mov bx,21
+ mov al,47
+ mov ah,4
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Showman proc near
+
+ mov ds,icons1
+ mov di,0
+ mov bx,0
+ mov al,0
+ mov ah,0
+ call showframe
+ mov ds,icons1
+ mov di,0
+ mov bx,114
+ mov al,1
+ mov ah,0
+ call showframe
+
+ cmp shadeson,0
+ jz notverycool
+
+ mov ds,icons1
+ mov di,28
+ mov bx,25
+ mov al,2
+ mov ah,0
+ call showframe
+notverycool: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showpanel proc near
+
+ mov ds,icons1
+ mov di,72
+ mov bx,0
+ mov al,19
+ mov ah,0
+ call showframe
+ mov ds,icons1
+ mov di,192
+ mov bx,0
+ mov al,19
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Roomname proc near
+
+ mov di,88
+ mov bx,18
+ mov al,53
+ mov dl,240
+ call printmessage
+
+ mov bl,roomnum
+ cmp bl,32
+ jc notover32
+ sub bl,32
+
+notover32: mov bh,0
+ add bx,bx
+ mov es,roomdesc
+ add bx,intextdat
+ mov ax,[es:bx]
+ add ax,intext
+ mov si,ax
+
+ mov linespacing,7
+ mov di,88
+ mov bx,25
+ mov dl,120
+ cmp watchon,1
+ jz gotpl
+ mov dl,160
+gotpl: mov al,0
+ mov ah,0
+ call printdirect
+ mov linespacing,10
+
+ call usecharset1
+ ret
+
+ endp
+
+
+
+
+
+
+Usecharset1 proc near
+
+ mov ax,charset1
+ mov currentset,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Usetempcharset proc near
+
+ mov ax,tempcharset
+ mov currentset,ax
+ ret
+
+ endp
+
+
+
+
+
+Showexit proc near
+
+ mov ds,icons1
+ mov di,274
+ mov bx,154
+ mov al,11
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+Panelicons1 proc near
+
+ mov di,0
+ cmp watchon,1
+ jz watchison
+ mov di,48
+watchison: push di
+ mov ds,icons2
+ add di,204
+ mov bx,4
+ mov al,2
+ mov ah,0
+ call showframe
+ pop di
+ push di
+ cmp zoomon,1
+ jz zoomisoff
+ mov ds,icons1
+ add di,228
+ mov bx,8
+ mov al,5
+ mov ah,0
+ call showframe
+zoomisoff: pop di
+ call showwatch
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Showwatch proc near
+
+ cmp watchon,0
+ jz nowristwatch
+ mov ds,icons1
+ mov di,250
+ mov bx,1
+ mov al,6
+ mov ah,0
+ call showframe
+ call showtime
+nowristwatch: ret
+
+ endp
+
+
+Gettime proc near
+
+ mov ah,2ch
+ int 21h
+ mov secondcount,dh
+ mov minutecount,cl
+ mov hourcount,ch
+ ret
+
+ endp
+
+
+
+
+
+Zoomicon proc near
+
+ cmp zoomon,0
+ jz nozoom1
+ mov ds,icons1
+ mov di,zoomx
+ mov bx,zoomy-1
+ mov al,8
+ mov ah,0
+ call showframe
+nozoom1: ret
+
+ endp
+
+
+
+
+
+
+Showblink proc near
+
+ cmp manisoffscreen,1
+ jz finblink1
+ inc blinkcount
+ cmp shadeson,0
+ jnz finblink1
+ cmp reallocation,50
+ jnc eyesshut
+ mov al,blinkcount
+ cmp al,3
+ jnz finblink1
+ mov blinkcount,0
+ mov al,blinkframe
+ inc al
+ mov blinkframe,al
+ cmp al,6
+ jc nomorethan6
+ mov al,6
+nomorethan6: mov ah,0
+ mov bx,offset cs:blinktab
+ add bx,ax
+
+ mov al,[cs:bx]
+ mov ds,icons1
+ mov di,44
+ mov bx,32
+ mov ah,0
+ call showframe
+finblink1: ret
+
+eyesshut: ;mov al,32
+ ;mov ds,icons1
+ ;mov di,44
+ ;mov bx,32
+ ;mov ah,0
+ ;call showframe
+ ret
+
+blinktab: db 16,18,18,17,16,16,16
+
+ endp
+
+
+
+
+
+
+Dumpblink proc near
+
+ cmp shadeson,0
+ jnz nodumpeye
+ cmp blinkcount,0
+ jnz nodumpeye
+ mov al,blinkframe
+ cmp al,6
+ jnc nodumpeye
+ push ds
+ mov di,44
+ mov bx,32
+ mov cl,16
+ mov ch,12
+ call multidump
+ pop ds
+nodumpeye: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Worktoscreenm proc near
+
+ call animpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+;-------------------------------------------------------------Blank routine----
+
+
+
+
+Blank proc near
+
+ cmp commandtype,199
+ jz alreadyblnk
+ mov commandtype,199
+ mov al,0
+ call commandonly
+alreadyblnk: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;---------------------------------------------------------Standard routines----
+
+
+
+
+
+
+
+
+
+
+
+
+
+Allpointer proc near
+
+ call readmouse
+ call showpointer
+ call dumppointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+Hangonp proc near
+
+ push cx
+ add cx,cx
+ pop ax
+ add cx,ax
+ mov maintimer,0
+ mov al,pointerframe
+ mov ah,pickup
+ push ax
+ mov pointermode,3
+ mov pickup,0
+ push cx
+ mov commandtype,255
+ call readmouse
+ call animpointer
+ call showpointer
+ call vsync
+ call dumppointer
+ pop cx
+
+hangloop: push cx
+ call delpointer
+ call readmouse
+ call animpointer
+ call showpointer
+ call vsync
+ call dumppointer
+ pop cx
+ mov ax,mousebutton
+ cmp ax,0
+ jz notpressed
+ cmp ax,oldbutton
+ jnz getoutofit
+notpressed: loop hangloop
+
+getoutofit: call delpointer
+ pop ax
+ mov pointerframe,al
+ mov pickup,ah
+ mov pointermode,0
+ ret
+
+ endp
+
+
+
+
+
+Hangonw proc near
+
+hangloopw: push cx
+ call delpointer
+ call readmouse
+ call animpointer
+ call showpointer
+ call vsync
+ call dumppointer
+ pop cx
+ loop hangloopw
+ ret
+
+ endp
+
+
+
+
+Hangoncurs proc near
+
+monloop1: push cx
+ call printcurs
+ call vsync
+ call delcurs
+ pop cx
+ loop monloop1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Getunderzoom proc near
+
+ mov di,zoomx+5
+ mov bx,zoomy+4
+ mov ds,buffers
+ mov si,zoomspace
+ mov cl,46
+ mov ch,40
+ call multiget
+ ret
+
+ endp
+
+
+
+
+
+Dumpzoom proc near
+
+ cmp zoomon,1
+ jnz notzoomon
+ mov di,zoomx+5
+ mov bx,zoomy+4
+ mov cl,46
+ mov ch,40
+ call multidump
+notzoomon: ret
+
+ endp
+
+
+
+
+
+
+
+Putunderzoom proc near
+
+ mov di,zoomx+5
+ mov bx,zoomy+4
+ mov ds,buffers
+ mov si,zoomspace
+ mov cl,46
+ mov ch,40
+ call multiput
+ ret
+
+ endp
+
+
+
+
+
+Crosshair proc near
+
+ cmp commandtype,3
+ jz nocross
+ cmp commandtype,10
+ jnc nocross
+
+ mov es,workspace
+ mov ds,icons1
+ mov di,zoomx+24
+ mov bx,zoomy+19
+ mov al,9
+ mov ah,0
+ call showframe
+ ret
+
+nocross: mov es,workspace
+ mov ds,icons1
+ mov di,zoomx+24
+ mov bx,zoomy+19
+ mov al,29
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+Showpointer proc near
+
+ call showblink
+ mov di,mousex
+ mov oldpointerx,di
+ mov bx,mousey
+ mov oldpointery,bx
+ cmp pickup,1
+ jz itsanobject
+
+ push bx di
+ mov ds,icons1
+ mov al,pointerframe
+ add al,20
+ mov ah,0
+ add ax,ax
+ mov si,ax
+ add ax,ax
+ add si,ax
+ mov cx,[si]
+ cmp cl,12
+ jnc notsmallx
+ mov cl,12
+notsmallx: cmp ch,12
+ jnc notsmally
+ mov ch,12
+notsmally: mov pointerxs,cl
+ mov pointerys,ch
+ push ds
+ mov ds,buffers
+ mov si,pointerback
+ call multiget
+ pop ds di bx
+ push di bx
+ mov al,pointerframe
+ add al,20
+ mov ah,0
+ call showframe
+ pop bx di
+ ret
+
+itsanobject: mov al,itemframe
+ mov ds,extras
+ cmp objecttype,4
+ jz itsfrominv
+ mov ds,freeframes
+itsfrominv: mov cl,al
+ add al,al
+ add al,cl
+ inc al
+ mov ah,0
+
+ push ax
+ add ax,ax
+ mov si,ax
+ add ax,ax
+ add si,ax
+ mov ax,2080
+ mov cx,[si]
+ cmp cl,12
+ jnc notsmallx2
+ mov cl,12
+notsmallx2: cmp ch,12
+ jnc notsmally2
+ mov ch,12
+notsmally2: mov pointerxs,cl
+ mov pointerys,ch
+ pop ax
+
+ push di bx
+ push ax bx di ds
+ mov al,cl
+ mov ah,0
+ shr ax,1
+ sub oldpointerx,ax
+ sub di,ax
+ mov al,ch
+ shr ax,1
+ sub oldpointery,ax
+ sub bx,ax
+ mov ds,buffers
+ mov si,pointerback
+ call multiget
+ pop ds di bx ax
+ mov ah,128
+ call showframe
+ pop bx di
+ mov ds,icons1
+ mov al,3
+ mov ah,128
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+Delpointer proc near
+
+ mov ax,oldpointerx
+ cmp ax,0ffffh
+ jz nevershown
+ mov delherex,ax
+ mov ax,oldpointery
+ mov delherey,ax
+ mov cl,pointerxs
+ mov delxs,cl
+ mov ch,pointerys
+ mov delys,ch
+ mov ds,buffers
+ mov si,pointerback
+ mov di,delherex
+ mov bx,delherey
+ call multiput
+nevershown: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Dumppointer proc near
+
+ call dumpblink
+ mov cl,delxs
+ mov ch,delys
+ mov di,delherex
+ mov bx,delherey
+ call multidump
+
+ mov bx,oldpointery
+ mov di,oldpointerx
+ cmp di,delherex
+ jnz difffound
+ cmp bx,delherey
+ jz notboth
+difffound: mov cl,pointerxs
+ mov ch,pointerys
+ call multidump
+notboth: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Undertextline proc near
+
+ mov di,textaddressx
+ mov bx,textaddressy
+ if foreign
+ sub bx,3
+ endif
+ mov ds,buffers
+ mov si,textunder
+ mov cl,undertextsizex
+ mov ch,undertextsizey
+ call multiget
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Deltextline proc near
+
+ mov di,textaddressx
+ mov bx,textaddressy
+ if foreign
+ sub bx,3
+ endif
+ mov ds,buffers
+ mov si,textunder
+ mov cl,undertextsizex
+ mov ch,undertextsizey
+ call multiput
+ ret
+
+ endp
+
+
+
+
+
+Dumptextline proc near
+
+ cmp newtextline,1
+ jnz nodumptextline
+ mov newtextline,0
+ mov di,textaddressx
+ mov bx,textaddressy
+ if foreign
+ sub bx,3
+ endif
+ mov cl,undertextsizex
+ mov ch,undertextsizey
+ call multidump
+nodumptextline: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Animpointer proc near
+
+ cmp pointermode,2
+ jz combathand
+ cmp pointermode,3
+ jz mousehand
+
+ cmp watchingtime,0
+ jz notwatchpoint
+ mov pointerframe,11
+ ret
+notwatchpoint: mov pointerframe,0
+ cmp inmaparea,0
+ jz gothand
+ cmp pointerfirstpath,0
+ jz gothand
+arrow: call getflagunderp
+ cmp cl,2
+ jc gothand
+ cmp cl,128
+ jnc gothand
+ mov pointerframe,3
+ test cl,4
+ jnz gothand
+ mov pointerframe,4
+ test cl,16
+ jnz gothand
+ mov pointerframe,5
+ test cl,2
+ jnz gothand
+ mov pointerframe,6
+ test cl,8
+ jnz gothand
+ mov pointerframe,8
+gothand: ret
+
+mousehand: cmp pointerspeed,0
+ jz rightspeed3
+ dec pointerspeed
+ jmp finflashmouse
+rightspeed3: mov pointerspeed,5
+ inc pointercount
+ cmp pointercount,16
+ jnz finflashmouse
+ mov pointercount,0
+finflashmouse: mov al,pointercount
+ mov ah,0
+ mov bx,offset cs:flashmousetab
+ add bx,ax
+ mov al,[cs:bx]
+ mov pointerframe,al
+ ret
+
+combathand: mov pointerframe,0
+ cmp reallocation,14
+ jnz notarrow
+ cmp commandtype,211
+ jnz notarrow
+ mov pointerframe,5
+notarrow: ret
+
+flashmousetab: db 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2
+
+ endp
+
+
+
+
+;------------------------------------------------Mouse and keyboard-readers----
+
+Setmouse proc near
+
+ if recording
+ mov recordpos,-8
+ mov dx,seg recname
+ mov ds,dx
+ mov dx,offset recname
+ mov cx,0
+ mov ah,3ch
+ mov al,2
+ int 21h
+ mov rechandle,ax
+ endif
+
+ if playback
+ mov dx,seg recname
+ mov ds,dx
+ mov dx,offset recname
+ mov ah,3dh
+ mov al,2
+ int 21h
+ mov rechandle,ax
+ call loadrec
+ endif
+
+ mov oldpointerx,0ffffh
+
+ mov ax,0
+ int 33h
+ mov ax,8
+ mov cx,15
+ mov dx,184
+ int 33h
+ mov ax,7
+ mov cx,15
+ mov dx,298*2
+ int 33h
+ ret
+
+ endp
+
+
+
+
+
+Readmouse proc near
+
+ mov ax,mousebutton
+ mov oldbutton,ax
+ mov ax,mousex
+ mov oldx,ax
+ mov ax,mousey
+ mov oldy,ax
+ call mousecall
+ mov mousex,cx
+ mov mousey,dx
+ mov mousebutton,bx
+ ret
+
+ endp
+
+
+
+
+
+
+
+Mousecall proc near
+
+ if playback
+ call playmouse
+ ret
+ endif
+
+ mov ax,3
+ int 33h
+ shr cx,1
+ cmp cx,298
+ jc notxover
+ mov cx,298
+notxover: cmp cx,15
+ jnc notxover2
+ mov cx,15
+notxover2: cmp dx,184
+ jc notyover
+ mov dx,184
+notyover: cmp dx,15
+ jnc notyover2
+ mov dx,15
+notyover2:
+ if recording
+ call recmouse
+ endif
+ ret
+
+ endp
+
+
+
+
+
+
+ if playback
+
+Playmouse proc near
+
+ mov es,recordspace
+ mov di,recordpos
+ cmp word ptr [es:di+6],0
+ jnz isthisplay
+ add di,8
+ add recordpos,8
+ cmp di,16384
+ jnz isthisplay
+ call loadrec
+isthisplay: mov cx,[es:di]
+ mov dx,[es:di+2]
+ mov bx,[es:di+4]
+ dec word ptr [es:di+6]
+ ret
+
+ endp
+
+ endif
+
+ if recording
+
+Recmouse proc near
+
+ mov es,recordspace
+ mov di,recordpos
+ cmp di,-8
+ jz diffrec
+ cmp [es:di],cx
+ jnz diffrec
+ cmp [es:di+2],dx
+ jnz diffrec
+ cmp [es:di+4],bx
+ jnz diffrec
+ inc word ptr [es:di+6]
+ cmp word ptr [es:di+5],0ffffh
+ jz diffrec
+ ret
+diffrec: add recordpos,8
+ add di,8
+ cmp di,16384
+ jnz notsaverec
+ push cx dx bx
+ call saverec
+ pop bx dx cx
+notsaverec: mov [es:di],cx
+ mov [es:di+2],dx
+ mov [es:di+4],bx
+ mov word ptr [es:di+6],1
+ ret
+
+ endp
+
+
+
+
+
+Saverec proc near
+
+ mov bx,rechandle
+ mov ds,recordspace
+ mov dx,0
+ mov cx,recordpos
+ add cx,8
+ mov ah,40h
+ int 21h
+ mov di,0
+ mov recordpos,0
+ ret
+
+ endp
+
+
+
+
+
+
+Loadrec proc near
+
+ mov bx,rechandle
+ mov ds,recordspace
+ mov dx,0
+ mov cx,16384+8
+ mov ah,3fh
+ int 21h
+ mov di,0
+ mov recordpos,0
+ ret
+
+ endp
+
+
+ endif
+
+
+
+
+
+
+
+Readmouse1 proc near
+
+ mov ax,mousex
+ mov oldx,ax
+ mov ax,mousey
+ mov oldy,ax
+ call mousecall
+ mov mousex,cx
+ mov mousey,dx
+ mov mousebutton1,bx
+ ret
+
+ endp
+
+
+
+Readmouse2 proc near
+
+ mov ax,mousex
+ mov oldx,ax
+ mov ax,mousey
+ mov oldy,ax
+ call mousecall
+ mov mousex,cx
+ mov mousey,dx
+ mov mousebutton2,bx
+ ret
+
+ endp
+
+
+Readmouse3 proc near
+
+ mov ax,mousex
+ mov oldx,ax
+ mov ax,mousey
+ mov oldy,ax
+ call mousecall
+ mov mousex,cx
+ mov mousey,dx
+ mov mousebutton3,bx
+ ret
+
+ endp
+
+
+
+
+
+
+Readmouse4 proc near
+
+ mov ax,mousebutton
+ mov oldbutton,ax
+ mov ax,mousex
+ mov oldx,ax
+ mov ax,mousey
+ mov oldy,ax
+ call mousecall
+ mov mousex,cx
+ mov mousey,dx
+ mov ax,mousebutton1
+ or ax,mousebutton2
+ or ax,mousebutton3
+ or bx,ax
+ mov mousebutton,bx
+ ret
+
+ endp
+
+
+
+
+
+Readkey proc near
+
+ mov bx,bufferout
+ cmp bx,bufferin
+ jz nokey
+ inc bx
+ and bx,15
+ mov bufferout,bx
+ mov di,offset cs:keybuffer
+ add di,bx
+ mov al,[cs:di]
+ mov currentkey,al
+ ret
+nokey: mov currentkey,0
+ ret
+
+
+ endp
+
+keybuffer: db 16 dup (0)
+
+
+
+Convertkey proc near
+
+ and al,127
+ mov ah,0
+ mov di,offset cs:keyconverttab
+ add di,ax
+ mov al,[cs:di]
+ ret
+
+keyconverttab: db 0,0,"1","2","3","4","5","6","7","8","9","0","-",0,8,0
+ db "Q","W","E","R","T","Y","U","I","O","P",0,0,13,0,"A","S"
+ db "D","F","G","H","J","K","L",0,0,0,0,0,"Z","X","C","V","B","N","M"
+ db 0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
+ endp
+
+
+
+
+;-------------------------------------------------------------Miscellaneous----
+
+Randomnum1 proc near
+
+ push ds es di bx cx
+ call randomnumber
+ pop cx bx di es ds
+ ret
+
+ endp
+
+
+
+
+
+Randomnum2 proc near
+
+ push ds es di bx ax
+ call randomnumber
+ mov cl,al
+ pop ax bx di es ds
+ ret
+
+ endp
+
+
+
+
+
+Randomnumber proc near
+
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+ mov al,seed
+ and al,48h
+ add al,38h
+ sal al,1
+ sal al,1
+ rcl seed+2,1
+ rcl seed+1,1
+ rcl seed+0,1
+
+ mov al,seed
+ ret
+
+ endp
+
+
+
+
+
+
+Hangon proc near
+
+hangonloop: push cx
+ call vsync
+ pop cx
+ loop hangonloop
+ ret
+
+ endp
+
+
+
+
+
+;-------------------------------------------------------------Disc handling----
+
+
+Loadtraveltext proc near
+
+ mov dx,offset cs:traveltextname
+ call standardload
+ mov traveltext,ax
+ ret
+
+ endp
+
+
+
+
+
+
+Loadintotemp proc near
+
+ push cs
+ pop ds
+ call standardload
+ mov tempgraphics,ax
+ ret
+
+ endp
+
+
+
+
+
+
+Loadintotemp2 proc near
+
+ push cs
+ pop ds
+ call standardload
+ mov tempgraphics2,ax
+ ret
+
+ endp
+
+
+
+
+Loadintotemp3 proc near
+
+ push cs
+ pop ds
+ call standardload
+ mov tempgraphics3,ax
+ ret
+
+ endp
+
+
+
+Loadtempcharset proc near
+
+ call standardload
+ mov tempcharset,ax
+ ret
+
+ endp
+
+
+
+
+
+
+Standardload proc near
+
+ call openfile
+ call readheader
+ mov bx,[es:di]
+ push bx
+ mov cl,4
+ shr bx,cl
+ call allocatemem
+ mov ds,ax
+ pop cx
+ push ax
+ mov dx,0
+ call readfromfile
+ call closefile
+ pop ax
+ ret
+
+ endp
+
+
+
+
+
+
+Loadtemptext proc near
+
+ call standardload
+ mov textfile1,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+Loadroom proc near
+
+ mov roomloaded,1
+ mov timecount,0
+ mov maintimer,0
+ mov mapoffsetx,104
+ mov mapoffsety,38
+ mov textaddressx,13
+ mov textaddressy,182
+ mov textlen,240
+ mov al,newlocation
+ mov location,al
+ call getroomdata
+ call startloading
+ call loadroomssample
+ call switchryanon
+ call drawflags
+ call getdimension
+ ret
+
+ endp
+
+
+
+
+Loadroomssample proc near
+
+ mov al,roomssample
+ cmp al,255
+ jz loadedalready
+ cmp al,currentsample
+ jz loadedalready
+ mov currentsample,al
+ mov al,currentsample
+ mov cl,"0"
+ call twodigitnum
+ mov di,offset cs:samplename
+ xchg al,ah
+ mov [cs:di+10],ax
+ mov dx,di
+ call loadsecondsample
+loadedalready: ret
+
+ endp
+
+
+
+
+
+Getridofreels proc near
+
+ cmp roomloaded,0
+ jz dontgetrid
+ mov es,reel1
+ call deallocatemem
+ mov es,reel2
+ call deallocatemem
+ mov es,reel3
+ call deallocatemem
+dontgetrid: ret
+
+ endp
+
+
+
+
+
+Getridofall proc near
+
+ mov es,backdrop
+ call deallocatemem
+ mov es,setframes
+ call deallocatemem
+ mov es,reel1
+ call deallocatemem
+ mov es,reel2
+ call deallocatemem
+ mov es,reel3
+ call deallocatemem
+ mov es,reels
+ call deallocatemem
+ mov es,people
+ call deallocatemem
+ mov es,setdesc
+ call deallocatemem
+ mov es,blockdesc
+ call deallocatemem
+ mov es,roomdesc
+ call deallocatemem
+ mov es,freeframes
+ call deallocatemem
+ mov es,freedesc
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+
+
+Restorereels proc near
+
+ cmp roomloaded,0
+ jz dontrestore
+ mov al,reallocation
+ call getroomdata
+ mov dx,bx
+ call openfile
+ call readheader
+
+ call dontloadseg
+ call dontloadseg
+ call dontloadseg
+ call dontloadseg
+
+ call allocateload
+ mov reel1,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call allocateload
+ mov reel2,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call allocateload
+ mov reel3,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call closefile
+dontrestore: ret
+
+ endp
+
+
+
+
+
+
+
+Restoreall proc near
+
+ mov al,location
+ call getroomdata
+ mov dx,bx
+ call openfile
+ call readheader
+
+ call allocateload
+ mov ds,ax
+ mov backdrop,ax
+ mov dx,flags
+ call loadseg
+
+ mov ds,workspace ;mapdata
+ mov dx,map
+ mov cx,132*66 ;maplen
+ mov al,0
+ call fillspace
+ call loadseg
+ call sortoutmap
+
+ call allocateload
+ mov setframes,ax
+ mov ds,ax
+ mov dx,framedata
+ call loadseg
+
+ ;mov ds,setdat
+ ;mov dx,0
+ ;mov cx,setdatlen
+ ;mov al,255
+ ;call fillspace
+ call dontloadseg
+
+ call allocateload
+ mov reel1,ax
+ mov ds,ax
+ mov dx,0
+ ;call bloc
+ ;BIG FIXME: undefined bloc, replaced with loadseg. dunno!
+ call loadseg
+ call allocateload
+ mov reel2,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call allocateload
+ mov reel3,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov reels,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov people,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov setdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov blockdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov roomdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov freeframes,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ ;mov ds,freedat
+ ;mov dx,0
+ ;mov cx,freedatlen
+ ;mov al,255
+ ;call fillspace
+ call dontloadseg
+
+ call allocateload
+ mov freedesc,ax
+ mov ds,ax
+ mov dx,freetextdat
+ call loadseg
+
+ call closefile
+
+ call setallchanges
+ ret
+
+ endp
+
+
+
+Sortoutmap proc near
+
+ push es di
+ mov ds,workspace
+ mov si,0
+ mov es,mapdata
+ mov di,0
+
+ mov cx,maplength
+blimey: push cx si
+ mov cx,mapwidth
+ rep movsb
+ pop si cx
+ add si,132
+ loop blimey
+ pop di es
+ ret
+
+ endp
+
+
+
+
+Startloading proc near
+
+ mov combatcount,0
+ mov al,[cs:bx+13]
+ mov roomssample,al
+ mov al,[cs:bx+15]
+ mov mapx,al
+ mov al,[cs:bx+16]
+ mov mapy,al
+
+ mov al,[cs:bx+20] ; start path pos
+ mov liftflag,al
+ mov al,[cs:bx+21] ; start path pos
+ mov manspath,al
+ mov destination,al
+ mov finaldest,al
+ mov al,[cs:bx+22]
+ mov facing,al
+ mov turntoface,al
+ mov al,[cs:bx+23]
+ mov counttoopen,al
+ mov al,[cs:bx+24]
+ mov liftpath,al
+ mov al,[cs:bx+25]
+ mov doorpath,al
+ mov lastweapon,-1
+ mov al,[cs:bx+27]
+ push ax
+
+ mov al,[cs:bx+31]
+ mov ah,reallocation
+ mov reallocation,al
+
+ mov dx,bx
+ call openfile
+ call readheader
+
+ call allocateload
+ mov ds,ax
+ mov backdrop,ax
+ mov dx,flags
+ call loadseg
+
+ mov ds,workspace ;mapdata
+ mov dx,map
+ mov cx,132*66 ;maplen
+ mov al,0
+ call fillspace
+ call loadseg
+ call sortoutmap
+
+ call allocateload
+ mov setframes,ax
+ mov ds,ax
+ mov dx,framedata
+ call loadseg
+
+ mov ds,setdat
+ mov dx,0
+ mov cx,setdatlen
+ mov al,255
+ call fillspace
+ call loadseg
+
+ call allocateload
+ mov reel1,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call allocateload
+ mov reel2,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+ call allocateload
+ mov reel3,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov reels,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov people,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov setdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov blockdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov roomdesc,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ call allocateload
+ mov freeframes,ax
+ mov ds,ax
+ mov dx,0
+ call loadseg
+
+ mov ds,freedat
+ mov dx,0
+ mov cx,freedatlen
+ mov al,255
+ call fillspace
+ call loadseg
+
+ call allocateload
+ mov freedesc,ax
+ mov ds,ax
+ mov dx,freetextdat
+ call loadseg
+
+ call closefile
+
+
+ call findroominloc
+ call deletetaken
+ call setallchanges
+ call autoappear
+ mov al,newlocation
+ call getroomdata
+ mov lastweapon,-1
+ mov mandead,0
+ mov lookcounter,160
+ mov newlocation,255
+ mov linepointer,254
+ pop ax
+ cmp al,255
+ jz dontwalkin
+ mov manspath,al
+ push bx
+ call autosetwalk
+ pop bx
+dontwalkin: call findxyfrompath
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Disablepath proc near ;needs al,ah map x,y cl=path
+
+ push cx
+ xchg al,ah
+ mov cx,-6
+looky2: add cx,6
+ sub al,10
+ jnc looky2
+ mov al,ah
+ dec cx
+lookx2: inc cx
+ sub al,11
+ jnc lookx2
+ mov al,cl
+ mov ah,0
+ mov cx,144
+ mul cx
+ mov es,reels
+ mov bx,pathdata
+ add bx,ax
+ pop ax
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,0
+ mov [es:bx+6],al
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Findxyfrompath proc near ;path number was found from
+ ;room data. Fill ryanxy from
+ call getroomspaths ;the pathdata.
+ mov al,manspath
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov ax,[es:bx]
+ sub al,12
+ sub ah,12
+ mov ryanx,al
+ mov ryany,ah
+ ret
+
+ endp
+
+
+
+
+
+Findroominloc proc near
+
+ mov al,mapy
+ mov cx,-6
+looky: add cx,6
+ sub al,10
+ jnc looky
+ mov al,mapx
+ dec cx
+lookx: inc cx
+ sub al,11
+ jnc lookx
+ mov roomnum,cl
+ ret
+
+ endp
+
+
+
+
+
+
+Getroomdata proc near
+
+ mov ah,0
+ mov cx,32
+ mul cx
+ mov bx,offset cs:roomdata
+ add bx,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+Readheader proc near
+
+ push cs
+ pop ds
+ mov dx,offset cs:fileheader
+ mov cx,headerlen
+ call readfromfile
+ push cs
+ pop es
+ mov di,offset cs:filedata
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Dontloadseg proc neqr
+
+ mov ax,[es:di]
+ add di,2
+ push bx di es
+ mov cx,0
+ mov dx,ax
+ mov al,1
+ mov ah,42h
+ int 21h
+ pop es di bx
+ ret
+
+ endp
+
+
+
+
+
+
+Allocateload proc near
+
+ push es di
+ mov bx,[es:di]
+ mov cl,4
+ shr bx,cl
+ call allocatemem
+ pop di es
+ ret
+
+ endp
+
+
+
+
+Fillspace proc near
+
+ push es ds dx di bx
+ mov di,dx
+ push ds
+ pop es
+ rep stosb
+ pop bx di dx ds es
+ ret
+
+ endp
+
+
+
+
+
+
+
+Getridoftemp proc near
+
+ mov es,tempgraphics
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+
+
+Getridoftemptext proc near
+
+ mov es,textfile1
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+
+
+Getridoftemp2 proc near
+
+ mov es,tempgraphics2
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+Getridoftemp3 proc near
+
+ mov es,tempgraphics3
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+Getridoftempcharset proc near
+
+ mov es,tempcharset
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+Getridoftempsp proc near
+
+ mov es,tempsprites
+ call deallocatemem
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Readsetdata proc near
+
+ mov dx,offset cs:characterset1
+ call standardload
+ mov charset1,ax
+
+ mov dx,offset cs:icongraphics0
+ call standardload
+ mov icons1,ax
+
+ mov dx,offset cs:icongraphics1
+ call standardload
+ mov icons2,ax
+
+ mov dx,offset cs:spritename1
+ call standardload
+ mov mainsprites,ax
+
+ mov dx,offset cs:puzzletextname
+ call standardload
+ mov puzzletext,ax
+
+ mov dx,offset cs:commandtextname
+ call standardload
+ mov commandtext,ax
+
+ mov ax,charset1
+ mov currentset,ax
+
+ cmp soundint,255
+ jz novolumeload
+ mov dx,offset cs:volumetabname
+ call openfile
+ mov cx,2048-256
+ mov ds,soundbuffer
+ mov dx,16384
+ call readfromfile
+ call closefile
+novolumeload: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Createfile proc near
+
+ mov ah,3ch
+ mov cx,0
+ int 21h
+ mov bx,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+Openfile proc near
+
+ if cd
+ call makename
+ endif
+ push cs
+ pop ds
+ mov ah,3dh
+ mov al,2
+ push dx
+ int 21h
+ pop dx
+ jc fileerror
+ mov handle,ax
+ ret
+fileerror: mov gameerror,8
+ jmp quickquit2
+
+ endp
+
+
+ if cd
+Openfilefromc proc near
+
+ push cs
+ pop ds
+ mov ah,3dh
+ mov al,2
+ push dx
+ int 21h
+ pop dx
+ mov handle,ax
+ ret
+
+ endp
+ endif
+
+
+ if cd
+Makename proc near
+
+ if demo
+ ret
+ endif
+ mov si,dx
+ mov di,offset cs:place
+transfer: mov al,[cs:si]
+ mov [cs:di],al
+ inc si
+ inc di
+ cmp al,0
+ jnz transfer
+ mov dx,offset cs:id
+ ret
+id: db "D:\"
+place: db 30 dup (0)
+
+ endp
+ endif
+
+
+
+
+
+Openfilenocheck proc near
+
+ if cd
+ call makename
+ endif
+ push cs
+ pop ds
+ mov ah,3dh
+ mov al,2
+ int 21h
+ mov handle,ax
+ ret
+
+ endp
+
+
+
+Openforsave proc near
+
+ mov cx,0
+ mov ah,3ch
+ mov al,2
+ int 21h
+ mov handle,ax
+ ret
+
+ endp
+
+
+
+Closefile proc near
+
+ mov bx,handle
+ mov ah,3eh
+ int 21h
+ ret
+
+ endp
+
+
+
+
+Readfromfile proc near
+
+ mov bx,handle
+ mov ah,3fh
+ int 21h
+ ret
+
+ endp
+
+
+
+
+Setkeyboardint proc near
+
+ mov ah,35h
+ mov al,9
+ int 21h
+ mov oldint9seg,es ; Save es:bx to temp memory
+ mov oldint9add,bx
+ push cs
+ pop ds
+ mov dx,offset cs:keyboardread
+ mov ah,25h
+ mov al,9
+ int 21h ; Set to new
+ ret
+
+ endp
+
+
+
+
+Resetkeyboard proc near
+
+ cmp oldint9add,-1
+ jz noreset
+ mov dx,oldint9add ;Restore old interupt vector
+ mov ax,oldint9seg ;for keys
+ mov ds,ax
+ mov ah,25h
+ mov al,9
+ int 21h
+noreset: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Keyboardread proc near
+
+ push ax dx di ds es
+ in al,60h
+ cmp al,lasthardkey
+ jz same
+ mov lasthardkey,al
+ cmp al,128
+ jnc same
+ mov dx,bufferin
+ inc dx
+ and dx,15
+ cmp dx,bufferout
+ jz same ;buffer is full
+ mov bufferin,dx
+ call convertkey
+ mov di,offset cs:keybuffer
+ mov dx,bufferin
+ add di,dx
+ mov [cs:di],al
+same: in al,61h
+ mov ah,al
+ or al,80h ; Mask for Akn
+ out 61h,al ; Set Akn.
+ and al,7fh
+ out 61h,al
+ cli
+ mov al,20h ; 8259 end of interrupt
+ out 20h,al
+ pop es ds di dx ax
+ iret
+
+ endp
+
+
+
+;------------------------------------------------------Text and tables data----
+
+
+
+Fileheader db "DREAMWEB DATA FILE "
+ db "COPYRIGHT 1992 "
+ db "CREATIVE REALITY"
+Filedata dw 20 dup (0)
+Extradata db 6 dup (0)
+Headerlen equ $-Fileheader
+
+
+Roomdata db "DREAMWEB.R00",0 ;Ryan's apartment
+ db 5,255,33,10
+ db 255,255,255,0
+ db 1,6,2,255,3,255,255,255,255,255,0
+
+ db "DREAMWEB.R01",0
+ db 1,255,44,10
+ db 255,255,255,0
+ db 7,2,255,255,255,255,6,255,255,255,1
+
+ db "DREAMWEB.R02",0
+ db 2,255,33,0
+ db 255,255,255,0
+ db 1,0,255,255,1,255,3,255,255,255,2
+
+ db "DREAMWEB.R03",0
+ db 5,255,33,10
+ db 255,255,255,0
+ db 2,2,0,2,4,255,0,255,255,255,3
+
+ db "DREAMWEB.R04",0
+ db 23,255,11,30
+ db 255,255,255,0
+ db 1,4,0,5,255,255,3,255,255,255,4
+
+ db "DREAMWEB.R05",0
+ if demo
+ db 22,255,22,30
+ else
+ db 5,255,22,30
+ endif
+ db 255,255,255,0
+ db 1,2,0,4,255,255,3,255,255,255,5
+
+ db "DREAMWEB.R06",0
+ db 5,255,11,30
+ db 255,255,255,0
+ db 1,0,0,1,2,255,0,255,255,255,6
+
+ db "DREAMWEB.R07",0
+ db 255,255,0,20
+ db 255,255,255,0
+ db 2,2,255,255,255,255,0,255,255,255,7
+
+ db "DREAMWEB.R08",0
+ db 8,255,0,10
+ db 255,255,255,0
+ db 1,2,255,255,255,255,0,11,40,0,8
+
+ db "DREAMWEB.R09",0
+ db 9,255,22,10
+ db 255,255,255,0
+ db 4,6,255,255,255,255,0,255,255,255,9
+
+ db "DREAMWEB.R10",0
+ db 10,255,33,30
+ db 255,255,255,0
+ db 2,0,255,255,2,2,4,22,30,255,10 ;22,30,0 switches
+ ;off path 0 in skip
+ db "DREAMWEB.R11",0
+ db 11,255,11,20
+ db 255,255,255,0
+ db 0,4,255,255,255,255,255,255,255,255,11
+
+ db "DREAMWEB.R12",0
+ db 12,255,22,20
+ db 255,255,255,0
+ db 1,4,255,255,255,255,255,255,255,255,12
+
+ db "DREAMWEB.R13",0
+ db 12,255,22,20
+ db 255,255,255,0
+ db 1,4,255,255,255,255,255,255,255,255,13
+
+ db "DREAMWEB.R14",0
+ db 14,255,44,20
+ db 255,255,255,0
+ db 0,6,255,255,255,255,255,255,255,255,14
+
+ db 32 dup (0)
+ db 32 dup (0)
+ db 32 dup (0)
+ db 32 dup (0)
+
+ db "DREAMWEB.R19",0
+ db 19,255,0,0
+ db 255,255,255,0
+ db 0,4,255,255,255,255,255,255,255,255,19
+
+ db "DREAMWEB.R20",0
+ db 22,255,0,20
+ db 255,255,255,0
+ db 1,4,2,15,255,255,255,255,255,255,20
+
+ db "DREAMWEB.R21",0
+ if demo
+ db 22,255,11,10
+ else
+ db 5,255,11,10
+ endif
+ db 255,255,255,0
+ db 1,4,2,15,1,255,255,255,255,255,21
+
+ db "DREAMWEB.R22",0
+ db 22,255,22,10
+ db 255,255,255,0
+ db 0,4,255,255,1,255,255,255,255,255,22
+
+ db "DREAMWEB.R23",0
+ db 23,255,22,30
+ db 255,255,255,0
+ db 1,4,2,15,3,255,255,255,255,255,23
+
+ db "DREAMWEB.R24",0
+ db 5,255,44,0
+ db 255,255,255,0
+ db 1,6,2,15,255,255,255,255,255,255,24
+
+ db "DREAMWEB.R25",0
+ db 22,255,11,40
+ db 255,255,255,0
+ db 1,0,255,255,255,255,255,255,255,255,25
+
+ db "DREAMWEB.R26",0
+ db 9,255,22,20
+ db 255,255,255,0
+ db 4,2,255,255,255,255,255,255,255,255,26
+
+ db "DREAMWEB.R27",0
+ db 22,255,11,20
+ db 255,255,255,0
+ db 0,6,255,255,255,255,255,255,255,255,27
+
+ db "DREAMWEB.R28",0
+ db 5,255,11,30
+ db 255,255,255,0
+ db 0,0,255,255,2,255,255,255,255,255,28
+
+ db "DREAMWEB.R29",0
+ db 22,255,11,10
+ db 255,255,255,0
+ db 0,2,255,255,255,255,255,255,255,255,29
+
+
+
+ db "DREAMWEB.R05",0 ;Duplicate of hotel lobby,
+ if demo
+ db 22,255,22,10 ;but emerging from the lift.
+ else
+ db 5,255,22,10
+ endif
+ db 255,255,255,0
+ db 1,4,1,15,255,255,255,255,255,255,5
+
+ db "DREAMWEB.R04",0 ;Duplicate of pool hall lobby,
+ db 23,255,22,20 ;but emerging from the lift.
+ db 255,255,255,0
+ db 1,4,2,15,255,255,255,255,255,255,4
+
+ db "DREAMWEB.R10",0 ;entering alley via skip
+ db 10,255,22,30
+ db 255,255,255,0
+ db 3,6,255,255,255,255,255,255,255,255,10
+
+ db "DREAMWEB.R12",0 ;on the beach, getting up.
+ db 12,255,22,20
+ db 255,255,255,0
+ db 0,2,255,255,255,255,255,255,255,255,12
+
+ db "DREAMWEB.R03",0 ;Duplicate of Eden's lobby
+ db 5,255,44,0 ;but emerging from the lift
+ db 255,255,255,0
+ db 1,6,2,255,4,255,255,255,255,255,3
+
+ db "DREAMWEB.R24",0 ;Duplicate of Eden's flat
+ db 5,255,22,0 ;but starting on the bed
+ db 255,255,255,0
+ db 3,6,0,255,255,255,255,33,0,3,24 ; 33,0,3 turns off
+ ; path for lift
+ db "DREAMWEB.R22",0 ;Duplicate
+ db 22,255,22,20 ;of hotel but in pool room
+ db 255,255,255,0
+ db 1,4,255,255,255,255,255,255,255,255,22
+
+ db "DREAMWEB.R22",0 ;Duplicate
+ db 22,255,22,20 ;of hotel but in pool room
+ db 255,255,255,0 ;coming out of bedroom
+ db 0,2,255,255,255,255,255,255,255,255,22
+
+ db "DREAMWEB.R11",0 ;Duplicate
+ db 11,255,22,30 ;of carpark but getting
+ db 255,255,255,0 ;up off the floor
+ db 0,0,255,255,255,255,255,255,255,255,11
+
+ db "DREAMWEB.R28",0
+ db 5,255,11,20
+ db 255,255,255,0
+ db 0,6,255,255,2,255,255,255,255,255,28
+
+ db "DREAMWEB.R21",0
+ if demo
+ db 22,255,11,10
+ else
+ db 5,255,11,10
+ endif
+ db 255,255,255,0
+ db 1,4,2,15,1,255,255,255,255,255,21
+
+ db "DREAMWEB.R26",0
+ db 9,255,0,40
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,26
+
+ db "DREAMWEB.R19",0
+ db 19,255,0,0
+ db 255,255,255,0
+ db 2,2,255,255,255,255,255,255,255,255,19
+
+ db "DREAMWEB.R08",0 ;leaving tvstudio into street
+ db 8,255,11,40
+ db 255,255,255,0
+ db 0,4,255,255,255,255,255,255,255,255,8
+
+ db "DREAMWEB.R01",0
+ db 1,255,44,10
+ db 255,255,255,0
+ db 3,6,255,255,255,255,255,255,255,255,1
+
+
+
+ db "DREAMWEB.R45",0 ;Dream room
+ db 35,255,22,30
+ db 255,255,255,0
+ db 0,6,255,255,255,255,255,255,255,255,45
+
+ db "DREAMWEB.R46",0 ;Dream room
+ db 35,255,22,40
+ db 255,255,255,0
+ db 0,4,255,255,255,255,255,255,255,255,46
+
+ db "DREAMWEB.R47",0 ;Dream room
+ db 35,255,0,0
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,47
+
+ db "DREAMWEB.R45",0 ;Dream room
+ db 35,255,22,30
+ db 255,255,255,0
+ db 4,0,255,255,255,255,255,255,255,255,45
+
+ db "DREAMWEB.R46",0 ;Dream room
+ db 35,255,22,50
+ db 255,255,255,0
+ db 0,4,255,255,255,255,255,255,255,255,46
+
+
+
+ db "DREAMWEB.R50",0 ; Intro sequence one
+ db 35,255,22,30
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,50
+
+ db "DREAMWEB.R51",0 ; Intro sequence two
+ db 35,255,11,30
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,51
+
+ db "DREAMWEB.R52",0 ; Intro sequence three
+ db 35,255,22,30
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,52
+
+ db "DREAMWEB.R53",0 ; Intro sequence four
+ db 35,255,33,0
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,53
+
+ db "DREAMWEB.R54",0 ; Intro sequence five - wasteland
+ db 35,255,0,0
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,54
+
+ db "DREAMWEB.R55",0 ; End sequence
+ db 14,255,44,0
+ db 255,255,255,0
+ db 0,0,255,255,255,255,255,255,255,255,55
+
+
+Madeuproomdat db 32 dup (0)
+
+Roomscango db 1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0
+
+Roompics db 5,0,3,2,4,1,10,9,8,6,11,4,7,7,0
+
+Oplist db 3 dup (0)
+
+Inputline db 128 dup (0)
+
+linedata dw 200 dup (0ffffh)
+
+presslist db 6 dup (255)
+
+savenames db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+ db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+
+
+
+savefiles db "DREAMWEB.D00",0
+ db "DREAMWEB.D01",0
+ db "DREAMWEB.D02",0
+ db "DREAMWEB.D03",0
+ db "DREAMWEB.D04",0
+ db "DREAMWEB.D05",0
+ db "DREAMWEB.D06",0
+
+Recname db "DREAMWEB.DEM",0
+
+
+;-------------------------------------------------------End of code segment----
+
+DREAMWEBPROG ends
+
+
+
+
+;---------------------------------------------------------------Stack space----s
+
+STACKSPACE segment para stack 'STACK'
+
+stak db 256 dup (?)
+
+STACKSPACE ends
+
+
+
+;-----------------------------------------------------------End of all code----
+
+ end Dreamweb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/keypad.asm b/devtools/tasmrecover/dreamweb/keypad.asm
new file mode 100644
index 0000000000..9ddce697f2
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/keypad.asm
@@ -0,0 +1,1758 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Entercode proc near
+
+ mov keypadax,ax
+ mov keypadcx,cx
+ call getridofreels
+ call loadkeypad
+ call createpanel
+ call showicon
+ call showouterpad
+ call showkeypad
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov presspointer,0
+ mov getback,0
+
+keypadloop: call delpointer
+ call readmouse
+ call showkeypad
+ call showpointer
+ cmp presscount,0
+ jz nopresses
+ dec presscount
+ jmp afterpress
+nopresses: mov pressed,255
+ mov graphicpress,255
+ call vsync
+
+afterpress: call dumppointer
+ call dumpkeypad
+ call dumptextline
+ mov bx,offset cs:keypadlist
+ call checkcoords
+ cmp getback,1
+ jz numberright
+
+ cmp lightcount,1
+ jnz notendkey
+ cmp lockstatus,0
+ jz numberright
+ jmp keypadloop
+
+notendkey: cmp presscount,40
+ jnz keypadloop
+ call addtopresslist
+ cmp pressed,11
+ jnz keypadloop
+ mov ax,keypadax
+ mov cx,keypadcx
+ call isitright
+ jnz incorrect
+ mov lockstatus,0
+ mov al,11
+ call playchannel1
+ mov lightcount,120
+ mov presspointer,0
+ jmp keypadloop
+incorrect: mov al,11
+ call playchannel1
+ mov lightcount,120
+ mov presspointer,0
+ jmp keypadloop
+
+numberright: mov manisoffscreen,0
+ call getridoftemp
+ call restorereels
+ call redrawmainscrn
+ call worktoscreenm
+ ret
+
+keypadlist: dw keypadx+9,keypadx+30,keypady+9,keypady+22,buttonone
+ dw keypadx+31,keypadx+52,keypady+9,keypady+22,buttontwo
+ dw keypadx+53,keypadx+74,keypady+9,keypady+22,buttonthree
+ dw keypadx+9,keypadx+30,keypady+23,keypady+40,buttonfour
+ dw keypadx+31,keypadx+52,keypady+23,keypady+40,buttonfive
+ dw keypadx+53,keypadx+74,keypady+23,keypady+40,buttonsix
+ dw keypadx+9,keypadx+30,keypady+41,keypady+58,buttonseven
+ dw keypadx+31,keypadx+52,keypady+41,keypady+58,buttoneight
+ dw keypadx+53,keypadx+74,keypady+41,keypady+58,buttonnine
+ dw keypadx+9,keypadx+30,keypady+59,keypady+73,buttonnought
+ dw keypadx+31,keypadx+74,keypady+59,keypady+73,buttonenter
+ dw keypadx+72,keypadx+86,keypady+80,keypady+94,quitkey
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+
+Loadkeypad proc near
+
+ mov dx,offset cs:extragraphics1
+ call loadintotemp
+ ret
+
+ endp
+
+
+
+
+Quitkey proc near
+
+ cmp commandtype,222
+ jz alreadyqk
+ mov commandtype,222
+ mov al,4
+ call commandonly
+alreadyqk: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notqk
+ and ax,1
+ jnz doqk
+notqk: ret
+
+doqk: mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Addtopresslist proc near
+
+ cmp presspointer,5
+ jz nomorekeys
+ mov al,pressed
+ cmp al,10
+ jnz not10
+ mov al,0
+not10: mov bx,presspointer
+ mov dx,seg presslist
+ mov es,dx
+ add bx,offset es:presslist
+ mov [es:bx],al
+ inc presspointer
+nomorekeys: ret
+
+ endp
+
+
+
+
+Buttonone proc near
+
+ mov cl,1
+ call buttonpress
+ ret
+
+ endp
+
+
+Buttontwo proc near
+
+ mov cl,2
+ call buttonpress
+ ret
+
+ endp
+
+
+
+Buttonthree proc near
+
+ mov cl,3
+ call buttonpress
+ ret
+
+ endp
+
+
+
+Buttonfour proc near
+
+ mov cl,4
+ call buttonpress
+ ret
+
+ endp
+
+
+Buttonfive proc near
+
+ mov cl,5
+ call buttonpress
+ ret
+
+ endp
+
+
+
+Buttonsix proc near
+
+ mov cl,6
+ call buttonpress
+ ret
+
+ endp
+
+
+Buttonseven proc near
+
+ mov cl,7
+ call buttonpress
+ ret
+
+ endp
+
+
+Buttoneight proc near
+
+ mov cl,8
+ call buttonpress
+ ret
+
+ endp
+
+Buttonnine proc near
+
+ mov cl,9
+ call buttonpress
+ ret
+
+ endp
+
+
+
+Buttonnought proc near
+
+ mov cl,10
+ call buttonpress
+ ret
+
+ endp
+
+
+
+
+
+
+Buttonenter proc near
+
+ mov cl,11
+ call buttonpress
+ ret
+
+ endp
+
+
+
+Buttonpress proc near
+
+ mov ch,cl
+ add ch,100
+ cmp commandtype,ch
+ jz alreadyb
+ mov commandtype,ch
+ mov al,cl
+ add al,4
+ push cx
+ call commandonly
+ pop cx
+alreadyb: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notb
+ and ax,1
+ jnz dob
+notb: ret
+
+dob: mov pressed,cl
+ add cl,21
+ mov graphicpress,cl
+ mov presscount,40
+ cmp cl,32
+ jz nonoise
+ mov al,10
+ call playchannel1
+nonoise: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showouterpad proc near
+
+ mov di,keypadx-3
+ mov bx,keypady-4
+ mov ds,tempgraphics
+ mov al,1
+ mov ah,0
+ call showframe
+ mov di,keypadx+74
+ mov bx,keypady+76
+ mov ds,tempgraphics
+ mov al,37
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Showkeypad proc near
+
+ mov al,22
+ mov di,keypadx+9
+ mov bx,keypady+5
+ call singlekey
+ mov al,23
+ mov di,keypadx+31
+ mov bx,keypady+5
+ call singlekey
+ mov al,24
+ mov di,keypadx+53
+ mov bx,keypady+5
+ call singlekey
+
+ mov al,25
+ mov di,keypadx+9
+ mov bx,keypady+23
+ call singlekey
+ mov al,26
+ mov di,keypadx+31
+ mov bx,keypady+23
+ call singlekey
+ mov al,27
+ mov di,keypadx+53
+ mov bx,keypady+23
+ call singlekey
+
+ mov al,28
+ mov di,keypadx+9
+ mov bx,keypady+41
+ call singlekey
+ mov al,29
+ mov di,keypadx+31
+ mov bx,keypady+41
+ call singlekey
+ mov al,30
+ mov di,keypadx+53
+ mov bx,keypady+41
+ call singlekey
+
+ mov al,31
+ mov di,keypadx+9
+ mov bx,keypady+59
+ call singlekey
+ mov al,32
+ mov di,keypadx+31
+ mov bx,keypady+59
+ call singlekey
+
+ cmp lightcount,0
+ jz notenter
+ dec lightcount
+ mov al,36
+ mov bx,keypady-1+63
+ cmp lockstatus,0
+ jnz changelight
+ mov al,41
+ mov bx,keypady+4+63
+changelight: cmp lightcount,60
+ jc gotlight
+ cmp lightcount,100
+ jnc gotlight
+ dec al
+gotlight: mov ds,tempgraphics
+ mov ah,0
+ mov di,keypadx+60
+ call showframe
+
+notenter: ret
+
+ endp
+
+
+
+
+
+Singlekey proc near
+
+ cmp graphicpress,al
+ jnz gotkey
+ add al,11
+ cmp presscount,8
+ jnc gotkey
+ sub al,11
+; cmp presscount,10
+; jnc gotkey
+; sub al,11
+gotkey: mov ds,tempgraphics
+ sub al,20
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Dumpkeypad proc near
+
+ mov di,keypadx-3
+ mov bx,keypady-4
+ mov cl,120
+ mov ch,90
+ call multidump
+ ret
+
+ endp
+
+
+
+
+
+;---------------------------------
+
+
+
+
+Usemenu proc near
+
+ call getridofreels
+ call loadmenu
+ call createpanel
+ call showpanel
+ call showicon
+ mov newobs,0
+ call drawfloor
+ call printsprites
+
+ mov al,4
+ mov ah,0
+ mov di,menux-48
+ mov bx,menuy-4
+ mov ds,tempgraphics2
+ call showframe
+ call getundermenu
+ mov al,5
+ mov ah,0
+ mov di,menux+54
+ mov bx,menuy+72
+ mov ds,tempgraphics2
+ call showframe
+
+
+ call worktoscreenm
+ mov getback,0
+
+menuloop: call delpointer
+ call putundermenu
+ call showmenu
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumpmenu
+ call dumptextline
+ mov bx,offset cs:menulist
+ call checkcoords
+ cmp getback,1
+ jnz menuloop
+
+ mov manisoffscreen,0
+ call redrawmainscrn
+ call getridoftemp
+ call getridoftemp2
+ call restorereels
+ call worktoscreenm
+ ret
+
+menulist: dw menux+54,menux+68,menuy+72,menuy+88,quitkey
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ ret
+
+ endp
+
+
+
+
+
+
+
+Dumpmenu proc near
+
+ mov di,menux
+ mov bx,menuy
+ mov cl,48
+ mov ch,48
+ call multidump
+ ret
+
+ endp
+
+
+
+
+
+
+Getundermenu proc near
+
+ mov di,menux
+ mov bx,menuy
+ mov cl,48
+ mov ch,48
+ mov ds,buffers
+ mov si,undertimedtext
+ call multiget
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Putundermenu proc near
+
+ mov di,menux
+ mov bx,menuy
+ mov cl,48
+ mov ch,48
+ mov ds,buffers
+ mov si,undertimedtext
+ call multiput
+ ret
+
+ endp
+
+
+
+Showoutermenu proc near
+
+ mov al,40
+ mov ah,0
+ mov di,menux-34
+ mov bx,menuy-40
+ mov ds,tempgraphics
+ call showframe
+ mov al,41
+ mov ah,0
+ mov di,menux+64-34
+ mov bx,menuy-40
+ mov ds,tempgraphics
+ call showframe
+ mov al,42
+ mov ah,0
+ mov di,menux-26
+ mov bx,menuy+57-40
+ mov ds,tempgraphics
+ call showframe
+ mov al,43
+ mov ah,0
+ mov di,menux+64-26
+ mov bx,menuy+57-40
+ mov ds,tempgraphics
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Showmenu proc near
+
+ inc menucount
+ cmp menucount,37*2
+ jnz menuframeok
+ mov menucount,0
+menuframeok: mov al,menucount
+ shr al,1
+ mov ah,0
+ mov di,menux
+ mov bx,menuy
+ mov ds,tempgraphics
+ call showframe
+ ret
+
+ endp
+
+
+
+Loadmenu proc near
+
+ mov dx,offset cs:spritename3
+ call loadintotemp
+ mov dx,offset cs:mongraphics2
+ call loadintotemp2
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Viewfolder proc near
+
+ mov manisoffscreen,1
+ call getridofall
+ call loadfolder
+ mov folderpage,0
+ call showfolder
+ call worktoscreenm
+ mov getback,0
+
+folderloop: call delpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ mov bx,offset cs:folderlist
+ call checkcoords
+ cmp getback,0
+ jz folderloop
+
+ mov manisoffscreen,0
+ call getridoftemp
+ call getridoftemp2
+ call getridoftemp3
+ call getridoftempcharset
+ call restoreall
+ call redrawmainscrn
+ call worktoscreenm
+ ret
+
+folderlist: dw 280,320,160,200,quitkey
+ dw 143,300,6,194,nextfolder
+ dw 0,143,6,194,lastfolder
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+Nextfolder proc near
+
+ cmp folderpage,12
+ jnz cannextf
+ call blank
+ ret
+cannextf: cmp commandtype,201
+ jz alreadynextf
+ mov commandtype,201
+ mov al,16
+ call commandonly
+alreadynextf: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notnextf
+ cmp ax,1
+ jz donextf
+notnextf: ret
+donextf: inc folderpage
+ call folderhints
+ call delpointer
+ call showfolder
+ mov mousebutton,0
+ mov bx,offset cs:folderlist
+ call checkcoords
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+Folderhints proc near
+
+ cmp folderpage,5
+ jnz notaideadd
+ cmp aidedead,1
+ jz notaideadd
+ mov al,13
+ call getlocation
+ cmp al,1
+ jz notaideadd
+ mov al,13
+ call setlocation
+ call showfolder
+ mov al,30
+ call findtext1
+ mov di,0
+ mov bx,86
+ mov dl,141
+ mov ah,16
+ call printdirect
+ call worktoscreenm
+ mov cx,200
+ call hangonp
+ ret
+
+notaideadd: cmp folderpage,9
+ jnz notaristoadd
+ mov al,7
+ call getlocation
+ cmp al,1
+ jz notaristoadd
+ mov al,7
+ call setlocation
+ call showfolder
+ mov al,31
+ call findtext1
+ mov di,0
+ mov bx,86
+ mov dl,141
+ mov ah,16
+ call printdirect
+ call worktoscreenm
+ mov cx,200
+ call hangonp
+notaristoadd: ret
+
+ endp
+
+
+
+Lastfolder proc near
+
+ cmp folderpage,0
+ jnz canlastf
+ call blank
+ ret
+canlastf: cmp commandtype,202
+ jz alreadylastf
+ mov commandtype,202
+ mov al,17
+ call commandonly
+alreadylastf: cmp folderpage,0
+ jz notlastf
+ mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notlastf
+ cmp ax,1
+ jz dolastf
+notlastf: ret
+dolastf: dec folderpage
+ call delpointer
+ call showfolder
+ mov mousebutton,0
+ mov bx,offset cs:folderlist
+ call checkcoords
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+Loadfolder proc near
+
+ mov dx,offset cs:foldergraphic1
+ call loadintotemp
+ mov dx,offset cs:foldergraphic2
+ call loadintotemp2
+ mov dx,offset cs:foldergraphic3
+ call loadintotemp3
+ mov dx,offset cs:characterset3
+ call loadtempcharset
+ mov dx,offset cs:foldertext
+ call loadtemptext
+ ret
+
+ endp
+
+
+
+
+Showfolder proc near
+
+ mov commandtype,255
+ cmp folderpage,0
+ jz closedfolder
+ call usetempcharset
+ call createpanel2
+ mov ds,tempgraphics
+ mov di,0
+ mov bx,0
+ mov al,0
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,143
+ mov bx,0
+ mov al,1
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,0
+ mov bx,92
+ mov al,2
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,143
+ mov bx,92
+ mov al,3
+ mov ah,0
+ call showframe
+ call folderexit
+
+ cmp folderpage,1
+ jz noleftpage
+ call showleftpage
+noleftpage: cmp folderpage,12
+ jz norightpage
+ call showrightpage
+norightpage: call usecharset1
+ call undertextline
+ ret
+
+closedfolder: call createpanel2
+ mov ds,tempgraphics3
+ mov di,143-28
+ mov bx,0
+ mov al,0
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics3
+ mov di,143-28
+ mov bx,92
+ mov al,1
+ mov ah,0
+ call showframe
+ call folderexit
+ call undertextline
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Folderexit proc near
+
+ mov ds,tempgraphics2
+ mov di,296
+ mov bx,178
+ mov al,6
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+Showleftpage proc near
+
+ mov ds,tempgraphics2
+ mov di,0
+ mov bx,12
+ mov al,3
+ mov ah,0
+ call showframe
+
+ mov bx,12+5
+ mov cx,9
+leftpageloop: push cx bx
+ mov ds,tempgraphics2
+ mov di,0
+ mov al,4
+ mov ah,0
+ call showframe
+ pop bx cx
+ add bx,16
+ loop leftpageloop
+
+ mov ds,tempgraphics2
+ mov di,0
+ mov al,5
+ mov ah,0
+ call showframe
+
+ mov linespacing,8
+ mov charshift,91
+ mov kerning,1
+ mov bl,folderpage
+ dec bl
+ dec bl
+ add bl,bl
+ mov bh,0
+ add bx,bx
+ mov es,textfile1
+ mov si,[es:bx]
+ add si,66*2
+ mov di,2
+ mov bx,48
+ mov dl,140
+ mov cx,2
+twolotsleft: push cx
+contleftpage: call printdirect
+ add bx,linespacing
+ cmp al,0
+ jnz contleftpage
+ pop cx
+ loop twolotsleft
+
+ mov kerning,0
+ mov charshift,0
+ mov linespacing,10
+
+ mov es,workspace
+ mov ds,workspace
+ mov di,(48*320)+2
+ mov si,(48*320)+2+130
+ mov cx,120
+flipfolder: push cx di si
+ mov cx,65
+flipfolderline: mov al,[es:di]
+ mov ah,[es:si]
+ mov [es:di],ah
+ mov [es:si],al
+ dec si
+ inc di
+ loop flipfolderline
+ pop si di cx
+ add si,320
+ add di,320
+ loop flipfolder
+ ret
+
+ endp
+
+
+
+Showrightpage proc near
+
+ mov ds,tempgraphics2
+ mov di,143
+ mov bx,12
+ mov al,0
+ mov ah,0
+ call showframe
+
+ mov bx,12+37
+ mov cx,7
+rightpageloop: push cx bx
+ mov ds,tempgraphics2
+ mov di,143
+ mov al,1
+ mov ah,0
+ call showframe
+ pop bx cx
+ add bx,16
+ loop rightpageloop
+
+ mov ds,tempgraphics2
+ mov di,143
+ mov al,2
+ mov ah,0
+ call showframe
+
+ mov linespacing,8
+ mov kerning,1
+ mov bl,folderpage
+ dec bl
+ add bl,bl
+ mov bh,0
+ add bx,bx
+ mov es,textfile1
+ mov si,[es:bx]
+ add si,66*2
+ mov di,152
+ mov bx,48
+ mov dl,140
+ mov cx,2
+twolotsright: push cx
+contrightpage: call printdirect
+ add bx,linespacing
+ cmp al,0
+ jnz contrightpage
+ pop cx
+ loop twolotsright
+
+ mov kerning,0
+ mov linespacing,10
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Entersymbol proc near
+
+ mov manisoffscreen,1
+ call getridofreels
+ mov dx,offset cs:symbolgraphic
+ call loadintotemp
+ mov symboltopx,24
+ mov symboltopdir,0
+ mov symbolbotx,24
+ mov symbolbotdir,0
+ call redrawmainscrn
+ call showsymbol
+ call undertextline
+ call worktoscreenm
+ mov getback,0
+
+symbolloop: call delpointer
+ call updatesymboltop
+ call updatesymbolbot
+ call showsymbol
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ call dumpsymbol
+ mov bx,offset cs:symbollist
+ call checkcoords
+ cmp getback,0
+ jz symbolloop
+
+ cmp symbolbotnum,3
+ jnz symbolwrong
+ cmp symboltopnum,5
+ jnz symbolwrong
+ mov al,43
+ call removesetobject
+ mov al,46
+ call placesetobject
+ mov ah,roomnum
+ add ah,12
+ mov al,0
+ call turnanypathon
+ mov manisoffscreen,0
+ call redrawmainscrn
+ call getridoftemp
+ call restorereels
+ call worktoscreenm
+ mov al,13
+ call playchannel1
+ ret
+
+symbolwrong: mov al,46
+ call removesetobject
+ mov al,43
+ call placesetobject
+ mov ah,roomnum
+ add ah,12
+ mov al,0
+ call turnanypathoff
+ mov manisoffscreen,0
+ call redrawmainscrn
+ call getridoftemp
+ call restorereels
+ call worktoscreenm
+ ret
+
+symbollist: dw symbolx+40,symbolx+64,symboly+2,symboly+16,quitsymbol
+ dw symbolx,symbolx+52,symboly+20,symboly+50,settopleft
+ dw symbolx+52,symbolx+104,symboly+20,symboly+50,settopright
+ dw symbolx,symbolx+52,symboly+50,symboly+80,setbotleft
+ dw symbolx+52,symbolx+104,symboly+50,symboly+80,setbotright
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Quitsymbol proc near
+
+ cmp symboltopx,24
+ jnz blank
+ cmp symbolbotx,24
+ jnz blank
+ cmp commandtype,222
+ jz alreadyqs
+ mov commandtype,222
+ mov al,18
+ call commandonly
+alreadyqs: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notqs
+ and ax,1
+ jnz doqs
+notqs: ret
+
+doqs: mov getback,1
+ ret
+
+ endp
+
+
+
+
+Settopleft proc near
+
+ cmp symboltopdir,0
+ jnz blank
+ cmp commandtype,210
+ jz alreadytopl
+ mov commandtype,210
+ mov al,19
+ call commandonly
+alreadytopl: cmp mousebutton,0
+ jz notopleft
+ mov symboltopdir,-1
+notopleft: ret
+
+ endp
+
+
+
+Settopright proc near
+
+ cmp symboltopdir,0
+ jnz blank
+ cmp commandtype,211
+ jz alreadytopr
+ mov commandtype,211
+ mov al,20
+ call commandonly
+alreadytopr: cmp mousebutton,0
+ jz notopright
+ mov symboltopdir,1
+notopright: ret
+
+ endp
+
+
+
+
+Setbotleft proc near
+
+ cmp symbolbotdir,0
+ jnz blank
+ cmp commandtype,212
+ jz alreadybotl
+ mov commandtype,212
+ mov al,21
+ call commandonly
+alreadybotl: cmp mousebutton,0
+ jz nobotleft
+ mov symbolbotdir,-1
+nobotleft: ret
+
+ endp
+
+
+
+Setbotright proc near
+
+ cmp symbolbotdir,0
+ jnz blank
+ cmp commandtype,213
+ jz alreadybotr
+ mov commandtype,213
+ mov al,22
+ call commandonly
+alreadybotr: cmp mousebutton,0
+ jz nobotright
+ mov symbolbotdir,1
+nobotright: ret
+
+ endp
+
+
+
+
+
+
+
+Dumpsymbol proc near
+
+ mov newtextline,0
+ mov di,symbolx
+ mov bx,symboly+20
+ mov cl,104
+ mov ch,60
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Showsymbol proc near
+
+ mov al,12
+ mov ah,0
+ mov di,symbolx
+ mov bx,symboly
+ mov ds,tempgraphics
+ call showframe
+
+ mov al,symboltopx
+ mov ah,0
+ mov di,ax
+ add di,symbolx-44
+ mov al,symboltopnum
+ mov bx,symboly+20
+ mov ds,tempgraphics
+ mov ah,32
+ push ax di bx ds
+ call showframe
+ pop ds bx di ax
+ call nextsymbol
+ add di,49
+ push ax di bx ds
+ call showframe
+ pop ds bx di ax
+ call nextsymbol
+ add di,49
+ call showframe
+
+ mov al,symbolbotx
+ mov ah,0
+ mov di,ax
+ add di,symbolx-44
+ mov al,symbolbotnum
+ add al,6
+ mov bx,symboly+49
+ mov ds,tempgraphics
+ mov ah,32
+ push ax di bx ds
+ call showframe
+ pop ds bx di ax
+ call nextsymbol
+ add di,49
+ push ax di bx ds
+ call showframe
+ pop ds bx di ax
+ call nextsymbol
+ add di,49
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+Nextsymbol proc near
+
+ inc al
+ cmp al,6
+ jz topwrap
+ cmp al,12
+ jz botwrap
+ ret
+topwrap: mov al,0
+ ret
+botwrap: mov al,6
+ ret
+
+ endp
+
+
+
+Updatesymboltop proc near
+
+ cmp symboltopdir,0
+ jz topfinished
+ cmp symboltopdir,-1
+ jz backwards
+
+ inc symboltopx
+ cmp symboltopx,49
+ jnz notwrapfor
+ mov symboltopx,0
+ dec symboltopnum
+ cmp symboltopnum,-1
+ jnz topfinished
+ mov symboltopnum,5
+ ret
+notwrapfor: cmp symboltopx,24
+ jnz topfinished
+ mov symboltopdir,0
+ ret
+
+backwards: dec symboltopx
+ cmp symboltopx,-1
+ jnz notwrapback
+ mov symboltopx,48
+ inc symboltopnum
+ cmp symboltopnum,6
+ jnz topfinished
+ mov symboltopnum,0
+ ret
+notwrapback: cmp symboltopx,24
+ jnz topfinished
+ mov symboltopdir,0
+topfinished: ret
+
+ endp
+
+
+
+Updatesymbolbot proc near
+
+ cmp symbolbotdir,0
+ jz botfinished
+ cmp symbolbotdir,-1
+ jz backwardsbot
+
+ inc symbolbotx
+ cmp symbolbotx,49
+ jnz notwrapforb
+ mov symbolbotx,0
+ dec symbolbotnum
+ cmp symbolbotnum,-1
+ jnz botfinished
+ mov symbolbotnum,5
+ ret
+notwrapforb: cmp symbolbotx,24
+ jnz botfinished
+ mov symbolbotdir,0
+ ret
+
+backwardsbot: dec symbolbotx
+ cmp symbolbotx,-1
+ jnz notwrapbackb
+ mov symbolbotx,48
+ inc symbolbotnum
+ cmp symbolbotnum,6
+ jnz botfinished
+ mov symbolbotnum,0
+ ret
+notwrapbackb: cmp symbolbotx,24
+ jnz botfinished
+ mov symbolbotdir,0
+botfinished: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Dumpsymbox proc near
+
+ cmp dumpx,-1
+ jz nodumpsym
+ mov di,dumpx
+ mov bx,dumpy
+ mov cl,30
+ mov ch,77;30
+ call multidump
+ mov dumpx,-1
+nodumpsym: ret
+
+ endp
+
+
+
+
+
+
+
+Usediary proc near
+
+ call getridofreels
+ mov dx,offset cs:diarygraphic
+ call loadintotemp
+ mov dx,offset cs:diarytext
+ call loadtemptext
+
+ mov dx,offset cs:characterset3
+ call loadtempcharset
+ call createpanel
+ call showicon
+ call showdiary
+ call undertextline
+ call showdiarypage
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov getback,0
+
+diaryloop: call delpointer
+ call readmouse
+ call showdiarykeys
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumpdiarykeys
+ call dumptextline
+ mov bx,offset cs:diarylist
+ call checkcoords
+ cmp getback,0
+ jz diaryloop
+
+ call getridoftemp
+ call getridoftemptext
+ call getridoftempcharset
+ call restorereels
+ mov manisoffscreen,0
+ call redrawmainscrn
+ call worktoscreenm
+ ret
+
+diarylist: dw diaryx+94,diaryx+110,diaryy+97,diaryy+113,diarykeyn
+ dw diaryx+151,diaryx+167,diaryy+71,diaryy+87,diarykeyp
+ dw diaryx+176,diaryx+192,diaryy+108,diaryy+124,quitkey
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ ret
+
+ endp
+
+
+
+
+
+
+
+Showdiary proc near
+
+ mov al,1
+ mov ah,0
+ mov di,diaryx
+ mov bx,diaryy+37
+ mov ds,tempgraphics
+ call showframe
+ mov al,2
+ mov ah,0
+ mov di,diaryx+176
+ mov bx,diaryy+108
+ mov ds,tempgraphics
+ call showframe
+ ret
+
+ endp
+
+
+
+
+Showdiarykeys proc near
+
+ cmp presscount,0
+ jz nokeyatall
+ dec presscount
+ cmp presscount,0
+ jz nokeyatall
+ cmp pressed,"N"
+ jnz nokeyn
+ mov al,3
+ cmp presscount,1
+ jz gotkeyn
+ mov al,4
+gotkeyn: mov ah,0
+ mov di,diaryx+94
+ mov bx,diaryy+97
+ mov ds,tempgraphics
+ call showframe
+ cmp presscount,1
+ jnz notshown
+ call showdiarypage
+notshown: ret
+
+nokeyn: mov al,5
+ cmp presscount,1
+ jz gotkeyp
+ mov al,6
+gotkeyp: mov ah,0
+ mov di,diaryx+151
+ mov bx,diaryy+71
+ mov ds,tempgraphics
+ call showframe
+ cmp presscount,1
+ jnz notshowp
+ call showdiarypage
+notshowp: ret
+
+nokeyatall: ret
+
+ endp
+
+
+
+
+
+
+Dumpdiarykeys proc near
+
+ cmp presscount,1
+ jnz notdumpdiary
+ cmp sartaindead,1
+ jz notsartadd
+ cmp diarypage,5
+ jnz notsartadd
+ cmp diarypage,5
+ jnz notsartadd
+ mov al,6
+ call getlocation
+ cmp al,1
+ jz notsartadd
+ mov al,6
+ call setlocation
+
+ call delpointer
+ mov al,12
+ call findtext1
+ mov di,70 ;diaryx+48
+ mov bx,106 ;diaryy+16
+ mov dl,241
+ mov ah,16
+ call printdirect
+
+ call worktoscreenm
+ mov cx,200
+ call hangonp
+ call createpanel
+ call showicon
+ call showdiary
+ call showdiarypage
+ call worktoscreenm
+ call showpointer
+ ret
+
+notsartadd: mov di,diaryx+48
+ mov bx,diaryy+15
+ mov cl,200
+ mov ch,16
+ call multidump
+notdumpdiary: mov di,diaryx+94
+ mov bx,diaryy+97
+ mov cl,16
+ mov ch,16
+ call multidump
+ mov di,diaryx+151
+ mov bx,diaryy+71
+ mov cl,16
+ mov ch,16
+ call multidump
+ ret
+
+ endp
+
+
+
+Diarykeyp proc near
+
+ cmp commandtype,214
+ jz alreadykeyp
+ mov commandtype,214
+ mov al,23
+ call commandonly
+alreadykeyp: cmp mousebutton,0
+ jz notkeyp
+ mov ax,oldbutton
+ cmp ax,mousebutton
+ jz notkeyp
+ cmp presscount,0
+ jnz notkeyp
+ mov al,16
+ call playchannel1
+ mov presscount,12
+ mov pressed,"P"
+ dec diarypage
+ cmp diarypage,-1
+ jnz notkeyp
+ mov diarypage,11
+notkeyp: ret
+
+ endp
+
+
+
+Diarykeyn proc near
+
+ cmp commandtype,213
+ jz alreadykeyn
+ mov commandtype,213
+ mov al,23
+ call commandonly
+alreadykeyn: cmp mousebutton,0
+ jz notkeyn
+ mov ax,oldbutton
+ cmp ax,mousebutton
+ jz notkeyn
+ cmp presscount,0
+ jnz notkeyn
+ mov al,16
+ call playchannel1
+ mov presscount,12
+ mov pressed,"N"
+ inc diarypage
+ cmp diarypage,12
+ jnz notkeyn
+ mov diarypage,0
+notkeyn: ret
+
+ endp
+
+
+
+
+
+
+Showdiarypage proc near
+
+ mov al,0
+ mov ah,0
+ mov di,diaryx
+ mov bx,diaryy
+ mov ds,tempgraphics
+ call showframe
+
+ mov al,diarypage
+ call findtext1
+
+ mov kerning,1
+ call usetempcharset
+ mov di,diaryx+48
+ mov bx,diaryy+16
+ mov dl,240
+ mov ah,16
+ mov charshift,91+91
+ call printdirect
+
+ mov di,diaryx+129
+ mov bx,diaryy+16
+ mov dl,240
+ mov ah,16
+ call printdirect
+
+ mov di,diaryx+48
+ mov bx,diaryy+23
+ mov dl,240
+ mov ah,16
+ call printdirect
+
+ mov kerning,0
+ mov charshift,0
+ call usecharset1
+ ret
+
+ endp
+
+
+
+
+
+Findtext1 proc near
+
+ mov ah,0
+ mov si,ax
+ add si,si
+ mov es,textfile1
+ mov ax,[es:si]
+ add ax,textstart
+ mov si,ax
+ ret
+
+ endp
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/look.asm b/devtools/tasmrecover/dreamweb/look.asm
new file mode 100644
index 0000000000..11ee24beb6
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/look.asm
@@ -0,0 +1,167 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;---------------------------------------------------------------Look-routine----
+
+Autolook proc near
+
+ mov ax,mousex
+ cmp ax,oldx
+ jnz diffmouse
+ mov ax,mousey
+ cmp ax,oldy
+ jnz diffmouse
+
+ dec lookcounter
+ cmp lookcounter,0
+ jnz noautolook
+ cmp watchingtime,0
+ jnz noautolook
+ call dolook
+noautolook: ret
+
+diffmouse: mov lookcounter,1000
+ ret
+
+ endp
+
+
+
+
+Look proc near
+
+ cmp watchingtime,0
+ jnz blank
+ cmp pointermode,2
+ jz blank
+
+ cmp commandtype,241
+ jz alreadylook
+ mov commandtype,241
+ mov al,25
+ call commandonly
+alreadylook: cmp mousebutton,1
+ jnz nolook
+ mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nolook
+ call dolook
+nolook: ret
+
+ endp
+
+
+
+
+
+Dolook proc near
+
+ call createpanel
+ call showicon
+ call undertextline
+ call worktoscreenm
+
+ mov commandtype,255
+ call dumptextline
+
+ mov bl,roomnum
+ and bl,31
+ mov bh,0
+ add bx,bx
+
+ mov es,roomdesc
+ add bx,intextdat
+
+ mov si,[es:bx]
+ add si,intext
+
+ call findnextcolon
+
+ mov di,66
+ cmp reallocation,50
+ jc notdream3
+ mov di,40
+notdream3: mov bx,80
+ mov dl,241
+ call printslow
+
+ cmp al,1
+ jz afterlook
+ mov cx,400
+ call hangonp
+
+afterlook: mov pointermode,0
+ mov commandtype,0
+ call redrawmainscrn
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+
+Redrawmainscrn proc near
+
+ mov timecount,0
+ call createpanel
+ mov newobs,0
+ call drawfloor
+ call printsprites
+ call reelsonscreen
+ call showicon
+ call getunderzoom
+ call undertextline
+ call readmouse
+ mov commandtype,255
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Getback1 proc near
+
+ cmp pickup,0
+ jz notgotobject
+ call blank
+ ret
+
+notgotobject: cmp commandtype,202
+ jz alreadyget
+ mov commandtype,202
+ mov al,26
+ call commandonly
+alreadyget: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nogetback
+ and ax,1
+ jnz dogetback
+nogetback: ret
+
+dogetback: mov getback,1
+ mov pickup,0
+ ret
+
+ endp
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/monitor.asm b/devtools/tasmrecover/dreamweb/monitor.asm
new file mode 100644
index 0000000000..65b68cb94c
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/monitor.asm
@@ -0,0 +1,1496 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Usemon proc near
+
+ mov lasttrigger,0
+
+ push cs ;start off with no file name
+ pop es
+ mov di,offset cs:currentfile+1
+ mov cx,12
+ mov al,32
+ rep stosb
+ push cs ;start off with no file name
+ pop es
+ mov di,offset cs:operand1+1
+ mov cx,12
+ mov al,32
+ rep stosb
+
+ push cs ;clear all keys
+ pop es
+ mov di,offset cs:keys
+ mov byte ptr [es:di],1
+ add di,26
+ mov cx,3
+keyloop: mov byte ptr [es:di],0
+ add di,26
+ loop keyloop
+
+ call createpanel
+ call showpanel
+ call showicon
+ call drawfloor
+ call getridofall ;reels
+
+ mov dx,offset cs:mongraphicname
+ call loadintotemp
+ call loadpersonal
+ call loadnews
+ call loadcart
+ mov dx,offset cs:characterset2
+ call loadtempcharset
+
+ call printoutermon
+ call initialmoncols
+ call printlogo
+ call worktoscreen
+ call turnonpower
+ call fadeupyellows
+ call fadeupmonfirst
+
+ mov monadx,76
+ mov monady,141
+ mov al,1
+ call monmessage
+ mov cx,120
+ call hangoncurs
+ mov al,2
+ call monmessage
+ mov cx,60
+ call randomaccess
+ mov al,3
+ call monmessage
+ mov cx,100
+ call hangoncurs
+ call printlogo
+ call scrollmonitor
+ mov bufferin,0
+ mov bufferout,0
+
+moreinput: mov di,monadx
+ mov bx,monady
+ push di bx
+ call input
+ pop bx di
+ mov monadx,di
+ mov monady,bx
+ call execcommand
+ cmp al,0
+ jz moreinput
+
+endmon: call getridoftemp
+ call getridoftempcharset
+ mov es,textfile1
+ call deallocatemem
+ mov es,textfile2
+ call deallocatemem
+ mov es,textfile3
+ call deallocatemem
+ mov getback,1
+ mov al,26
+ call playchannel1
+ mov manisoffscreen,0
+ call restoreall ;reels
+ call redrawmainscrn
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+
+Printoutermon proc near
+
+ mov di,40
+ mov bx,32
+ mov ds,tempgraphics
+ mov al,1
+ mov ah,0
+ call showframe
+ mov di,264
+ mov bx,32
+ mov ds,tempgraphics
+ mov al,2
+ mov ah,0
+ call showframe
+ mov di,40
+ mov bx,12
+ mov ds,tempgraphics
+ mov al,3
+ mov ah,0
+ call showframe
+ mov di,40
+ mov bx,164
+ mov ds,tempgraphics
+ mov al,4
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+Loadpersonal proc near
+
+ mov al,location
+ mov dx,offset cs:monitorfile1
+ cmp al,0
+ jz foundpersonal
+ cmp al,42
+ jz foundpersonal
+ mov dx,offset cs:monitorfile2
+ cmp al,2
+ jz foundpersonal
+
+foundpersonal: call openfile
+ call readheader
+ mov bx,[es:di]
+ push bx
+ mov cl,4
+ shr bx,cl
+ call allocatemem
+ mov textfile1,ax
+ mov ds,ax
+ pop cx
+ mov dx,0
+ call readfromfile
+ call closefile
+ ret
+
+ endp
+
+
+
+
+Loadnews proc near ;textfile2 holds information
+ ;accessable by anyone
+ mov al,newsitem
+ mov dx,offset cs:monitorfile10
+ cmp al,0
+ jz foundnews
+ mov dx,offset cs:monitorfile11
+ cmp al,1
+ jz foundnews
+ mov dx,offset cs:monitorfile12
+ cmp al,2
+ jz foundnews
+ mov dx,offset cs:monitorfile13
+foundnews: call openfile
+ call readheader
+ mov bx,[es:di]
+ push bx
+ mov cl,4
+ shr bx,cl
+ call allocatemem
+ mov textfile2,ax
+ mov ds,ax
+ pop cx
+ mov dx,0
+ call readfromfile
+ call closefile
+ ret
+
+ endp
+
+
+
+
+
+
+Loadcart proc near
+
+ call lookininterface
+
+ mov dx,offset cs:monitorfile20
+ cmp al,0
+ jz gotcart
+ mov dx,offset cs:monitorfile21
+ cmp al,1
+ jz gotcart
+ mov dx,offset cs:monitorfile22
+ cmp al,2
+ jz gotcart
+ mov dx,offset cs:monitorfile23
+ cmp al,3
+ jz gotcart
+ mov dx,offset cs:monitorfile24
+gotcart: call openfile
+ call readheader
+ mov bx,[es:di]
+ push bx
+ mov cl,4
+ shr bx,cl
+ call allocatemem
+ mov textfile3,ax
+ mov ds,ax
+ pop cx
+ mov dx,0
+ call readfromfile
+ call closefile
+ ret
+
+ endp
+
+
+
+
+
+
+Lookininterface proc near
+
+ mov al,"I"
+ mov ah,"N"
+ mov cl,"T"
+ mov ch,"F"
+ call findsetobject ;this bit searches set obs
+ ;until the interface is found
+ ;al holds object number
+ mov ah,1 ;ah holds type, 1=set object
+ call checkinside ;this searches for any extra
+ ;object inside the interface..
+ cmp cl,numexobjects
+ jz emptyinterface
+ mov al,[es:bx+15] ;get the last letter of ID code
+ inc al
+ ret
+emptyinterface: mov al,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+Turnonpower proc near
+
+ mov cx,3
+powerloop: push cx
+ call powerlighton
+ mov cx,30
+ call hangon
+ call powerlightoff
+ mov cx,30
+ call hangon
+ pop cx
+ loop powerloop
+ call powerlighton
+ ret
+
+ endp
+
+
+
+
+
+Randomaccess proc near
+
+accessloop: push cx
+ call vsync
+ call vsync
+ call randomnum1
+ and al,15
+ cmp al,10
+ jc off
+ call accesslighton
+ jmp chosenaccess
+off: call accesslightoff
+chosenaccess: pop cx
+ loop accessloop
+ call accesslightoff
+ ret
+
+ endp
+
+
+
+Powerlighton proc near
+
+ mov di,257+4
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,6
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Powerlightoff proc near
+
+ mov di,257+4
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,5
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Accesslighton proc near
+
+ mov di,74
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,8
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Accesslightoff proc near
+
+ mov di,74
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,7
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+
+Locklighton proc near
+
+ mov di,56
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,10
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Locklightoff proc near
+
+ mov di,56
+ mov bx,182
+ mov ds,tempgraphics
+ mov al,9
+ mov ah,0
+ push di bx
+ call showframe
+ pop bx di
+ mov cl,12
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Input proc near
+
+ push cs
+ pop es
+ mov di,offset cs:inputline
+ mov cx,64
+ mov al,0
+ rep stosb
+
+ mov curpos,0
+ mov al,">"
+ mov di,monadx
+ mov bx,monady
+ mov ds,tempcharset
+ mov ah,0
+ call printchar
+ mov di,monadx
+ mov bx,monady
+ mov cl,6
+ mov ch,8
+ call multidump
+ add monadx,6
+ mov ax,monadx
+ mov curslocx,ax
+ mov ax,monady
+ mov curslocy,ax
+
+waitkey: call printcurs
+ call vsync
+ call delcurs
+ call readkey
+ mov al,currentkey
+ cmp al,0
+ jz waitkey
+ cmp al,13
+ jz endofinput
+ cmp al,8
+ jnz notdel
+ cmp curpos,0
+ jz waitkey
+ call delchar
+ jmp waitkey
+notdel: cmp curpos,28
+ jz waitkey
+ cmp currentkey,32
+ jnz notleadingspace
+ cmp curpos,0
+ jz waitkey
+notleadingspace: call makecaps
+ push cs
+ pop es
+ mov si,curpos
+ add si,si
+ add si,offset cs:inputline
+ mov [es:si],al
+
+ cmp al,"Z"+1
+ jnc waitkey
+
+ push ax es si
+ mov di,monadx
+ mov bx,monady
+ mov ds,mapstore
+ mov ax,curpos
+ xchg al,ah
+ mov si,ax
+ mov cl,8
+ mov ch,8
+ call multiget
+ pop si es ax
+
+ push es si
+ mov di,monadx
+ mov bx,monady
+ mov ds,tempcharset
+ mov ah,0
+ call printchar
+ pop si es
+ ;dec cx
+ mov [es:si+1],cl
+ mov ch,0
+ add monadx,cx
+ inc curpos
+ add curslocx,cx
+ jmp waitkey
+
+endofinput: ret
+
+ endp
+
+
+
+
+
+
+
+
+Makecaps proc near
+
+ cmp al,"a"
+ jc notupperc
+ sub al,32
+notupperc: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Delchar proc near
+
+ dec curpos
+ mov si,curpos
+ add si,si
+ push cs
+ pop es
+ add si,offset cs:inputline
+ mov byte ptr [es:si],0
+ mov al,[es:si+1]
+ mov ah,0
+ sub monadx,ax
+ sub curslocx,ax
+ mov di,monadx
+ mov bx,monady
+ mov ds,mapstore
+ mov ax,curpos
+ xchg al,ah
+ mov si,ax
+ mov cl,8
+ mov ch,8
+ call multiput
+ mov di,monadx
+ mov bx,monady
+ mov cl,al
+ mov ch,8
+ call multidump
+ ret
+
+ endp
+
+
+
+
+
+
+
+Execcommand proc near
+
+ push cs
+ pop es
+ mov bx,offset cs:comlist
+ push cs
+ pop ds
+ mov si,offset cs:inputline
+ mov al,[si]
+ cmp al,0
+ jnz notblankinp
+ call scrollmonitor
+ ret
+
+notblankinp: mov cl,0
+comloop: push bx si
+comloop2: mov al,[si]
+ add si,2
+ mov ah,[es:bx]
+ inc bx
+ cmp ah,32
+ jz foundcom
+ cmp al,ah
+ jz comloop2
+ pop si bx
+ add bx,10
+ inc cl
+ cmp cl,6
+ jnz comloop
+ call neterror
+ mov al,0
+ ret
+foundcom: pop si bx
+ cmp cl,1
+ jz testcom
+ cmp cl,2
+ jz directory
+ cmp cl,3
+ jz accesscom
+ cmp cl,4
+ jz signoncom
+ cmp cl,5
+ jz keyscom
+ jmp quitcom
+
+directory: call dircom
+ mov al,0
+ ret
+
+signoncom: call signon
+ mov al,0
+ ret
+
+accesscom: call read
+ mov al,0
+ ret
+
+keyscom: call showkeys
+ mov al,0
+ ret
+
+testcom: mov al,6
+ call monmessage
+ mov al,0
+ ret
+
+quitcom: mov al,1
+ ret
+
+comlist: db "EXIT "
+ db "HELP "
+ db "LIST "
+ db "READ "
+ db "LOGON "
+ db "KEYS "
+
+keys: db 1,0,"PUBLIC PUBLIC ",0
+ db 0,0,"BLACKDRAGON RYAN ",0
+ db 0,0,"HENDRIX LOUIS ",0
+ db 0,0,"SEPTIMUS BECKETT ",0
+ db 255,255
+
+operand1: db " ",0
+rootdir: db 34,"ROOT ",0
+currentfile db 34," ",0
+
+ endp
+
+
+
+
+
+
+
+Neterror proc near
+
+ mov al,5
+ call monmessage
+ call scrollmonitor
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Dircom proc near
+
+ mov cx,30
+ call randomaccess
+ call parser
+ cmp byte ptr [es:di+1],0
+ jz dirroot
+ call dirfile
+ ret
+
+dirroot: mov logonum,0
+ push cs
+ pop ds
+ mov si,offset cs:rootdir
+ inc si
+ push cs
+ pop es
+ mov di,offset cs:currentfile
+ inc di
+ mov cx,12
+ rep movsb
+ call monitorlogo
+ call scrollmonitor
+
+ mov al,9
+ call monmessage
+
+ mov es,textfile1
+ call searchforfiles
+ mov es,textfile2
+ call searchforfiles
+ mov es,textfile3
+ call searchforfiles
+
+ call scrollmonitor
+ ret
+
+ endp
+
+
+
+
+
+
+Searchforfiles proc near
+
+ mov bx,textstart
+directloop1: mov al,[es:bx]
+ inc bx
+ cmp al,"*"
+ jz endofdir
+ cmp al,34
+ jnz directloop1
+ call monprint
+ jmp directloop1
+endofdir: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Signon proc near
+
+ call parser
+ inc di
+ push cs
+ pop ds
+ mov si,offset cs:keys
+ mov cx,4
+signonloop: push cx si di
+ add si,14
+ mov cx,11
+signonloop2: lodsb
+ cmp al,32
+ jz foundsign
+ call makecaps
+ mov ah,[es:di]
+ inc di
+ cmp al,ah
+ jnz nomatch
+ loop signonloop2
+nomatch: pop di si cx
+ add si,26
+ loop signonloop
+ mov al,13
+ call monmessage
+ ret
+
+foundsign: pop di si cx ;ds:si contains ad of key matched
+ mov bx,si
+ push ds
+ pop es ;now ds:si is in es:bx
+
+ cmp byte ptr [es:bx],0
+ jz notyetassigned
+
+ mov al,17
+ call monmessage
+ ret
+
+notyetassigned: push es bx
+ call scrollmonitor
+ mov al,15
+ call monmessage
+ mov di,monadx
+ mov bx,monady
+ push di bx
+ call input
+ pop bx di
+ mov monadx,di
+ mov monady,bx
+ pop bx es
+ push es bx
+
+ add bx,2
+ push cs
+ pop ds
+ mov si,offset cs:inputline
+checkpass: lodsw
+ mov ah,[es:bx]
+ inc bx
+ ;cmp al,0
+ cmp ah,32
+ jz passpassed
+ cmp al,ah
+ jz checkpass
+passerror: pop bx es
+ call scrollmonitor
+ mov al,16
+ call monmessage
+ ret
+
+passpassed: mov al,14
+ call monmessage
+ pop bx es
+ push es bx
+ add bx,14
+ call monprint
+ call scrollmonitor
+ pop bx es
+ mov byte ptr [es:bx],1
+ ret
+
+ endp
+
+
+
+
+
+
+
+Showkeys proc near
+
+ mov cx,10
+ call randomaccess
+ call scrollmonitor
+ mov al,18
+ call monmessage
+
+ push cs
+ pop es
+ mov bx,offset cs:keys
+ mov cx,4
+keysloop: push cx bx
+ cmp byte ptr [es:bx],0
+ jz notheld
+ add bx,14
+ call monprint
+notheld: pop bx cx
+ add bx,26
+ loop keysloop
+ call scrollmonitor
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Read proc near
+
+ mov cx,40
+ call randomaccess
+ call parser
+ cmp byte ptr [es:di+1],0
+ jnz okcom
+ call neterror
+ ret
+okcom: push cs
+ pop es
+ mov di,offset cs:currentfile
+ mov ax,textfile1
+ mov monsource,ax
+ mov ds,ax
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile2
+ mov ax,textfile2
+ mov monsource,ax
+ mov ds,ax
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile2
+ mov ax,textfile3
+ mov monsource,ax
+ mov ds,ax
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile2
+ mov al,7
+ call monmessage
+ ret
+foundfile2: call getkeyandlogo
+ cmp al,0
+ jz keyok1
+ ret
+keyok1: push cs
+ pop es
+ mov di,offset cs:operand1
+ mov ds,monsource
+ call searchforstring
+ cmp al,0
+ jz findtopictext
+ mov al,oldlogonum
+ mov logonum,al
+ mov al,11
+ call monmessage
+ ret
+
+findtopictext: inc bx
+ push es bx
+ call monitorlogo
+ call scrollmonitor
+ pop bx es
+moretopic: call monprint
+ mov al,[es:bx]
+ cmp al,34
+ jz endoftopic
+ cmp al,"="
+ jz endoftopic
+ cmp al,"*"
+ jz endoftopic
+ push es bx
+ call processtrigger
+ mov cx,24
+ call randomaccess
+ pop bx es
+ jmp moretopic
+
+endoftopic: call scrollmonitor
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Dirfile proc near
+
+ mov al,34
+ mov [es:di],al
+ push es di ;save start point held in es:di
+ mov ds,textfile1
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile
+ pop di es
+ push es di
+ mov ds,textfile2
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile
+ pop di es
+ push es di
+ mov ds,textfile3
+ mov si,textstart
+ call searchforstring
+ cmp al,0
+ jz foundfile
+
+ pop di es
+ mov al,7
+ call monmessage
+ ret
+
+foundfile: pop ax ax ;discard old values of es:di
+ call getkeyandlogo
+ cmp al,0
+ jz keyok2
+ ret
+
+keyok2: push es bx
+ push cs
+ pop ds
+ mov si,offset cs:operand1+1
+ push cs
+ pop es
+ mov di,offset cs:currentfile+1
+ mov cx,12
+ rep movsb
+ call monitorlogo
+ call scrollmonitor
+ mov al,10
+ call monmessage
+ pop bx es
+
+
+directloop2: mov al,[es:bx]
+ inc bx
+ cmp al,34
+ jz endofdir2
+ cmp al,"*"
+ jz endofdir2
+ cmp al,"="
+ jnz directloop2
+ call monprint
+ jmp directloop2
+
+endofdir2: call scrollmonitor
+ ret
+
+ endp
+
+
+
+
+
+
+Getkeyandlogo proc near
+
+ inc bx
+ mov al,[es:bx]
+ sub al,48
+ mov newlogonum,al
+ add bx,2
+ mov al,[es:bx]
+ sub al,48
+ mov keynum,al
+ inc bx
+ push es bx
+ mov al,keynum
+ mov ah,0
+ mov cx,26
+ mul cx
+ push cs
+ pop es
+ mov bx,offset cs:keys
+ add bx,ax
+ mov al,[es:bx]
+ cmp al,1
+ jz keyok
+ push bx es
+ mov al,12
+ call monmessage
+ pop es bx
+ add bx,14
+ call monprint
+ call scrollmonitor
+ pop bx es
+ mov al,1
+ ret
+
+keyok: pop bx es
+ mov al,newlogonum
+ mov logonum,al
+ mov al,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Searchforstring proc near ;finds string at es:di in
+ ;text at ds:si
+
+ mov dl,[es:di] ;needs to know first character
+ ;if it's an equals then we must
+ ;stop at the next quotation mark
+ mov cx,di ;need to remember starting point
+
+restartlook: mov di,cx
+ mov bx,si
+
+ mov dh,0 ;dh holds count of brackets
+ ;brackets are either " or =
+keeplooking: lodsb
+ call makecaps
+ cmp al,"*"
+ jz notfound
+ cmp dl,"="
+ jnz nofindingtopic ;are we looking for a topic?
+ cmp al,34 ;if YES, check we haven't reached
+ jz notfound ;the end of this file.
+nofindingtopic: mov ah,[es:di]
+ cmp al,dl ;all searches bracketed by same thing
+ jnz notbracket
+ inc dh
+ cmp dh,2
+ jz complete
+notbracket: cmp al,ah
+ jnz restartlook
+ inc di
+ jmp keeplooking
+complete: push ds ;es:bx returns found string
+ pop es
+ mov al,0
+ mov bx,si
+ ret
+notfound: mov al,1
+ ret
+
+ endp
+
+
+
+
+
+
+Parser proc near
+
+ push cs
+ pop es
+ mov di,offset cs:operand1
+ mov cx,13
+ mov al,0
+ rep stosb
+
+ mov di,offset cs:operand1
+ mov al,"="
+ stosb
+
+ push cs
+ pop ds
+ mov si,offset cs:inputline
+
+notspace1: lodsw
+ cmp al,32
+ jz stillspace1
+ cmp al,0
+ jnz notspace1
+ jmp finishpars
+
+stillspace1: lodsw
+ cmp al,32
+ jz stillspace1
+
+copyin1: stosb
+ lodsw
+ cmp al,0
+ jz finishpars
+ cmp al,32
+ jnz copyin1
+
+finishpars: mov di,offset cs:operand1
+ ret
+
+ endp
+
+
+
+
+
+
+Scrollmonitor proc near
+
+ push ax bx cx dx di si es ds
+
+ call printlogo
+ mov di,monadx
+ mov bx,monady
+ call printundermon
+ mov ax,monady
+ call worktoscreen
+ mov al,25
+ call playchannel1
+
+ pop ds es si di dx cx bx ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Lockmon proc near
+
+ cmp lasthardkey,57
+ jnz notlock
+ call locklighton
+lockloop: cmp lasthardkey,57
+ jz lockloop
+ call locklightoff
+notlock: ret
+
+ endp
+
+
+
+
+
+Monitorlogo proc near
+
+ mov al,logonum
+ cmp al,oldlogonum
+ jz notnewlogo
+ mov oldlogonum,al
+ ;call fadedownmon
+ call printlogo
+ call printundermon
+ call worktoscreen
+ call printlogo
+ ;call fadeupmon
+ call printlogo
+ mov al,26
+ call playchannel1
+ mov cx,20
+ call randomaccess
+ ret
+notnewlogo: call printlogo
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Printlogo proc near
+
+ mov di,56
+ mov bx,32
+ mov ds,tempgraphics
+ mov al,0
+ mov ah,0
+ call showframe
+ call showcurrentfile
+ ret
+
+ endp
+
+
+
+
+
+
+Showcurrentfile proc near
+
+ mov di,178 ;99
+ mov bx,37
+ mov si,offset cs:currentfile+1
+curfileloop: mov al,[cs:si]
+ cmp al,0
+ jz finishfile
+ inc si
+ push si
+ if foreign
+ call modifychar
+ endif
+ mov ds,tempcharset
+ mov ah,0
+ call printchar
+ pop si
+ jmp curfileloop
+finishfile: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Monmessage proc near
+
+ mov es,textfile1
+ mov bx,textstart
+ mov cl,al
+ mov ch,0
+monmessageloop: mov al,[es:bx]
+ inc bx
+ cmp al,"+"
+ jnz monmessageloop
+ loop monmessageloop
+ call monprint
+ ret
+
+ endp
+
+
+
+
+
+
+Processtrigger proc near
+
+ cmp lasttrigger,"1"
+ jnz notfirsttrigger
+ mov al,8
+ call setlocation
+ mov al,45
+ call triggermessage
+ ret
+
+notfirsttrigger: cmp lasttrigger,"2"
+ jnz notsecondtrigger
+ mov al,9
+ call setlocation
+ mov al,55
+ call triggermessage
+ ret
+
+notsecondtrigger: cmp lasttrigger,"3"
+ jnz notthirdtrigger
+ mov al,2
+ call setlocation
+ mov al,59
+ call triggermessage
+
+notthirdtrigger: ret
+
+ endp
+
+
+
+
+Triggermessage proc near
+
+ push ax
+ mov di,174
+ mov bx,153
+ mov cl,200
+ mov ch,63
+ mov ds,mapstore
+ mov si,0
+ call multiget
+ pop ax
+ call findpuztext
+ mov di,174
+ mov bx,156
+ mov dl,141
+ mov ah,16
+ call printdirect
+ mov cx,140
+ call hangon
+ call worktoscreen
+ mov cx,340
+ call hangon
+ mov di,174
+ mov bx,153
+ mov cl,200
+ mov ch,63
+ mov ds,mapstore
+ mov si,0
+ call multiput
+ call worktoscreen
+ mov lasttrigger,0
+ ret
+
+ endp
+
+
+
+
+
+
+Printcurs proc near
+
+ push si di ds dx bx es
+ mov di,curslocx
+ mov bx,curslocy
+ mov cl,6
+ mov ch,8
+ if foreign
+ sub bx,3
+ mov ch,11
+ endif
+ mov ds,buffers
+ mov si,textunder
+ push di bx
+ call multiget
+ pop bx di
+
+ push bx di
+ inc maintimer
+ mov ax,maintimer
+ and al,16
+ jnz flashcurs
+ mov al,"/"
+ sub al,32
+ mov ah,0
+ mov ds,tempcharset
+ call showframe
+
+flashcurs: pop di bx
+ sub di,6
+ mov cl,12
+ if foreign
+ mov ch,11
+ else
+ mov ch,8
+ endif
+ call multidump
+
+ pop es bx dx ds di si
+ ret
+
+ endp
+
+
+
+
+
+
+Delcurs proc near
+
+ push es bx di ds dx si
+ mov di,curslocx
+ mov bx,curslocy
+ mov cl,6
+ mov ch,8
+ if foreign
+ sub bx,3
+ mov ch,11
+ endif
+ push di bx cx
+ mov ds,buffers
+ mov si,textunder
+ call multiput
+ pop cx bx di
+ call multidump
+finishcurdel:
+ pop si dx ds di bx es
+ ret
+
+ endp
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/newplace.asm b/devtools/tasmrecover/dreamweb/newplace.asm
new file mode 100644
index 0000000000..8a1e97367c
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/newplace.asm
@@ -0,0 +1,581 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;----------------------------------------------------Choosing a new location----
+
+Newplace proc near
+
+ cmp needtotravel,1
+ jz istravel
+ cmp autolocation,-1
+ jnz isautoloc
+ ret
+
+isautoloc: mov al,autolocation
+ mov newlocation,al
+ mov autolocation,-1
+ ret
+
+istravel: mov needtotravel,0
+ call selectlocation
+ ret
+
+ endp
+
+
+
+
+Selectlocation proc near
+
+ mov inmaparea,0
+ call clearbeforeload
+ mov getback,0
+ mov pointerframe,22
+
+ call readcitypic
+ call showcity
+ call getridoftemp
+ call readdesticon
+ call loadtraveltext
+ call showpanel
+ call showman
+ call showarrows
+ call showexit
+ call locationpic
+ call undertextline
+ mov commandtype,255
+ call readmouse
+ mov pointerframe,0
+ call showpointer
+ call worktoscreen
+ mov al,9
+ mov ah,255
+ call playchannel0
+ mov newlocation,255
+
+select: call delpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ cmp getback,1
+ jz quittravel
+ mov bx,offset cs:destlist
+ call checkcoords
+ cmp newlocation,255
+ jz select
+ mov al,newlocation
+ cmp al,location
+ jz quittravel
+
+ call getridoftemp
+ call getridoftemp2
+ call getridoftemp3
+ mov es,traveltext
+ call deallocatemem
+ ret
+
+quittravel: mov al,reallocation ; was just location
+ mov newlocation,al
+ mov getback,0
+ call getridoftemp
+ call getridoftemp2
+ call getridoftemp3
+ mov es,traveltext
+ call deallocatemem
+ ret
+
+destlist: dw 238,258,4,44,nextdest
+ dw 104,124,4,44,lastdest
+ dw 280,308,4,44,lookatplace
+ dw 104,216,138,192,destselect
+ dw 273,320,157,198,getback1
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+Showcity proc near
+
+ call clearwork
+ mov ds,tempgraphics
+ mov di,57
+ mov bx,32
+ mov al,0
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,120+57
+ mov bx,32
+ mov al,1
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+Lookatplace proc near
+
+ cmp commandtype,224
+ jz alreadyinfo
+ mov commandtype,224
+ mov al,27
+ call commandonly
+alreadyinfo: mov ax,mousebutton
+ and ax,1
+ jz noinfo
+ cmp ax,oldbutton
+ jz noinfo
+
+ mov bl,destpos
+ cmp bl,15
+ jnc noinfo
+
+ push bx
+ call delpointer
+ call deltextline
+ call getundercentre
+ mov ds,tempgraphics3
+ mov al,0
+ mov ah,0
+ mov di,60
+ mov bx,72
+ call showframe
+ mov al,4
+ mov ah,0
+ mov di,60
+ mov bx,72+55
+ call showframe
+ if foreign
+ mov al,4
+ mov ah,0
+ mov di,60
+ mov bx,72+55+21
+ call showframe
+ endif
+ pop bx
+
+ mov bh,0
+ add bx,bx
+ mov es,traveltext
+ mov si,[es:bx]
+ add si,textstart
+ call findnextcolon
+
+ mov di,63
+ if foreign
+ mov bx,84+4
+ else
+ mov bx,84
+ endif
+ mov dl,191
+ mov al,0
+ mov ah,0
+ call printdirect
+ call worktoscreenm
+
+ mov cx,500
+ call hangonp
+
+afterinfo: mov pointermode,0
+ mov pointerframe,0
+ call putundercentre
+ call worktoscreenm
+
+noinfo: ret
+
+ endp
+
+
+
+
+Getundercentre proc near
+
+ mov di,58
+ mov bx,72
+ mov ds,mapstore
+ mov si,0
+ mov cl,254
+ mov ch,110
+ call multiget
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Putundercentre proc near
+
+ mov di,58
+ mov bx,72
+ mov ds,mapstore
+ mov si,0
+ mov cl,254
+ mov ch,110
+ call multiput
+ ret
+
+ endp
+
+
+
+
+
+
+
+Locationpic proc near
+
+ call getdestinfo
+ mov al,[es:si]
+ push es si
+ mov di,0
+ cmp al,6
+ jnc secondlot
+ mov ds,tempgraphics
+ add al,4
+ jmp gotgraphic
+secondlot: sub al,6
+ mov ds,tempgraphics2
+gotgraphic: add di,104
+ mov bx,138+14
+ mov ah,0
+ call showframe
+ pop si es
+ mov al,destpos
+ cmp al,reallocation
+ jnz notinthisone
+ mov al,3
+ mov di,104
+ mov bx,140+14
+ mov ds,tempgraphics
+ mov ah,0
+ call showframe
+notinthisone: mov bl,destpos
+ mov bh,0
+ add bx,bx
+ mov es,traveltext
+ mov si,[es:bx]
+ add si,textstart
+ mov di,50
+ mov bx,20
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+ ret
+
+ endp
+
+
+
+
+Getdestinfo proc near
+
+ mov al,destpos
+ mov ah,0
+ push ax
+ mov dx,seg roomscango
+ mov es,dx
+ mov si,offset es:roomscango
+ add si,ax
+ mov cl,[es:si]
+ pop ax
+ push cx
+ mov dx,seg roompics
+ mov es,dx
+ mov si,offset es:roompics
+ add si,ax
+ pop ax
+ ret
+
+ endp
+
+
+
+
+
+
+Showarrows proc near
+
+ mov di,116-12
+ mov bx,16
+ mov ds,tempgraphics
+ mov al,0
+ mov ah,0
+ call showframe
+ mov di,226+12
+ mov bx,16
+ mov ds,tempgraphics
+ mov al,1
+ mov ah,0
+ call showframe
+ mov di,280
+ mov bx,14
+ mov ds,tempgraphics
+ mov al,2
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Nextdest proc near
+
+duok: cmp commandtype,218
+ jz alreadydu
+ mov commandtype,218
+ mov al,28
+ call commandonly
+alreadydu: mov ax,mousebutton
+ and ax,1
+ jz nodu
+ cmp ax,oldbutton
+ jz nodu
+
+searchdestup: inc destpos
+ cmp destpos,15
+ jnz notlastdest
+ mov destpos,0
+notlastdest: call getdestinfo
+ cmp al,0
+ jz searchdestup
+
+ mov newtextline,1
+ call deltextline
+ call delpointer
+ call showpanel
+ call showman
+ call showarrows
+ call locationpic
+ call undertextline
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+nodu: ret
+
+ endp
+
+
+
+
+
+
+
+Lastdest proc near
+
+ddok: cmp commandtype,219
+ jz alreadydd
+ mov commandtype,219
+ mov al,29
+ call commandonly
+alreadydd: mov ax,mousebutton
+ and ax,1
+ jz nodd
+ cmp ax,oldbutton
+ jz nodd
+
+searchdestdown: dec destpos
+ cmp destpos,-1
+ jnz notfirstdest
+ mov destpos,15
+notfirstdest: call getdestinfo
+ cmp al,0
+ jz searchdestdown
+
+ mov newtextline,1
+ call deltextline
+ call delpointer
+ call showpanel
+ call showman
+ call showarrows
+ call locationpic
+ call undertextline
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+nodd: ret
+
+ endp
+
+
+
+
+
+
+
+
+Destselect proc near
+
+ cmp commandtype,222
+ jz alreadytrav
+ mov commandtype,222
+ mov al,30
+ call commandonly
+alreadytrav: mov ax,mousebutton
+ and ax,1
+ jz notrav
+ cmp ax,oldbutton
+ jz notrav
+
+ call getdestinfo
+ mov al,destpos
+ mov newlocation,al
+notrav: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Getlocation proc near
+
+ mov ah,0
+ mov bx,ax
+ mov dx,seg roomscango
+ mov es,dx
+ add bx,offset es:roomscango
+ mov al,[es:bx]
+ ret
+
+ endp
+
+
+Setlocation proc near ;makes a location accessable
+
+ mov ah,0
+ mov bx,ax
+ mov dx,seg roomscango
+ mov es,dx
+ add bx,offset es:roomscango
+ mov byte ptr [es:bx],1
+ ret
+
+ endp
+
+
+
+
+Resetlocation proc near ;makes a location inaccessable
+
+ push ax
+ cmp al,5
+ jnz notdelhotel
+ call purgealocation
+ mov al,21
+ call purgealocation
+ mov al,22
+ call purgealocation
+ mov al,27
+ call purgealocation
+ jmp clearedlocations
+
+notdelhotel: cmp al,8
+ jnz notdeltvstud
+ call purgealocation
+ mov al,28
+ call purgealocation
+ jmp clearedlocations
+
+notdeltvstud: cmp al,6
+ jnz notdelsarters
+ call purgealocation
+ mov al,20
+ call purgealocation
+ mov al,25
+ call purgealocation
+ jmp clearedlocations
+
+notdelsarters: cmp al,13
+ jnz notdelboathouse
+ call purgealocation
+ mov al,29
+ call purgealocation
+ jmp clearedlocations
+
+notdelboathouse:
+
+clearedlocations: pop ax
+ mov ah,0
+ mov bx,ax
+ mov dx,seg roomscango
+ mov es,dx
+ add bx,offset es:roomscango
+ mov byte ptr [es:bx],0
+ ret
+
+ endp
+
+
+
+
+Readdesticon proc near
+
+ mov dx,offset cs:travelgraphic1
+ call loadintotemp
+
+ mov dx,offset cs:travelgraphic2
+ call loadintotemp2
+
+ mov dx,offset cs:icongraphics8
+ call loadintotemp3
+ ret
+
+ endp
+
+
+
+
+Readcitypic proc near
+
+ mov dx,offset cs:cityname
+ call loadintotemp
+ ret
+
+ endp
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/object.asm b/devtools/tasmrecover/dreamweb/object.asm
new file mode 100644
index 0000000000..19265bb4ac
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/object.asm
@@ -0,0 +1,2608 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;---------------------------------------------------------Inventory printer----
+
+Fillryan proc near
+ ; cx=what to search for
+ mov es,buffers
+ mov di,ryaninvlist
+ call findallryan
+ mov si,ryaninvlist
+ mov al,ryanpage
+ mov ah,0
+ mov cx,20
+ mul cx
+ add si,ax
+
+ mov di,inventx
+ mov bx,inventy
+
+ mov cx,2
+ryanloop2: push cx di bx
+ mov cx,5
+ryanloop1: push cx di bx
+ mov ax,[es:si]
+ add si,2
+ push si es
+ call obtoinv
+ pop es si
+ pop bx di cx
+ add di,itempicsize
+ loop ryanloop1
+ pop bx di cx
+ add bx,itempicsize
+ loop ryanloop2
+
+ call showryanpage
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Fillopen proc near
+
+ call deltextline
+
+ call getopenedsize ;find out how many slots
+ cmp ah,4 ;ah=slots, al=size holdable
+ jc lessthanapage
+ mov ah,4
+lessthanapage: mov al,1
+
+ push ax
+ mov es,buffers
+ mov di,openinvlist
+ call findallopen
+ mov si,openinvlist
+ mov di,inventx
+ mov bx,inventy+96
+ pop cx
+
+openloop1: push cx di bx
+ mov ax,[es:si]
+ add si,2
+ push si es
+ cmp ch,cl
+ jc nextopenslot
+ call obtoinv
+nextopenslot: pop es si
+ pop bx di cx
+ add di,itempicsize
+ inc cl
+ cmp cl,5
+ jnz openloop1
+
+ call undertextline
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Findallryan proc near
+
+ push di
+ mov cx,30
+ mov ax,0ffffh
+ rep stosw
+ pop di
+
+ mov cl,4
+ mov ds,extras
+ mov bx,exdata
+ mov ch,0
+findryanloop: cmp [bx+2],cl
+ jnz notinryaninv
+ cmp byte ptr [bx+3],255
+ jnz notinryaninv
+ mov al,[bx+4]
+ mov ah,0
+ push di
+ add di,ax
+ add di,ax
+ mov al,ch
+ mov ah,4 ;means it is an exchanged object ie:not free or set
+ stosw
+ pop di
+notinryaninv: add bx,16
+ inc ch
+ cmp ch,numexobjects
+ jnz findryanloop
+ ret
+
+ endp
+
+
+
+
+
+
+
+Findallopen proc near
+
+ push di
+ mov cx,16
+ mov ax,0ffffh
+ rep stosw
+ pop di
+
+ mov cl,openedob
+ mov dl,openedtype
+ mov ds,extras
+ mov bx,exdata
+ mov ch,0
+findopen1: cmp [bx+3],cl
+ jnz findopen2
+ cmp [bx+2],dl
+ jnz findopen2
+ cmp openedtype,4
+ jz noloccheck
+ mov al,[bx+5]
+ cmp al,reallocation
+ jnz findopen2
+noloccheck: mov al,[bx+4]
+ mov ah,0
+ push di
+ add di,ax
+ add di,ax
+ mov al,ch
+ mov ah,4
+ stosw
+ pop di
+findopen2: add bx,16
+ inc ch
+ cmp ch,numexobjects
+ jnz findopen1
+
+ mov cl,openedob
+ mov dl,openedtype
+ push dx
+ mov ds,freedat
+ pop dx
+ mov bx,0
+ mov ch,0
+findopen1a: cmp [bx+3],cl
+ jnz findopen2a
+ cmp [bx+2],dl
+ jnz findopen2a
+ mov al,[bx+4]
+ mov ah,0
+ push di
+ add di,ax
+ add di,ax
+ mov al,ch
+ mov ah,2 ; means it's in a free ob
+ stosw
+ pop di
+findopen2a: add bx,16
+ inc ch
+ cmp ch,80
+ jnz findopen1a
+ ret
+
+ endp
+
+
+
+
+
+
+Obtoinv proc near
+
+ push bx es si ax
+
+ push ax di bx
+ mov ds,icons1
+ sub di,2
+ sub bx,1
+ mov al,10
+ mov ah,0
+ call showframe
+ pop bx di ax
+ cmp al,255
+ jz finishfill
+
+ push bx di ax
+ mov ds,extras
+ cmp ah,4
+ jz isanextra
+ mov ds,freeframes
+isanextra: mov cl,al
+ add al,al
+ add al,cl
+ inc al
+ mov ah,128
+ add bx,19
+ add di,18
+ call showframe
+ pop ax di bx
+
+ push bx
+ call getanyaddir
+ call isitworn
+ pop bx
+ jnz finishfill
+ mov ds,icons1 ;Print wearing logo
+ sub di,3
+ sub bx,2
+ mov al,7
+ mov ah,0
+ call showframe
+
+finishfill: pop ax si es bx
+ ret
+
+ endp
+
+
+
+
+
+Isitworn proc near ;zero if yes
+
+ mov al,[es:bx+12]
+ cmp al,"W"-"A"
+ jnz notworn
+ mov al,[es:bx+13]
+ cmp al,"E"-"A"
+notworn: ret
+
+ endp
+
+
+
+Makeworn proc near
+
+ mov byte ptr [es:bx+12],"W"-"A"
+ mov byte ptr [es:bx+13],"E"-"A"
+ ret
+
+ endp
+
+
+
+
+
+
+;-------------------------------------------------------Examining an object----
+
+Examineob proc near
+
+ mov pointermode,0
+ mov timecount,0
+
+examineagain: mov inmaparea,0
+ mov examagain,0
+ mov openedob,255
+ mov openedtype,255
+ mov invopen,0
+ mov al,commandtype
+ mov objecttype,al
+ mov itemframe,0
+ mov pointerframe,0
+
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call obicons
+ call obpicture
+ call describeob
+ call undertextline
+
+ mov commandtype,255
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+
+waitexam: ;call delpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ call delpointer
+
+ mov getback,0
+ mov bx,offset cs:examlist
+ cmp invopen,0
+ jz notuseinv
+ mov bx,offset cs:invlist1
+ cmp invopen,1
+ jz notuseinv
+ mov bx,offset cs:withlist1
+notuseinv: call checkcoords
+ cmp examagain,0
+ jz norex
+ jmp examineagain
+norex: cmp getback,0
+ jz waitexam
+
+ mov pickup,0
+ cmp watchingtime,0
+ jnz iswatching
+ cmp newlocation,255
+ jnz justgetback
+
+iswatching: call makemainscreen
+ mov invopen,0
+ mov openedob,255
+ ret
+
+justgetback: mov invopen,0
+ mov openedob,255
+ ret
+
+examlist: dw 273,320,157,198,getbackfromob
+ dw 260,300,0,44,useobject
+ dw 210,254,0,44,selectopenob
+ dw 144,176,64,96,setpickup
+ dw 0,50,50,200,examinventory
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+invlist1: dw 273,320,157,198,getbackfromob
+ dw 255,294,0,24,dropobject
+ dw inventx+167,inventx+167+(18*3),inventy-18,inventy-2,incryanpage
+ dw inventx
+openchangesize: dw inventx+(4*itempicsize)
+ dw inventy+100,inventy+100+itempicsize,useopened
+ dw inventx,inventx+(5*itempicsize)
+ dw inventy,inventy+(2*itempicsize),intoinv
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+withlist1: dw 273,320,157,198,getbackfromob
+ dw inventx+167,inventx+167+(18*3),inventy-18,inventy-2,incryanpage
+ dw inventx,inventx+(5*itempicsize)
+ dw inventy,inventy+(2*itempicsize),selectob
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+Makemainscreen proc near
+
+ call createpanel
+ mov newobs,1
+ call drawfloor
+ call spriteupdate
+ call printsprites
+ call reelsonscreen
+ call showicon
+ call getunderzoom
+ call undertextline
+ mov commandtype,255
+ call animpointer
+ call worktoscreenm
+ mov commandtype,200
+ mov manisoffscreen,0
+ ret
+
+ endp
+
+
+
+
+Getbackfromob proc near
+
+ cmp pickup,1
+ jnz notheldob
+ call blank
+ ret
+notheldob: call getback1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Incryanpage proc near
+
+ cmp commandtype,222
+ jz alreadyincryan
+ mov commandtype,222
+ mov al,31
+ call commandonly
+alreadyincryan: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz noincryan
+ and ax,1
+ jnz doincryan
+noincryan: ret
+
+doincryan: mov ax,mousex
+ sub ax,inventx+167
+ mov ryanpage,-1
+findnewpage: inc ryanpage
+ sub ax,18
+ jnc findnewpage
+ call delpointer
+ call fillryan
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+Openinv proc near
+
+ mov invopen,1
+ mov al,61
+ mov di,inventx
+ mov bx,inventy-10
+ mov dl,240
+ call printmessage
+ call fillryan
+ mov commandtype,255
+ ret
+
+ endp
+
+
+
+
+
+
+
+Showryanpage proc near
+
+ mov ds,icons1
+ mov di,inventx+167
+ mov bx,inventy-12
+ mov al,12
+ mov ah,0
+ call showframe
+
+ mov al,13
+ add al,ryanpage
+ push ax
+ mov al,ryanpage
+ mov ah,0
+ mov cx,18
+ mul cx
+ mov ds,icons1
+ mov di,inventx+167
+ add di,ax
+ mov bx,inventy-12
+ pop ax
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Openob proc near
+
+ mov al,openedob
+ mov ah,openedtype
+ mov di,offset cs:commandline
+ call copyname
+
+ mov di,inventx
+ mov bx,inventy+86
+ mov al,62
+ mov dl,240
+ call printmessage
+
+ mov di,lastxpos
+ add di,5
+ mov bx,inventy+86
+ push cs
+ pop es
+ mov si,offset cs:commandline
+ mov dl,220
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ call fillopen
+ call getopenedsize
+ mov al,ah
+ mov ah,0
+ mov cx,itempicsize
+ mul cx
+ add ax,inventx
+ mov bx,offset cs:openchangesize
+ mov [cs:bx],ax
+ ret
+
+ endp
+
+
+
+
+
+
+Obicons proc near
+
+ mov al,command
+ call getanyad
+ cmp al,255
+ jz cantopenit
+
+ mov ds,icons2
+ mov di,210
+ mov bx,1
+ mov al,4
+ mov ah,0
+ call showframe
+
+cantopenit: mov ds,icons2
+ mov di,260
+ mov bx,1
+ mov al,1
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+Examicon proc near
+
+ mov ds,icons2
+ mov di,254
+ mov bx,5
+ mov al,3
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+Obpicture proc near
+
+ mov al,command
+ mov ah,objecttype
+ cmp ah,1
+ jz setframe
+ cmp ah,4
+ jz exframe
+
+ mov ds,freeframes
+ mov di,160
+ mov bx,68
+ mov cl,al
+ add al,al
+ add al,cl
+ inc al
+ mov ah,128
+ call showframe
+ ret
+
+setframe: ret
+
+exframe: mov ds,extras
+ mov di,160
+ mov bx,68
+ mov cl,al
+ add al,al
+ add al,cl
+ inc al
+ mov ah,128
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Describeob proc near
+
+ call getobtextstart
+
+ mov di,33
+ mov bx,92
+ if foreign
+ cmp objecttype,1
+ jnz notsetd
+ mov bx,82
+notsetd: endif
+ mov dl,241
+ mov ah,16
+ mov charshift,91+91
+ call printdirect
+ mov charshift,0
+ mov di,36
+ mov bx,104
+ if foreign
+ cmp objecttype,1
+ jnz notsetd2
+ mov bx,94
+notsetd2: endif
+ mov dl,241
+ mov ah,0
+ call printdirect
+ push bx
+ call obsthatdothings
+ pop bx
+ call additionaltext
+ ret
+
+
+ endp
+
+
+
+
+
+Additionaltext proc near
+
+ add bx,10
+ push bx
+ mov al,command
+ mov ah,objecttype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"E"
+ call compare
+ jz emptycup
+ mov al,command
+ mov ah,objecttype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"F"
+ call compare
+ jz fullcup
+ pop bx
+ ret
+emptycup: mov al,40
+ call findpuztext
+ pop bx
+ mov di,36
+ mov dl,241
+ mov ah,0
+ call printdirect
+ ret
+fullcup: mov al,39
+ call findpuztext
+ pop bx
+ mov di,36
+ mov dl,241
+ mov ah,0
+ call printdirect
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Obsthatdothings proc near
+
+ mov al,command
+ mov ah,objecttype
+ mov cl,"M"
+ mov ch,"E"
+ mov dl,"M"
+ mov dh,"B"
+ call compare
+ jnz notlouiscard
+ mov al,4
+ call getlocation
+ cmp al,1
+ jz seencard
+ mov al,4
+ call setlocation
+ call lookatcard
+seencard: ret
+notlouiscard: ret
+
+ endp
+
+
+
+
+
+
+
+Getobtextstart proc near
+
+ mov es,freedesc
+ mov si,freetextdat
+ mov cx,freetext
+ cmp objecttype,2
+ jz describe
+ mov es,setdesc
+ mov si,settextdat
+ mov cx,settext
+ cmp objecttype,1
+ jz describe
+ mov es,extras
+ mov si,extextdat
+ mov cx,extext
+
+describe: mov al,command
+ mov ah,0
+ add ax,ax
+ add si,ax
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ mov bx,ax
+tryagain: push si
+ call findnextcolon
+ mov al,[es:si]
+ mov cx,si
+ pop si
+ cmp objecttype,1
+ jnz cantmakeoneup
+ cmp al,0
+ jz findsometext
+ cmp al,":"
+ jz findsometext
+cantmakeoneup: ret
+
+findsometext: call searchforsame
+ jmp tryagain
+ ret
+
+ endp
+
+
+
+
+
+
+Searchforsame proc near
+
+ mov si,cx
+searchagain: inc si
+ mov al,[es:bx]
+search: cmp [es:si],al
+ jz gotstartletter
+ inc cx
+ inc si
+ cmp si,8000 ;arbitrary give-up
+ jc search ;counter.
+ mov si,bx
+ pop ax
+ ret
+
+gotstartletter: push bx si
+keepchecking: inc si
+ inc bx
+ mov al,[es:bx]
+ mov ah,[es:si]
+ cmp al,":"
+ jz foundmatch
+ cmp al,0
+ jz foundmatch
+ cmp al,ah
+ jz keepchecking
+ pop si bx
+ jmp searchagain
+
+foundmatch: pop si bx
+ ret
+
+ endp
+
+
+
+
+
+
+
+;-----------------------------------------------------------Using an object----
+
+
+
+
+
+Findnextcolon proc near
+
+isntcolon: mov al,[es:si]
+ inc si
+ cmp al,0
+ jz endofcolon
+ cmp al,":"
+ jnz isntcolon
+endofcolon: ret
+
+ endp
+
+
+;------------------------------------------------------Taking, dropping etc----
+
+
+
+
+
+
+Inventory proc near
+
+ cmp mandead,1
+ jz iswatchinv
+ cmp watchingtime,0
+ jz notwatchinv
+iswatchinv: call blank
+ ret
+notwatchinv: cmp commandtype,239
+ jz alreadyopinv
+ mov commandtype,239
+ mov al,32
+ call commandonly
+alreadyopinv: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz cantopinv
+ and ax,1
+ jnz doopeninv
+cantopinv: ret
+
+doopeninv: mov timecount,0
+ mov pointermode,0
+ mov inmaparea,0
+ call animpointer
+ call createpanel
+ call showpanel
+ call examicon
+ call showman
+ call showexit
+ call undertextline
+ mov pickup,0
+ mov invopen,2
+ call openinv
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov openedob,255
+ jmp waitexam ; very naughty!
+
+ endp
+
+
+
+
+
+
+Setpickup proc near
+
+ cmp objecttype,1
+ jz cantpick
+ cmp objecttype,3
+ jz cantpick
+ call getanyad
+ mov al,[es:bx+2]
+ cmp al,4
+ jnz canpick
+cantpick: call blank
+ ret
+
+canpick: cmp commandtype,209
+ jz alreadysp
+ mov commandtype,209
+
+ mov bl,command
+ mov bh,objecttype
+ mov al,33
+ call commandwithob
+alreadysp: mov ax,mousebutton
+ cmp ax,1
+ jnz nosetpick
+ cmp ax,oldbutton
+ jnz dosetpick
+nosetpick: ret
+
+dosetpick: call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call examicon
+ mov pickup,1
+ mov invopen,2
+ cmp objecttype,4
+ jz pickupexob
+
+ mov al,command
+ mov itemframe,al
+ mov openedob,255
+ call transfertoex
+ mov itemframe,al
+ mov objecttype,4
+ call geteitherad
+ mov byte ptr [es:bx+2],20 ; means it is in transit
+ mov byte ptr [es:bx+3],255
+ call openinv
+ call worktoscreenm
+ ret
+
+pickupexob: mov al,command
+ mov itemframe,al
+ mov openedob,255
+ call openinv
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+Examinventory proc near
+
+ cmp commandtype,249
+ jz alreadyexinv
+ mov commandtype,249
+ mov al,32
+ call commandonly
+alreadyexinv: mov ax,mousebutton
+ and ax,1
+ jnz doexinv
+ ret
+
+doexinv: call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call examicon
+ mov pickup,0
+ mov invopen,2
+ call openinv
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+Reexfrominv proc near
+
+ call findinvpos
+ mov ax,[es:bx]
+ mov commandtype,ah
+ mov command,al
+ mov examagain,1
+ mov pointermode,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+Reexfromopen proc near
+
+ ret
+ call findopenpos
+ mov ax,[es:bx]
+ mov commandtype,ah
+ mov command,al
+ mov examagain,1
+ mov pointermode,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Swapwithinv proc near
+
+ mov al,itemframe
+ mov ah,objecttype
+ cmp ax,oldsubject
+ jnz difsub7
+ cmp commandtype,243
+ jz alreadyswap1
+ mov commandtype,243
+
+difsub7: mov oldsubject,ax
+ mov bx,ax
+ mov al,34
+ call commandwithob
+alreadyswap1: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz cantswap1
+ and ax,1
+ jnz doswap1
+cantswap1: ret
+
+doswap1: mov ah,objecttype
+ mov al,itemframe
+ push ax
+
+ call findinvpos
+ mov ax,[es:bx]
+ mov itemframe,al
+ mov objecttype,ah
+ call geteitherad
+ mov byte ptr [es:bx+2],20 ; means unplaced object
+ mov byte ptr [es:bx+3],255
+ mov bl,itemframe
+ mov bh,objecttype
+
+ pop ax
+ mov objecttype,ah
+ mov itemframe,al
+ push bx
+
+ call findinvpos ;NONE OF THIS IS NEEDED
+ call delpointer ;ONLY EXTRAS CAN BE IN
+ mov al,itemframe
+ call geteitherad
+ mov byte ptr [es:bx+2],4
+ mov byte ptr [es:bx+3],255
+ mov al,lastinvpos
+ mov [es:bx+4],al
+
+ pop ax
+ mov objecttype,ah
+ mov itemframe,al
+ call fillryan
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Swapwithopen proc near
+
+ mov al,itemframe
+ mov ah,objecttype
+ cmp ax,oldsubject
+ jnz difsub8
+ cmp commandtype,242
+ jz alreadyswap2
+ mov commandtype,242
+
+difsub8: mov oldsubject,ax
+ mov bx,ax
+ mov al,34
+ call commandwithob
+alreadyswap2: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz cantswap2
+ and ax,1
+ jnz doswap2
+cantswap2: ret
+
+doswap2: call geteitherad
+ call isitworn
+ jnz notwornswap
+ call wornerror
+ ret
+notwornswap: call delpointer
+ mov al,itemframe
+ cmp al,openedob
+ jnz isntsame2
+ mov al,objecttype
+ cmp al,openedtype
+ jnz isntsame2
+ call errormessage1
+ ret
+
+isntsame2: call checkobjectsize
+ cmp al,0
+ jz sizeok2
+ ret
+
+sizeok2: mov ah,objecttype
+ mov al,itemframe
+ push ax
+
+ call findopenpos
+ mov ax,[es:bx]
+ mov itemframe,al
+ mov objecttype,ah
+
+ cmp ah,4
+ jnz makeswapex
+ call geteitherad
+ mov byte ptr [es:bx+2],20
+ mov byte ptr [es:bx+3],255
+ jmp actuallyswap
+
+makeswapex: call transfertoex
+ mov itemframe,al
+ mov objecttype,4
+ call geteitherad
+ mov byte ptr [es:bx+2],20
+ mov byte ptr [es:bx+3],255
+
+actuallyswap: mov bl,itemframe
+ mov bh,objecttype
+ pop ax
+ mov objecttype,ah
+ mov itemframe,al
+ push bx
+
+ call findopenpos
+ call geteitherad
+ mov al,openedtype
+ mov byte ptr [es:bx+2],al
+ mov al,openedob
+ mov byte ptr [es:bx+3],al
+ mov al,lastinvpos
+ mov [es:bx+4],al
+ mov al,reallocation
+ mov [es:bx+5],al
+
+ pop ax
+ mov objecttype,ah
+ mov itemframe,al
+ call fillopen
+ call fillryan
+ call undertextline
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Intoinv proc near
+
+ cmp pickup,0
+ jnz notout
+ call outofinv
+ ret
+
+notout: call findinvpos
+ mov ax,[es:bx]
+ cmp al,255
+ jz canplace1
+ call swapwithinv
+ ret
+
+canplace1: mov al,itemframe
+ mov ah,objecttype
+ cmp ax,oldsubject
+ jnz difsub1
+ cmp commandtype,220
+ jz alreadyplce
+ mov commandtype,220
+
+difsub1: mov oldsubject,ax
+ mov bx,ax
+ mov al,35
+ call commandwithob
+alreadyplce: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notletgo2
+ and ax,1
+ jnz doplace
+notletgo2: ret
+
+doplace: call delpointer
+ mov al,itemframe
+ call getexad
+ mov byte ptr [es:bx+2],4
+ mov byte ptr [es:bx+3],255
+ mov al,lastinvpos
+ mov [es:bx+4],al
+
+ mov pickup,0
+ call fillryan
+ call readmouse
+ call showpointer
+ call outofinv
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+Deletetaken proc near ;gets rid of objects that were
+ ;transfered to exlist ages ago
+ mov es,freedat
+ mov ah,reallocation
+ mov ds,extras
+ mov si,exdata
+
+ mov cx,numexobjects
+takenloop: mov al,[si+11]
+ cmp al,ah
+ jnz notinhere
+ mov bl,[si+1]
+ mov bh,0
+ add bx,bx
+ add bx,bx
+ add bx,bx
+ add bx,bx
+ mov byte ptr [es:bx+2],254 ; was 255
+
+notinhere: add si,16
+ loop takenloop
+
+ ret
+
+ endp
+
+
+
+
+
+
+Outofinv proc near
+
+ call findinvpos
+ mov ax,[es:bx]
+ cmp al,255
+ jnz canpick2
+ call blank
+ ret
+
+canpick2: mov bx,mousebutton
+ cmp bx,2
+ jnz canpick2a
+ call reexfrominv
+ ret
+
+canpick2a: cmp ax,oldsubject
+ jnz difsub3
+ cmp commandtype,221
+ jz alreadygrab
+ mov commandtype,221
+
+difsub3: mov oldsubject,ax
+ mov bx,ax
+ mov al,36
+ call commandwithob
+alreadygrab: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notletgo
+ and ax,1
+ jnz dograb
+notletgo: ret
+
+dograb: call delpointer
+ mov pickup,1
+ call findinvpos
+ mov ax,[es:bx]
+ mov itemframe,al
+ mov objecttype,ah
+ call getexad
+ mov byte ptr [es:bx+2],20 ; means unplaced object
+ mov byte ptr [es:bx+3],255
+ call fillryan
+ call readmouse
+ call showpointer
+ call intoinv
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+Getfreead proc near
+
+ mov ah,0
+ mov cl,4
+ shl ax,cl
+ mov bx,ax
+ mov es,freedat
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Getexad proc near
+
+ mov ah,0
+ mov bx,16
+ mul bx
+ mov bx,ax
+ mov es,extras
+ add bx,exdata
+ ret
+
+ endp
+
+
+
+
+
+
+Geteitherad proc near
+
+ cmp objecttype,4
+ jz isinexlist
+ mov al,itemframe
+ call getfreead
+ ret
+isinexlist: mov al,itemframe
+ call getexad
+ ret
+
+ endp
+
+
+
+
+
+
+Getanyad proc near ;nearly same as above
+ ;but uses command
+ cmp objecttype,4
+ jz isex
+ cmp objecttype,2
+ jz isfree
+ mov al,command
+ call getsetad
+ mov ax,[es:bx+4]
+ ret
+isfree: mov al,command
+ call getfreead
+ mov ax,[es:bx+7]
+ ret
+isex: mov al,command
+ call getexad
+ mov ax,[es:bx+7]
+ ret
+
+ endp
+
+
+
+Getanyaddir proc near ;nearly same as above
+ ;but uses ax
+ cmp ah,4
+ jz isex3
+ cmp ah,2
+ jz isfree3
+ call getsetad
+ ret
+isfree3: call getfreead
+ ret
+isex3: call getexad
+ ret
+
+ endp
+
+
+
+
+
+
+Getopenedsize proc near ;nearly same as above again
+ ;but finds ad of opened ob
+ cmp openedtype,4
+ jz isex2
+ cmp openedtype,2
+ jz isfree2
+ mov al,openedob
+ call getsetad
+ mov ax,[es:bx+3]
+ ret
+isfree2: mov al,openedob
+ call getfreead
+ mov ax,[es:bx+7]
+ ret
+isex2: mov al,openedob
+ call getexad
+ mov ax,[es:bx+7]
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Getsetad proc near
+
+ mov ah,0
+ mov bx,64
+ mul bx
+ mov bx,ax
+ mov es,setdat
+ ret
+
+ endp
+
+
+
+
+
+
+Findinvpos proc near
+
+ mov cx,mousex
+ sub cx,inventx
+ mov bx,-1
+findinv1: inc bx
+ sub cx,itempicsize
+ jnc findinv1
+
+ mov cx,mousey
+ sub cx,inventy
+ sub bx,5
+findinv2: add bx,5
+ sub cx,itempicsize
+ jnc findinv2
+
+ mov al,ryanpage
+ mov ah,0
+ mov cx,10
+ mul cx
+ add bx,ax
+
+ mov al,bl
+ mov lastinvpos,al
+ add bx,bx
+
+ mov es,buffers
+ add bx,ryaninvlist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Findopenpos proc near
+
+ mov cx,mousex
+ sub cx,inventx
+ mov bx,-1
+findopenp1: inc bx
+ sub cx,itempicsize
+ jnc findopenp1
+
+ mov al,bl
+ mov lastinvpos,al
+
+ add bx,bx
+ mov es,buffers
+ add bx,openinvlist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+;--------------------------------------------------------Dropping an object----
+
+Dropobject proc near
+
+ cmp commandtype,223
+ jz alreadydrop
+ mov commandtype,223
+ cmp pickup,0
+ jz blank
+
+ mov bl,itemframe
+ mov bh,objecttype
+ mov al,37
+ call commandwithob
+alreadydrop: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nodrop
+ and ax,1
+ jnz dodrop
+nodrop: ret
+
+dodrop: call geteitherad
+ call isitworn
+ jnz nowornerror
+ call wornerror
+ ret
+nowornerror: cmp reallocation,47
+ jz nodrop2
+ mov cl,ryanx
+ add cl,12
+ mov ch,ryany
+ add ch,12
+ call checkone
+ cmp cl,2
+ jc nodroperror
+nodrop2: call droperror
+ ret
+nodroperror: cmp mapxsize,64
+ jnz notinlift
+ cmp mapysize,64
+ jnz notinlift
+ call droperror
+ ret
+notinlift: mov al,itemframe
+ mov ah,4
+ mov cl,"G"
+ mov ch,"U"
+ mov dl,"N"
+ mov dh,"A"
+ call compare
+ jz cantdrop
+ mov al,itemframe
+ mov ah,4
+ mov cl,"S"
+ mov ch,"H"
+ mov dl,"L"
+ mov dh,"D"
+ call compare
+ jz cantdrop
+ mov objecttype,4
+ mov al,itemframe
+ call getexad
+ mov byte ptr [es:bx+2],0
+ mov al,ryanx
+ add al,4
+ mov cl,4
+ shr al,cl
+ add al,mapx
+ mov ah,ryany
+ add ah,8
+ mov cl,4
+ shr ah,cl
+ add ah,mapy
+ mov byte ptr [es:bx+3],al
+ mov byte ptr [es:bx+5],ah
+ mov al,ryanx
+ add al,4
+ and al,15
+ mov ah,ryany
+ add ah,8
+ and ah,15
+ mov byte ptr [es:bx+4],al
+ mov byte ptr [es:bx+6],ah
+ mov pickup,0
+ mov al,reallocation
+ mov [es:bx],al
+ ret
+
+ endp
+
+
+
+
+Droperror proc near
+
+ mov commandtype,255
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,56
+ mov dl,240
+ call printmessage
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ mov commandtype,255
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+Cantdrop proc near
+
+ mov commandtype,255
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,24
+ mov dl,240
+ call printmessage
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ mov commandtype,255
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+Wornerror proc near
+
+ mov commandtype,255
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,57
+ mov dl,240
+ call printmessage
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ mov commandtype,255
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Removeobfrominv proc near
+
+ cmp command,100
+ jz obnotexist
+ call getanyad
+ mov di,bx
+ mov cl,command
+ mov ch,0
+ call deleteexobject
+ ;mov byte ptr [es:bx+2],0
+obnotexist: ret
+
+ endp
+
+
+
+
+;---------------------------------------------------------Opening an object----
+
+Selectopenob proc near
+
+ mov al,command
+ call getanyad
+ cmp al,255
+ jnz canopenit1
+ call blank
+ ret
+
+canopenit1: cmp commandtype,224
+ jz alreadyopob
+ mov commandtype,224
+
+ mov bl,command
+ mov bh,objecttype
+ mov al,38
+ call commandwithob
+alreadyopob: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz noopenob
+ and ax,1
+ jnz doopenob
+noopenob: ret
+
+doopenob: mov al,command
+ mov openedob,al
+ mov al,objecttype
+ mov openedtype,al
+
+ call createpanel
+ call showpanel
+ call showman
+ call examicon
+ call showexit
+ call openinv
+ call openob
+ call undertextline
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Useopened proc near
+
+ cmp openedob,255
+ jz cannotuseopen
+ cmp pickup,0
+ jnz notout2
+ call outofopen
+ ret
+
+notout2: call findopenpos
+ mov ax,[es:bx]
+ cmp al,255
+ jz canplace3
+ call swapwithopen
+cannotuseopen: ret
+
+canplace3: cmp pickup,1
+ jz intoopen
+ call blank
+ ret
+
+intoopen: mov al,itemframe
+ mov ah,objecttype
+ cmp ax,oldsubject
+ jnz difsub2
+ cmp commandtype,227
+ jz alreadyplc2
+ mov commandtype,227
+
+difsub2: mov oldsubject,ax
+ mov bx,ax
+ mov al,35
+ call commandwithob
+alreadyplc2: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notletgo3
+ cmp ax,1
+ jz doplace2
+notletgo3: ret
+
+doplace2: call geteitherad
+ call isitworn
+ jnz notworntoopen
+ call wornerror
+ ret
+notworntoopen: call delpointer
+ mov al,itemframe
+ cmp al,openedob
+ jnz isntsame
+ mov al,objecttype
+ cmp al,openedtype
+ jnz isntsame
+ call errormessage1
+ ret
+
+isntsame: call checkobjectsize
+ cmp al,0
+ jz sizeok1
+ ret
+
+sizeok1: mov pickup,0
+ mov al,itemframe
+ call geteitherad
+ mov al,openedtype
+ mov byte ptr [es:bx+2],al
+ mov al,openedob
+ mov byte ptr [es:bx+3],al
+ mov al,lastinvpos
+ mov [es:bx+4],al
+ mov al,reallocation
+ mov [es:bx+5],al
+ call fillopen
+ call undertextline
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Errormessage1 proc near
+
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,58
+ mov dl,240
+ call printmessage
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+Errormessage2 proc near
+
+ mov commandtype,255
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,59
+ mov dl,240
+ call printmessage
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Errormessage3 proc near
+
+ call delpointer
+ mov di,76
+ mov bx,21
+ mov al,60
+ mov dl,240
+ call printmessage
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call showpanel
+ call showman
+ call examicon
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+Checkobjectsize proc near
+
+ call getopenedsize
+ push ax
+ mov al,itemframe
+ call geteitherad
+ mov al,[es:bx+9]
+ pop cx
+
+ cmp al,255 ;gives a size of 6 if no
+ jnz notunsized ;size was defined in the editor
+ mov al,6 ;could be a bad idea
+notunsized:
+
+
+ cmp al,100
+ jnc specialcase
+ cmp cl,100
+ jc isntspecial
+ call errormessage3
+ jmp sizewrong
+isntspecial: cmp cl,al
+ jnc sizeok
+specialcase: sub al,100
+ cmp cl,100
+ jnc bothspecial
+ cmp cl,al
+ jnc sizeok
+ call errormessage2
+ jmp sizewrong
+bothspecial: sub cl,100
+ cmp al,cl
+ jz sizeok
+ call errormessage3
+sizewrong: mov al,1
+ ret
+sizeok: mov al,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Outofopen proc near
+
+ cmp openedob,255
+ jz cantuseopen
+ call findopenpos
+ mov ax,[es:bx]
+ cmp al,255
+ jnz canpick4
+cantuseopen: call blank
+ ret
+
+canpick4: cmp ax,oldsubject
+ jnz difsub4
+ cmp commandtype,228
+ jz alreadygrb
+ mov commandtype,228
+
+difsub4: mov oldsubject,ax
+ mov bx,ax
+ mov al,36
+ call commandwithob
+alreadygrb: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notletgo4
+ cmp ax,1
+ jz dogrb
+ cmp ax,2
+ jnz notletgo4
+ call reexfromopen
+notletgo4: ret
+
+dogrb: call delpointer
+ mov pickup,1
+ call findopenpos
+ mov ax,[es:bx]
+ mov itemframe,al
+ mov objecttype,ah
+
+ cmp ah,4
+ jnz makeintoex
+ call geteitherad
+ mov byte ptr [es:bx+2],20 ; means unplaced object
+ mov byte ptr [es:bx+3],255
+ jmp actuallyout
+
+makeintoex: call transfertoex
+ mov itemframe,al
+ mov objecttype,4
+ call geteitherad
+ mov byte ptr [es:bx+2],20 ; means it is in transit
+ mov byte ptr [es:bx+3],255
+
+actuallyout: call fillopen
+ call undertextline
+ call readmouse
+ call useopened
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+;All Extra object code - adding and removing plus purge routines -------------
+
+
+
+
+
+
+Transfertoex proc near
+
+ call emergencypurge
+
+ call getexpos
+ mov al,expos
+ push ax
+
+ push di
+ mov al,itemframe
+ mov ah,0
+ mov bx,16
+ mul bx
+ mov ds,freedat
+ mov si,ax
+ mov cx,8
+ rep movsw
+ pop di
+
+ mov al,reallocation
+ mov [es:di],al
+ mov [es:di+11],al
+ mov al,itemframe
+ mov [es:di+1],al
+ mov byte ptr [es:di+2],4
+ mov byte ptr [es:di+3],255
+ mov al,lastinvpos
+ mov [es:di+4],al
+
+ mov al,itemframe
+ mov itemtotran,al
+ call transfermap
+ call transferinv
+ call transfertext
+
+ mov al,itemframe
+ mov ah,0
+ mov bx,16
+ mul bx
+ mov ds,freedat
+ mov si,ax
+ mov byte ptr [si+2],254 ; was 255
+ call pickupconts
+
+ pop ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Pickupconts proc near
+
+ mov al,[si+7]
+ cmp al,255
+ jz notopenable
+
+ mov al,itemframe
+ mov ah,objecttype
+ mov dl,expos
+ ;dec dl
+ mov es,freedat
+ mov bx,0
+ mov cx,0
+pickupcontloop: push cx es bx dx ax
+
+ cmp byte ptr [es:bx+2],ah
+ jnz notinsidethis
+ cmp byte ptr [es:bx+3],al
+ jnz notinsidethis
+
+ mov itemtotran,cl
+ call transfercontoex
+
+notinsidethis: pop ax dx bx es cx
+ add bx,16
+ inc cx
+ cmp cx,80
+ jnz pickupcontloop
+
+notopenable: ret
+
+ endp
+
+
+
+
+
+
+
+Transfercontoex proc near
+
+ push es bx
+
+ push dx es bx
+ call getexpos
+ pop si ds
+
+ push di
+ mov cx,8
+ rep movsw
+ pop di
+ pop dx
+
+ mov al,reallocation
+ mov [es:di],al
+ mov [es:di+11],al
+ mov al,itemtotran
+ mov [es:di+1],al
+ mov [es:di+3],dl
+ mov byte ptr [es:di+2],4
+
+ call transfermap
+ call transferinv
+ call transfertext
+ ;inc expos
+
+ pop si ds
+ mov byte ptr [si+2],255
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Transfertext proc near
+
+ mov es,extras
+ mov al,expos
+ mov ah,0
+ add ax,ax
+ mov bx,extextdat
+ add bx,ax
+ mov di,extextpos
+ mov [es:bx],di
+ add di,extext
+
+ mov al,itemtotran
+ mov ah,0
+ add ax,ax
+ mov ds,freedesc
+ mov bx,freetextdat
+ add bx,ax
+ mov si,freetext
+ mov ax,[bx]
+ add si,ax
+
+moretext: lodsb
+ stosb
+ inc extextpos
+ cmp al,0
+ jnz moretext
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Getexpos proc near
+
+
+ mov es,extras
+ mov al,0
+ mov di,exdata
+tryanotherex: cmp byte ptr [es:di+2],255
+ jz foundnewex
+ add di,16
+ inc al
+ cmp al,numexobjects
+ jnz tryanotherex
+foundnewex: mov expos,al
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Purgealocation proc near
+
+ push ax
+ mov es,extras
+ mov di,exdata
+ pop bx
+ mov cx,0
+purgeloc: cmp bl,[es:di+0]
+ jnz dontpurge
+ cmp byte ptr [es:di+2],0
+ jnz dontpurge
+ push di es bx cx
+ call deleteexobject
+ pop cx bx es di
+dontpurge: add di,16
+ inc cx
+ cmp cx,numexobjects
+ jnz purgeloc
+ ret
+
+ endp
+
+
+
+
+
+Emergencypurge proc near
+
+checkpurgeagain: mov ax,exframepos
+ add ax,4000
+ cmp ax,exframeslen
+ jc notnearframeend
+ call purgeanitem
+ jmp checkpurgeagain
+notnearframeend: mov ax,extextpos
+ add ax,400
+ cmp ax,extextlen
+ jc notneartextend
+ call purgeanitem
+ jmp checkpurgeagain
+notneartextend: ret
+
+ endp
+
+
+
+
+
+
+Purgeanitem proc near
+
+ mov es,extras ;first time try and
+ mov di,exdata ;find an object in a
+ mov bl,reallocation ;location other than
+ mov cx,0 ;the one the player is
+lookforpurge: mov al,[es:di+2] ;in
+ cmp al,0
+ jnz cantpurge
+ cmp byte ptr [es:di+12],2
+ jz iscup
+ cmp byte ptr [es:di+12],255
+ jnz cantpurge
+iscup: cmp byte ptr [es:di+11],bl
+ jz cantpurge
+ call deleteexobject
+ ret
+cantpurge: add di,16
+ inc cx
+ cmp cx,numexobjects
+ jnz lookforpurge
+
+ mov di,exdata
+ mov bl,reallocation
+ mov cx,0
+lookforpurge2: mov al,[es:di+2]
+ cmp al,0
+ jnz cantpurge2
+ cmp byte ptr [es:di+12],255
+ jnz cantpurge2
+ call deleteexobject
+ ret
+cantpurge2: add di,16
+ inc cx
+ cmp cx,numexobjects
+ jnz lookforpurge2
+ ret
+
+ endp
+
+
+
+
+
+Deleteexobject proc near ;es:di holds data ad
+ ;cx holds number
+ push cx cx cx cx
+ mov al,255
+ mov cx,16
+ rep stosb
+ pop ax
+ mov cl,al
+ add al,al
+ add al,cl
+ call deleteexframe
+ pop ax
+ mov cl,al
+ add al,al
+ add al,cl
+ inc al
+ call deleteexframe
+ pop ax
+ call deleteextext
+
+ pop bx
+ mov bh,bl
+ mov bl,4
+ mov di,exdata
+ mov cx,0
+deleteconts: cmp [es:di+2],bx
+ jnz notinsideex
+ push bx cx di
+ call deleteexobject ;Oooh missus!
+ pop di cx bx ;Recursive code!
+notinsideex: add di,16
+ inc cx
+ cmp cx,numexobjects
+ jnz deleteconts
+ ret
+
+ endp
+
+
+
+
+
+Deleteexframe proc near ;al holds frame to delete
+
+ mov di,exframedata
+ mov ah,0
+ add ax,ax
+ add di,ax
+ add ax,ax
+ add di,ax
+ mov al,[es:di]
+ mov ah,0
+ mov cl,[es:di+1]
+ mov ch,0
+ mul cx ;ax holds size of this
+ ;frame in bytes
+ mov si,[es:di+2]
+ push si
+ add si,exframes
+ mov cx,exframeslen
+ sub cx,[es:di+2]
+ mov di,si ;di/si hold start of frame
+ add si,ax ;si holds end of frame
+ push ax
+ push es
+ pop ds
+ rep movsb
+ pop bx ;bx holds size now
+ sub exframepos,bx
+ pop si ;si holds start of frame
+ ;(offset only)
+ mov cx,numexobjects*3
+ mov di,exframedata
+shuffleadsdown: mov ax,[es:di+2]
+ cmp ax,si
+ jc beforethisone
+ sub ax,bx
+beforethisone: mov [es:di+2],ax
+ add di,6
+ loop shuffleadsdown
+ ret
+
+ endp
+
+
+
+
+Deleteextext proc near
+
+ mov di,extextdat
+ mov ah,0
+ add ax,ax
+ add di,ax
+ mov ax,[es:di]
+ mov si,ax
+ mov di,ax
+ add si,extext
+ add di,extext
+ mov ax,0
+findlenextext: mov cl,[es:si]
+ inc ax
+ inc si
+ cmp cl,0
+ jnz findlenextext
+
+ mov cx,extextlen
+ mov bx,si
+ sub bx,extext
+ push bx ax
+ sub cx,bx
+ rep movsb
+ pop bx
+ sub extextpos,bx
+
+ pop si
+ mov cx,numexobjects
+ mov di,extextdat
+shuffletextads: mov ax,[es:di]
+ cmp ax,si
+ jc beforethistext
+ sub ax,bx
+beforethistext: mov [es:di],ax
+ add di,2
+ loop shuffletextads
+ ret
+
+ endp
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/print.asm b/devtools/tasmrecover/dreamweb/print.asm
new file mode 100644
index 0000000000..2dbf616efc
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/print.asm
@@ -0,0 +1,591 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Printchar proc near
+
+ cmp al,255
+ jz ignoreit
+ push si bx di
+ if foreign
+ sub bx,3
+ endif
+ push ax
+ sub al,32 ;"A"
+ mov ah,0
+ add ax,charshift
+ call showframe
+ pop ax di bx si
+ cmp kerning,0
+ jnz nokern
+ call kernchars
+nokern: push cx
+ mov ch,0
+ add di,cx
+ pop cx
+ ;dec di
+ignoreit: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Kernchars proc near
+
+ ;sub al,13
+ cmp al,"a"
+ jz iskern
+ cmp al,"u"
+ jz iskern
+ ret
+iskern: cmp ah,"n"
+ jz kernit
+ cmp ah,"t"
+ jz kernit
+ cmp ah,"r"
+ jz kernit
+ cmp ah,"i"
+ jz kernit
+ cmp ah,"l"
+ jz kernit
+ ret
+kernit: dec cl
+ ret
+
+ endp
+
+
+
+
+
+
+;------------------------------------------------Proportional text printing----
+
+
+;Memprint proc near
+;
+; call usecharset1
+;
+; push ax bx cx dx es ds si di
+; call deltextline
+; pop di si ds es dx cx bx ax
+;
+; pop si
+; push cs
+; pop es
+; inc si
+; mov ds,currentset
+; mov di,textaddressx
+; mov bx,textaddressy
+; mov dl,textlen
+; mov al,0
+; mov ah,0
+; call printdirect
+; push si
+
+; mov newtextline,1
+; ret
+
+; endp
+
+
+
+
+
+
+;------------------------------------------------Proportional text printing----
+
+;Print proc near
+;
+; pop si
+; mov bx,[cs:si+2]
+; mov di,[cs:si+0]
+; mov dl,[cs:si+4]
+; add si,6
+; mov ds,currentset
+;
+;printloop2: push bx di dx
+; push es cs
+; pop es
+; call getnumber
+; pop es
+; mov ch,0
+;printloop1: mov ax,[cs:si]
+; inc si
+; cmp al,0
+; jz finishprint
+; push cx es
+; call modifychar
+; call printchar
+; pop es cx
+; loop printloop1
+; pop dx di bx
+; add bx,linespacing
+; jmp printloop2
+
+;finishprint: pop dx di bx
+ ; push si
+ ; ret
+
+ ; endp
+
+
+
+
+
+
+
+
+
+Printslow proc near
+
+ mov pointerframe,1
+ mov pointermode,3
+ mov ds,charset1
+printloopslow6: push bx di dx
+ call getnumber
+
+ mov ch,0
+printloopslow5: push cx si es
+ mov ax,[es:si]
+ push bx cx es si ds
+ if foreign
+ call modifychar
+ endif
+ call printboth
+ pop ds si es cx bx
+ mov ax,[es:si+1]
+ inc si
+ cmp al,0
+ jz finishslow
+ cmp al,":"
+ jz finishslow
+ cmp cl,1
+ jz afterslow
+ push di ds bx cx es si
+ if foreign
+ call modifychar
+ endif
+ mov charshift,91
+ call printboth
+ mov charshift,0
+ pop si es cx bx ds di
+ call waitframes
+ cmp ax,0
+ jz keepgoing
+ cmp ax,oldbutton
+ jnz finishslow2
+keepgoing: call waitframes
+noslow: cmp ax,0
+ jz afterslow
+ cmp ax,oldbutton
+ jnz finishslow2 ;used to finish early
+afterslow: pop es si cx
+ inc si
+ loop printloopslow5
+
+ pop dx di bx
+ add bx,10
+ jmp printloopslow6
+
+finishslow: pop es si cx dx di bx
+ mov al,0
+ ret
+
+finishslow2: pop es si cx dx di bx
+ mov al,1
+ ret
+
+ endp
+
+
+
+Waitframes proc near
+
+ push di bx es si ds
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call delpointer
+ mov ax,mousebutton
+ pop ds si es bx di
+ ret
+
+ endp
+
+
+
+
+Printboth proc near
+
+ push ax cx bx
+ push di
+ call printchar
+ pop ax
+ push di
+ mov di,ax
+ call multidump
+ pop di
+ pop bx cx ax
+ ret
+
+ endp
+
+
+
+
+
+
+Printdirect proc near
+
+ mov lastxpos,di
+ mov ds,currentset
+printloop6: push bx di dx
+ call getnumber
+ mov ch,0
+printloop5: mov ax,[es:si]
+ inc si
+ cmp al,0
+ jz finishdirct
+ cmp al,":"
+ jz finishdirct
+ push cx es
+ if foreign
+ call modifychar
+ endif
+ call printchar
+ mov lastxpos,di
+ pop es cx
+ loop printloop5
+ pop dx di bx
+ add bx,linespacing
+ jmp printloop6
+
+finishdirct: pop dx di bx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Monprint proc near
+
+ mov kerning,1
+ mov si,bx
+ mov dl,166
+ mov di,monadx
+ mov bx,monady
+ mov ds,tempcharset
+
+printloop8: push bx di dx
+ call getnumber
+ mov ch,0
+printloop7: mov al,[es:si]
+ inc si
+
+ cmp al,":"
+ jz finishmon2
+ cmp al,0
+ jz finishmon
+ cmp al,34
+ jz finishmon
+ cmp al,"="
+ jz finishmon
+ cmp al,"%"
+ jnz nottrigger
+ mov ah,[es:si]
+ inc si
+ inc si
+ jmp finishmon
+nottrigger: push cx es
+ if foreign
+ call modifychar
+ endif
+ call printchar
+ mov curslocx,di
+ mov curslocy,bx
+ mov maintimer,1
+ call printcurs
+
+ call vsync
+ push si dx ds es bx di
+ call lockmon
+ pop di bx es ds dx si
+ call delcurs
+ pop es cx
+ loop printloop7
+
+finishmon2: pop dx di bx
+ call scrollmonitor
+ mov curslocx,di
+ jmp printloop8
+
+finishmon: pop dx di bx
+ cmp al,"%"
+ jnz nottrigger2
+ mov lasttrigger,ah
+nottrigger2: mov curslocx,di
+ call scrollmonitor
+ mov bx,si
+ mov kerning,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Getnumber proc near
+
+ mov cx,0
+ push si bx di ds es
+ mov di,si
+
+wordloop: push cx dx
+ call getnextword
+ pop dx cx
+ cmp al,1
+ jz endoftext
+ mov al,cl
+ mov ah,0
+ push bx
+ mov bh,0
+ add ax,bx
+ pop bx
+ sub ax,10
+ mov dh,0
+ cmp ax,dx
+ jnc gotoverend
+ add cl,bl
+ add ch,bh
+ jmp wordloop
+
+gotoverend: mov al,dl
+ and al,1
+ jz notcentre
+ push cx
+ mov al,dl
+ and al,11111110b
+ mov ah,0
+ mov ch,0
+ sub ax,cx
+ add ax,20
+ shr ax,1
+ pop cx
+ pop es ds di bx si
+ add di,ax
+ mov cl,ch
+ ret
+notcentre: pop es ds di bx si
+ mov cl,ch
+ ret
+
+
+
+endoftext: mov al,cl
+ mov ah,0
+ push bx
+ mov bh,0
+ add ax,bx
+ pop bx
+ sub ax,10
+ mov dh,0
+ cmp ax,dx
+ jnc gotoverend2
+ add cl,bl
+ add ch,bh
+
+gotoverend2: mov al,dl
+ and al,1
+ jz notcent2
+ push cx
+ mov al,dl
+ and al,11111110b
+ add al,2
+ mov ah,0
+ mov ch,0
+ add ax,20
+ sub ax,cx
+ shr ax,1
+ pop cx
+ pop es ds di bx si
+ add di,ax
+ mov cl,ch
+ ret
+notcent2: pop es ds di bx si
+ mov cl,ch
+ ret
+
+ endp
+
+
+
+
+
+Getnextword proc near
+
+ mov bx,0
+getloop: mov ax,[es:di]
+ inc di
+ inc bh
+ cmp al,":"
+ jz endall
+ cmp al,0
+ jz endall
+ cmp al,32
+ jz endword
+ if foreign
+ call modifychar
+ endif
+ cmp al,255
+ jz getloop
+ push ax
+ sub al,32 ;"A"
+ mov ah,0
+ add ax,charshift
+ add ax,ax
+ mov si,ax
+ add ax,ax
+ add si,ax
+ mov cl,[si+0]
+ pop ax
+ call kernchars
+ add bl,cl
+ ;dec bl
+ jmp getloop
+
+endword: add bl,6
+ mov al,0
+ ret
+
+endall: add bl,6
+ mov al,1
+ ret
+
+ endp
+
+
+
+
+
+ if german
+
+Modifychar proc near
+
+ cmp al,128
+ jc nomod
+ cmp al,129
+ jnz not129
+ mov al,"Z"+3
+ ret
+not129: cmp al,132
+ jnz not132
+ mov al,"Z"+1
+ ret
+not132: cmp al,142
+ jnz not142
+ mov al,"Z"+4
+ ret
+not142: cmp al,154
+ jnz not154
+ mov al,"Z"+6
+ ret
+not154: cmp al,225
+ jnz not225
+ mov al,"A"-1
+ ret
+not225: cmp al,153
+ jnz not153
+ mov al,"Z"+5
+ ret
+not153: cmp al,148
+ jnz not148
+ mov al,"Z"+2
+ ret
+not148: ret
+
+nomod: ret
+
+ endp
+
+ endif
+
+
+
+
+ if spanish
+
+Modifychar proc near
+
+ cmp al,128
+ jc nomod
+ cmp al,160
+ jnz not160
+ mov al,"Z"+1
+ ret
+not160: cmp al,130
+ jnz not130
+ mov al,"Z"+2
+ ret
+not130: cmp al,161
+ jnz not161
+ mov al,"Z"+3
+ ret
+not161: cmp al,162
+ jnz not162
+ mov al,"Z"+4
+ ret
+not162: cmp al,163
+ jnz not163
+ mov al,"Z"+5
+ ret
+not163: cmp al,164
+ jnz not164
+ mov al,"Z"+6
+ ret
+not164: cmp al,165
+ jnz not165
+ mov al,","-1
+ ret
+not165: cmp al,168
+ jnz not168
+ mov al,"A"-1
+ ret
+not168: cmp al,173
+ jnz not173
+ mov al,"A"-4
+ ret
+not173: cmp al,129
+ jnz not129
+ mov al,"A"-5
+not129: ret
+
+nomod: ret
+
+ endp
+
+ endif
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/saveload.asm b/devtools/tasmrecover/dreamweb/saveload.asm
new file mode 100644
index 0000000000..a814c50bd6
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/saveload.asm
@@ -0,0 +1,1495 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+
+
+Zoomonoff proc near
+
+ cmp watchingtime,0
+ jnz blank
+ cmp pointermode,2
+ jz blank
+ cmp commandtype,222
+ jz alreadyonoff
+ mov commandtype,222
+ mov al,39
+ call commandonly
+alreadyonoff: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nozoomonoff
+ and ax,1
+ jnz dozoomonoff
+nozoomonoff: ret
+
+dozoomonoff: mov al,zoomon
+ xor al,1
+ mov zoomon,al
+
+ call createpanel
+ mov newobs,0
+ call drawfloor
+ call printsprites
+ call reelsonscreen
+ call showicon
+ call getunderzoom
+ call undertextline
+ mov al,39
+ call commandonly
+ call readmouse
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Saveload proc near
+
+ if demo
+ call dosreturn
+ ret
+ else
+ cmp watchingtime,0
+ jnz blank
+ cmp pointermode,2
+ jz blank
+ cmp commandtype,253
+ jz alreadyops
+ mov commandtype,253
+ mov al,43
+ call commandonly
+alreadyops: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz noops
+ and ax,1
+ jz noops
+ call dosaveload
+noops: ret
+ endif
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Dosaveload proc near
+
+ mov pointerframe,0
+ mov textaddressx,70
+ mov textaddressy,182-8
+ mov textlen,181
+ mov manisoffscreen,1
+ call clearwork
+ call createpanel2
+ call undertextline
+ call getridofall ;reels
+ call loadsavebox
+ call showopbox
+ call showmainops
+ call worktoscreen ;2
+ jmp donefirstops
+
+restartops: call showopbox
+ call showmainops
+ call worktoscreenm
+donefirstops: mov getback,0
+waitops: call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ call delpointer
+ mov bx,offset cs:opslist
+ call checkcoords
+ cmp getback,0
+ jz waitops
+ cmp getback,2
+ jz restartops
+ mov textaddressx,13
+ mov textaddressy,182
+ mov textlen,240
+ cmp getback,4
+ jz justret
+ call getridoftemp
+ call restoreall ;reels
+ call redrawmainscrn
+ call worktoscreenm
+ mov commandtype,200
+justret: mov manisoffscreen,0
+ ret
+
+opslist: dw opsx+59,opsx+114,opsy+30,opsy+76,getbackfromops
+ dw opsx+10,opsx+77,opsy+10,opsy+59,dosreturn
+ dw opsx+128,opsx+190,opsy+16,opsy+100,discops
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+
+ endp
+
+
+
+Getbackfromops proc near
+
+ cmp mandead,2
+ jz opsblock1
+ call getback1
+ ret
+opsblock1: call blank
+ ret
+
+ endp
+
+
+
+
+
+Showmainops proc near
+
+ mov ds,tempgraphics
+ mov di,opsx+10
+ mov bx,opsy+10
+ mov al,8
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+59
+ mov bx,opsy+30
+ mov al,7
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+128+4
+ mov bx,opsy+12
+ mov al,1
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+Showdiscops proc near
+
+ mov ds,tempgraphics
+ mov di,opsx+128+4
+ mov bx,opsy+12
+ mov al,1
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+10
+ mov bx,opsy+10
+ mov al,9
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+59
+ mov bx,opsy+30
+ mov al,10
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+176+2
+ mov bx,opsy+60-4
+ mov al,5
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+Loadsavebox proc near
+
+ mov dx,offset cs:icongraphics8
+ call loadintotemp
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Loadgame proc near
+
+ cmp commandtype,246
+ jz alreadyload
+ mov commandtype,246
+ mov al,41
+ call commandonly
+alreadyload: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz noload
+ cmp ax,1
+ jz doload
+noload: ret
+
+doload: mov loadingorsave,1
+ call showopbox
+ call showloadops
+ mov currentslot,0
+ call showslots
+ call shownames
+ mov pointerframe,0
+ call worktoscreenm
+ call namestoold
+ mov getback,0
+
+loadops: call delpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+
+ mov bx,offset cs:loadlist
+ call checkcoords
+ cmp getback,0
+ jz loadops
+ cmp getback,2
+ jz quitloaded
+ call getridoftemp
+ ;call clearnoreels
+ mov dx,seg madeuproomdat
+ mov es,dx
+ mov bx,offset es:madeuproomdat
+ call startloading
+ call loadroomssample
+ mov roomloaded,1
+ mov newlocation,255
+ call clearsprites
+ call initman
+ call initrain
+ mov textaddressx,13
+ mov textaddressy,182
+ mov textlen,240
+ call startup
+ call worktoscreen
+ mov getback,4
+quitloaded: ret
+
+loadlist: dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops
+ dw opsx+128,opsx+190,opsy+12,opsy+100,actualload
+ dw opsx+2,opsx+92,opsy+4,opsy+81,selectslot
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+Getbacktoops proc near
+
+ cmp commandtype,201
+ jz alreadygetops
+ mov commandtype,201
+ mov al,42
+ call commandonly
+alreadygetops: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nogetbackops
+ and ax,1
+ jnz dogetbackops
+nogetbackops: ret
+
+dogetbackops: call oldtonames
+ mov getback,2
+ ret
+
+ endp
+
+
+
+
+
+
+
+Discops proc near
+
+ cmp commandtype,249
+ jz alreadydiscops
+ mov commandtype,249
+ mov al,43
+ call commandonly
+alreadydiscops: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nodiscops
+ and ax,1
+ jnz dodiscops
+nodiscops: ret
+dodiscops: call scanfornames
+ mov loadingorsave,2
+ call showopbox
+ call showdiscops
+ mov currentslot,0
+ call worktoscreenm
+
+ mov getback,0
+discopsloop: call delpointer
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ mov bx,offset cs:discopslist
+ call checkcoords
+ cmp getback,0
+ jz discopsloop
+ ret
+
+discopslist: dw opsx+59,opsx+114,opsy+30,opsy+76,loadgame
+ dw opsx+10,opsx+79,opsy+10,opsy+59,savegame
+ dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+
+Savegame proc near
+
+ cmp mandead,2
+ jnz cansaveok
+ call blank
+ ret
+
+cansaveok: cmp commandtype,247
+ jz alreadysave
+ mov commandtype,247
+ mov al,44
+ call commandonly
+alreadysave: mov ax,mousebutton
+ and ax,1
+ jnz dosave
+ ret
+dosave: mov loadingorsave,2
+ call showopbox
+ call showsaveops
+ mov currentslot,0
+ call showslots
+ call shownames
+ call worktoscreenm
+
+ call namestoold
+ mov bufferin,0
+ mov bufferout,0
+
+ mov getback,0
+
+saveops: call delpointer
+ call checkinput
+ call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+
+ mov bx,offset cs:savelist
+ call checkcoords
+ cmp getback,0
+ jz saveops
+ ret
+
+savelist: dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops
+ dw opsx+128,opsx+190,opsy+12,opsy+100,actualsave
+ dw opsx+2,opsx+92,opsy+4,opsy+81,selectslot
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+Actualsave proc near
+
+ cmp commandtype,222
+ jz alreadyactsave
+ mov commandtype,222
+ mov al,44
+ call commandonly
+alreadyactsave: mov ax,mousebutton
+ and ax,1
+ jz noactsave
+
+ mov dx,seg savenames
+ mov ds,dx
+ mov si,offset savenames
+ mov al,currentslot
+ mov ah,0
+ mov cx,17
+ mul cx
+ add si,ax
+ inc si
+ cmp byte ptr [si],0
+ jz noactsave
+
+ mov al,location
+ mov ah,0
+ mov cx,32
+ mul cx
+ push cs
+ pop ds
+ mov si,offset cs:roomdata
+ add si,ax
+
+ mov di,offset cs:madeuproomdat
+ mov bx,di
+ push cs
+ pop es
+ mov cx,16
+ rep movsw
+
+ mov al,roomssample
+ mov [es:bx+13],al
+ mov al,mapx
+ mov [es:bx+15],al
+ mov al,mapy
+ mov [es:bx+16],al
+ mov al,liftflag
+ mov [es:bx+20],al
+ mov al,manspath
+ mov [es:bx+21],al
+ mov al,facing
+ mov [es:bx+22],al
+ mov al,255
+ mov [es:bx+27],al
+ call saveposition
+ call getridoftemp
+ call restoreall ;reels
+ mov textaddressx,13
+ mov textaddressy,182
+ mov textlen,240
+ call redrawmainscrn
+ call worktoscreenm
+ mov getback,4
+noactsave: ret
+
+ endp
+
+
+
+
+Actualload proc near
+
+ cmp commandtype,221
+ jz alreadyactload
+ mov commandtype,221
+ mov al,41
+ call commandonly
+alreadyactload: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notactload
+ cmp ax,1
+ jnz notactload
+
+ mov dx,seg savenames
+ mov ds,dx
+ mov si,offset savenames
+ mov al,currentslot
+ mov ah,0
+ mov cx,17
+ mul cx
+ add si,ax
+ inc si
+ cmp byte ptr [si],0
+ jz notactload
+ call loadposition
+ mov getback,1
+notactload: ret
+
+ endp
+
+
+
+
+Selectslot2 proc near
+
+ cmp mousebutton,0
+ jz noselslot2
+ mov loadingorsave,2
+noselslot2: call selectslot
+ ret
+
+ endp
+
+
+
+
+
+Checkinput proc near
+
+ cmp loadingorsave,3
+ jz nokeypress
+ call readkey
+ mov al,currentkey
+ cmp al,0
+ jz nokeypress
+ cmp al,13
+ jnz notret
+ mov loadingorsave,3
+ jmp afterkey
+notret: cmp al,8
+ jnz nodel2
+ cmp cursorpos,0
+ jz nokeypress
+ call getnamepos
+ dec cursorpos
+ mov byte ptr [es:bx],0
+ mov byte ptr [es:bx+1],1
+ jmp afterkey
+nodel2: ;cmp al,32
+ ;jz spacepress
+ ;cmp al,"A"
+ ;jc nokeypress
+ ;cmp al,"Z"+1
+ ;jnc nokeypress
+spacepress: cmp cursorpos,14
+ jz nokeypress
+ call getnamepos
+ inc cursorpos
+ mov al,currentkey
+ mov [es:bx+1],al
+ mov byte ptr [es:bx+2],0
+ mov byte ptr [es:bx+3],1
+ jmp afterkey
+
+nokeypress: ret
+
+afterkey: call showopbox
+ call shownames
+ call showslots
+ call showsaveops
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+Getnamepos proc near
+
+ mov al,currentslot
+ mov ah,0
+ mov cx,17
+ mul cx
+ mov dx,seg savenames
+ mov es,dx
+ mov bx,offset es:savenames
+ add bx,ax
+ mov al,cursorpos
+ mov ah,0
+ add bx,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Showopbox proc near
+
+ mov ds,tempgraphics
+ mov di,opsx
+ mov bx,opsy
+ mov al,0
+ mov ah,0
+ call showframe
+
+ mov ds,tempgraphics
+ mov di,opsx
+ mov bx,opsy+55
+ mov al,4
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Showloadops proc near
+
+ mov ds,tempgraphics
+ mov di,opsx+128+4
+ mov bx,opsy+12
+ mov al,1
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+176+2
+ mov bx,opsy+60-4
+ mov al,5
+ mov ah,0
+ call showframe
+
+ mov di,opsx+104
+ mov bx,opsy+14
+ mov al,55
+ mov dl,101
+ call printmessage
+ ret
+
+ endp
+
+
+
+
+Showsaveops proc near
+
+ mov ds,tempgraphics
+ mov di,opsx+128+4
+ mov bx,opsy+12
+ mov al,1
+ mov ah,0
+ call showframe
+ mov ds,tempgraphics
+ mov di,opsx+176+2
+ mov bx,opsy+60-4
+ mov al,5
+ mov ah,0
+ call showframe
+
+ mov di,opsx+104
+ mov bx,opsy+14
+ mov al,54
+ mov dl,101
+ call printmessage
+ ret
+
+ endp
+
+
+
+
+
+Selectslot proc near
+
+ cmp commandtype,244
+ jz alreadysel
+ mov commandtype,244
+ mov al,45
+ call commandonly
+alreadysel: mov ax,mousebutton
+ cmp ax,1
+ jnz noselslot
+ cmp ax,oldbutton
+ jz noselslot
+
+ cmp loadingorsave,3
+ jnz notnocurs
+ dec loadingorsave
+notnocurs: call oldtonames
+ mov ax,mousey
+ sub ax,opsy+4
+ mov cl,-1
+getslotnum: inc cl
+ sub ax,11
+ jnc getslotnum
+ mov currentslot,cl
+ call delpointer
+ call showopbox
+ call showslots
+ call shownames
+ cmp loadingorsave,1
+ jz isloadmode
+ call showsaveops
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+isloadmode: call showloadops
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+noselslot: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Showslots proc near
+
+ mov di,opsx+7
+ mov bx,opsy+8
+ mov al,2
+ mov ds,tempgraphics
+ mov ah,0
+ call showframe
+
+ mov di,opsx+10
+ mov bx,opsy+11
+ mov cl,0
+slotloop: push cx di bx
+
+ cmp cl,currentslot
+ jnz nomatchslot
+ mov al,3
+ mov ds,tempgraphics
+ mov ah,0
+ call showframe
+
+nomatchslot: pop bx di cx
+ add bx,10
+ inc cl
+ cmp cl,7
+ jnz slotloop
+ ret
+
+ endp
+
+
+
+
+
+Shownames proc near
+
+ mov dx,seg savenames
+ mov es,dx
+ mov si,offset es:savenames+1
+ mov di,opsx+21
+ mov bx,opsy+10
+ mov cl,0
+
+shownameloop: push cx di es bx si
+ mov al,4
+ cmp cl,currentslot
+ jnz nomatchslot2
+
+ cmp loadingorsave,2
+ jnz loadmode
+
+ mov dx,si
+ mov cx,15
+ add si,15
+zerostill: dec si
+ dec cl
+ cmp byte ptr [es:si],1
+ jnz foundcharacter
+ jmp zerostill
+foundcharacter: mov cursorpos,cl
+ mov byte ptr [es:si],"/"
+ mov byte ptr [es:si+1],0
+ push si
+ mov si,dx
+ mov dl,200
+ mov ah,0
+ call printdirect
+ pop si
+ mov byte ptr [es:si],0
+ mov byte ptr [es:si+1],1
+ jmp afterprintname
+
+loadmode: mov al,0
+ mov dl,200
+ mov ah,0
+ mov charshift,91
+ call printdirect
+ mov charshift,0
+ jmp afterprintname
+
+nomatchslot2: mov dl,200
+ mov ah,0
+ call printdirect
+
+afterprintname: pop si bx es di cx
+ add si,17
+ add bx,10
+ inc cl
+ cmp cl,7
+ jnz shownameloop
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Dosreturn proc near
+
+ cmp commandtype,250
+ jz alreadydos
+ mov commandtype,250
+ mov al,46
+ call commandonly
+alreadydos: mov ax,mousebutton
+ and ax,1
+ jz nodos
+
+quickquit2: call soundend
+ call removeemm
+
+quickquit: if recording
+ call saverec
+ mov bx,rechandle
+ mov ah,3eh
+ int 21h
+ endif
+ if playback
+ mov bx,rechandle
+ mov ah,3eh
+ int 21h
+ endif
+
+ call resetkeyboard
+ mov bl,31h
+ mov al,0
+ mov ah,12h
+ int 10h
+ call vsync
+
+ mov ah,0
+ mov al,3
+ int 10h
+ call error
+ mov ax,4c00h
+ int 21h
+ ret
+
+ endp
+
+
+
+Error proc near
+
+ cmp gameerror,1
+ jz error1
+ cmp gameerror,2
+ jz error2
+ cmp gameerror,3
+ jz error3
+ cmp gameerror,4
+ jz error4
+ cmp gameerror,5
+ jz error5
+ cmp gameerror,6
+ jz error6
+ cmp gameerror,7
+ jz error7
+ cmp gameerror,8
+ jz error8
+ ret
+
+error1: mov dx,offset cs:gameerror1
+ jmp generalerror
+
+error2: mov ax,soundbaseadd
+ sub ax,200h
+ mov cl,4
+ shr ax,cl
+ add al,"0"
+ mov bx,offset cs:error2patch
+ mov [cs:bx+1],al
+ mov dx,offset cs:gameerror2
+ call generalerror
+ mov dx,offset cs:gameinfo
+ jmp generalerror
+
+error3: mov dx,offset cs:gameerror3
+ jmp generalerror
+
+error4: mov dx,offset cs:gameerror4
+ jmp generalerror
+
+error5: mov dx,offset cs:gameerror5
+ jmp generalerror
+
+error6: mov al,soundint
+ add al,"0"
+ mov bx,offset cs:error6patch
+ mov [cs:bx],al
+ mov dx,offset cs:gameerror6
+ call generalerror
+ mov dx,offset cs:gameinfo
+ jmp generalerror
+
+error7: mov dx,offset cs:gameerror7
+ jmp generalerror
+
+error8: mov dx,offset cs:gameerror8
+ jmp generalerror
+
+generalerror: mov ah,9h
+ push cs
+ pop ds
+ int 21h
+ ret
+
+nodos: ret
+
+gameerror1: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Unable to allocate Expanded Memory."
+ db 13,10,13,10
+ db 24h
+gameerror2: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Sound Blaster card not found at address "
+error2patch: db "220 Hex."
+ db 13,10,13,10
+ db 24h
+gameerror3: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Out of Base Memory."
+ db 13,10,13,10
+ db 24h
+gameerror4: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Memory Deallocation problem."
+ db 13,10,13,10
+ db 24h
+gameerror5: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "At least 590K of base memory is required."
+ db 13,10,13,10
+ db 24h
+gameerror6: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Sound Blaster not found on interupt "
+error6patch: db "0"
+ db 13,10,13,10
+ db 24h
+gameerror7: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "Unable to select EMM page."
+ db 13,10,13,10
+ db 24h
+gameerror8: db 13,10,13,10
+ db "Dreamweb has an Error:",13,10
+ db "File not found.c"
+error8patch: db 13,10,13,10
+ db 24h
+
+gameinfo: db "Dreamweb looks for Sound Blaster information in",13,10
+ db "the BLASTER environment variable (in your AUTOEXEC.BAT)",13,10
+ db 13,10,"If this is not found then IRQ 7, DMA channel 1 and base",13,10
+ db "address 220h are assumed.",13,10,13,10
+
+ db "To alter any or all of these settings you can specify them",13,10
+ db "on the command line. For example:",13,10,13,10
+ db "Type DREAMWEB I7 A220 D1 to run Dreamweb on IRQ 7, DMA",13,10
+ db " channel 1 and base address 220h"
+ db 13,10
+ db " DREAMWEB I5 to run Dreamweb on IRQ 5 and",13,10
+ db " default address of 220h, DMA 1",13,10
+ db 13,10
+ db 24h
+
+endgametext1: db 13,10,13,10
+ db "Try the Dreamweb CD in your stereo....",13,10
+ db 13,10,13,10
+ db 24h
+
+ endp
+
+
+
+
+
+
+
+
+Namestoold proc near
+
+ push cs
+ pop ds
+ mov si,offset cs:savenames
+ mov di,zoomspace
+ mov es,buffers
+ mov cx,17*4
+ rep movsb
+ ret
+
+ endp
+
+
+
+Oldtonames proc near
+
+ push cs
+ pop es
+ mov di,offset cs:savenames
+ mov si,zoomspace
+ mov ds,buffers
+ mov cx,17*4
+ rep movsb
+ ret
+
+ endp
+
+
+
+Savefilewrite proc near
+ mov bx,handle
+ mov ah,40h
+ int 21h
+ ret
+ endp
+
+Savefileread proc near
+ mov bx,handle
+ mov ah,3fh
+ int 21h
+ ret
+ endp
+
+Saveposition proc near
+
+ call makeheader
+
+ mov al,currentslot
+ mov ah,0
+ push ax
+ mov cx,13
+ mul cx
+ mov dx,seg savefiles
+ mov ds,dx
+ mov dx,offset savefiles
+ add dx,ax
+ call openforsave
+
+ mov dx,seg fileheader
+ mov ds,dx
+ mov dx,offset fileheader
+ mov cx,headerlen
+ call savefilewrite
+ mov dx,seg fileheader
+ mov es,dx
+ mov di,offset es:filedata
+
+ pop ax
+ mov cx,17
+ mul cx
+ mov dx,seg savenames
+ mov ds,dx
+ mov dx,offset savenames
+ add dx,ax
+ call saveseg
+
+ mov dx,seg startvars
+ mov ds,dx
+ mov dx,offset startvars
+ call saveseg
+
+ mov ds,extras
+ mov dx,exframedata
+ call saveseg
+
+ mov ds,buffers
+ mov dx,listofchanges
+ call saveseg
+
+ mov dx,seg madeuproomdat
+ mov ds,dx
+ mov dx,offset madeuproomdat
+ call saveseg
+
+ mov dx,seg reelroutines
+ mov ds,dx
+ mov dx,offset reelroutines
+ call saveseg
+
+fquit: call closefile
+ ret
+
+ endp
+
+
+
+
+
+
+Loadposition proc near
+
+ mov timecount,0
+ call clearchanges
+
+ mov al,currentslot
+ mov ah,0
+ push ax
+ mov cx,13
+ mul cx
+ mov dx,seg savefiles
+ mov ds,dx
+ mov dx,offset savefiles
+ add dx,ax
+ if cd
+ call openfilefromc
+ else
+ call openfile
+ endif
+
+ push cs
+ pop ds
+ mov dx,offset cs:fileheader
+ mov cx,headerlen
+ call savefileread
+ push cs
+ pop es
+ mov di,offset cs:filedata
+
+ pop ax
+ mov cx,17
+ mul cx
+ mov dx,seg savenames
+ mov ds,dx
+ mov dx,offset savenames
+ add dx,ax
+ call loadseg
+
+ mov dx,seg startvars
+ mov ds,dx
+ mov dx,offset startvars
+ call loadseg
+
+ mov ds,extras
+ mov dx,exframedata
+ call loadseg
+
+ mov ds,buffers
+ mov dx,listofchanges
+ call loadseg
+
+ mov dx,seg madeuproomdat
+ mov ds,dx
+ mov dx,offset madeuproomdat
+ call loadseg
+
+ push cs
+ pop ds
+ mov dx,offset cs:reelroutines
+ call loadseg
+
+ call closefile
+ ret
+
+ endp
+
+
+
+
+
+Loadseg proc near
+
+ mov bx,handle
+ mov ax,[es:di]
+ add di,2
+ push di
+ push es
+ mov cx,ax
+ mov ah,3fh
+ int 21h
+ pop es
+ pop di
+ ret
+
+ endp
+
+
+
+
+
+Makeheader proc near
+
+ mov dx,seg fileheader
+ mov es,dx
+ mov di,offset es:filedata
+ mov ax,17
+ call storeit
+ mov ax,lengthofvars
+ call storeit
+ mov ax,lengthofextra
+ call storeit
+ mov ax,numchanges*4
+ call storeit
+ mov ax,48
+ call storeit
+ mov ax,lenofreelrouts
+ call storeit
+ ret
+
+ endp
+
+
+
+
+
+Storeit proc near
+
+ cmp ax,0
+ jnz isntblank
+ inc ax
+isntblank: stosw
+ ret
+
+ endp
+
+
+
+
+Saveseg proc near
+
+ mov cx,[es:di]
+ add di,2
+ push di es
+ mov bx,handle
+ mov ah,40h
+ int 21h
+ pop es di
+ ret
+
+ endp
+
+
+
+Findlen proc near
+
+ dec bx
+ add bx,ax
+nextone: cmp cl,[bx]
+ jnz foundlen
+ dec bx
+ dec ax
+ cmp ax,0
+ jnz nextone
+foundlen: ret
+
+ endp
+
+
+
+
+
+Scanfornames proc near
+
+ mov dx,seg savenames
+ mov es,dx
+ mov di,offset es:savenames
+ mov dx,seg savefiles
+ mov ds,dx
+ mov dx,offset savefiles
+ mov cx,7
+scanloop: push es ds di dx cx
+
+ if cd
+ call openfilefromc
+ else
+ call openfilenocheck
+ endif
+ jc notexist
+ pop cx
+ inc ch
+ push cx
+ push di es
+ mov dx,seg fileheader
+ mov ds,dx
+ mov dx,offset fileheader
+ mov cx,headerlen
+ call savefileread
+ mov dx,seg fileheader
+ mov es,dx
+ mov di,offset es:filedata
+ pop ds dx
+ call loadseg
+ mov bx,handle
+ call closefile
+
+notexist: pop cx dx di ds es
+ add dx,13
+ add di,17
+ dec cl
+ jnz scanloop
+ mov al,ch
+ ret
+
+ endp
+
+
+
+
+
+Decide proc near
+
+ call setmode
+ call loadpalfromiff
+ call clearpalette
+ mov pointermode,0
+ mov watchingtime,0
+ mov pointerframe,0
+ mov textaddressx,70
+ mov textaddressy,182-8
+ mov textlen,181
+ mov manisoffscreen,1
+ call loadsavebox
+ call showdecisions
+ call worktoscreen
+ call fadescreenup
+ mov getback,0
+
+waitdecide: call readmouse
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ call delpointer
+ mov bx,offset cs:decidelist
+ call checkcoords
+ cmp getback,0
+ jz waitdecide
+ cmp getback,4
+ jz hasloadedroom
+ call getridoftemp
+hasloadedroom: mov textaddressx,13
+ mov textaddressy,182
+ mov textlen,240
+ ret
+
+decidelist: dw opsx+69,opsx+124,opsy+30,opsy+76,newgame
+ dw opsx+20,opsx+87,opsy+10,opsy+59,dosreturn
+ dw opsx+123,opsx+190,opsy+10,opsy+59,loadold
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+Showdecisions proc near
+
+ call createpanel2
+ call showopbox
+ mov ds,tempgraphics
+ mov di,opsx+17
+ mov bx,opsy+13
+ mov al,6
+ mov ah,0
+ call showframe
+ call undertextline
+ ret
+
+ endp
+
+
+
+
+
+Newgame proc near
+
+ cmp commandtype,251
+ jz alreadynewgame
+ mov commandtype,251
+ mov al,47
+ call commandonly
+alreadynewgame: mov ax,mousebutton
+ cmp ax,1
+ jnz nonewgame
+ mov getback,3
+nonewgame: ret
+
+ endp
+
+
+
+
+
+
+
+Loadold proc near
+
+ cmp commandtype,252
+ jz alreadyloadold
+ mov commandtype,252
+ mov al,48
+ call commandonly
+alreadyloadold: mov ax,mousebutton
+ and ax,1
+ jz noloadold
+ call doload
+ cmp getback,4
+ jz noloadold
+ call showdecisions
+ call worktoscreenm
+ mov getback,0
+noloadold: ret
+
+ endp
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/sblaster.asm b/devtools/tasmrecover/dreamweb/sblaster.asm
new file mode 100644
index 0000000000..113bdd9548
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/sblaster.asm
@@ -0,0 +1,1293 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+; Creative Reality Sound Blaster Drivers . (C) 1994 Creative Reality
+
+; Very sparsly commented.
+
+
+
+;These drivers are not stand alone. We had them as an integral part of the
+;game.
+;
+;Put interupt no. into SOUNDINT, base address (eg 220h) into SOUNDBASEADD.
+;If interupt is 255 then no card is assumed.
+;
+;Call soundstartup at beginning of program to test card and initialise.
+;
+;This code assumes that EMS has been initialised
+;Emm page frame is in variable EMMPAGEFRAME. Handle is in EMMHANDLE.
+;
+;Call loadsample with a filename in CS:DX (ie. in the code somewhere)
+;
+;To play a sample call playchannel0 or playchannel1 with sound no. in al.
+;
+;Call endsample to restore interupts and halt sound.
+;
+;
+
+
+
+
+;------------------------------------------- Initial sound set up and end ---
+
+Loadspeech proc near
+
+ cmp soundint,255
+ jz dontbother8
+
+ call cancelch1
+
+ mov speechloaded,0
+ call createname
+
+ mov speechlength,0
+ mov dx,offset cs:speechfilename
+ call openfilenocheck
+ jc dontbother8
+
+ mov bx,speechemmpage
+
+moreloadspeech: push dx bx
+
+ push es di bx
+ mov al,2
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror
+ mov ds,emmpageframe
+ pop bx di es
+ inc bx
+ push es di
+ mov al,3
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror
+ mov ds,emmpageframe
+ mov es,emmpageframe
+ mov di,8000h
+ mov cx,4000h
+ mov ax,0
+ rep stosw
+ pop di es
+
+ mov cx,8000h
+ mov dx,8000h
+ call readfromfile
+ mov cl,11
+ shr ax,cl
+ add speechlength,ax
+ pop bx dx
+ add bx,2
+ cmp ax,0
+ jnz moreloadspeech
+ call closefile
+
+ mov es,sounddata2
+ mov di,50*6
+ mov ax,speechemmpage
+ mov [es:di],al
+ mov ax,0
+ mov [es:di+1],ax
+ mov ax,speechlength
+ mov [es:di+3],ax
+ mov speechloaded,1
+dontbother8: ret
+
+speechfilename: db "SPEECH\"
+speechfile: db "R24C0005.RAW",0
+
+ endp
+
+
+
+Createname proc near
+
+ push ax
+ mov di,offset cs:speechfile
+ mov byte ptr [cs:di+0],dl ;"R"
+ mov [cs:di+3],cl
+
+ mov al,dh ;reallocation
+ mov ah,"0"-1
+findten: inc ah
+ sub al,10
+ jnc findten
+ mov [cs:di+1],ah
+ add al,10+"0"
+ mov [cs:di+2],al
+ pop ax
+
+ mov cl,"0"-1
+thousandsc: inc cl
+ sub ax,1000
+ jnc thousandsc
+ add ax,1000
+ mov [cs:di+4],cl
+ mov cl,"0"-1
+hundredsc: inc cl
+ sub ax,100
+ jnc hundredsc
+ add ax,100
+ mov [cs:di+5],cl
+ mov cl,"0"-1
+tensc: inc cl
+ sub ax,10
+ jnc tensc
+ add ax,10
+ mov [cs:di+6],cl
+ add al,"0"
+ mov [cs:di+7],al
+ ret
+
+ endp
+
+
+
+
+
+
+Loadsample proc near
+
+ cmp soundint,255
+ jz dontbother
+
+ call openfile
+ call readheader
+ mov bx,[es:di]
+ push es di bx
+ mov ds,sounddata
+ pop cx
+ mov dx,0
+ call readfromfile
+ pop di es
+
+ add di,2
+ mov bx,0
+ mov dx,[es:di]
+ add dx,1
+ shr dx,1
+
+ mov soundemmpage,0
+
+moreload: push dx bx
+
+ push es di bx
+ mov al,2
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror
+ mov ds,emmpageframe
+ pop bx di es
+ inc bx
+ push es di
+ mov al,3
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror
+ mov ds,emmpageframe
+ pop di es
+
+ mov cx,8000h
+ mov dx,8000h
+ call readfromfile
+ pop bx dx
+ add bx,2
+ add soundemmpage,2
+ dec dx
+ jnz moreload
+ ;inc soundemmpage
+ call closefile
+dontbother: ret
+
+emmerror: mov gameerror,7
+ jmp quickquit2
+
+ endp
+
+
+
+
+
+
+Loadsecondsample proc near
+
+ cmp soundint,255
+ jz dontbother9
+
+ cmp ch0playing,12
+ jc ch0oksecond
+ cmp ch0playing,255
+ jz ch0oksecond
+ call cancelch0
+ ;mov cx,100
+ ;call hangon
+ jmp ch0oksecond
+justcancel: call cancelch0
+ch0oksecond: cmp ch1playing,12
+ jc ch1oksecond
+ call cancelch1
+
+ch1oksecond: call openfile
+ call readheader
+ mov bx,[es:di]
+ push es di bx
+ mov ds,sounddata2
+ pop cx
+ mov dx,0
+ call readfromfile
+
+ mov cx,100
+ mov di,0
+ mov es,sounddata2
+ mov bx,soundemmpage
+adjustemmpage: mov al,[es:di]
+ add al,bl
+ mov [es:di],al
+ add di,6
+ loop adjustemmpage
+
+ pop di es
+
+ add di,2
+ mov bx,soundemmpage
+ mov speechemmpage,bx
+ mov dx,[es:di]
+ add dx,1
+ shr dx,1
+
+moreload2: push dx bx
+
+ push es di bx
+ mov al,2
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror2
+ mov ds,emmpageframe
+ pop bx di es
+ inc bx
+ push es di
+ mov al,3
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ cmp ah,0
+ jnz emmerror2
+ mov ds,emmpageframe
+ pop di es
+
+ mov cx,8000h
+ mov dx,8000h
+ call readfromfile
+ pop bx dx
+ add bx,2
+ add speechemmpage,2
+ dec dx
+ jnz moreload2
+ call closefile
+dontbother9: ret
+
+emmerror2: mov gameerror,7
+ jmp quickquit2
+
+ endp
+
+
+
+
+
+
+Soundstartup proc near
+
+ cmp soundint,255
+ jz dontbother2
+
+ mov dx,soundbaseadd
+ add dx,0eh
+ mov DSP_status,dx
+ mov dx,soundbaseadd
+ add dx,0ch
+ mov DSP_write,dx
+
+ mov al,1
+ mov dx,soundbaseadd
+ add dx,0006h
+ out dx,al
+ push ax ax ax ax ax ax ax ax
+ pop ax ax ax ax ax ax ax ax
+ mov al,0
+ out dx,al
+
+ mov dx,DSP_status
+ mov cx,2000
+waitinit: in al,dx
+ and al,128
+ jz waitinit
+ mov dx,soundbaseadd
+ add dx,000ah
+ in al,dx
+ cmp al,0aah
+ jz dspready
+ loop waitinit
+ mov gameerror,2
+ jmp quickquit
+
+dspready: call trysoundalloc
+
+ cli
+ mov ah,40h ;set sample rate
+ call out22c
+ mov ah,210 ;of 22050Hz
+ call out22c
+ sti
+
+ call checksoundint
+
+ mov ah,35h
+ mov al,soundint
+ add al,8
+ int 21h
+ mov oldsoundintseg,es ; Save es:bx to temp memory
+ mov oldsoundintadd,bx
+ push cs
+ pop ds
+ mov dx,offset cs:dmaend
+ mov ah,25h
+ mov al,soundint
+ add al,8
+ int 21h ; Set to new
+
+ call enablesoundint
+
+ mov al,sounddmachannel
+ xor ah,ah
+ mov bx,offset cs:dmaaddresses
+ add bx,ax
+ mov al,[cs:bx]
+ mov dmaaddress,al
+
+ mov ah,0d1h ;speaker on
+ call out22c
+ mov ah,0d0h
+ call out22c
+
+dontbother2: ret
+
+dmaaddresses db 87h,83h,81h,82h
+
+ endp
+
+
+
+
+
+Trysoundalloc proc near
+
+ cmp needsoundbuff,1
+ jz gotsoundbuff
+ inc soundtimes
+ mov bx,(16384+2048)/16
+ call allocatemem
+ mov soundbuffer,ax
+ push ax
+ mov al,ah
+ mov cl,4
+ shr al,cl
+ mov soundbufferpage,al
+ pop ax
+ mov cl,4
+ shl ax,cl
+ mov soundbufferad,ax
+ cmp ax,0b7ffh
+ jnc soundfail
+
+ mov es,soundbuffer
+ mov di,0
+ mov cx,16384/2
+ mov ax,7f7fh
+ rep stosw
+ mov needsoundbuff,1
+ ret
+
+soundfail: mov es,soundbuffer
+ call deallocatemem
+gotsoundbuff: ret
+
+ endp
+
+
+
+
+
+
+Setsoundoff proc near
+
+ cmp soundint,255
+ jz dontbother28
+ mov soundbufferwrite,0
+ cli
+ call setupPIT
+ mov soundbufferwrite,4096
+ call startdmablock
+ sti
+dontbother28: ret
+
+ endp
+
+
+
+
+
+
+Checksoundint proc near
+
+ mov ah,0d3h ;speaker off
+ call out22c
+
+ mov testresult,0
+ mov ah,35h
+ mov al,soundint
+ add al,8
+ int 21h
+ mov oldsoundintseg,es
+ mov oldsoundintadd,bx
+ push cs
+ pop ds
+ mov dx,offset cs:interupttest
+ mov ah,25h
+ mov al,soundint
+ add al,8
+ int 21h
+
+ call enablesoundint
+
+ mov ah,0f2h
+ call out22c
+
+ mov cx,20
+ call hangon
+
+ call disablesoundint
+
+ mov dx,oldsoundintseg
+ mov ds,dx
+ mov dx,oldsoundintadd ;Restore old interupt vector
+ mov ah,25h
+ mov al,soundint
+ add al,8
+ int 21h
+
+ cmp testresult,1
+ jz interuptworked
+ mov gameerror,6 ;interupt wrong
+ jmp quickquit ;exit to DOS with error
+
+interuptworked: ret
+
+ endp
+
+
+
+
+
+Enablesoundint proc near
+
+ mov dx,21h ; Enable int?
+ in al,dx
+ mov currentirq,al
+ mov ah,11111110b
+ mov cl,soundint
+ rol ah,cl
+ and al,ah
+ out dx,al
+ ret
+
+ endp
+
+
+
+
+
+Disablesoundint proc near
+
+ mov al,soundint
+ mov dx,21h
+ mov al,currentirq
+ out dx,al
+ ret
+
+ endp
+
+
+
+
+Interupttest proc near
+
+ cli
+ push ax dx
+ mov testresult,1
+ mov dx,DSP_status
+ in al,dx
+ mov al,20h
+ out 20h,al
+ pop dx ax
+ iret
+
+ endp
+
+
+
+
+
+Soundend proc near
+
+ cmp soundint,255
+ jz dontbother3
+
+ call getridofPIT
+
+ mov ah,0d0h
+ call out22c
+
+ call disablesoundint
+
+ mov ds,oldsoundintseg ;for keys
+ mov dx,oldsoundintadd ;Restore old interupt vector
+ mov ah,25h
+ mov al,soundint
+ add al,8
+ int 21h
+
+dontbother3: ret
+
+ endp
+
+
+
+
+
+Out22c proc near
+
+ mov dx,DSP_write
+notclear: in al,dx
+ or al,al
+ js notclear
+ mov al,ah
+ out dx,al
+ ret
+
+ endp
+
+
+
+
+
+;---------------------------------------------------------------------------
+
+
+
+
+Playchannel0 proc near ;al=sound no
+ ;ah=times to repeat
+ cmp soundint,255
+ jz dontbother4
+
+ push es ds bx cx di si
+
+ mov ch0playing,al
+ mov es,sounddata
+ cmp al,12
+ jc notsecondbank
+ mov es,sounddata2
+ sub al,12
+notsecondbank: mov ch0repeat,ah
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ add ax,ax
+ add bx,ax
+
+ mov al,[es:bx]
+ mov ah,0
+ mov ch0emmpage,ax
+ mov ax,[es:bx+1]
+ mov ch0offset,ax
+ mov ax,[es:bx+3]
+ mov ch0blockstocopy,ax
+
+ cmp ch0repeat,0
+ jz nosetloop
+ mov ax,ch0emmpage
+ mov ch0oldemmpage,ax
+ mov ax,ch0offset
+ mov ch0oldoffset,ax
+ mov ax,ch0blockstocopy
+ mov ch0oldblockstocopy,ax
+
+nosetloop: pop si di cx bx ds es
+
+dontbother4: ret
+
+ endp
+
+
+
+
+
+
+
+Playchannel1 proc near ;al=sound no
+
+ cmp soundint,255
+ jz dontbother5
+ cmp ch1playing,7
+ jz dontbother5
+ push es ds bx cx di si
+
+ mov ch1playing,al
+ mov es,sounddata
+ cmp al,12
+ jc notsecondbank1
+ mov es,sounddata2
+ sub al,12
+notsecondbank1: mov ah,0
+ add ax,ax
+ mov bx,ax
+ add ax,ax
+ add bx,ax
+
+ mov al,[es:bx]
+ mov ah,0
+ mov ch1emmpage,ax
+ mov ax,[es:bx+1]
+ mov ch1offset,ax
+ mov ax,[es:bx+3]
+ mov ch1blockstocopy,ax
+
+ pop si di cx bx ds es
+
+dontbother5: ret
+
+ endp
+
+
+
+
+
+
+
+
+Makenextblock proc near
+
+ call volumeadjust
+
+ call loopchannel0
+ cmp ch1blockstocopy,0
+ jz mightbeonlych0
+ cmp ch0blockstocopy,0
+ jz mightbeonlych1
+
+ dec ch0blockstocopy
+ dec ch1blockstocopy
+ call bothchannels
+ ret
+
+mightbeonlych1: mov ch0playing,255
+ cmp ch1blockstocopy,0
+ jz notch1only
+ dec ch1blockstocopy
+ call channel1only
+notch1only: ret
+
+mightbeonlych0: mov ch1playing,255
+ cmp ch0blockstocopy,0
+ jz notch0only
+ dec ch0blockstocopy
+ call channel0only
+ ret
+notch0only: mov es,soundbuffer
+ mov di,soundbufferwrite
+ mov cx,1024
+ mov ax,7f7fh
+ rep stosw
+ and di,16384-1
+ mov soundbufferwrite,di
+ ret
+
+ endp
+
+
+
+
+Volumeadjust proc near
+
+ mov al,volumedirection
+ cmp al,0
+ jz volok
+ mov al,volume
+ cmp al,volumeto
+ jz volfinish
+ add volumecount,64
+ jnz volok
+ mov al,volume
+ add al,volumedirection
+ mov volume,al
+ ret
+volfinish: mov volumedirection,0
+volok: ret
+
+ endp
+
+
+
+Loopchannel0 proc near
+
+ cmp ch0blockstocopy,0
+ jnz notloop
+ cmp ch0repeat,0
+ jz notloop
+ cmp ch0repeat,255
+ jz endlessloop
+ dec ch0repeat
+endlessloop: mov ax,ch0oldemmpage
+ mov ch0emmpage,ax
+ mov ax,ch0oldoffset
+ mov ch0offset,ax
+ mov ax,ch0blockstocopy
+ add ax,ch0oldblockstocopy
+ mov ch0blockstocopy,ax
+ ret
+notloop: ret
+
+ endp
+
+
+
+
+
+
+
+Cancelch0 proc near
+
+ mov ch0repeat,0
+ mov ch0blockstocopy,0
+ mov ch0playing,255
+ ret
+
+ endp
+
+
+
+Cancelch1 proc near
+
+ mov ch1blockstocopy,0
+ mov ch1playing,255
+ ret
+
+ endp
+
+
+
+
+Channel0only proc near
+
+ call saveems
+ mov al,0
+ mov bx,ch0emmpage
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+
+ mov es,soundbuffer
+ mov ds,emmpageframe
+ mov di,soundbufferwrite
+ mov si,ch0offset
+
+ call channel0tran
+ call restoreems
+
+ and di,16384-1
+ mov soundbufferwrite,di
+ and si,16384-1
+ mov ch0offset,si
+ cmp si,0
+ jnz notch0endofpage0
+ inc ch0emmpage
+notch0endofpage0: ret
+
+ endp
+
+
+
+
+Channel1only proc near
+
+ call saveems
+ mov al,1
+ mov bx,ch1emmpage
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+
+ mov es,soundbuffer
+ mov ds,emmpageframe
+ mov di,soundbufferwrite
+ mov si,ch1offset
+ add si,16384
+
+ mov cx,1024
+ rep movsw
+ call restoreems
+
+ and di,16384-1
+ mov soundbufferwrite,di
+ and si,16384-1
+ mov ch1offset,si
+ cmp si,0
+ jnz notch1endofpage1
+ inc ch1emmpage
+notch1endofpage1: ret
+
+ endp
+
+
+
+
+
+Channel0tran proc near
+
+ cmp volume,0
+ jnz lowvolumetran
+ mov cx,1024
+ rep movsw
+ ret
+
+lowvolumetran: mov cx,1024
+ mov bh,volume
+ mov bl,0
+ add bx,16384-256
+volloop: lodsw
+ mov bl,al
+ mov al,[es:bx]
+ mov bl,ah
+ mov ah,[es:bx]
+ stosw
+ loop volloop
+ ret
+
+
+ endp
+
+
+
+
+
+
+
+
+Bothchannels proc near ;rather slow routine
+ ;to mix two channels
+
+ call saveems
+ mov al,0
+ mov bx,ch0emmpage
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+ mov al,1
+ mov bx,ch1emmpage
+ mov dx,emmhandle
+ mov ah,44h
+ int 67h
+
+ mov es,soundbuffer
+ mov ds,emmpageframe
+ mov di,soundbufferwrite
+ mov si,ch0offset
+ mov bx,ch1offset
+ add bx,16384
+ mov cx,2048
+ mov dh,128
+ mov dl,255
+
+ call domix
+ call restoreems
+
+ and di,16384-1
+ mov soundbufferwrite,di
+
+ mov si,ch0offset
+ add si,2048
+ and si,16384-1
+ mov ch0offset,si
+ cmp si,0
+ jnz notbothendofpage0
+ inc ch0emmpage
+notbothendofpage0: mov si,ch1offset
+ add si,2048
+ and si,16384-1
+ mov ch1offset,si
+ cmp si,0
+ jnz notbothendofpage1
+ inc ch1emmpage
+notbothendofpage1: ret
+
+ endp
+
+
+
+Saveems proc near
+
+ mov ah,4eh
+ mov al,0
+ mov es,soundbuffer
+ mov di,16384+2048-256
+ int 67h
+ ret
+
+ endp
+
+
+Restoreems proc near
+
+ push si di
+ mov ah,4eh
+ mov al,1
+ mov ds,soundbuffer
+ mov si,16384+2048-256
+ int 67h
+ pop di si
+ ret
+
+ endp
+
+
+
+Domix proc near
+
+ cmp volume,0
+ jnz lowvolumemix
+
+slow: lodsb
+ mov ah,[bx]
+ inc bx
+ cmp al,dh
+ jnc toplot
+
+botlot: cmp ah,dh
+ jnc nodistort
+ add al,ah
+ js botok
+ xor al,al
+ stosb
+ loop slow
+ jmp doneit
+botok: xor al,dh
+ stosb
+ loop slow
+ jmp doneit
+
+toplot: cmp ah,dh
+ jc nodistort
+ add al,ah
+ jns topok
+ mov al,dl
+ stosb
+ loop slow
+ jmp doneit
+topok: xor al,dh
+ stosb
+ loop slow
+ jmp doneit
+
+nodistort: add al,ah
+ xor al,dh
+ stosb
+ loop slow
+ jmp doneit
+
+
+lowvolumemix: lodsb
+ push bx
+ mov bh,volume
+ add bh,63
+ mov bl,al
+ mov al,[es:bx]
+ pop bx
+
+ mov ah,[bx]
+ inc bx
+ cmp al,dh
+ jnc toplotv
+
+botlotv: cmp ah,dh
+ jnc nodistortv
+ add al,ah
+ js botokv
+ xor al,al
+ stosb
+ loop lowvolumemix
+ jmp doneit
+botokv: xor al,dh
+ stosb
+ loop lowvolumemix
+ jmp doneit
+
+toplotv: cmp ah,dh
+ jc nodistortv
+ add al,ah
+ jns topokv
+ mov al,dl
+ stosb
+ loop lowvolumemix
+ jmp doneit
+topokv: xor al,dh
+ stosb
+ loop lowvolumemix
+ jmp doneit
+
+nodistortv: add al,ah
+ xor al,dh
+ stosb
+ loop lowvolumemix
+doneit: ret
+
+
+ endp
+
+
+
+
+
+
+
+Dmaend proc near
+
+ cli
+ push ax cx dx
+ call startdmablock
+ mov dx,DSP_status
+ in al,dx
+ mov al,20h
+ out 20h,al
+ pop dx cx ax
+ iret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Startdmablock proc near
+
+ mov al,sounddmachannel ;cx=length
+ or al,4 ;bx=offset
+ out 0ah,al
+ xor al,al
+ out 0ch,al
+
+ mov al,48h
+ or al,sounddmachannel
+ out 0bh,al
+
+ mov cx,soundbufferad
+ xor dh,dh
+ mov dl,sounddmachannel
+ shl dl,1
+ mov al,cl
+ out dx,al
+ mov al,ch
+ out dx,al
+
+ mov dl,dmaaddress
+ mov al,soundbufferpage ;hardware page
+ out dx,al
+
+ mov dl,sounddmachannel
+ shl dl,1
+ inc dl
+ mov cx,16384-1
+ mov al,cl
+ out dx,al
+ mov al,ch
+ out dx,al
+
+ mov al,sounddmachannel
+ out 0ah,al ;dmac programmed
+
+ mov dx,DSP_write
+notclear1: in al,dx
+ or al,al
+ js notclear1
+ mov al,14h
+ out dx,al
+notclear2: in al,dx
+ or al,al
+ js notclear2
+ mov al,cl
+ out dx,al
+notclear3: in al,dx
+ or al,al
+ js notclear3
+ mov al,ch
+ out dx,al
+
+ ret
+
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SetupPIT proc near
+
+ mov ah,35h
+ mov al,8
+ int 21h
+ mov oldint8seg,es ; Save es:bx to temp memory
+ mov oldint8add,bx
+ push cs
+ pop ds
+ mov dx,offset cs:PITinterupt
+ mov ah,25h
+ mov al,8
+ int 21h ; Set to new
+
+ mov al,34h
+ out 43h,al
+ mov al,0h
+ out 40h,al
+ mov al,0dah
+ out 40h,al
+ ret
+
+ endp
+
+
+
+
+
+
+Getridofpit proc near
+
+ cmp oldint8seg,-1
+ jz noresetPIT
+ mov dx,oldint8add
+ mov ax,oldint8seg
+ mov ds,ax
+ mov ah,25h
+ mov al,8
+ int 21h
+ mov al,34h
+ out 43h,al
+ mov al,0
+ out 40h,al
+ mov al,0
+ out 40h,al
+noresetPIT: ret
+
+ endp
+
+
+
+
+
+
+PITinterupt proc near
+
+ cli
+ push ax dx cx
+
+ xor dh,dh
+ mov dl,sounddmachannel
+ shl dl,1
+ in al,dx
+ mov cl,al
+ in al,dx
+ mov ch,al
+ sub cx,soundbufferad
+ mov ax,soundbufferwrite
+ sub ax,cx
+ and ax,3fffh
+ sti
+ cmp ax,8192
+ jnc mustgo
+ cmp ax,2048
+ jnc nopitflip
+
+mustgo: push bx si di es ds
+ call makenextblock
+ pop ds es di si bx
+
+nopitflip: cli
+ mov al,20h
+ out 20h,al
+ pop cx dx ax
+ iret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/sprite.asm b/devtools/tasmrecover/dreamweb/sprite.asm
new file mode 100644
index 0000000000..31325fc2b3
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/sprite.asm
@@ -0,0 +1,5034 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;------------------------------------------------------------People Routines----
+
+
+
+Reelroutines db 1,44,0 ;Room number and x,y
+ dw 20 ;reel pointer
+ db 2,0,1 ;speed,speed count,convers. no.
+
+ db 1,55,0
+ dw 0
+ db 50,20,0
+
+ db 24,22,0
+ dw 74
+ db 1,0,0
+
+ db 24,33,10
+ dw 75
+ db 1,0,1
+
+ db 1,44,0
+ dw 27
+ db 2,0,2
+
+ db 1,44,0
+ dw 96
+ db 3,0,4
+
+ db 1,44,0
+ dw 118
+ db 2,0,5
+
+ db 1,44,10
+ dw 0
+ db 2,0,0
+
+ db 5,22,20
+ dw 53
+ db 3,0,0
+
+ db 5,22,20
+ dw 40
+ db 1,0,2
+
+ db 5,22,20
+ dw 50
+ db 1,0,3
+
+ db 2,11,10
+ dw 192
+ db 1,0,0
+
+ db 2,11,10
+ dw 182
+ db 2,0,1
+
+ db 8,11,10
+ dw 0
+ db 2,0,1
+
+ db 23,0,50
+ dw 0
+ db 3,0,0
+
+ db 28,11,20
+ dw 250
+ db 4,0,0
+
+ db 23,0,50
+ dw 43
+ db 2,0,8
+
+ db 23,11,40
+ dw 130
+ db 2,0,1
+
+ db 23,22,40
+ dw 122
+ db 2,0,2
+
+ db 23,22,40
+ dw 105
+ db 2,0,3
+
+ db 23,22,40
+ dw 81
+ db 2,0,4
+
+ db 23,11,40
+ dw 135
+ db 2,0,5
+
+ db 23,22,40
+ dw 145
+ db 2,0,6
+
+ db 4,22,30
+ dw 0
+ db 2,0,0
+
+ db 45,22,30
+ dw 200
+ db 0,0,20
+
+ db 45,22,30
+ dw 39
+ db 2,0,0
+
+ db 45,22,30
+ dw 25
+ db 2,0,0
+
+ db 8,22,40
+ dw 32
+ db 2,0,0
+
+ db 7,11,20
+ dw 64
+ db 2,0,0
+
+ db 22,22,20
+ dw 82
+ db 2,0,0
+
+ db 27,11,30
+ dw 0
+ db 2,0,0
+
+ db 20,0,30
+ dw 0
+ db 2,0,0
+
+ db 14,33,40
+ dw 21
+ db 1,0,0
+
+ db 29,11,10
+ dw 0
+ db 1,0,0
+
+ db 2,22,0
+ dw 2
+ db 2,0,0
+
+ db 25,0,50
+ dw 4
+ db 2,0,0
+
+ db 50,22,30
+ dw 121
+ db 2,0,0
+
+ db 50,22,30
+ dw 0
+ db 20,0,0
+
+ db 52,22,30
+ dw 192
+ db 2,0,0
+
+ db 52,22,30
+ dw 233
+ db 2,0,0
+
+ db 50,22,40
+ dw 104
+ if cd
+ if german
+ db 65,0,0
+ else
+ db 55,0,0
+ endif
+ else
+ db 55,0,0
+ endif
+
+ db 53,33,0
+ dw 99
+ db 2,0,0
+
+ db 50,22,40
+ dw 0
+ db 3,0,0
+
+ db 50,22,30
+ dw 162
+ db 2,0,0
+
+ db 52,22,30
+ dw 57
+ db 2,0,0
+
+ db 52,22,30
+ dw 0
+ db 2,0,0
+
+ db 54,0,0
+ dw 72
+ db 3,0,0
+
+ db 55,44,0
+ dw 0
+ db 2,0,0
+
+ db 19,0,0
+ dw 0
+ db 28,0,0
+
+ db 14,22,0
+ dw 2
+ db 2,0,0
+
+ db 14,22,0
+ dw 300
+ db 1,0,0
+
+ db 10,22,30
+ dw 174
+ db 0,0,0
+
+ db 12,22,20
+ dw 0
+ db 1,0,0
+
+ db 11,11,20
+ dw 0
+ db 50,20,0
+
+ db 11,11,30
+ dw 0
+ db 50,20,0
+
+ db 11,22,20
+ dw 0
+ db 50,20,0
+
+ db 14,33,40
+ dw 0
+ db 50,20,0
+
+ db 255
+
+
+Lenofreelrouts equ $-reelroutines
+
+
+Reelcalls dw gamer,sparkydrip,eden,edeninbath,sparky,smokebloke
+ dw manasleep,drunk,receptionist,malefan,femalefan
+ dw louis,louischair,soldier1,bossman,interviewer
+ dw heavy,manasleep2,mansatstill,drinker,bartender
+ dw othersmoker,tattooman,attendant,keeper,candles1
+ dw smallcandle,security,copper,poolguard,rockstar
+ dw businessman,train,aide,mugger,helicopter
+ dw intromagic1,intromusic,intromagic2,candles2,gates
+ dw intromagic3,intromonks1,candles,intromonks2
+ dw handclap,monkandryan,endgameseq,priest,madman
+ dw madmanstelly,alleybarksound,foghornsound
+ dw carparkdrip,carparkdrip,carparkdrip,carparkdrip
+
+
+
+;---------------------------------------------------------Character updates----
+
+
+
+Alleybarksound proc near
+
+ mov ax,[es:bx+3]
+ dec ax
+ cmp ax,0
+ jnz nobark
+ push bx es
+ mov al,14
+ call playchannel1
+ pop es bx
+ mov ax,1000
+nobark: mov [es:bx+3],ax
+ ret
+
+ endp
+
+
+
+
+Intromusic proc near
+
+ ret
+
+ endp
+
+
+Foghornsound proc near
+
+ call randomnumber
+ cmp al,198
+ jnz nofog
+ mov al,13
+ call playchannel1
+nofog: ret
+
+ endp
+
+
+
+
+Receptionist proc near
+
+ call checkspeed
+ jnz gotrecep
+ cmp cardpassflag,1
+ jnz notsetcard
+ inc cardpassflag
+ mov byte ptr [es:bx+7],1
+ mov word ptr [es:bx+3],64
+notsetcard: cmp word ptr [es:bx+3],58
+ jnz notdes1
+ call randomnumber
+ cmp al,30
+ jc notdes2
+ mov word ptr [es:bx+3],55
+ jmp gotrecep
+
+notdes1: cmp word ptr [es:bx+3],60
+ jnz notdes2
+ call randomnumber
+ cmp al,240
+ jc gotrecep
+ mov word ptr [es:bx+3],53
+ jmp gotrecep
+
+notdes2: cmp word ptr [es:bx+3],88
+ jnz notendcard
+ mov word ptr [es:bx+3],53
+ jmp gotrecep
+
+notendcard: inc word ptr [es:bx+3]
+gotrecep: call showgamereel
+ call addtopeoplelist
+
+ mov al,[es:bx+7]
+ and al,128
+ jz nottalkedrecep
+ mov talkedtorecep,1
+nottalkedrecep: ret
+
+ endp
+
+
+
+
+Smokebloke proc near
+
+ cmp rockstardead,0
+ jnz notspokento
+ mov al,[es:bx+7]
+ and al,128
+ jz notspokento
+ push es bx
+ mov al,5
+ call setlocation
+ pop bx es
+notspokento: ;mov al,[es:bx+7]
+ ;and al,127
+ ;mov [es:bx+7],al
+ call checkspeed
+ jnz gotsmokeb
+ cmp word ptr [es:bx+3],100
+ jnz notsmokeb1
+ call randomnumber
+ cmp al,30
+ jc notsmokeb2
+ mov word ptr [es:bx+3],96
+ jmp gotsmokeb
+
+notsmokeb1: cmp word ptr [es:bx+3],117
+ jnz notsmokeb2
+ mov word ptr [es:bx+3],96
+ jmp gotsmokeb
+
+notsmokeb2: inc word ptr [es:bx+3]
+gotsmokeb: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Attendant proc near
+
+ call showgamereel
+ call addtopeoplelist
+ mov al,[es:bx+7]
+ and al,128
+ jz nottalked
+ mov talkedtoattendant,1
+nottalked: ret
+
+ endp
+
+
+
+
+
+
+Manasleep proc near
+
+ mov al,[es:bx+7]
+ and al,127
+ mov [es:bx+7],al
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+Eden proc near
+
+ cmp generaldead,0
+ jnz notinbed
+ call showgamereel
+ call addtopeoplelist
+notinbed: ret
+
+ endp
+
+
+
+Edeninbath proc near
+
+ cmp generaldead,0
+ jz notinbed
+ cmp sartaindead,0
+ jnz notinbath
+ call showgamereel
+ call addtopeoplelist
+notinbath: ret
+
+ endp
+
+
+
+Malefan proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+Femalefan proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+Louis proc near
+
+ cmp rockstardead,0
+ jnz notlouis1
+ call showgamereel
+ call addtopeoplelist
+notlouis1: ret
+
+ endp
+
+
+
+
+Louischair proc near
+
+ cmp rockstardead,0
+ jz notlouis2
+ call checkspeed
+ jnz notlouisanim
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,191
+ jz restartlouis
+ cmp ax,185
+ jz randomlouis
+ mov [es:bx+3],ax
+ jmp notlouisanim
+randomlouis: mov [es:bx+3],ax
+ call randomnumber
+ cmp al,245
+ jnc notlouisanim
+restartlouis: mov ax,182
+ mov [es:bx+3],ax
+notlouisanim: call showgamereel
+ call addtopeoplelist
+notlouis2: ret
+
+ endp
+
+
+
+Manasleep2 proc near
+
+ mov al,[es:bx+7]
+ and al,127
+ mov [es:bx+7],al
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+Mansatstill proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+Tattooman proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+Drinker proc near
+
+ call checkspeed
+ jnz gotdrinker
+ inc word ptr [es:bx+3]
+ cmp word ptr [es:bx+3],115
+ jnz notdrinker1
+ mov word ptr [es:bx+3],105
+ jmp gotdrinker
+
+notdrinker1: cmp word ptr [es:bx+3],106
+ jnz gotdrinker
+ call randomnumber
+ cmp al,3
+ jc gotdrinker
+ mov word ptr [es:bx+3],105
+
+gotdrinker: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+Bartender proc near
+
+ call checkspeed
+ jnz gotsmoket
+ cmp word ptr [es:bx+3],86
+ jnz notsmoket1
+ call randomnumber
+ cmp al,18
+ jc notsmoket2
+ mov word ptr [es:bx+3],81
+ jmp gotsmoket
+
+notsmoket1: cmp word ptr [es:bx+3],103
+ jnz notsmoket2
+ mov word ptr [es:bx+3],81
+ jmp gotsmoket
+
+notsmoket2: inc word ptr [es:bx+3]
+gotsmoket: call showgamereel
+ cmp gunpassflag,1
+ jnz notgotgun
+ mov byte ptr [es:bx+7],9
+notgotgun: call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+
+Othersmoker proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+Barwoman proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Interviewer proc near
+
+ cmp reeltowatch,68
+ jnz notgeneralstart
+ inc word ptr [es:bx+3]
+notgeneralstart: cmp word ptr [es:bx+3],250
+ jz talking
+ call checkspeed
+ jnz talking
+ cmp word ptr [es:bx+3],259
+ jz talking
+ inc word ptr [es:bx+3]
+talking: call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+Soldier1 proc near
+
+ cmp word ptr [es:bx+3],0
+ jz soldierwait
+ mov watchingtime,10
+ cmp word ptr [es:bx+3],30
+ jnz notaftersshot
+ inc combatcount
+ cmp combatcount,40
+ jnz gotsoldframe
+ mov mandead,2
+ jmp gotsoldframe
+notaftersshot: call checkspeed
+ jnz gotsoldframe
+ inc word ptr [es:bx+3]
+ jmp gotsoldframe
+soldierwait: cmp lastweapon,1
+ jnz gotsoldframe
+ mov watchingtime,10
+ cmp manspath,2
+ jnz gotsoldframe
+ cmp facing,4
+ jnz gotsoldframe
+ inc word ptr [es:bx+3]
+ mov lastweapon,-1
+ mov combatcount,0
+gotsoldframe: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Rockstar proc near
+
+ mov ax,[es:bx+3]
+ cmp ax,303
+ jz rockcombatend
+ cmp ax,118
+ jz rockcombatend
+ call checkspeed
+ jnz rockspeed
+
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,118
+ jnz notbeforedead
+ mov mandead,2
+ jmp gotrockframe
+
+notbeforedead: cmp ax,79
+ jnz gotrockframe
+ dec ax
+ cmp lastweapon,1
+ jnz notgunonrock
+ mov lastweapon,-1
+ mov ax,123
+ jmp gotrockframe
+notgunonrock: inc combatcount
+ cmp combatcount,40
+ jnz gotrockframe
+ mov combatcount,0
+ mov ax,79
+
+gotrockframe: mov [es:bx+3],ax
+rockspeed: call showgamereel
+ cmp word ptr [es:bx+3],78
+ jnz notalkrock
+ call addtopeoplelist
+ mov pointermode,2
+ mov watchingtime,0
+ ret
+
+notalkrock: mov watchingtime,2
+ mov pointermode,0
+ mov al,mapy
+ mov [es:bx+2],al
+ ret
+
+rockcombatend: mov newlocation,45
+ call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Helicopter proc near
+
+ mov ax,[es:bx+3]
+ cmp ax,203
+ jz heliwon
+ ;cmp ax,53
+ ;jz helicombatend
+ call checkspeed
+ jnz helispeed
+
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,53
+ jnz notbeforehdead
+ inc combatcount
+ cmp combatcount,8
+ jc waitabit
+ mov mandead,2
+waitabit: mov ax,49
+ jmp gotheliframe
+
+notbeforehdead: cmp ax,9
+ jnz gotheliframe
+ dec ax
+ cmp lastweapon,1
+ jnz notgunonheli
+ mov lastweapon,-1
+ mov ax,55
+ jmp gotheliframe
+notgunonheli: mov ax,5
+ inc combatcount
+ cmp combatcount,20
+ jnz gotheliframe
+ mov combatcount,0
+ mov ax,9
+
+gotheliframe: mov [es:bx+3],ax
+helispeed: call showgamereel
+ mov al,mapx
+ mov [es:bx+1],al
+helicombatend: mov ax,[es:bx+3]
+ cmp ax,9 ;8
+ jnc notwaitingheli
+ cmp combatcount,7
+ jc notwaitingheli
+ mov pointermode,2
+ mov watchingtime,0
+ ret
+notwaitingheli: mov pointermode,0
+ mov watchingtime,2
+ ret
+
+heliwon: mov pointermode,0
+ ret
+
+ endp
+
+
+Mugger proc near
+
+ mov ax,[es:bx+3]
+ cmp ax,138
+ jz endmugger1
+ cmp ax,176
+ jz endmugger2
+ cmp ax,2
+ jnz havesetwatch
+ mov watchingtime,175*2
+havesetwatch: call checkspeed
+ jnz notmugger
+ inc word ptr [es:bx+3]
+notmugger: call showgamereel
+ mov al,mapx
+ mov [es:bx+1],al
+ ret
+
+endmugger1: push es bx
+ call createpanel2
+ call showicon
+ mov al,41
+ call findpuztext
+ mov di,33+20
+ mov bx,104
+ mov dl,241
+ mov ah,0
+ call printdirect
+ call worktoscreen
+ mov cx,300
+ call hangon
+ pop bx es
+ push es bx
+ mov word ptr [es:bx+3],140
+ mov manspath,2
+ mov finaldest,2
+ call findxyfrompath
+ mov resetmanxy,1
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"A"
+ call findexobject
+ mov command,al
+ mov objecttype,4
+ call removeobfrominv
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"B"
+ call findexobject
+ mov command,al
+ mov objecttype,4
+ call removeobfrominv
+ call makemainscreen
+ mov al,48
+ mov bl,68-32
+ mov bh,54+64
+ mov cx,70 ; time on screen
+ mov dx,10 ; pause before show
+ call setuptimeduse
+ mov beenmugged,1
+ pop bx es
+ ret
+
+endmugger2: ret
+
+
+ endp
+
+
+
+
+
+
+
+
+Aide proc near
+
+ call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+Businessman proc near
+
+ mov pointermode,0
+ mov watchingtime,2
+ mov ax,[es:bx+3]
+ cmp ax,2
+ jnz notfirstbiz
+ push ax bx es
+ mov al,49
+ mov cx,30
+ mov dx,1
+ mov bl,68
+ mov bh,174
+ call setuptimeduse
+ pop es bx ax
+
+notfirstbiz: cmp ax,95
+ jz buscombatwonend
+ cmp ax,49
+ jz buscombatend
+
+ call checkspeed
+ jnz busspeed
+
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,48
+ jnz notbeforedeadb
+ mov mandead,2
+ jmp gotbusframe
+
+notbeforedeadb: cmp ax,15
+ jnz buscombatwon
+ dec ax
+ cmp lastweapon,3
+ jnz notshieldonbus
+ mov lastweapon,-1
+ mov combatcount,0
+ mov ax,51
+ jmp gotbusframe
+notshieldonbus: inc combatcount
+ cmp combatcount,20
+ jnz gotbusframe
+ mov combatcount,0
+ mov ax,15
+ jmp gotbusframe
+
+buscombatwon: cmp ax,91
+ jnz gotbusframe
+ push bx es
+ mov al,0
+ call turnpathon
+ mov al,1
+ call turnpathon
+ mov al,2
+ call turnpathon
+ mov al,3
+ call turnpathoff
+ mov manspath,5
+ mov finaldest,5
+ call findxyfrompath
+ mov resetmanxy,1
+ pop es bx
+ mov ax,92
+ jmp gotbusframe
+
+gotbusframe: mov [es:bx+3],ax
+busspeed: call showgamereel
+ mov al,mapy
+ mov [es:bx+2],al
+ mov ax,[es:bx+3]
+ cmp ax,14
+ jnz buscombatend
+ mov watchingtime,0
+ mov pointermode,2
+ ret
+
+buscombatend: ret
+
+buscombatwonend: mov pointermode,0
+ mov watchingtime,0
+ ret
+
+ endp
+
+
+
+
+
+
+Poolguard proc near
+
+ mov ax,[es:bx+3]
+ cmp ax,214
+ jz combatover2
+ cmp ax,258
+ jz combatover2
+ cmp ax,185
+ jz combatover1
+ cmp ax,0
+ jnz notfirstpool
+ mov al,0
+ call turnpathon
+notfirstpool: call checkspeed
+ jnz guardspeed
+
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,122
+ jnz notendguard1
+ dec ax
+ cmp lastweapon,2
+ jnz notaxeonpool
+ mov lastweapon,-1
+ mov ax,122
+ jmp gotguardframe
+notaxeonpool: inc combatcount
+ cmp combatcount,40
+ jnz gotguardframe
+ mov combatcount,0
+ mov ax,195
+ jmp gotguardframe
+
+notendguard1: cmp ax,147
+ jnz gotguardframe
+ dec ax
+ cmp lastweapon,1
+ jnz notgunonpool
+ mov lastweapon,-1
+ mov ax,147
+ jmp gotguardframe
+notgunonpool: inc combatcount
+ cmp combatcount,40
+ jnz gotguardframe
+ mov combatcount,0
+ mov ax,220
+
+gotguardframe: mov [es:bx+3],ax
+guardspeed: call showgamereel
+ mov ax,[es:bx+3]
+ cmp ax,121
+ jz iswaitingpool
+ cmp ax,146
+ jz iswaitingpool
+ mov pointermode,0
+ mov watchingtime,2
+ ret
+iswaitingpool: mov pointermode,2
+ mov watchingtime,0
+ ret
+
+combatover1: mov watchingtime,0
+ mov pointermode,0
+ mov al,0
+ call turnpathon
+ mov al,1
+ call turnpathoff
+ ret
+
+combatover2: call showgamereel
+ mov watchingtime,2
+ mov pointermode,0
+ inc combatcount
+ cmp combatcount,100
+ jc doneover2
+ mov watchingtime,0
+ mov mandead,2
+doneover2: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Security proc near
+
+ cmp word ptr [es:bx+3],32
+ jz securwait
+ cmp word ptr [es:bx+3],69
+ jnz notaftersec
+ ret
+notaftersec: mov watchingtime,10
+ call checkspeed
+ jnz gotsecurframe
+ inc word ptr [es:bx+3]
+ jmp gotsecurframe
+securwait: cmp lastweapon,1
+ jnz gotsecurframe
+ mov watchingtime,10
+ cmp manspath,9
+ jnz gotsecurframe
+ cmp facing,0
+ jnz gotsecurframe
+ mov lastweapon,-1
+ inc word ptr [es:bx+3]
+gotsecurframe: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+Heavy proc near
+
+ mov al,[es:bx+7]
+ and al,127
+ mov [es:bx+7],al
+ cmp word ptr [es:bx+3],43
+ jz heavywait
+ mov watchingtime,10
+ cmp word ptr [es:bx+3],70
+ jnz notafterhshot
+ inc combatcount
+ cmp combatcount,80
+ jnz gotheavyframe
+ mov mandead,2
+ jmp gotheavyframe
+notafterhshot: call checkspeed
+ jnz gotheavyframe
+ inc word ptr [es:bx+3]
+ jmp gotheavyframe
+heavywait: cmp lastweapon,1
+ jnz gotheavyframe
+ cmp manspath,5
+ jnz gotheavyframe
+ cmp facing,4
+ jnz gotheavyframe
+ mov lastweapon,-1
+ inc word ptr [es:bx+3]
+ mov combatcount,0
+gotheavyframe: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+Bossman proc near
+
+ call checkspeed
+ jnz notboss
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,4
+ jz firstdes
+ cmp ax,20
+ jz secdes
+ cmp ax,41
+ jnz gotallboss
+ mov ax,0
+ inc gunpassflag
+ mov byte ptr [es:bx+7],10
+ jmp gotallboss
+firstdes: cmp gunpassflag,1
+ jz gotallboss
+ push ax
+ call randomnumber
+ mov cl,al
+ pop ax
+ cmp cl,10
+ jc gotallboss
+ mov ax,0
+ jmp gotallboss
+secdes: cmp gunpassflag,1
+ jz gotallboss
+ mov ax,0
+gotallboss: mov [es:bx+3],ax
+notboss: call showgamereel
+ call addtopeoplelist
+
+ mov al,[es:bx+7]
+ and al,128
+ jz nottalkedboss
+ mov talkedtoboss,1
+nottalkedboss: ret
+
+ endp
+
+
+
+
+
+Gamer proc near
+
+ call checkspeed
+ jnz gamerfin
+gameragain: call randomnum1
+ and al,7
+ cmp al,5
+ jnc gameragain
+ add al,20
+ cmp al,[es:bx+3]
+ jz gameragain
+ mov ah,0
+ mov [es:bx+3],ax
+gamerfin: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+Sparkydrip proc near
+
+ call checkspeed
+ jnz cantdrip
+ mov al,14
+ mov ah,0
+ call playchannel0
+cantdrip: ret
+
+ endp
+
+
+
+Carparkdrip proc near
+
+ call checkspeed
+ jnz cantdrip2
+ mov al,14
+ call playchannel1
+cantdrip2: ret
+
+ endp
+
+
+
+Keeper proc near
+
+ cmp keeperflag,0
+ jnz notwaiting
+ cmp reeltowatch,190
+ jc waiting
+ inc keeperflag
+ mov ah,[es:bx+7]
+ and ah,127
+ cmp ah,dreamnumber
+ jz notdiff
+ mov al,dreamnumber
+ mov [es:bx+7],al
+notdiff: ret
+notwaiting: call addtopeoplelist
+ call showgamereel
+waiting: ret
+
+ endp
+
+
+
+Candles1 proc near
+
+ call checkspeed
+ jnz candle1
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,44
+ jnz notendcandle1
+ mov ax,39
+notendcandle1: mov [es:bx+3],ax
+candle1: call showgamereel
+ ret
+
+ endp
+
+
+
+Smallcandle proc near
+
+ call checkspeed
+ jnz smallcandlef
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,37
+ jnz notendsmallcandle
+ mov ax,25
+notendsmallcandle: mov [es:bx+3],ax
+smallcandlef: call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Intromagic1 proc near
+
+ call checkspeed
+ jnz introm1fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,145
+ jnz gotintrom1
+ mov ax,121
+gotintrom1: mov [es:bx+3],ax
+ cmp ax,121
+ jnz introm1fin
+ inc introcount
+ push es bx
+ call intro1text
+ pop bx es
+ cmp introcount,8 ; was 7
+ jnz introm1fin
+ add mapy,10
+ mov nowinnewroom,1
+introm1fin: call showgamereel
+ ret
+
+ endp
+
+
+
+
+Candles proc near
+
+ call checkspeed
+ jnz candlesfin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,167
+ jnz gotcandles
+ mov ax,162
+gotcandles: mov [es:bx+3],ax
+candlesfin: call showgamereel
+ ret
+
+ endp
+
+
+
+Candles2 proc near
+
+ call checkspeed
+ jnz candles2fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,238
+ jnz gotcandles2
+ mov ax,233
+gotcandles2: mov [es:bx+3],ax
+candles2fin: call showgamereel
+ ret
+
+ endp
+
+
+
+Gates proc near
+
+ call checkspeed
+ jnz gatesfin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,116
+ jnz notbang
+ push ax bx es
+ mov al,17 ;12
+ call playchannel1
+ pop es bx ax
+notbang: cmp ax,110
+ jc slowgates
+ mov byte ptr [es:bx+5],2
+slowgates: cmp ax,120
+ jnz gotgates
+ mov getback,1
+ mov ax,119
+gotgates: mov [es:bx+3],ax
+ push es bx
+ call intro3text
+ pop bx es
+gatesfin: call showgamereel
+ ret
+
+ endp
+
+
+
+
+Intromagic2 proc near
+
+ call checkspeed
+ jnz introm2fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,216
+ jnz gotintrom2
+ mov ax,192
+gotintrom2: mov [es:bx+3],ax
+introm2fin: call showgamereel
+ ret
+
+ endp
+
+
+
+
+Intromagic3 proc near
+
+ call checkspeed
+ jnz introm3fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,218
+ jnz gotintrom3
+ mov getback,1
+gotintrom3: mov [es:bx+3],ax
+introm3fin: call showgamereel
+ mov al,mapx
+ mov [es:bx+1],al
+ ret
+
+ endp
+
+
+
+
+
+
+
+Intromonks1 proc near
+
+ call checkspeed
+ jnz intromonk1fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,80
+ jnz notendmonk1
+ add mapy,10
+ mov nowinnewroom,1
+ call showgamereel
+ ret
+notendmonk1: cmp ax,30
+ jnz gotintromonk1
+ sub mapy,10
+ mov nowinnewroom,1
+ mov ax,51
+gotintromonk1: mov [es:bx+3],ax
+ cmp ax,5
+ jz waitstep
+ cmp ax,15
+ jz waitstep
+ cmp ax,25
+ jz waitstep
+ cmp ax,61
+ jz waitstep
+ cmp ax,71
+ jz waitstep
+ jmp intromonk1fin
+waitstep: push es bx
+ call intro2text
+ pop bx es
+ mov byte ptr [es:bx+6],-20
+intromonk1fin: call showgamereel
+ mov al,mapy
+ mov [es:bx+2],al
+ ret
+
+ endp
+
+
+
+
+Intromonks2 proc near
+
+ call checkspeed
+ jnz intromonk2fin
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,87
+ jnz nottalk1
+ inc introcount
+ push es bx
+ call monks2text
+ pop bx es
+ cmp introcount,19
+ jnz notlasttalk1
+ mov ax,87
+ jmp gotintromonk2
+notlasttalk1: mov ax,74
+ jmp gotintromonk2
+
+nottalk1: cmp ax,110
+ jnz notraisearm
+ inc introcount
+ push es bx
+ call monks2text
+ pop bx es
+ if cd
+ if german
+ cmp introcount,42
+ else
+ cmp introcount,35
+ endif
+ else
+ cmp introcount,35
+ endif
+ jnz notlastraise
+ mov ax,111
+ jmp gotintromonk2
+notlastraise: mov ax,98
+ jmp gotintromonk2
+
+notraisearm: cmp ax,176
+ jnz notendmonk2
+ mov getback,1
+ jmp gotintromonk2
+notendmonk2: cmp ax,125
+ jnz gotintromonk2
+ mov ax,140
+gotintromonk2: mov [es:bx+3],ax
+intromonk2fin: call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+Handclap proc near
+
+ ret
+
+ endp
+
+
+
+
+ if german
+ if cd
+
+Monks2text proc near
+
+ cmp introcount,1
+ jnz notmonk2text1
+ mov al,8
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text1: cmp introcount,5
+ jnz notmonk2text2
+ mov al,9
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text2: cmp introcount,9
+ jnz notmonk2text3
+ mov al,10
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text3: cmp introcount,13
+ jnz notmonk2text4
+ mov introcount,14
+ mov al,11
+ mov bl,0
+ mov bh,105
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text4: cmp introcount,19
+ jnz notmonk2text7
+ mov al,14
+ mov bl,36
+ mov bh,160
+ mov cx,100 ;32
+ mov dx,1
+ mov ah,82
+ jmp setuptimedtemp
+notmonk2text7: cmp introcount,23
+ jnz notmonk2text8
+ mov al,15
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text8: cmp introcount,27
+ jnz notmonk2text9
+ mov al,16
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text9: cmp introcount,30
+ jnz notmonk2text10
+ mov al,17
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text10: cmp introcount,35
+ jnz notmonk2text11
+ mov al,18
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text11: ret
+
+gotmonks2text: mov dx,1
+ mov cx,120
+ mov ah,82
+ call setuptimedtemp
+ ret
+
+ endp
+
+ else
+
+Monks2text proc near
+
+ cmp introcount,1
+ jnz notmonk2text1
+ mov al,8
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text1: cmp introcount,4
+ jnz notmonk2text2
+ mov al,9
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text2: cmp introcount,7
+ jnz notmonk2text3
+ mov al,10
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text3: cmp introcount,10
+ jnz notmonk2text4
+ if cd
+ mov introcount,12
+ endif
+ mov al,11
+ mov bl,0
+ mov bh,105
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text4: cmp introcount,13
+ jnz notmonk2text5
+ if cd
+ mov introcount,17; 18
+ ret
+ endif
+ mov al,12
+ mov bl,0
+ mov bh,120
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text5: cmp introcount,16
+ jnz notmonk2text6
+ mov al,13
+ mov bl,0
+ mov bh,135
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text6: cmp introcount,19
+ jnz notmonk2text7
+ mov al,14
+ mov bl,36
+ mov bh,160
+ mov cx,100 ;32
+ mov dx,1
+ mov ah,82
+ jmp setuptimedtemp
+notmonk2text7: cmp introcount,22
+ jnz notmonk2text8
+ mov al,15
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text8: cmp introcount,25
+ jnz notmonk2text9
+ mov al,16
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text9: if cd
+ cmp introcount,27
+ else
+ cmp introcount,28
+ endif
+ jnz notmonk2text10
+ mov al,17
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text10: cmp introcount,31
+ jnz notmonk2text11
+ mov al,18
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text11: ret
+
+gotmonks2text: mov dx,1
+ mov cx,120
+ mov ah,82
+ call setuptimedtemp
+ ret
+
+ endp
+
+
+ endif
+ else
+
+Monks2text proc near
+
+ cmp introcount,1
+ jnz notmonk2text1
+ mov al,8
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text1: cmp introcount,4
+ jnz notmonk2text2
+ mov al,9
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text2: cmp introcount,7
+ jnz notmonk2text3
+ mov al,10
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text3: cmp introcount,10
+ jnz notmonk2text4
+ if cd
+ mov introcount,12
+ endif
+ mov al,11
+ mov bl,0
+ mov bh,105
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text4: cmp introcount,13
+ jnz notmonk2text5
+ if cd
+ mov introcount,17; 18
+ ret
+ endif
+ mov al,12
+ mov bl,0
+ mov bh,120
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text5: cmp introcount,16
+ jnz notmonk2text6
+ mov al,13
+ mov bl,0
+ mov bh,135
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text6: cmp introcount,19
+ jnz notmonk2text7
+ mov al,14
+ mov bl,36
+ mov bh,160
+ mov cx,100 ;32
+ mov dx,1
+ mov ah,82
+ jmp setuptimedtemp
+notmonk2text7: cmp introcount,22
+ jnz notmonk2text8
+ mov al,15
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text8: cmp introcount,25
+ jnz notmonk2text9
+ mov al,16
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text9: if cd
+ cmp introcount,27
+ else
+ cmp introcount,28
+ endif
+ jnz notmonk2text10
+ mov al,17
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text10: cmp introcount,31
+ jnz notmonk2text11
+ mov al,18
+ mov bl,36
+ mov bh,160
+ mov cx,100
+ jmp gotmonks2text
+notmonk2text11: ret
+
+gotmonks2text: mov dx,1
+ mov cx,120
+ mov ah,82
+ call setuptimedtemp
+ ret
+
+ endp
+
+ endif
+
+
+
+
+
+
+Intro1text proc near
+
+ cmp introcount,2
+ jnz notintro1text1
+ mov al,40
+ mov bl,34
+ mov bh,130
+ mov cx,90
+ jmp gotintro1text
+notintro1text1: cmp introcount,4
+ jnz notintro1text2
+ mov al,41
+ mov bl,34
+ mov bh,130
+ mov cx,90
+ jmp gotintro1text
+notintro1text2: cmp introcount,6
+ jnz notintro1text3
+ mov al,42
+ mov bl,34
+ mov bh,130
+ mov cx,90
+ jmp gotintro1text
+notintro1text3: ret
+
+gotintro1text: mov dx,1
+ mov ah,82
+ if cd
+ cmp ch1playing,255
+ jz oktalk2
+ dec introcount
+ ret
+ endif
+oktalk2: call setuptimedtemp
+ ret
+
+ endp
+
+
+
+Intro2text proc near
+
+ cmp ax,5
+ jnz notintro2text1
+ mov al,43
+ mov bl,34
+ mov bh,40
+ mov cx,90
+ jmp gotintro2text
+notintro2text1: cmp ax,15
+ jnz notintro2text2
+ mov al,44
+ mov bl,34
+ mov bh,40
+ mov cx,90
+ jmp gotintro2text
+notintro2text2: ret
+
+gotintro2text: mov dx,1
+ mov ah,82
+ call setuptimedtemp
+ ret
+
+ endp
+
+
+
+
+
+
+Intro3text proc near
+
+ cmp ax,107
+ jnz notintro3text1
+ mov al,45
+ mov bl,36
+ mov bh,56
+ mov cx,100
+ jmp gotintro3text
+notintro3text1: if cd
+ cmp ax,108
+ else
+ cmp ax,109
+ endif
+ jnz notintro3text2
+ mov al,46
+ mov bl,36
+ mov bh,56
+ mov cx,100
+ jmp gotintro3text
+notintro3text2: ret
+
+gotintro3text: mov dx,1
+ mov ah,82
+ call setuptimedtemp
+ ret
+
+ endp
+
+
+
+
+
+
+
+Monkandryan proc near
+
+ call checkspeed
+ jnz notmonkryan
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,83
+ jnz gotmonkryan
+ inc introcount
+ push es bx
+ call textformonk
+ pop bx es
+ mov ax,77
+ cmp introcount,57
+ jnz gotmonkryan
+ mov getback,1
+ ret
+gotmonkryan: mov [es:bx+3],ax
+notmonkryan: call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+Endgameseq proc near
+
+ call checkspeed
+ jnz notendseq
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,51
+ jnz gotendseq
+ cmp introcount,140
+ jz gotendseq
+ inc introcount
+ push es bx
+ call textforend
+ pop bx es
+ mov ax,50
+gotendseq: mov [es:bx+3],ax
+ cmp ax,134
+ jnz notfadedown
+ push es bx ax
+ call fadescreendownhalf
+ pop ax bx es
+ jmp notendseq
+notfadedown: cmp ax,324
+ jnz notfadeend
+ push es bx ax
+ call fadescreendowns
+ mov volumeto,7
+ mov volumedirection,1
+ pop ax bx es
+notfadeend: cmp ax,340
+ jnz notendseq
+ mov getback,1
+notendseq: call showgamereel
+ mov al,mapy
+ mov [es:bx+2],al
+ mov ax,[es:bx+3]
+ cmp ax,145
+ jnz notendcreds
+ mov word ptr [es:bx+3],146
+ call rollendcredits
+notendcreds: ret
+
+ endp
+
+
+
+
+
+
+Rollendcredits proc near
+
+ mov al,16
+ mov ah,255
+ call playchannel0
+ mov volume,7
+ mov volumeto,0
+ mov volumedirection,-1
+
+ mov cl,160
+ mov ch,160
+ mov di,75
+ mov bx,20
+ mov ds,mapstore
+ mov si,0
+ call multiget
+
+ mov es,textfile1
+ mov si,3*2
+ mov ax,[es:si]
+ mov si,ax
+ add si,textstart
+
+ mov cx,254
+endcredits1: push cx
+
+ mov bx,10
+ mov cx,linespacing
+endcredits2: push cx si di es bx
+
+ call vsync
+ mov cl,160
+ mov ch,160
+ mov di,75
+ mov bx,20
+ mov ds,mapstore
+ mov si,0
+ call multiput
+ call vsync
+ pop bx es di si
+ push si di es bx
+
+ mov cx,18
+onelot: push cx
+ mov di,75
+ mov dx,161
+ mov ax,0
+ call printdirect
+ add bx,linespacing
+ pop cx
+ loop onelot
+
+ call vsync
+ mov cl,160
+ mov ch,160
+ mov di,75
+ mov bx,20
+ call multidump
+
+ pop bx es di si cx
+ dec bx
+ loop endcredits2
+ pop cx
+looknext: mov al,[es:si]
+ inc si
+ cmp al,":"
+ jz gotnext
+ cmp al,0
+ jz gotnext
+ jmp looknext
+gotnext: loop endcredits1
+
+ mov cx,100
+ call hangon
+ call paneltomap
+ call fadescreenuphalf
+ ret
+
+ endp
+
+
+
+
+
+
+Priest proc near
+
+ cmp word ptr [es:bx+3],8
+ jz priestspoken
+ mov pointermode,0
+ mov watchingtime,2
+ call checkspeed
+ jnz priestwait
+ inc word ptr [es:bx+3]
+ push es bx
+ call priesttext
+ pop bx es
+priestwait: ret
+
+priestspoken: ret
+
+ endp
+
+
+
+
+
+
+Madmanstelly proc near
+
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,307
+ jnz notendtelly
+ mov ax,300
+notendtelly: mov [es:bx+3],ax
+ call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+Madman proc near
+
+ mov watchingtime,2
+ call checkspeed
+ jnz nomadspeed
+ mov ax,[es:bx+3]
+ cmp ax,364
+ jnc ryansded
+ cmp ax,10
+ jnz notfirstmad
+ push es bx ax
+ mov dx,offset cs:introtextname
+ call loadtemptext
+ pop ax bx es
+ mov combatcount,-1
+ mov speechcount,0
+notfirstmad: inc ax
+ cmp ax,294
+ jz madmanspoken
+ cmp ax,66
+ jnz nomadspeak
+ inc combatcount
+ push es bx
+ call madmantext
+ pop bx es
+ mov ax,53
+ if cd
+ cmp combatcount,64
+ else
+ cmp combatcount,62
+ endif
+ jc nomadspeak
+ if cd
+ cmp combatcount,70
+ else
+ cmp combatcount,68
+ endif
+ jz killryan
+ cmp lastweapon,8
+ jnz nomadspeak
+ if cd
+ mov combatcount,72
+ else
+ mov combatcount,70
+ endif
+ mov lastweapon,-1
+ mov madmanflag,1
+ mov ax,67
+ jmp nomadspeak
+killryan: mov ax,310
+nomadspeak: mov [es:bx+3],ax
+nomadspeed: call showgamereel
+ mov al,mapx
+ mov [es:bx+1],al
+ call madmode
+ ret
+madmanspoken: cmp wongame,1
+ jz alreadywon
+ mov wongame,1
+ push es bx
+ call getridoftemptext
+ pop bx es
+alreadywon: ret
+
+ryansded: mov mandead,2
+ call showgamereel
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+ if cd
+Madmantext proc near
+
+ cmp speechcount,63
+ jnc nomadtext
+ cmp ch1playing,255
+ jnz nomadtext
+
+ mov al,speechcount
+ inc speechcount
+ add al,47
+ mov bl,72
+ mov bh,80
+ mov cx,90
+ mov dx,1
+ mov ah,82
+ call setuptimedtemp
+nomadtext: ret
+
+ endp
+
+ else
+
+Madmantext proc near
+
+ cmp combatcount,61
+ jnc nomadtext
+ mov al,combatcount
+ and al,3
+ jnz nomadtext
+ mov al,combatcount
+ shr al,1
+ shr al,1
+ add al,47
+ mov bl,72
+ mov bh,80
+ mov cx,90
+ mov dx,1
+ mov ah,82
+ call setuptimedtemp
+nomadtext: ret
+
+ endp
+ endif
+
+
+
+
+Madmode proc near
+
+ mov watchingtime,2
+ mov pointermode,0
+ if cd
+ cmp combatcount,65
+ else
+ cmp combatcount,63
+ endif
+ jc iswatchmad
+ if cd
+ cmp combatcount,70
+ else
+ cmp combatcount,68
+ endif
+ jnc iswatchmad
+ mov pointermode,2
+iswatchmad: ret
+
+ endp
+
+
+
+
+
+Priesttext proc near
+
+ cmp word ptr [es:bx+3],2
+ jc nopriesttext
+ cmp word ptr [es:bx+3],7
+ jnc nopriesttext
+ mov al,[es:bx+3]
+ and al,1
+ jnz nopriesttext
+ mov al,[es:bx+3]
+ shr al,1
+ add al,50
+ mov bl,72
+ mov bh,80
+ mov cx,54
+ mov dx,1
+ call setuptimeduse
+nopriesttext: ret
+
+ endp
+
+
+
+
+Textforend proc near
+
+ cmp introcount,20
+ jnz notendtext1
+ mov al,0
+ mov bl,34
+ mov bh,20
+ mov cx,60
+ jmp gotendtext
+notendtext1: if cd
+ cmp introcount,50
+ else
+ cmp introcount,65
+ endif
+ jnz notendtext2
+ mov al,1
+ mov bl,34
+ mov bh,20
+ mov cx,60
+ jmp gotendtext
+notendtext2: if cd
+ cmp introcount,85
+ else
+ cmp introcount,110
+ endif
+ jnz notendtext3
+ mov al,2
+ mov bl,34
+ mov bh,20
+ mov cx,60
+ jmp gotendtext
+notendtext3: ret
+
+gotendtext: mov dx,1
+ mov ah,83
+ call setuptimedtemp
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Textformonk proc near
+
+ cmp introcount,1
+ jnz notmonktext1
+ mov al,19
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext1: cmp introcount,5
+ jnz notmonktext2
+ mov al,20
+ mov bl,68
+ mov bh,38
+ mov cx,120
+ jmp gotmonktext
+notmonktext2: cmp introcount,9
+ jnz notmonktext3
+ mov al,21
+ mov bl,48
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext3: cmp introcount,13
+ jnz notmonktext4
+ mov al,22
+ mov bl,68
+ mov bh,38
+ mov cx,120
+ jmp gotmonktext
+notmonktext4: if cd
+ cmp introcount,15
+ else
+ cmp introcount,17
+ endif
+ jnz notmonktext5
+ mov al,23
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext5: cmp introcount,21
+ jnz notmonktext6
+ mov al,24
+ mov bl,68
+ mov bh,38
+ mov cx,120
+ jmp gotmonktext
+notmonktext6: cmp introcount,25
+ jnz notmonktext7
+ mov al,25
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext7: cmp introcount,29
+ jnz notmonktext8
+ mov al,26
+ mov bl,68
+ mov bh,38
+ mov cx,120
+ jmp gotmonktext
+notmonktext8: cmp introcount,33
+ jnz notmonktext9
+ mov al,27
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext9: cmp introcount,37
+ jnz notmonktext10
+ mov al,28
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext10: cmp introcount,41
+ jnz notmonktext11
+ mov al,29
+ mov bl,68
+ mov bh,38
+ mov cx,120
+ jmp gotmonktext
+notmonktext11: cmp introcount,45
+ jnz notmonktext12
+ mov al,30
+ mov bl,68
+ mov bh,154
+ mov cx,120
+ jmp gotmonktext
+notmonktext12: if cd
+ cmp introcount,52
+ else
+ cmp introcount,49
+ endif
+ jnz notmonktext13
+ mov al,31
+ mov bl,68
+ mov bh,154
+ mov cx,220 ;132
+ jmp gotmonktext
+notmonktext13: cmp introcount,53
+ jnz notendtitles
+ call fadescreendowns
+ if cd
+ mov volumeto,7
+ mov volumedirection,1
+ endif
+notendtitles: ret
+
+gotmonktext: mov dx,1
+ mov ah,82
+ if cd
+ cmp ch1playing,255
+ jz oktalk
+ dec introcount
+ ret
+ endif
+oktalk: call setuptimedtemp
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Drunk proc near
+
+ cmp generaldead,0
+ jnz trampgone
+ mov al,[es:bx+7]
+ and al,127
+ mov [es:bx+7],al
+ call showgamereel
+ call addtopeoplelist
+trampgone: ret
+
+ endp
+
+
+Advisor proc near
+
+ call checkspeed
+ jnz noadvisor
+ jmp noadvisor
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,123
+ jnz notendadvis
+ mov ax,106
+ jmp gotadvframe
+notendadvis: cmp ax,108
+ jnz gotadvframe
+ push ax
+ call randomnumber
+ mov cl,al
+ pop ax
+ cmp cl,3
+ jc gotadvframe
+ mov ax,106
+gotadvframe: mov [es:bx+3],ax
+noadvisor: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+Copper proc near
+
+ call checkspeed
+ jnz nocopper
+ mov ax,[es:bx+3]
+ inc ax
+ cmp ax,94
+ jnz notendcopper
+ mov ax,64
+ jmp gotcopframe
+notendcopper: cmp ax,81
+ jz mightwait
+ cmp ax,66
+ jnz gotcopframe
+mightwait: push ax
+ call randomnumber
+ mov cl,al
+ pop ax
+ cmp cl,7
+ jc gotcopframe
+ dec ax
+gotcopframe: mov [es:bx+3],ax
+nocopper: call showgamereel
+ call addtopeoplelist
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Sparky proc near
+
+ cmp card1money,0
+ jz animsparky
+ mov byte ptr [es:bx+7],3
+ jmp animsparky
+
+animsparky: call checkspeed
+ jnz finishsparky
+ cmp word ptr [es:bx+3],34
+ jnz notsparky1
+ call randomnumber
+ cmp al,30
+ jc dosparky
+ mov word ptr [es:bx+3],27
+ jmp finishsparky
+
+notsparky1: cmp word ptr [es:bx+3],48
+ jnz dosparky
+ mov word ptr [es:bx+3],27
+ jmp finishsparky
+
+dosparky: inc word ptr [es:bx+3]
+finishsparky: call showgamereel
+ call addtopeoplelist
+
+ mov al,[es:bx+7]
+ and al,128
+ jz nottalkedsparky
+ mov talkedtosparky,1
+nottalkedsparky: ret
+
+ endp
+
+
+
+
+
+Train proc near
+
+ ret
+ mov ax,[es:bx+3]
+ cmp ax,21
+ jnc notrainyet
+ inc ax
+ jmp gottrainframe
+notrainyet: call randomnumber
+ cmp al,253
+ jc notrainatall
+ cmp manspath,5
+ jnz notrainatall
+ cmp finaldest,5
+ jnz notrainatall
+ mov ax,5
+gottrainframe: mov [es:bx+3],ax
+ call showgamereel
+notrainatall: ret
+
+ endp
+
+
+
+
+
+
+
+Addtopeoplelist proc near
+
+ push es bx bx
+ mov cl,[es:bx+7]
+ mov ax,[es:bx+3]
+ mov bx,listpos
+ mov es,buffers
+ mov [es:bx],ax ;reel pointer position
+ pop ax
+ mov [es:bx+2],ax
+ mov [es:bx+4],cl ;coversation number
+ pop bx es
+ add listpos,5
+ ret
+
+ endp
+
+
+
+Showgamereel proc near
+
+ mov ax,[es:bx+3]
+ cmp ax,512
+ jnc noshow
+ mov reelpointer,ax
+ push es bx
+ call plotreel
+ pop bx es
+ mov ax,reelpointer
+ mov [es:bx+3],ax
+noshow: ret
+
+ endp
+
+
+
+
+
+
+Checkspeed proc near
+
+ cmp lastweapon,-1
+ jnz forcenext
+ inc byte ptr [es:bx+6]
+ mov al,[es:bx+6]
+ cmp al,[es:bx+5]
+ jnz notspeed
+ mov al,0
+ mov [es:bx+6],al
+ cmp al,al
+notspeed: ret
+
+forcenext: cmp al,al
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+;------------------------------------------------------------Sprite Routines----
+
+
+
+Clearsprites proc near
+
+ mov es,buffers
+ mov di,spritetable
+ mov al,255
+ mov cx,tablesize*16
+ rep stosb
+ ret
+
+ endp
+
+
+
+
+Makesprite proc near ;si holds x,y cx holds update
+ ;di,dx holds data offset,seg
+ mov es,buffers
+ mov bx,spritetable
+$17: cmp byte ptr [es:bx+15],255
+ jz $17a
+ add bx,tablesize
+ jmp $17
+
+$17a: mov [es:bx],cx
+ mov [es:bx+10],si
+ mov [es:bx+6],dx
+ mov [es:bx+8],di
+ mov [es:bx+2],0ffffh
+ mov byte ptr [es:bx+15],0
+ mov byte ptr [es:bx+18],0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Delsprite proc near
+
+ mov di,bx
+ mov cx,tablesize
+ mov al,255
+ rep stosb
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Spriteupdate proc near
+
+ mov es,buffers
+ mov bx,spritetable
+ mov al,ryanon
+ mov byte ptr [es:bx+31],al
+
+ mov es,buffers
+ mov bx,spritetable
+ mov cx,16
+$18: push cx bx
+ mov ax,[es:bx]
+ cmp ax,0ffffh
+ jz $18a
+ push es ds
+ mov cx,[es:bx+2]
+ mov [es:bx+24],cx
+ call ax
+ pop ds es
+$18a: pop bx cx
+ cmp nowinnewroom,1
+ jz $18b
+ add bx,tablesize
+ loop $18
+
+$18b: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Printsprites proc near
+
+ mov es,buffers
+ mov cx,0
+priorityloop: push cx
+ mov priority,cl
+ mov bx,spritetable
+ mov cx,16
+prtspriteloop: push cx bx
+ mov ax,[es:bx]
+ cmp ax,0ffffh
+ jz skipsprite
+ mov al,priority
+ cmp al,[es:bx+23]
+ jnz skipsprite
+ cmp byte ptr [es:bx+31],1
+ jz skipsprite
+ call printasprite
+skipsprite: pop bx cx
+ add bx,tablesize
+ loop prtspriteloop
+ pop cx
+ inc cx
+ cmp cx,7
+ jnz priorityloop
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Printasprite proc near
+
+ push es bx
+ mov si,bx
+ mov ds,[es:si+6]
+ mov al,[es:si+11]
+ mov ah,0
+ cmp al,220
+ jc notnegative1
+ mov ah,255
+notnegative1: mov bx,ax
+ add bx,mapady
+ mov al,[es:si+10]
+ mov ah,0
+ cmp al,220
+ jc notnegative2
+ mov ah,255
+notnegative2: mov di,ax
+ add di,mapadx
+ mov al,[es:si+15]
+ mov ah,0
+ cmp byte ptr [es:si+30],0
+ jz steadyframe
+ mov ah,8
+steadyframe: cmp priority,6
+ jnz notquickp
+notquickp: call showframe
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+;cmp priority,6
+; ;jz quicksprite ; WIll NEED TO DO THIS LATER!!!!!
+;Quicksprite: mov cl,al
+; mov ch,0
+; mov dx,[es:bx+6]
+; mov es,workspace
+; mov ds,dx
+; mov bx,ax
+; mov dx,vgawidth
+;
+;printquickloop: push di si
+;
+; push si
+; add si,cx
+; dec si
+; jmp startzero
+;zeroloop: dec si
+; dec cl
+;startzero: cmp [si],ch
+; jz zeroloop
+; pop si
+;
+;;printquickline: cmp [si],ch
+; jnz foundfirstpix
+; inc si
+; inc di
+; dec cl
+; jnz printquickline
+;
+;foundfirstpix: cmp cl,0
+; jz finquickspr
+; rep movsb
+;
+;finquickspr: pop si di
+; mov cl,bl
+; add si,cx
+; add di,dx
+; dec bh
+; jnz printquickloop
+;
+; pop bx ds es
+; ret
+
+
+
+
+
+
+
+;Calcframe proc near
+;
+; ret
+;
+; mov al,[es:bx+15]
+; mov ah,0
+; mov cx,6
+; mul cx
+; add ax,[es:bx+8]
+;
+; mov dx,[es:bx+6]
+; push bx
+; mov ds,dx
+; mov bx,ax
+; mov ax,[bx]
+; mov cx,[bx+2]
+; mov dx,[bx+4]
+; pop bx
+; mov [es:bx+2],ax
+; add cx,[es:bx+8]
+; add cx,2080
+; mov [es:bx+4],cx ;calculates frame data
+;
+; mov al,[es:bx+10] ;this bit calculates the actual
+; add al,dl ;x and y (including any offset)
+; mov [es:bx+12],al
+; mov al,[es:bx+11]
+; add al,dh
+; mov [es:bx+13],al
+; ret
+;
+; endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Checkone proc near ;cx=x,y to check
+
+ push cx
+ mov al,ch
+ mov ah,0
+ mov cl,4
+ shr ax,cl
+ mov dl,al
+ pop cx
+ mov al,cl
+ mov ah,0
+ mov cl,4
+ shr ax,cl
+ mov ah,dl ; al,ah holds x,y in blocks
+
+ push ax
+ mov ch,0
+ mov cl,al
+ push cx
+ mov al,ah
+ mov ah,0
+ mov cx,11
+ mul cx
+ pop cx
+ add ax,cx
+
+ mov cx,3
+ mul cx
+ mov si,ax
+
+ mov ds,buffers
+ add si,mapflags
+ lodsw
+ mov cx,ax
+ lodsb
+ pop dx
+ ret
+
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Findsource proc near
+
+ mov ax,currentframe
+ cmp ax,160
+ jnc over1000
+ mov ds,reel1
+ mov takeoff,0
+ ret
+over1000: cmp ax,320
+ jnc over1001
+ mov ds,reel2
+ mov takeoff,160
+ ret
+over1001: mov ds,reel3
+ mov takeoff,320
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+;---------------------------------------------------------Routines for Ryan----
+
+
+Initman proc near
+
+ ;mov linepointer,254
+ mov al,ryanx
+ mov ah,ryany
+ mov si,ax
+ mov cx,offset cs:mainman
+ mov dx,mainsprites
+ mov di,0
+ call makesprite
+ mov byte ptr [es:bx+23],4
+ mov byte ptr [es:bx+22],0
+ mov byte ptr [es:bx+29],0
+ ret
+
+ endp
+
+
+
+
+
+
+
+Mainman proc near
+
+ cmp resetmanxy,1
+ jnz notinnewroom
+ mov resetmanxy,0
+ mov al,ryanx
+ mov ah,ryany
+ mov [es:bx+10],ax
+ mov byte ptr [es:bx+29],0
+ jmp executewalk
+notinnewroom: dec byte ptr [es:bx+22]
+ cmp byte ptr [es:bx+22],-1
+ jz executewalk
+ ret
+
+
+executewalk: mov byte ptr [es:bx+22],0 ; speed
+ mov al,turntoface
+ cmp al,facing
+ jz facingok
+ call aboutturn
+ jmp notwalk
+
+facingok: cmp turndirection,0
+ jz alreadyturned
+ cmp linepointer,254
+ jnz alreadyturned
+ mov reasseschanges,1
+ mov al,facing
+ cmp al,leavedirection
+ jnz alreadyturned
+ call checkforexit
+alreadyturned: mov turndirection,0
+ cmp linepointer,254
+ jnz walkman
+ mov byte ptr [es:bx+29],0
+ jmp notwalk
+
+walkman: mov al,[es:bx+29]
+ inc al
+ cmp al,11
+ jnz notanimend1
+ mov al,1
+notanimend1: mov [es:bx+29],al
+
+ call walking
+ cmp linepointer,254
+ jz afterwalk
+
+ mov al,facing
+ and al,1
+ jz isdouble
+ mov al,[es:bx+29]
+ cmp al,2
+ jz afterwalk
+ cmp al,7
+ jz afterwalk
+isdouble: call walking
+afterwalk: cmp linepointer,254
+ jnz notwalk
+ mov al,turntoface
+ cmp al,facing
+ jnz notwalk
+ mov reasseschanges,1
+ mov al,facing
+ cmp al,leavedirection
+ jnz notwalk
+ call checkforexit
+
+notwalk: mov al,facing
+ mov ah,0
+ mov di,offset cs:facelist
+ add di,ax
+ mov al,[cs:di]
+ add al,[es:bx+29]
+ mov [es:bx+15],al
+ mov ax,[es:bx+10]
+ mov ryanx,al
+ mov ryany,ah
+ ret
+
+facelist: db 0,60,33,71,11,82,22,93
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Aboutturn proc near
+
+ cmp turndirection,1
+ jz incdir
+ cmp turndirection,-1
+ jz decdir
+ mov al,facing
+ sub al,turntoface
+ jnc higher
+ neg al
+ cmp al,4
+ jnc decdir
+ jmp incdir
+higher: cmp al,4
+ jnc incdir
+ jmp decdir
+
+incdir: mov turndirection,1
+ mov al,facing
+ inc al
+ and al,7
+ mov facing,al
+ mov byte ptr [es:bx+29],0
+ ret
+
+decdir: mov turndirection,-1
+ mov al,facing
+ dec al
+ and al,7
+ mov facing,al
+ mov byte ptr [es:bx+29],0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Walking proc near
+
+ cmp linedirection,0
+ jz normalwalk
+ mov al,linepointer
+ dec al
+ mov linepointer,al
+ cmp al,200
+ jnc endofline
+ jmp continuewalk
+
+normalwalk: mov al,linepointer
+ inc al
+ mov linepointer,al
+ cmp al,linelength
+ jnc endofline
+
+continuewalk: mov ah,0
+ add ax,ax
+ push es bx
+ mov dx,seg linedata
+ mov es,dx
+ mov bx,offset es:linedata
+ add bx,ax
+ mov ax,[es:bx]
+ pop bx es
+stillline: mov [es:bx+10],ax
+ ret
+
+endofline: mov linepointer,254
+ mov al,destination
+ mov manspath,al
+ cmp al,finaldest
+ jz finishedwalk
+ mov al,finaldest
+ mov destination,al
+ push es bx
+ call autosetwalk
+ pop bx es
+ ret
+
+finishedwalk: call facerightway
+ ret
+
+ endp
+
+
+
+
+
+
+
+Facerightway proc near
+
+ push es bx ;Face object when finished
+ call getroomspaths ;walking
+ mov al,manspath
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ add bx,ax
+ mov al,[es:bx+7]
+ mov turntoface,al
+ mov leavedirection,al
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+
+
+Checkforexit proc near
+
+ mov cl,ryanx ;look under feet to see if
+ add cl,12 ;any flags are there
+ mov ch,ryany
+ add ch,12
+ call checkone
+ mov lastflag,cl
+ mov lastflagex,ch
+ mov flagx,dl
+ mov flagy,dh
+ mov al,lastflag
+
+ test al,64
+ jz notnewdirect
+ mov al,lastflagex
+ mov autolocation,al
+ ret
+
+notnewdirect: test al,32
+ jz notleave
+ push es bx
+ cmp reallocation,2
+ jnz notlouis
+ mov bl,0
+ push bx
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"A"
+ call isryanholding
+ pop bx
+ jz noshoe1
+ inc bl
+noshoe1: push bx
+ mov al,"W"
+ mov ah,"E"
+ mov cl,"T"
+ mov ch,"B"
+ call isryanholding
+ pop bx
+ jz noshoe2
+ inc bl
+noshoe2: cmp bl,2
+ jz notlouis
+ mov al,42
+ cmp bl,0
+ jz notravmessage
+ inc al
+notravmessage: mov cx,80
+ mov dx,10
+ mov bl,68
+ mov bh,64
+ call setuptimeduse
+ mov al,facing
+ add al,4
+ and al,7
+ mov turntoface,al
+ pop bx es
+ ret
+
+notlouis: pop bx es
+ mov needtotravel,1
+ ret
+
+
+
+notleave: test al,4
+ jz notaleft
+ call adjustleft
+ ret
+
+notaleft: test al,2
+ jz notaright
+ call adjustright
+ ret
+
+notaright: test al,8
+ jz notadown
+ call adjustdown
+ ret
+
+notadown: test al,16
+ jz notanup
+ call adjustup
+ ret
+
+notanup: ret
+
+ endp
+
+
+
+
+
+Adjustdown proc near
+
+ push es bx
+ add mapy,10
+ mov al,lastflagex
+ mov cl,16
+ mul cl
+ mov [es:bx+11],al
+ mov nowinnewroom,1
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+Adjustup proc near
+
+ push es bx
+ sub mapy,10
+ mov al,lastflagex
+ mov cl,16
+ mul cl
+ mov [es:bx+11],al
+ mov nowinnewroom,1
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+Adjustleft proc near
+
+ push es bx
+ mov lastflag,0
+ sub mapx,11
+ mov al,lastflagex
+ mov cl,16
+ mul cl
+ mov [es:bx+10],al
+ mov nowinnewroom,1
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+
+Adjustright proc near
+
+ push es bx
+ add mapx,11
+ mov al,lastflagex
+ mov cl,16
+ mul cl
+ sub al,2
+ mov [es:bx+10],al
+ mov nowinnewroom,1
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+Reminders proc nar
+
+ cmp reallocation,24
+ jnz notinedenslift
+ cmp mapx,44
+ jnz notinedenslift
+ cmp progresspoints,0
+ jnz notfirst
+ mov al,"D"
+ mov ah,"K"
+ mov cl,"E"
+ mov ch,"Y"
+ call isryanholding
+ jz forgotone
+ mov al,"C"
+ mov ah,"S"
+ mov cl,"H"
+ mov ch,"R"
+ call findexobject
+ cmp al,numexobjects
+ jz forgotone
+ mov ax,[es:bx+2]
+ cmp al,4
+ jnz forgotone ;card is in inventory
+ cmp ah,255
+ jz havegotcard ;card must be in an ex
+ mov cl,"P" ;object
+ mov ch,"U"
+ mov dl,"R"
+ mov dh,"S"
+ xchg al,ah
+ call compare
+ jnz forgotone ;is it in wallet?
+havegotcard: inc progresspoints
+notfirst: ret
+
+forgotone: mov al,50 ;message number
+ mov bl,54 ;x pos of message
+ mov bh,70 ;and y pos
+ mov cx,48 ;time on screen
+ mov dx,8 ;pause before show
+ call setuptimeduse
+ ret
+notinedenslift: ret
+
+ endp
+
+
+
+
+
+;---------------------------------------------------------------------------
+;
+; Sprite update routines for rain effect
+;
+;---------------------------------------------------------------------------
+
+
+
+
+Initrain proc near
+
+ mov es,buffers
+ mov di,rainlist
+ mov bx,offset cs:rainlocations
+checkmorerain: mov al,[cs:bx]
+ cmp al,255
+ jz finishinitrain
+ cmp al,reallocation
+ jnz checkrain
+ mov al,[cs:bx+1]
+ cmp al,mapx
+ jnz checkrain
+ mov al,[cs:bx+2]
+ cmp al,mapy
+ jnz checkrain
+ mov al,[cs:bx+3]
+ mov rainspace,al
+ jmp dorain
+checkrain: add bx,4
+ jmp checkmorerain
+
+dorain: mov cx,4
+initraintop: call randomnumber
+ and al,31
+ add al,3
+ cmp al,rainspace
+ jnc initraintop
+ add cl,al
+ cmp cl,mapxsize
+ jnc initrainside
+ push cx
+ call splitintolines
+ pop cx
+ jmp initraintop
+
+initrainside: mov cl,mapxsize
+ dec cl
+initrainside2: call randomnumber
+ and al,31
+ add al,3
+ cmp al,rainspace
+ jnc initrainside2
+ add ch,al
+ cmp ch,mapysize
+ jnc finishinitrain
+ push cx
+ call splitintolines
+ pop cx
+ jmp initrainside2
+finishinitrain: mov al,255
+ stosb
+ ret
+
+rainlocations: db 1,44,10,16 ;location,map x,y,seed
+ db 4,11,30,14
+ db 4,22,30,14
+ db 3,33,10,14
+ db 10,33,30,14
+ db 10,22,30,24
+ db 9,22,10,14
+ db 2,33,0,14
+ db 2,22,0,14
+ db 6,11,30,14
+ db 7,11,20,18
+ db 7,0,20,18
+ db 7,0,30,18
+ db 55,44,0,14
+ db 5,22,30,14
+
+ db 8,0,10,18
+ db 8,11,10,18
+ db 8,22,10,18
+ db 8,33,10,18
+ db 8,33,20,18
+ db 8,33,30,18
+ db 8,33,40,18
+ db 8,22,40,18
+ db 8,11,40,18
+
+ db 21,44,20,18
+ db 255
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Splitintolines proc near
+
+
+lookforlinestart: call getblockofpixel
+ cmp al,0
+ jnz foundlinestart
+ dec cl
+ inc ch
+ cmp cl,0
+ jz endofthisline
+ cmp ch,mapysize
+ jnc endofthisline
+ jmp lookforlinestart
+
+foundlinestart: mov [es:di],cx
+ mov bh,1
+lookforlineend: call getblockofpixel
+ cmp al,0
+ jz foundlineend
+ dec cl
+ inc ch
+ cmp cl,0
+ jz foundlineend
+ cmp ch,mapysize
+ jnc foundlineend
+ inc bh
+ jmp lookforlineend
+
+foundlineend: push cx
+ mov [es:di+2],bh
+ call randomnumber
+ mov [es:di+3],al
+ call randomnumber
+ mov [es:di+4],al
+ call randomnumber
+ and al,3
+ add al,4
+ mov [es:di+5],al
+ add di,6
+ pop cx
+ cmp cl,0
+ jz endofthisline
+ cmp ch,mapysize
+ jnc endofthisline
+ jmp lookforlinestart
+
+endofthisline: ret
+
+ endp
+
+
+
+
+Getblockofpixel proc near
+
+ push cx es di
+ mov ax,mapxstart
+ add cl,al
+ mov ax,mapystart
+ add ch,al
+ call checkone
+ and cl,1
+ jnz failrain
+ pop di es cx
+ ret
+failrain: pop di es cx
+ mov al,0
+ ret
+
+ endp
+
+
+
+
+Showrain proc near
+
+ mov ds,mainsprites
+ mov si,6*58
+ mov ax,[si+2]
+ mov si,ax
+ add si,2080
+
+ mov bx,rainlist
+ mov es,buffers
+ cmp byte ptr [es:bx],255
+ jz nothunder
+
+morerain: mov es,buffers
+ cmp byte ptr [es:bx],255
+ jz finishrain
+
+ mov al,[es:bx+1]
+ mov ah,0
+ add ax,mapady
+ add ax,mapystart
+ mov cx,320
+ mul cx
+ mov cl,[es:bx]
+ mov ch,0
+ add ax,cx
+ add ax,mapadx
+ add ax,mapxstart
+ mov di,ax
+
+ mov cl,[es:bx+2]
+ mov ch,0
+ mov ax,[es:bx+3]
+ mov dl,[es:bx+5]
+ mov dh,0
+ sub ax,dx
+ and ax,511
+ mov [es:bx+3],ax
+ add bx,6
+
+ push si
+ add si,ax
+ mov es,workspace
+ mov ah,0
+ mov dx,320-2
+rainloop: lodsb
+ cmp al,ah
+ jz noplot
+ stosb
+ add di,dx
+ loop rainloop
+ pop si
+ jmp morerain
+noplot: add di,320-1
+ loop rainloop
+ pop si
+ jmp morerain
+
+finishrain: cmp ch1blockstocopy,0
+ jnz nothunder
+ cmp reallocation,2
+ jnz notlouisthund
+ cmp beenmugged,1
+ jnz nothunder
+notlouisthund: cmp reallocation,55
+ jz nothunder
+ call randomnum1
+ cmp al,1
+ jnc nothunder
+ mov al,7
+ cmp ch0playing,6
+ jz isthunder1
+ mov al,4
+isthunder1: call playchannel1
+nothunder: ret
+
+ endp
+
+
+
+
+
+
+
+;---------------------------------------------------------------------------
+;
+; Sprite update routines for background objects
+;
+;---------------------------------------------------------------------------
+
+
+
+
+
+
+Backobject proc near
+
+ mov ds,setdat
+ mov di,[es:bx+20]
+
+ mov al,[es:bx+18]
+ cmp al,0
+ jz $48z
+ dec al
+ mov [es:bx+18],al
+ jmp finishback
+
+$48z: mov al,[di+7]
+ mov [es:bx+18],al
+ mov al,[di+8]
+ cmp al,6
+ jnz notwidedoor
+ call widedoor
+ jmp finishback
+
+notwidedoor: cmp al,5
+ jnz notrandom
+ call random
+ jmp finishback
+
+notrandom: cmp al,4
+ jnz notlockdoor
+ call lockeddoorway
+ jmp finishback
+
+notlockdoor: cmp al,3
+ jnz notlift
+ call liftsprite
+ jmp finishback
+
+notlift: cmp al,2
+ jnz notdoor
+ call doorway
+ jmp finishback
+
+notdoor: cmp al,1
+ jnz steadyob
+ call constant
+ jmp finishback
+
+steadyob: call steady
+
+finishback: ;call calcframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Liftsprite proc near
+
+ mov al,liftflag
+ cmp al,0
+ jz liftclosed
+ cmp al,1
+ jz liftopen
+ cmp al,3
+ jz openlift
+
+ mov al,[es:bx+19]
+ cmp al,0
+ jz finishclose
+ dec al
+ cmp al,11
+ jnz pokelift
+ push ax
+ mov al,3
+ call liftnoise
+ pop ax
+ jmp pokelift
+finishclose: mov liftflag,0
+ ret
+
+openlift: mov al,[es:bx+19]
+ cmp al,12
+ jz endoflist
+ inc al
+ cmp al,1
+ jnz pokelift
+ push ax
+ mov al,2
+ call liftnoise
+ pop ax
+pokelift: mov [es:bx+19],al
+ mov ah,0
+ push di
+ add di,ax
+ mov al,[di+18]
+ pop di
+ mov [es:bx+15],al
+ mov [di+17],al
+ ret
+
+endoflist: mov liftflag,1
+ ret
+
+liftopen: mov al,liftpath
+ push es bx
+ call turnpathon
+ pop bx es
+ cmp counttoclose,0
+ jz nocountclose
+ dec counttoclose
+ cmp counttoclose,0
+ jnz nocountclose
+ mov liftflag,2
+nocountclose: mov al,12
+ jmp pokelift
+
+liftclosed: mov al,liftpath
+ push es bx
+ call turnpathoff
+ pop bx es
+ cmp counttoopen,0
+ jz nocountopen
+ dec counttoopen
+ cmp counttoopen,0
+ jnz nocountopen
+ mov liftflag,3
+nocountopen: mov al,0
+ jmp pokelift
+
+ endp
+
+
+Liftnoise proc near
+
+ cmp reallocation,5
+ jz hissnoise
+ cmp reallocation,21
+ jz hissnoise
+ call playchannel1
+ ret
+hissnoise: if demo
+ mov al,25
+ else
+ mov al,13
+ endif
+ call playchannel1
+ ret
+
+ endp
+
+
+
+
+Random proc near
+
+ call randomnum1
+ push di
+ and ax,7
+ add di,18
+ add di,ax
+ mov al,[di]
+ pop di
+ mov [es:bx+15],al
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Steady proc near
+
+ mov al,[di+18]
+ mov [di+17],al
+ mov [es:bx+15],al
+ ret
+
+ endp
+
+
+
+
+
+Constant proc near
+
+ inc byte ptr [es:bx+19]
+ mov cl,[es:bx+19]
+ mov ch,0
+ add di,cx
+ cmp byte ptr [di+18],255
+ jnz gotconst
+ sub di,cx
+ mov cx,0
+ mov [es:bx+19],cl
+gotconst: mov al,[di+18]
+ sub di,cx
+ mov [es:bx+15],al
+ mov [di+17],al
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Doorway proc near
+
+ mov doorcheck1,-24
+ mov doorcheck2,10
+ mov doorcheck3,-30
+ mov doorcheck4,10
+ call dodoor
+ ret
+
+ endp
+
+
+
+Widedoor proc near
+
+ mov doorcheck1,-24
+ mov doorcheck2,24
+ mov doorcheck3,-30
+ mov doorcheck4,24
+ call dodoor
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Dodoor proc near
+
+ mov al,ryanx
+ mov ah,ryany
+ mov cl,[es:bx+10]
+ mov ch,[es:bx+11]
+
+ cmp al,cl
+ jnc rtofdoor
+ sub al,cl
+ cmp al,doorcheck1
+ jnc upordown
+ jmp shutdoor
+rtofdoor: sub al,cl
+ cmp al,doorcheck2
+ jnc shutdoor
+
+upordown: cmp ah,ch
+ jnc botofdoor
+ sub ah,ch
+ cmp ah,doorcheck3
+ jc shutdoor
+ jmp opendoor
+botofdoor: sub ah,ch
+ cmp ah,doorcheck4
+ jnc shutdoor
+
+opendoor: mov cl,[es:bx+19]
+ cmp throughdoor,1
+ jnz notthrough
+ cmp cl,0
+ jnz notthrough
+ mov cl,6
+notthrough: inc cl
+ cmp cl,1
+ jnz notdoorsound2
+ mov al,0
+ cmp reallocation,5
+ jnz nothoteldoor2
+ if demo
+ mov al,25
+ else
+ mov al,13
+ endif
+nothoteldoor2: call playchannel1
+notdoorsound2: mov ch,0
+
+ push di
+ add di,cx
+ mov al,[di+18] ; must be a better way than this
+ cmp al,255
+ jnz atlast1
+ dec di
+ dec cl
+atlast1: mov [es:bx+19],cl
+ mov al,[di+18]
+ pop di
+ mov [es:bx+15],al
+ mov [di+17],al
+ mov throughdoor,1
+ ret
+
+
+shutdoor: mov cl,[es:bx+19]
+ cmp cl,5
+ jnz notdoorsound1
+ mov al,1
+ cmp reallocation,5
+ jnz nothoteldoor1
+ if demo
+ mov al,25
+ else
+ mov al,13
+ endif
+nothoteldoor1: call playchannel1
+notdoorsound1: cmp cl,0
+ jz atlast2
+ dec cl
+ mov [es:bx+19],cl
+atlast2: mov ch,0
+ push di
+ add di,cx
+ mov al,[di+18]
+ pop di
+ mov [es:bx+15],al
+ mov [di+17],al
+ cmp cl,5
+ jnz notnearly
+ mov throughdoor,0
+notnearly: ret
+
+ endp
+
+
+
+
+
+
+
+
+Lockeddoorway proc near
+
+ mov al,ryanx
+ mov ah,ryany
+ mov cl,[es:bx+10]
+ mov ch,[es:bx+11]
+
+ cmp al,cl
+ jnc rtofdoor2
+ sub al,cl
+ cmp al,-24
+ jnc upordown2
+ jmp shutdoor2
+rtofdoor2: sub al,cl
+ cmp al,10
+ jnc shutdoor2
+
+upordown2: cmp ah,ch
+ jnc botofdoor2
+ sub ah,ch
+ cmp ah,-30
+ jc shutdoor2
+ jmp opendoor2
+botofdoor2: sub ah,ch
+ cmp ah,12
+ jnc shutdoor2
+
+opendoor2: cmp throughdoor,1
+ jz mustbeopen
+ cmp lockstatus,1
+ jz shutdoor
+mustbeopen: mov cl,[es:bx+19]
+ cmp cl,1
+ jnz notdoorsound4
+ mov al,0
+ call playchannel1
+notdoorsound4: cmp cl,6 ; was 3
+ jnz noturnonyet
+ mov al,doorpath
+ push es bx
+ call turnpathon
+ pop bx es
+
+noturnonyet: mov cl,[es:bx+19]
+ cmp throughdoor,1
+ jnz notthrough2
+ cmp cl,0
+ jnz notthrough2
+ mov cl,6
+notthrough2: inc cl
+ mov ch,0
+
+ push di
+ add di,cx
+ mov al,[di+18]
+ cmp al,255
+ jnz atlast3
+ dec di
+ dec cl
+atlast3: mov [es:bx+19],cl
+ mov al,[di+18]
+ pop di
+ mov [es:bx+15],al
+ mov [di+17],al
+ cmp cl,5
+ jnz justshutting
+ mov throughdoor,1
+justshutting: ret
+
+
+
+shutdoor2: mov cl,[es:bx+19]
+ cmp cl,5
+ jnz notdoorsound3
+ mov al,1
+ call playchannel1
+notdoorsound3: cmp cl,0
+ jz atlast4
+ dec cl
+ mov [es:bx+19],cl
+atlast4: mov ch,0
+ mov throughdoor,0
+ push di
+ add di,cx
+ mov al,[di+18]
+ pop di
+ mov [es:bx+15],al
+ mov [di+17],al
+ cmp cl,0 ;1
+ jnz notlocky
+ mov al,doorpath
+ push es bx
+ call turnpathoff
+ pop bx es
+ mov lockstatus,1
+notlocky: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+;------------------------------------------------------------People handler----
+
+Updatepeople proc near
+
+ mov es,buffers
+ mov di,peoplelist
+ mov listpos,di
+ mov cx,12*5
+ mov al,255
+ rep stosb
+
+ inc maintimer
+ push cs
+ pop es
+ mov bx,offset cs:reelroutines
+ mov di,offset cs:reelcalls
+updateloop: mov al,[es:bx]
+ cmp al,255
+ jz endupdate
+ cmp al,reallocation
+ jnz notinthisroom
+ mov cx,[es:bx+1]
+ cmp cl,mapx
+ jnz notinthisroom
+ cmp ch,mapy
+ jnz notinthisroom
+ push di
+ mov ax,[cs:di]
+ call ax
+ pop di
+notinthisroom: add bx,8
+ add di,2
+ jmp updateloop
+endupdate: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Getreelframeax proc near
+
+ push ds
+ mov currentframe,ax
+ call findsource
+ push ds
+ pop es
+ pop ds
+ mov ax,currentframe
+ sub ax,takeoff
+ add ax,ax
+ mov cx,ax
+ add ax,ax
+ add ax,cx
+ mov bx,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Reelsonscreen proc near
+
+ call reconstruct
+ call updatepeople
+ call watchreel
+ call showrain
+ call usetimedtext
+ ret
+
+ endp
+
+
+
+
+
+
+Plotreel proc near
+
+ call getreelstart
+retryreel: push es si
+ mov ax,[es:si+2]
+ cmp al,220
+ jc normalreel
+ cmp al,255
+ jz normalreel
+ call dealwithspecial
+ inc reelpointer
+ pop si es
+ add si,40
+ jmp retryreel
+
+normalreel: mov cx,8
+plotloop: push cx es si
+ mov ax,[es:si]
+ cmp ax,0ffffh
+ jz notplot
+ call showreelframe
+notplot: pop si es cx
+ add si,5
+ loop plotloop
+ call soundonreels
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+Soundonreels proc near
+
+ mov bl,reallocation
+ add bl,bl
+ xor bh,bh
+ add bx,offset cs:roombyroom
+ mov si,[cs:bx]
+
+reelsoundloop: mov al,[cs:si]
+ cmp al,255
+ jz endreelsound
+ mov ax,[cs:si+1]
+ cmp ax,reelpointer
+ jnz skipreelsound
+
+ cmp ax,lastsoundreel
+ jz skipreelsound
+
+ mov lastsoundreel,ax
+ mov al,[cs:si]
+ cmp al,64
+ jc playchannel1
+ cmp al,128
+ jc channel0once
+ and al,63
+ mov ah,255
+ jmp playchannel0
+channel0once: and al,63
+ mov ah,0
+ jmp playchannel0
+skipreelsound: add si,3
+ jmp reelsoundloop
+endreelsound: mov ax,lastsoundreel
+ cmp ax,reelpointer
+ jz nochange2
+ mov lastsoundreel,-1
+nochange2: ret
+
+roombyroom dw r0,r1,r2,r0,r0,r0,r6,r0,r8,r9,r10,r11,r12,r13,r14,r0,r0,r0,r0,r0
+ dw r20,r0,r22,r23,r0,r25,r26,r27,r28,r29,r0,r0,r0,r0,r0
+ dw r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r45,r46,r47,r0,r0,r0,r0,r52,r53,r0,r55
+
+r0 db 255
+
+r1 db 15
+ dw 257
+ db 255
+
+r2 db 12
+ dw 5
+ db 13
+ dw 21
+ db 15 ;hitting floor?
+ dw 35
+ db 17
+ dw 50
+ db 18
+ dw 103
+ db 19
+ dw 108
+ db 255
+
+r6 db 18
+ dw 19
+ db 19
+ dw 23
+ db 255
+
+r8 db 12
+ dw 51
+ db 13
+ dw 53
+ db 14
+ dw 14
+ db 15
+ dw 20
+ db 0
+ dw 78
+ db 255
+
+r9 db 12
+ dw 119
+ db 12
+ dw 145
+ db 255
+
+r10 db 13
+ dw 16
+ db 255
+
+r11 db 13
+ dw 20
+ db 255
+
+r12 db 14
+ dw 16
+ db 255
+
+r13 db 15
+ dw 4
+ db 16
+ dw 8
+ db 17
+ dw 134
+ db 18
+ dw 153
+ db 255
+
+r14 db 13
+ dw 108
+ db 15
+ dw 326
+ db 15
+ dw 331
+ db 15
+ dw 336
+ db 15
+ dw 342
+ db 15
+ dw 348
+ db 15
+ dw 354
+ db 18
+ dw 159
+ db 18
+ dw 178
+ db 19+128
+ dw 217
+ db 20+64
+ dw 228
+ db 255
+
+r20 db 13
+ dw 20
+ db 13
+ dw 21
+ db 15
+ dw 34
+ db 13
+ dw 52
+ db 13
+ dw 55
+ db 25
+ dw 57
+ db 21
+ dw 73
+ db 255
+
+r22 db 13 ;room,sample
+ dw 196 ;reelpointer
+ db 13
+ dw 234
+ db 13
+ dw 156
+ db 14
+ dw 129
+ db 13
+ dw 124
+ db 15
+ dw 162
+ db 15
+ dw 200
+ db 15
+ dw 239
+ db 17
+ dw 99
+ db 12
+ dw 52
+ db 255
+
+r23 db 15
+ dw 56
+ db 16
+ dw 64
+ db 19
+ dw 22
+ db 20
+ dw 33
+ db 255
+
+r25 db 20
+ dw 11
+ db 20
+ dw 15
+ db 15
+ dw 28
+ db 13
+ dw 80
+ db 21
+ dw 82
+ db 19+128
+ dw 87
+ db 23+64
+ dw 128
+ db 255
+
+r26 db 12
+ dw 13
+ db 14
+ dw 39
+ db 12
+ dw 67
+ db 12
+ dw 75
+ db 12
+ dw 83
+ db 12
+ dw 91
+ db 15
+ dw 102 ; was 90, should be mine cart
+ db 255
+
+r27 db 22
+ dw 36
+ db 13
+ dw 125
+ db 18
+ dw 88
+ db 15
+ dw 107
+ db 14
+ dw 127
+ db 14
+ dw 154
+ db 19+128
+ dw 170
+ db 23+64
+ dw 232
+ db 255
+
+r28 db 21
+ dw 16
+ db 21
+ dw 72
+ db 21
+ dw 205
+ db 22
+ dw 63 ;65
+ db 23+128
+ dw 99
+ db 24+64
+ dw 158
+ db 255
+
+r29 db 13
+ dw 21
+ db 14
+ dw 24
+ db 19+128
+ dw 50
+ db 23+64
+ dw 75
+ if german
+ else
+ db 24
+ dw 128
+ endif
+ db 255
+
+r45 db 19+64
+ dw 46
+ db 16
+ dw 167
+ db 255
+
+r46 db 16
+ dw 19
+ db 14
+ dw 36
+ db 16
+ dw 50
+ db 14
+ dw 65
+ db 16
+ dw 81
+ db 14
+ dw 96
+ db 16
+ dw 114
+ db 14
+ dw 129
+ db 16
+ dw 147
+ db 14
+ dw 162
+ db 16
+ dw 177
+ db 14
+ dw 191
+ db 255
+
+r47 db 13
+ dw 48
+ db 14
+ dw 41
+ db 15
+ dw 78
+ db 16
+ dw 92
+ db 255
+
+r52 db 16
+ dw 115
+ db 255
+
+r53 db 21
+ dw 103
+ db 20
+ dw 199
+ db 255
+
+r55 db 17
+ dw 53
+ db 17
+ dw 54
+ db 17
+ dw 55
+ db 17
+ dw 56
+ db 17
+ dw 57
+ db 17
+ dw 58
+ db 17
+ dw 59
+ db 17
+ dw 61
+ db 17
+ dw 63
+ db 17
+ dw 64
+ db 17
+ dw 65
+ db 255
+
+ endp
+
+
+
+
+
+
+
+
+
+Reconstruct proc near
+
+ cmp havedoneobs,0
+ jz noneedtorecon
+ mov newobs,1
+ call drawfloor
+ call spriteupdate
+ call printsprites
+ if foreign
+ cmp reallocation,20
+ jnz notfudge
+ call undertextline
+notfudge:
+ endif
+ mov havedoneobs,0
+noneedtorecon: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Dealwithspecial proc near
+
+ sub al,220
+ cmp al,0
+ jnz notplset
+ mov al,ah
+ call placesetobject
+ mov havedoneobs,1
+ ret
+notplset: cmp al,1
+ jnz notremset
+ mov al,ah
+ call removesetobject
+ mov havedoneobs,1
+ ret
+notremset: cmp al,2
+ jnz notplfree
+ mov al,ah
+ call placefreeobject
+ mov havedoneobs,1
+ ret
+notplfree: cmp al,3
+ jnz notremfree
+ mov al,ah
+ call removefreeobject
+ mov havedoneobs,1
+ ret
+notremfree: cmp al,4
+ jnz notryanoff
+ call switchryanoff
+ ret
+notryanoff: cmp al,5
+ jnz notryanon
+ mov turntoface,ah
+ mov facing,ah
+ call switchryanon
+ ret
+notryanon: cmp al,6
+ jnz notchangeloc
+ mov newlocation,ah ; was new loc in watch
+ ;call switchryanon
+ ret
+notchangeloc: call movemap
+ ret
+
+ endp
+
+
+
+Movemap proc near
+
+ cmp ah,32
+ jnz notmapup2
+ sub mapy,20
+ mov nowinnewroom,1
+ ret
+
+notmapup2: cmp ah,16
+ jnz notmapupspec
+ sub mapy,10
+ mov nowinnewroom,1
+ ret
+
+notmapupspec: cmp ah,8
+ jnz notmapdownspec
+ add mapy,10
+ mov nowinnewroom,1
+ ret
+
+notmapdownspec: cmp ah,2
+ jnz notmaprightspec
+ add mapx,11
+ mov nowinnewroom,1
+ ret
+
+notmaprightspec: sub mapx,11
+ mov nowinnewroom,1
+ ret
+
+ endp
+
+
+
+
+Getreelstart proc near
+
+ mov ax,reelpointer
+ mov cx,40
+ mul cx
+ mov es,reels
+ mov si,ax
+ add si,reellist
+ ret
+
+ endp
+
+
+
+
+
+;------------------------------------------------------Printing a reel frame----
+
+
+
+Showreelframe proc near
+
+ mov al,[es:si+2]
+ mov ah,0
+ mov di,ax
+ add di,mapadx
+ mov al,[es:si+3]
+ mov bx,ax
+ add bx,mapady
+ mov ax,[es:si]
+ mov currentframe,ax
+ call findsource
+ mov ax,currentframe
+ sub ax,takeoff
+ mov ah,8
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+;-------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+Deleverything proc near
+
+ mov al,mapysize
+ mov ah,0
+ add ax,mapoffsety
+ cmp ax,182
+ jnc bigroom
+ call maptopanel
+ ret
+bigroom: sub mapysize,8
+ call maptopanel
+ add mapysize,8
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Dumpeverything proc near
+
+ mov es,buffers
+ mov bx,printedlist
+dumpevery1: mov ax,[es:bx]
+ mov cx,[es:bx+2]
+ cmp ax,0ffffh
+ jz finishevery1
+ cmp ax,[es:bx+(40*5)]
+ jnz notskip1
+ cmp cx,[es:bx+(40*5)+2]
+ jz skip1
+
+notskip1: push bx es ds
+ mov bl,ah
+ mov bh,0
+ mov ah,0
+ mov di,ax
+ add di,mapadx
+ add bx,mapady
+ call multidump
+ pop ds es bx
+
+skip1: add bx,5
+ jmp dumpevery1
+
+finishevery1: mov bx,printedlist+(40*5)
+dumpevery2: mov ax,[es:bx]
+ mov cx,[es:bx+2]
+ cmp ax,0ffffh
+ jz finishevery2
+
+ push bx es ds
+ mov bl,ah
+ mov bh,0
+ mov ah,0
+ mov di,ax
+ add di,mapadx
+ add bx,mapady
+ call multidump
+ pop ds es bx
+ add bx,5
+ jmp dumpevery2
+
+finishevery2: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/talk.asm b/devtools/tasmrecover/dreamweb/talk.asm
new file mode 100644
index 0000000000..cb100f6602
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/talk.asm
@@ -0,0 +1,580 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Talk proc near
+
+ mov talkpos,0
+ mov inmaparea,0
+ mov al,command
+ mov character,al
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call undertextline
+ call convicons
+ call starttalk
+ mov commandtype,255
+ call readmouse
+ call showpointer
+ call worktoscreen
+waittalk: call delpointer
+ call readmouse
+ call animpointer
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ mov getback,0
+ mov bx,offset cs:talklist
+ call checkcoords
+ cmp getback,0
+ jz waittalk
+finishtalk: mov bx,persondata
+ push cs
+ pop es
+ cmp talkpos,4
+ jc notnexttalk
+ mov al,[es:bx+7]
+ or al,128
+ mov [es:bx+7],al
+notnexttalk: call redrawmainscrn
+ call worktoscreenm
+ cmp speechloaded,1
+ jnz nospeech
+ call cancelch1
+ mov volumedirection,-1 ;fade (louder)
+ mov volumeto,0 ;up to 0 (max)
+nospeech: ret
+
+talklist: dw 273,320,157,198,getback1
+ dw 240,290,2,44,moretalk
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Convicons proc near
+
+ mov al,character
+ and al,127
+ call getpersframe
+ mov di,234
+ mov bx,2
+ mov currentframe,ax
+ call findsource
+ mov ax,currentframe
+ sub ax,takeoff
+ mov ah,0
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Getpersframe proc near
+
+ mov ah,0
+ add ax,ax
+ mov bx,ax
+ mov es,people
+ add bx,personframes
+ mov ax,[es:bx]
+ ret
+
+ endp
+
+
+
+
+
+Starttalk proc near
+
+ mov talkmode,0
+ mov al,character
+ and al,127
+ call getpersontext
+ mov charshift,91+91
+ mov di,66
+ mov bx,64
+ mov dl,241
+ mov al,0
+ mov ah,79
+ call printdirect
+ mov charshift,0
+ mov di,66
+ mov bx,80
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ if cd
+ mov speechloaded,0
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cl,"C"
+ mov dl,"R"
+ mov dh,reallocation
+ call loadspeech
+ cmp speechloaded,1
+ jnz nospeech1
+ mov volumedirection,1 ;quieter
+ mov volumeto,6 ;quite quiet!
+ mov al,50+12
+ call playchannel1
+ endif
+nospeech1: ret
+
+ endp
+
+
+
+
+
+Getpersontext proc near
+
+ mov ah,0
+ mov cx,64*2
+ mul cx
+ mov si,ax
+ mov es,people
+ add si,persontxtdat
+ mov cx,persontext
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+Moretalk proc near
+
+ ;cmp ch1playing,255
+ ;jnz cantredes
+ cmp talkmode,0
+ jz canmore
+ call redes
+ ret
+
+canmore: cmp commandtype,215
+ jz alreadymore
+ mov commandtype,215
+ mov al,49
+ call commandonly
+alreadymore: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nomore
+ and ax,1
+ jnz domoretalk
+nomore: ret
+
+domoretalk: mov talkmode,2
+ mov talkpos,4
+ cmp character,100
+ jc notsecondpart
+ mov talkpos,48
+notsecondpart: call dosometalk
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Dosometalk proc near
+
+ if cd
+dospeech: mov al,talkpos
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cx,ax
+ mov al,talkpos
+ mov ah,0
+ add ax,cx
+ add ax,ax
+ mov si,ax
+
+ mov es,people
+ add si,persontxtdat
+ mov cx,persontext
+
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ cmp byte ptr [es:si],0
+ jz endheartalk
+
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call convicons
+ pop si es
+
+ mov di,164
+ mov bx,64
+ mov dl,144
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cl,talkpos
+ mov ch,0
+ add ax,cx
+ mov cl,"C"
+ mov dl,"R"
+ mov dh,reallocation
+ call loadspeech
+ cmp speechloaded,0
+ jz noplay1
+ mov al,62
+ call playchannel1
+
+noplay1: mov pointermode,3
+ call worktoscreenm
+ mov cx,180
+ call hangonpq
+ jnc $1
+ ret
+
+$1:
+ inc talkpos
+
+ mov al,talkpos
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cx,ax
+ mov al,talkpos
+ mov ah,0
+ add ax,cx
+ add ax,ax
+ mov si,ax
+
+ mov es,people
+ add si,persontxtdat
+ mov cx,persontext
+
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ cmp byte ptr [es:si],0
+ jz endheartalk
+ cmp byte ptr [es:si],":"
+ jz skiptalk2
+ cmp byte ptr [es:si],32
+ jz skiptalk2
+
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call convicons
+ pop si es
+
+ mov di,48
+ mov bx,128
+ mov dl,144
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cl,talkpos
+ mov ch,0
+ add ax,cx
+ mov cl,"C"
+ mov dl,"R"
+ mov dh,reallocation
+ call loadspeech
+ cmp speechloaded,0
+ jz noplay2
+ mov al,62
+ call playchannel1
+
+noplay2: mov pointermode,3
+ call worktoscreenm
+ mov cx,180
+ call hangonpq
+ jnc skiptalk2
+ ret
+
+skiptalk2: inc talkpos
+ jmp dospeech
+
+endheartalk: mov pointermode,0
+ ret
+
+ else
+
+watchtalk: mov al,talkpos
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cx,ax
+ mov al,talkpos
+ mov ah,0
+ add ax,cx
+ add ax,ax
+ mov si,ax
+
+ mov es,people
+ add si,persontxtdat
+ mov cx,persontext
+
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ cmp byte ptr [es:si],0
+ jz endwatchtalk
+
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call convicons
+ pop si es
+
+ mov di,164
+ mov bx,64
+ mov dl,144
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov pointermode,3
+ call worktoscreenm
+ mov cx,180
+ call hangonpq
+ jnc $1
+ ret
+$1:
+
+ inc talkpos
+
+ mov al,talkpos
+ mov al,character
+ and al,127
+ mov ah,0
+ mov cx,64
+ mul cx
+ mov cx,ax
+ mov al,talkpos
+ mov ah,0
+ add ax,cx
+ add ax,ax
+ mov si,ax
+
+ mov es,people
+ add si,persontxtdat
+ mov cx,persontext
+
+ mov ax,[es:si]
+ add ax,cx
+ mov si,ax
+ cmp byte ptr [es:si],0
+ jz endwatchtalk
+ cmp byte ptr [es:si],":"
+ jz skiptalk
+ cmp byte ptr [es:si],32
+ jz skiptalk
+
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call convicons
+ pop si es
+
+ mov di,48
+ mov bx,128
+ mov dl,144
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov pointermode,3
+ call worktoscreenm
+ mov cx,180
+ call hangonpq
+ jnc skiptalk
+ ret
+
+skiptalk: inc talkpos
+ jmp watchtalk
+
+endwatchtalk: mov pointermode,0
+ ret
+
+ endif
+
+ endp
+
+
+
+
+
+
+
+Hangonpq proc near
+
+ mov getback,0
+ mov bx,0
+hangloopq: push cx bx
+ call delpointer
+ call readmouse
+ call animpointer
+ call showpointer
+ call vsync
+ call dumppointer
+ call dumptextline
+ mov bx,offset cs:quitlist
+ call checkcoords
+ pop bx cx
+ cmp getback,1
+ jz quitconv
+ cmp speechloaded,1
+ jnz notspeaking
+ cmp ch1playing,255
+ jnz notspeaking
+ inc bx
+ cmp bx,40 ;pause after speech ends
+ jz finishconv
+notspeaking: cmp mousebutton,0
+ jz hangloopq
+ cmp oldbutton,0
+ jnz hangloopq
+finishconv: call delpointer
+ mov pointermode,0
+ clc
+ ret
+
+quitconv: call delpointer
+ mov pointermode,0
+ call cancelch1
+ stc
+ ret
+
+quitlist: dw 273,320,157,198,getback1
+ dw 0,320,0,200,blank
+ dw 0ffffh
+
+ endp
+
+
+
+
+
+
+
+
+
+Redes proc near
+
+ cmp ch1playing,255
+ jnz cantredes
+ cmp talkmode,2
+ jz canredes
+cantredes: call blank
+ ret
+
+canredes: cmp commandtype,217
+ jz alreadyreds
+ mov commandtype,217
+ mov al,50
+ call commandonly
+alreadyreds: mov ax,mousebutton
+ and ax,1
+ jnz doredes
+ ret
+
+doredes: call delpointer
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call convicons
+ call starttalk
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/titles.asm b/devtools/tasmrecover/dreamweb/titles.asm
new file mode 100644
index 0000000000..b4ca4d1c49
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/titles.asm
@@ -0,0 +1,583 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+
+Titles proc near
+
+ if demo
+ ret
+ else
+ call clearpalette
+ call biblequote
+ call intro
+ ret
+ endif
+
+ endp
+
+
+
+
+Endgame proc near
+
+ mov dx,offset cs:endtextname
+ call loadtemptext
+ call monkspeaking
+ call gettingshot
+ call getridoftemptext
+ mov volumeto,7
+ mov volumedirection,1
+ mov cx,200
+ call hangon
+ ret
+
+ endp
+
+
+ if cd
+
+Monkspeaking proc near
+
+ mov roomssample,35
+ call loadroomssample
+ mov dx,offset cs:monkface
+ call loadintotemp
+ call clearwork ;createpanel2
+ call showmonk
+ call worktoscreen
+ mov volume,7
+ mov volumedirection,-1
+ mov volumeto,5
+ mov al,12
+ mov ah,255
+ call playchannel0
+ call fadescreenups
+ mov cx,300
+ call hangon
+
+ mov al,40
+loadspeech2: push ax
+ mov dl,"T"
+ mov dh,83
+ mov cl,"T"
+ mov ah,0
+ call loadspeech
+ mov al,50+12
+ call playchannel1
+notloadspeech2:
+ call vsync
+ cmp ch1playing,255
+ jnz notloadspeech2
+ pop ax
+ inc al
+ cmp al,48
+ jnz loadspeech2
+
+ mov volumedirection,1
+ mov volumeto,7
+ call fadescreendowns
+ mov cx,300
+ call hangon
+ call getridoftemp
+ ret
+
+ endp
+
+ else
+
+Monkspeaking proc near
+
+ mov roomssample,35
+ call loadroomssample
+ mov dx,offset cs:monkface
+ call loadintotemp
+ call clearwork ;createpanel2
+ call showmonk
+ call worktoscreen
+ mov volume,7
+ mov volumedirection,-1
+ mov volumeto,0
+ mov al,12
+ mov ah,255
+ call playchannel0
+ call fadescreenups
+ mov cx,300
+ call hangon
+
+ mov al,40
+nextmonkspeak: push ax
+ mov ah,0
+ mov si,ax
+ add si,si
+ mov es,textfile1
+ mov ax,[es:si]
+ add ax,textstart
+ mov si,ax
+nextbit: mov di,36
+ mov bx,140
+ mov dl,239
+ call printdirect
+ push ax si es
+ call worktoscreen
+ call clearwork
+ call showmonk
+ mov cx,240
+ call hangon
+ pop es si ax
+ cmp al,0
+ jnz nextbit
+ pop ax
+ inc al
+ cmp al,44
+ jnz nextmonkspeak
+
+ mov volumedirection,1
+ mov volumeto,7
+ call fadescreendowns
+ mov cx,300
+ call hangon
+ call getridoftemp
+ ret
+
+ endp
+
+ endif
+
+
+
+
+Showmonk proc near
+
+ mov al,0
+ mov ah,128
+ mov di,160
+ mov bx,72
+ mov ds,tempgraphics
+ call showframe
+ ret
+
+ endp
+
+
+Gettingshot proc near
+
+ mov newlocation,55
+ call clearpalette
+ call loadintroroom
+ call fadescreenups
+ mov volumeto,0
+ mov volumedirection,-1
+ call runendseq
+ call clearbeforeload
+ ret
+
+ endp
+
+
+
+
+
+
+Credits proc near
+
+ call clearpalette
+ call realcredits
+ ret
+
+ endp
+
+
+
+Biblequote proc near
+
+ call mode640x480
+ mov dx,offset cs:title0graphics
+ call showpcx
+ call fadescreenups
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz biblequotearly
+ mov cx,560
+ call hangone
+ cmp lasthardkey,1
+ jz biblequotearly
+ call fadescreendowns
+ mov cx,200 ;128
+ call hangone
+ cmp lasthardkey,1
+ jz biblequotearly
+ call cancelch0
+biblequotearly:
+ mov lasthardkey,0
+ ret
+
+ endp
+
+
+
+
+Hangone proc near
+
+hangonloope: push cx
+ call vsync
+ pop cx
+ cmp lasthardkey,1
+ jz hangonearly
+ loop hangonloope
+hangonearly:
+ ret
+
+ endp
+
+
+
+
+
+
+Intro proc near
+
+ mov dx,offset cs:introtextname
+ call loadtemptext
+
+ call loadpalfromiff
+ call setmode
+
+ mov newlocation,50
+ call clearpalette
+ call loadintroroom
+ mov volume,7
+ mov volumedirection,-1
+ if cd
+ mov volumeto,4
+ else
+ mov volumeto,0
+ endif
+ mov al,12 ;4
+ mov ah,255
+ call playchannel0
+ call fadescreenups
+ call runintroseq
+ cmp lasthardkey,1
+ jz introearly
+
+;waitsound: cmp ch1blockstoplay,0
+; jnz waitsound
+ call clearbeforeload
+
+ mov newlocation,52
+ call loadintroroom
+ call runintroseq
+ cmp lasthardkey,1
+ jz introearly
+ call clearbeforeload
+
+ mov newlocation,53
+ call loadintroroom
+ call runintroseq
+ cmp lasthardkey,1
+ jz introearly
+ call clearbeforeload
+
+ call allpalette
+ mov newlocation,54
+ call loadintroroom
+ ;mov al,12
+ ;mov ah,255
+ ;call playchannel0
+ call runintroseq
+ cmp lasthardkey,1
+ jz introearly
+
+ call getridoftemptext
+ call clearbeforeload
+introearly:
+ mov lasthardkey, 0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Runintroseq proc near
+
+ mov getback,0
+
+moreintroseq: call vsync
+ cmp lasthardkey,1
+ jz earlyendrun
+ call spriteupdate
+ call vsync
+ cmp lasthardkey,1
+ jz earlyendrun
+ call deleverything
+ call printsprites
+ call reelsonscreen
+ call afterintroroom
+ call usetimedtext
+ call vsync
+ cmp lasthardkey,1
+ jz earlyendrun
+ call dumpmap
+ call dumptimedtext
+ call vsync
+ cmp lasthardkey,1
+ jz earlyendrun
+ cmp getback,1
+ jnz moreintroseq
+ ret
+earlyendrun:
+ call getridoftemptext
+ call clearbeforeload
+ ret
+
+ endp
+
+
+
+
+
+Runendseq proc near
+
+ call atmospheres
+ mov getback,0
+moreendseq: call vsync
+ call spriteupdate
+ call vsync
+ call deleverything
+ call printsprites
+ call reelsonscreen
+ call afterintroroom
+ call usetimedtext
+ call vsync
+ call dumpmap
+ call dumptimedtext
+ call vsync
+ cmp getback,1
+ jnz moreendseq
+ ret
+
+ endp
+
+
+
+
+Loadintroroom proc near
+
+ mov introcount,0
+ mov location,255
+ call loadroom
+ mov mapoffsetx,72
+ mov mapoffsety,16
+ call clearsprites
+ mov throughdoor,0
+ mov currentkey,"0"
+ mov mainmode,0
+ call clearwork
+ mov newobs,1
+ call drawfloor
+ call reelsonscreen
+ call spriteupdate
+ call printsprites
+ call worktoscreen
+ ret
+
+ endp
+
+
+
+
+
+
+Mode640x480 proc near
+
+ mov al,12h+128
+ mov ah,0
+ int 10h
+ ;call clearpalette
+ ret
+
+ endp
+
+
+
+Set16colpalette proc near
+
+ mov cx,16
+ mov bl,0
+ mov bh,0
+ mov al,0
+ mov ah,10h
+set16palloop2: push ax bx cx
+ int 10h
+ pop cx bx ax
+ inc bl
+ inc bh
+ loop set16palloop2
+
+ mov bl,31h
+ mov al,1
+ mov ah,12h
+ int 10h
+ ret
+
+ endp
+
+
+
+
+
+RealCredits proc near
+
+ mov roomssample,33
+ call loadroomssample
+ mov volume,0
+
+ call mode640x480
+ mov cx,35
+ call hangon
+
+ mov dx,offset cs:title1graphics
+ call showpcx
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov cx,2
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call allpalette
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+
+ mov dx,offset cs:title2graphics
+ call showpcx
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov cx,2
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call allpalette
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+
+ if demo
+ else
+ mov dx,offset cs:title3graphics
+ call showpcx
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov cx,2
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call allpalette
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+
+ mov dx,offset cs:title4graphics
+ call showpcx
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov cx,2
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call allpalette
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+
+ mov dx,offset cs:title5graphics
+ call showpcx
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov cx,2
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call allpalette
+ mov cx,80
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ endif
+
+ mov dx,offset cs:title6graphics
+ call showpcx
+ call fadescreenups
+ mov cx,60
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ mov al,13
+ mov ah,0
+ call playchannel0
+ mov cx,350
+ call hangone
+ cmp lasthardkey,1
+ jz realcreditsearly
+ call fadescreendowns
+ mov cx,256
+ call hangone
+realcreditsearly:
+ mov lasthardkey, 0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/use.asm b/devtools/tasmrecover/dreamweb/use.asm
new file mode 100644
index 0000000000..4b82f946f0
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/use.asm
@@ -0,0 +1,3810 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+
+Useobject proc near
+
+ mov withobject,255
+
+ cmp commandtype,229
+ jz alreadyuse
+ mov commandtype,229
+
+ mov bl,command
+ mov bh,objecttype
+ mov al,51
+ call commandwithob
+alreadyuse: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz nouse
+ and ax,1
+ jnz douse
+nouse: ret
+
+douse: call useroutine
+ ret
+
+ endp
+
+
+
+
+
+
+
+Useroutine proc near
+
+ cmp reallocation,50
+ jc nodream7
+ cmp pointerpower,0
+ jnz powerok
+ ret
+powerok: mov pointerpower,0
+
+nodream7: call getanyad
+ mov dx,seg uselist
+ mov ds,dx
+ mov si,offset uselist
+checkuselist: push si
+ lodsb
+ sub al,"A"
+ cmp al,[es:bx+12]
+ jnz failed
+ lodsb
+ sub al,"A"
+ cmp al,[es:bx+13]
+ jnz failed
+ lodsb
+ sub al,"A"
+ cmp al,[es:bx+14]
+ jnz failed
+ lodsb
+ sub al,"A"
+ cmp al,[es:bx+15]
+ jnz failed
+ lodsw
+ pop si
+ call ax
+ ret
+failed: pop si
+ add si,6
+ cmp byte ptr [si],140
+ jnz checkuselist
+
+ call delpointer
+ call getobtextstart
+ call findnextcolon
+ cmp al,0
+ jz cantuse2
+ call findnextcolon
+ cmp al,0
+ jz cantuse2
+ mov al,[es:si]
+ cmp al,0
+ jz cantuse2
+ call usetext
+ mov cx,400
+ call hangonp
+ call putbackobstuff
+ ret
+cantuse2: call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call obicons
+ mov di,33
+ mov bx,100
+ mov al,63
+ mov dl,241
+ call printmessage
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call putbackobstuff
+ mov commandtype,255
+ ret
+
+Uselist: db "NETW"
+ dw usemon
+ db "ELVA"
+ dw useelevator1
+ db "ELVB"
+ dw useelevator2
+ db "ELVC"
+ dw useelevator3
+ db "ELVE"
+ dw useelevator4
+ db "ELVF"
+ dw useelevator5
+ db "CGAT"
+ dw usechurchgate
+ db "REMO"
+ dw usestereo
+ db "BUTA"
+ dw usebuttona
+ db "CBOX"
+ dw usewinch
+ db "LITE"
+ dw uselighter
+ db "PLAT"
+ dw useplate
+ db "LIFT"
+ dw usecontrol
+ db "WIRE"
+ dw usewire
+ db "HNDL"
+ dw usehandle
+ db "HACH"
+ dw usehatch
+ db "DOOR"
+ dw useelvdoor
+ db "CSHR"
+ dw usecashcard
+ db "GUNA"
+ dw usegun
+ db "CRAA"
+ dw usecardreader1
+ db "CRBB"
+ dw usecardreader2
+ db "CRCC"
+ dw usecardreader3
+ db "SEAT"
+ dw sitdowninbar
+ db "MENU"
+ dw usemenu
+ db "COOK"
+ dw usecooker
+ db "ELCA"
+ dw callhotellift
+ db "EDCA"
+ dw calledenslift
+ db "DDCA"
+ dw calledensdlift
+ db "ALTR"
+ dw usealtar
+ db "LOKA"
+ dw openhoteldoor
+ db "LOKB"
+ dw openhoteldoor2
+ db "ENTA"
+ dw openlouis
+ db "ENTB"
+ dw openryan
+ db "ENTE"
+ dw openpoolboss
+ db "ENTC"
+ dw openyourneighbour
+ db "ENTD"
+ dw openeden
+ db "ENTH"
+ dw opensarters
+ db "WWAT"
+ dw wearwatch
+ db "POOL"
+ dw usepoolreader
+ db "WSHD"
+ dw wearshades
+ db "GRAF"
+ dw grafittidoor
+ db "TRAP"
+ dw trapdoor
+ db "CDPE"
+ dw edenscdplayer
+
+ db "DLOK"
+ dw opentvdoor
+
+ db "HOLE"
+ dw usehole
+
+ db "DRYR"
+ dw usedryer
+
+ db "HOLY"
+ dw usechurchhole
+
+ db "WALL"
+ dw usewall
+ db "BOOK"
+ dw usediary
+
+ db "AXED"
+ dw useaxe
+ db "SHLD"
+ dw useshield
+
+ db "BCNY"
+ dw userailing
+ db "LIDC"
+ dw usecoveredbox
+ db "LIDU"
+ dw useclearbox
+ db "LIDO"
+ dw useopenbox
+ db "PIPE"
+ dw usepipe
+
+ db "BALC"
+ dw usebalcony
+ db "WIND"
+ dw usewindow
+ db "PAPR"
+ dw viewfolder
+
+ db "UWTA"
+ dw usetrainer
+ db "UWTB"
+ dw usetrainer
+
+ db "STAT"
+ dw entersymbol
+ db "TLID"
+ dw opentomb
+ db "SLAB"
+ dw useslab
+ db "CART"
+ dw usecart
+ db "FCAR"
+ dw usefullcart
+
+
+ db "SLBA"
+ dw slabdoora
+ db "SLBB"
+ dw slabdoorb
+ db "SLBC"
+ dw slabdoorc
+ db "SLBD"
+ dw slabdoord
+ db "SLBE"
+ dw slabdoore
+ db "SLBF"
+ dw slabdoorf
+ db "PLIN"
+ dw useplinth
+
+ db "LADD"
+ dw useladder
+ db "LADB"
+ dw useladderb
+
+ db "GUMA"
+ dw chewy
+
+ db "SQEE"
+ dw wheelsound
+ db "TAPP"
+ dw runtap
+ db "GUIT"
+ dw playguitar
+ db "CONT"
+ dw hotelcontrol
+
+ db "BELL"
+ dw hotelbell
+
+ db 140,140,140,140
+
+ endp
+
+
+
+
+
+
+;-----------------------------------------------------------Puzzle routines----
+
+
+Wheelsound proc near
+
+ mov al,17
+ call playchannel1
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+Runtap proc near
+
+ cmp withobject,255
+ jnz tapwith
+ call withwhat
+ ret
+tapwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"E"
+ call compare
+ jz fillcupfromtap
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"F"
+ call compare
+ jz cupfromtapfull
+ mov cx,300
+ mov al,56
+ call showpuztext
+ call putbackobstuff
+ ret
+
+fillcupfromtap: mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+15],"F"-"A"
+ mov al,8
+ call playchannel1
+ mov cx,300
+ mov al,57
+ call showpuztext
+ call putbackobstuff
+ ret
+
+cupfromtapfull: mov cx,300
+ mov al,58
+ call showpuztext
+ call putbackobstuff
+ ret
+
+
+ endp
+
+
+
+Playguitar proc near
+
+ mov al,14
+ call playchannel1
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+Hotelcontrol proc near
+
+ cmp reallocation,21
+ jnz notrightcont
+ cmp mapx,33
+ jnz notrightcont
+ call showfirstuse
+ call putbackobstuff
+ ret
+notrightcont: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+Hotelbell proc near
+
+ if demo
+ mov al,24
+ else
+ mov al,12
+ endif
+ call playchannel1
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+Opentomb proc near
+
+ inc progresspoints
+ call showfirstuse
+ mov watchingtime,35*2
+ mov reeltowatch,1
+ mov endwatchreel,33
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Usetrainer proc near
+
+ call getanyad
+ cmp byte ptr [es:bx+2],4
+ jnz notheldtrainer
+ inc progresspoints
+ call makeworn
+ call showseconduse
+ call putbackobstuff
+ ret
+notheldtrainer: call nothelderror
+ ret
+
+ endp
+
+
+
+Nothelderror proc near
+
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call obicons
+ mov di,64
+ mov bx,100
+ mov al,63
+ mov ah,1
+ mov dl,201
+ call printmessage2
+ call worktoscreenm
+ mov cx,50
+ call hangonp
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+Usepipe proc near
+
+ cmp withobject,255
+ jnz pipewith
+ call withwhat
+ ret
+pipewith: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"E"
+ call compare
+ jz fillcup
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"F"
+ call compare
+ jz alreadyfull
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+fillcup: mov cx,300
+ mov al,36
+ call showpuztext
+ call putbackobstuff
+ mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+15],"F"-"A"
+ ret
+
+alreadyfull: mov cx,300
+ mov al,35
+ call showpuztext
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Usefullcart proc near
+
+ inc progresspoints
+ mov al,2
+ mov ah,roomnum
+ add ah,6
+ call turnanypathon
+ mov manspath,4
+ mov facing,4
+ mov turntoface,4
+ mov finaldest,4
+ call findxyfrompath
+ mov resetmanxy,1
+ call showfirstuse
+ mov watchingtime,72*2
+ mov reeltowatch,58
+ mov endwatchreel,142
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+Useplinth proc near
+
+ cmp withobject,255
+ jnz plinthwith
+ call withwhat
+ ret
+
+plinthwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"D"
+ mov ch,"K"
+ mov dl,"E"
+ mov dh,"Y"
+ call compare
+ jz isrightkey
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+isrightkey: inc progresspoints
+ call showseconduse
+ mov watchingtime,220
+ mov reeltowatch,0
+ mov endwatchreel,104
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ mov al,roomafterdream
+ mov newlocation,al
+ ret
+
+ endp
+
+
+
+Chewy proc near
+
+ call showfirstuse
+ call getanyad
+ mov byte ptr [es:bx+2],255
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Useladder proc near
+
+ call showfirstuse
+ sub mapx,11
+ call findroominloc
+ mov facing,6
+ mov turntoface,6
+ mov manspath,0
+ mov destination,0
+ mov finaldest,0
+ call findxyfrompath
+ mov resetmanxy,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Useladderb proc near
+
+ call showfirstuse
+ add mapx,11
+ call findroominloc
+ mov facing,2
+ mov turntoface,2
+ mov manspath,1
+ mov destination,1
+ mov finaldest,1
+ call findxyfrompath
+ mov resetmanxy,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Slabdoora proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,13
+ cmp dreamnumber,3
+ jnz slabawrong
+ inc progresspoints
+ mov watchingtime,60
+ mov endwatchreel,42
+ mov newlocation,47
+ ret
+slabawrong: mov watchingtime,40
+ mov endwatchreel,34
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+
+Slabdoorb proc near
+
+ cmp dreamnumber,1
+ jnz slabbwrong
+ mov al,"S"
+ mov ah,"H"
+ mov cl,"L"
+ mov ch,"D"
+ call isryanholding
+ jnz gotcrystal
+ mov al,44
+ mov cx,200
+ call showpuztext
+ call putbackobstuff
+ ret
+gotcrystal: call showfirstuse
+ inc progresspoints
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,44
+ mov watchingtime,60
+ mov endwatchreel,71
+ mov newlocation,47
+ ret
+slabbwrong: call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,44
+ mov watchingtime,40
+ mov endwatchreel,63
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+Slabdoord proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,75
+ cmp dreamnumber,0
+ jnz slabcwrong
+ inc progresspoints
+ mov watchingtime,60
+ mov endwatchreel,102
+ mov newlocation,47
+ ret
+slabcwrong: mov watchingtime,40
+ mov endwatchreel,94
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+Slabdoorc proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,108
+ cmp dreamnumber,4
+ jnz slabdwrong
+ inc progresspoints
+ mov watchingtime,60
+ mov endwatchreel,135
+ mov newlocation,47
+ ret
+slabdwrong: mov watchingtime,40
+ mov endwatchreel,127
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+Slabdoore proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,141
+ cmp dreamnumber,5
+ jnz slabewrong
+ inc progresspoints
+ mov watchingtime,60
+ mov endwatchreel,168
+ mov newlocation,47
+ ret
+slabewrong: mov watchingtime,40
+ mov endwatchreel,160
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+Slabdoorf proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchspeed,1
+ mov speedcount,1
+ mov reeltowatch,171
+ cmp dreamnumber,2
+ jnz slabfwrong
+ inc progresspoints
+ mov watchingtime,60
+ mov endwatchreel,197
+ mov newlocation,47
+ ret
+slabfwrong: mov watchingtime,40
+ mov endwatchreel,189
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+
+
+
+Useslab proc near
+
+ cmp withobject,255
+ jnz slabwith
+ call withwhat
+ ret
+slabwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"J"
+ mov ch,"E"
+ mov dl,"W"
+ mov dh,"L"
+ call compare
+ jz nextslab
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+nextslab: mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+2],0
+ mov al,command
+ push ax
+ call removesetobject
+ pop ax
+ inc al
+ push ax
+ call placesetobject
+ pop ax
+ cmp al,54
+ jnz notlastslab
+ mov al,0
+ call turnpathon
+ mov watchingtime,22
+ mov reeltowatch,35
+ mov endwatchreel,48
+ mov watchspeed,1
+ mov speedcount,1
+notlastslab: inc progresspoints
+ call showfirstuse
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Usecart proc near
+
+ cmp withobject,255
+ jnz cartwith
+ call withwhat
+ ret
+cartwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"R"
+ mov ch,"O"
+ mov dl,"C"
+ mov dh,"K"
+ call compare
+ jz nextcart
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+nextcart: mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+2],0
+ mov al,command
+ push ax
+ call removesetobject
+ pop ax
+ inc al
+ call placesetobject
+ inc progresspoints
+ mov al,17
+ call playchannel1
+ call showfirstuse
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Useclearbox proc near
+
+ cmp withobject,255
+ jnz clearboxwith
+ call withwhat
+ ret
+clearboxwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"R"
+ mov ch,"A"
+ mov dl,"I"
+ mov dh,"L"
+ call compare
+ jz openbox
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+openbox: inc progresspoints
+ call showfirstuse
+ mov watchingtime,80
+ mov reeltowatch,67
+ mov endwatchreel,105
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Usecoveredbox proc near
+
+ inc progresspoints
+ call showfirstuse
+ mov watchingtime,50
+ mov reeltowatch,41
+ mov endwatchreel,66
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Userailing proc near
+
+ call showfirstuse
+ mov watchingtime,80
+ mov reeltowatch,0
+ mov endwatchreel,30
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ mov mandead,4
+ ret
+
+ endp
+
+
+
+
+
+Useopenbox proc near
+
+ cmp withobject,255
+ jnz openboxwith
+ call withwhat
+ ret
+openboxwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"F"
+ call compare
+ jz destoryopenbox
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"P"
+ mov dh,"E"
+ call compare
+ jz openboxwrong
+ call showfirstuse
+ ret
+
+destoryopenbox: inc progresspoints
+ mov cx,300
+ mov al,37
+ call showpuztext
+ mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+15],"E"-"A"
+ mov watchingtime,140
+ mov reeltowatch,105
+ mov endwatchreel,181
+ mov watchspeed,1
+ mov speedcount,1
+ mov al,4
+ call turnpathon
+ mov getback,1
+ ret
+
+openboxwrong: mov cx,300
+ mov al,38
+ call showpuztext
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Wearwatch proc near
+
+ cmp watchon,1
+ jz wearingwatch
+ call showfirstuse
+ mov watchon,1
+ mov getback,1
+ call getanyad
+ call makeworn
+ ret
+wearingwatch: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+Wearshades proc near
+
+ cmp shadeson,1
+ jz wearingshades
+ mov shadeson,1
+ call showfirstuse
+ mov getback,1
+ call getanyad
+ call makeworn
+ ret
+wearingshades: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+Sitdowninbar proc near
+
+ cmp watchmode,-1
+ jnz satdown
+ call showfirstuse
+ mov watchingtime,50
+ mov reeltowatch,55
+ mov endwatchreel,71
+ mov reeltohold,73
+ mov endofholdreel,83
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+satdown: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+Usechurchhole proc near
+
+ call showfirstuse
+ mov getback,1
+ mov watchingtime,28
+ mov reeltowatch,13
+ mov endwatchreel,26
+ mov watchspeed,1
+ mov speedcount,1
+ ret
+
+ endp
+
+
+
+Usehole proc near
+
+ cmp withobject,255
+ jnz holewith
+ call withwhat
+ ret
+holewith: mov al,withobject
+ mov ah,withtype
+ mov cl,"H"
+ mov ch,"N"
+ mov dl,"D"
+ mov dh,"A"
+ call compare
+ jz righthand
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+righthand: call showfirstuse
+ mov al,86
+ call removesetobject
+ mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+2],255
+ mov canmovealtar,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Usealtar proc near
+
+ mov al,"C"
+ mov ah,"N"
+ mov cl,"D"
+ mov ch,"A"
+ call findexobject
+ cmp al,numexobjects
+ jz thingsonaltar
+ mov al,"C"
+ mov ah,"N"
+ mov cl,"D"
+ mov ch,"B"
+ call findexobject
+ cmp al,numexobjects
+ jz thingsonaltar
+ cmp canmovealtar,1
+ jz movealtar
+ mov cx,300
+ mov al,23
+ call showpuztext
+ mov getback,1
+ ret
+
+movealtar: inc progresspoints
+ call showseconduse
+ mov watchingtime,160
+ mov reeltowatch,81
+ mov endwatchreel,174
+ mov watchspeed,1
+ mov speedcount,1
+
+ mov al,47 ;message number
+ mov bl,52 ;x pos of message
+ mov bh,76 ;and y pos
+ mov cx,32 ;time on screen
+ mov dx,98 ;pause before show
+ call setuptimeduse
+ mov getback,1
+ ret
+
+thingsonaltar: call showfirstuse
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Opentvdoor proc near
+
+ cmp withobject,255
+ jnz tvdoorwith
+ call withwhat
+ ret
+tvdoorwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"U"
+ mov ch,"L"
+ mov dl,"O"
+ mov dh,"K"
+ call compare
+ jz keyontv
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+keyontv: call showfirstuse
+ mov lockstatus,0
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usedryer proc near
+
+ mov al,12
+ call playchannel1
+ call showfirstuse
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Openlouis proc near
+
+ mov al,5
+ mov ah,2
+ mov cl,3
+ mov ch,8
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Nextcolon proc near
+
+lookcolon: mov al,[es:si]
+ inc si
+ cmp al,":"
+ jnz lookcolon
+ ret
+
+ endp
+
+
+
+
+Openyourneighbour proc near
+
+ mov al,255
+ mov ah,255
+ mov cl,255
+ mov ch,255
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Usewindow proc near
+
+ cmp manspath,6
+ jnz notonbalc
+ inc progresspoints
+ call showfirstuse
+ mov newlocation,29
+ mov getback,1
+ ret
+notonbalc: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+Usebalcony proc near
+
+ call showfirstuse
+ mov al,6
+ call turnpathon
+ mov al,0
+ call turnpathoff
+ mov al,1
+ call turnpathoff
+ mov al,2
+ call turnpathoff
+ mov al,3
+ call turnpathoff
+ mov al,4
+ call turnpathoff
+ mov al,5
+ call turnpathoff
+ inc progresspoints
+ mov manspath,6
+ mov destination,6
+ mov finaldest,6
+ call findxyfrompath
+ call switchryanoff
+ mov resetmanxy,1
+
+ mov watchingtime,30*2
+ mov reeltowatch,183
+ mov endwatchreel,212
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Openryan proc near
+
+ mov al,5
+ mov ah,1
+ mov cl,0
+ mov ch,6
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Openpoolboss proc near
+
+ mov al,5
+ mov ah,2
+ mov cl,2
+ mov ch,2
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Openeden proc near
+
+ mov al,2
+ mov ah,8
+ mov cl,6
+ mov ch,5
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+Opensarters proc near
+
+ mov al,7
+ mov ah,8
+ mov cl,3
+ mov ch,3
+ call entercode
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Isitright proc near
+
+ mov bx,seg presslist
+ mov es,bx
+ mov bx,offset es:presslist
+ cmp [es:bx+0],al
+ jnz notright
+ cmp [es:bx+1],ah
+ jnz notright
+ cmp [es:bx+2],cl
+ jnz notright
+ cmp [es:bx+3],ch
+notright: ret
+
+ endp
+
+
+
+
+Drawitall proc near
+
+ call createpanel
+ call drawfloor
+ ;call dumpallmap
+ call printsprites
+ call showicon
+ ret
+
+ endp
+
+
+
+
+Openhoteldoor proc near
+
+ cmp withobject,255
+ jnz hoteldoorwith
+ call withwhat
+ ret
+hoteldoorwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"E"
+ mov dl,"Y"
+ mov dh,"A"
+ call compare
+ jz keyonhotel1
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+keyonhotel1: if demo
+ mov al,27
+ else
+ mov al,16
+ endif
+ call playchannel1
+ call showfirstuse
+ ;mov destination,1
+ ;mov finaldest,1
+ ;call autosetwalk
+ mov lockstatus,0
+ mov getback,1
+ ret
+
+ endp
+
+
+
+Openhoteldoor2 proc near
+
+ cmp withobject,255
+ jnz hoteldoorwith2
+ call withwhat
+ ret
+hoteldoorwith2: mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"E"
+ mov dl,"Y"
+ mov dh,"A"
+ call compare
+ jz keyonhotel2
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+keyonhotel2: if demo
+ mov al,27
+ else
+ mov al,16
+ endif
+ call playchannel1
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Grafittidoor proc near
+
+ cmp withobject,255
+ jnz grafwith
+ call withwhat
+ ret
+grafwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"A"
+ mov ch,"P"
+ mov dl,"E"
+ mov dh,"N"
+ call compare
+ jz dograf
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+dograf: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+Trapdoor proc near
+
+ inc progresspoints
+ call showfirstuse
+ call switchryanoff
+ mov watchingtime,20*2
+ mov reeltowatch,181
+ mov endwatchreel,197
+ mov newlocation,26
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Callhotellift proc near
+
+ if demo
+ mov al,24
+ else
+ mov al,12
+ endif
+ call playchannel1
+ call showfirstuse
+ mov counttoopen,8
+ mov getback,1
+ mov destination,5
+ mov finaldest,5
+ call autosetwalk
+ mov al,4
+ call turnpathon
+ ret
+
+ endp
+
+
+
+
+Calledenslift proc near
+
+ call showfirstuse
+ mov counttoopen,8
+ mov getback,1
+ mov al,2
+ call turnpathon
+ ret
+
+ endp
+
+
+
+Calledensdlift proc near
+
+ cmp liftflag,1
+ jz edensdhere
+ call showfirstuse
+ mov counttoopen,8
+ mov getback,1
+ mov al,2
+ call turnpathon
+ ret
+edensdhere: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Usepoolreader proc near
+
+ cmp withobject,255
+ jnz poolwith
+ call withwhat
+ ret
+poolwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"M"
+ mov ch,"E"
+ mov dl,"M"
+ mov dh,"B"
+ call compare
+ jz openpool
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+openpool: cmp talkedtoattendant,1
+ jz canopenpool
+ call showseconduse
+ call putbackobstuff
+ ret
+
+canopenpool: mov al,17
+ call playchannel1
+ call showfirstuse
+ mov counttoopen,6
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+Uselighter proc near
+
+ cmp withobject,255
+ jnz gotlighterwith
+ call withwhat
+ ret
+gotlighterwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"S"
+ mov ch,"M"
+ mov dl,"K"
+ mov dh,"E"
+ call compare
+ jz cigarette
+ call showfirstuse
+ call putbackobstuff
+ ret
+cigarette: mov cx,300
+ mov al,9
+ call showpuztext
+ mov al,withobject
+ call getexad
+ mov byte ptr [es:bx+2],255
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showseconduse proc near
+
+ call getobtextstart
+ call nextcolon
+ call nextcolon
+ call nextcolon
+ call usetext
+ mov cx,400
+ call hangonp
+ ret
+
+ endp
+
+
+
+
+
+
+Usecardreader1 proc near
+
+ cmp withobject,255
+ jnz gotreader1with
+ call withwhat
+ ret
+gotreader1with: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"S"
+ mov dl,"H"
+ mov dh,"R"
+ call compare
+ jz correctcard
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+correctcard: cmp talkedtosparky,0
+ jz notyet
+ cmp card1money,0
+ jz getscash
+ mov cx,300
+ mov al,17
+ call showpuztext
+ call putbackobstuff
+ ret
+getscash: mov al,16
+ call playchannel1
+ mov cx,300
+ mov al,18
+ call showpuztext
+ inc progresspoints
+ mov card1money,12432
+ mov getback,1
+ ret
+notyet: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+Usecardreader2 proc near
+
+ cmp withobject,255
+ jnz gotreader2with
+ call withwhat
+ ret
+gotreader2with: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"S"
+ mov dl,"H"
+ mov dh,"R"
+ call compare
+ jz correctcard2
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+correctcard2: cmp talkedtoboss,0
+ jz notyetboss
+ cmp card1money,0
+ jz nocash
+ cmp gunpassflag,2
+ jz alreadygotnew
+ mov al,18
+ call playchannel1
+ mov cx,300
+ mov al,19
+ call showpuztext
+ mov al,94
+ call placesetobject
+ mov gunpassflag,1
+ sub card1money,2000
+ inc progresspoints
+ mov getback,1
+ ret
+nocash: mov cx,300
+ mov al,20
+ call showpuztext
+ call putbackobstuff
+ ret
+alreadygotnew: mov cx,300
+ mov al,22
+ call showpuztext
+ call putbackobstuff
+ ret
+notyetboss: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usecardreader3 proc near
+
+ cmp withobject,255
+ jnz gotreader3with
+ call withwhat
+ ret
+gotreader3with: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"S"
+ mov dl,"H"
+ mov dh,"R"
+ call compare
+ jz rightcard
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+rightcard: cmp talkedtorecep,0
+ jz notyetrecep
+ cmp cardpassflag,0
+ jnz alreadyusedit
+ if demo
+ mov al,27
+ else
+ mov al,16
+ endif
+ call playchannel1
+ mov cx,300
+ mov al,25
+ call showpuztext
+ inc progresspoints
+ sub card1money,8300
+ mov cardpassflag,1
+ mov getback,1
+ ret
+alreadyusedit: mov cx,300
+ mov al,26
+ call showpuztext
+ call putbackobstuff
+ ret
+notyetrecep: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Usecashcard proc near
+
+ call getridofreels
+ call loadkeypad
+ call createpanel
+ call showpanel
+ call showexit
+ call showman
+
+ mov di,114
+ if foreign
+ mov bx,120-3
+ else
+ mov bx,120
+ endif
+ mov ds,tempgraphics
+ mov al,39
+ mov ah,0
+ call showframe
+
+ mov ax,card1money
+ call moneypoke
+
+ call getobtextstart
+ call nextcolon
+ call nextcolon
+
+ mov di,36
+ mov bx,98
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov di,160
+ mov bx,155
+ push cs
+ pop es
+ mov si,offset cs:money1poke
+ mov charshift,91*2+75
+ mov al,0
+ mov ah,0
+ mov dl,240
+ call printdirect
+ mov di,187
+ mov bx,155
+ push cs
+ pop es
+ mov si,offset cs:money2poke
+ mov charshift,91*2+85
+ mov al,0
+ mov ah,0
+ mov dl,240
+ call printdirect
+ mov charshift,0
+ call worktoscreenm
+ mov cx,400
+ call hangonp
+ call getridoftemp
+ call restorereels
+ call putbackobstuff
+ ret
+
+money1poke: db "0000",0
+money2poke: db "00",0
+
+ endp
+
+
+
+
+Lookatcard proc near
+
+ mov manisoffscreen,1
+ call getridofreels
+ call loadkeypad
+
+ call createpanel2
+ mov di,160
+ mov bx,80
+ mov ds,tempgraphics
+ mov al,42
+ mov ah,128
+ call showframe
+
+ call getobtextstart
+ call findnextcolon
+ call findnextcolon
+ call findnextcolon
+ mov di,36
+ mov bx,124
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ push es si
+ call worktoscreenm
+ mov cx,280
+ call hangonw
+ call createpanel2
+ mov di,160
+ mov bx,80
+ mov ds,tempgraphics
+ mov al,42
+ mov ah,128
+ call showframe
+ pop si es
+
+ mov di,36
+ mov bx,130
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+ call worktoscreenm
+
+ mov cx,200
+ call hangonw
+ mov manisoffscreen,0
+ call getridoftemp
+ call restorereels
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+Moneypoke proc near
+
+ mov bx,offset cs:money1poke
+ mov cl,48-1
+numberpoke0: inc cl
+ sub ax,10000
+ jnc numberpoke0
+ add ax,10000
+ mov [cs:bx],cl
+ inc bx
+
+ mov cl,48-1
+numberpoke1: inc cl
+ sub ax,1000
+ jnc numberpoke1
+ add ax,1000
+ mov [cs:bx],cl
+ inc bx
+
+ mov cl,48-1
+numberpoke2: inc cl
+ sub ax,100
+ jnc numberpoke2
+ add ax,100
+ mov [cs:bx],cl
+ inc bx
+
+ mov cl,48-1
+numberpoke3: inc cl
+ sub ax,10
+ jnc numberpoke3
+ add ax,10
+ mov [cs:bx],cl
+
+ mov bx,offset cs:money2poke
+ add al,48
+ mov [cs:bx],al
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usecontrol proc near
+
+ cmp withobject,255
+ jnz gotcontrolwith
+ call withwhat
+ ret
+gotcontrolwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"E"
+ mov dl,"Y"
+ mov dh,"A"
+ call compare
+ jz rightkey
+ cmp reallocation,21
+ jnz balls
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"N"
+ mov dl,"F"
+ mov dh,"E"
+ call compare
+ jz jimmycontrols
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"A"
+ mov ch,"X"
+ mov dl,"E"
+ mov dh,"D"
+ call compare
+ jz axeoncontrols
+
+balls: call showfirstuse
+ call putbackobstuff
+ ret
+
+rightkey: mov al,16
+ call playchannel1
+ cmp location,21
+ jz goingdown
+ mov cx,300
+ mov al,0
+ call showpuztext
+ mov newlocation,21
+ mov counttoclose,8
+ mov counttoopen,0
+ mov watchingtime,80
+ mov getback,1
+ ret
+
+goingdown: mov cx,300
+ mov al,3
+ call showpuztext
+ mov newlocation,30
+ mov counttoclose,8
+ mov counttoopen,0
+ mov watchingtime,80
+ mov getback,1
+ ret
+
+jimmycontrols: mov al,50
+ call placesetobject
+ mov al,51
+ call placesetobject
+ mov al,26
+ call placesetobject
+ mov al,30
+ call placesetobject
+ mov al,16
+ call removesetobject
+ mov al,17
+ call removesetobject
+ if demo
+ mov al,26
+ else
+ mov al,14
+ endif
+ call playchannel1
+ mov cx,300
+ mov al,10
+ call showpuztext
+ inc progresspoints
+ mov getback,1
+ ret
+
+axeoncontrols: mov cx,300
+ mov al,16
+ call showpuztext
+ inc progresspoints
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Usehatch proc near
+
+ call showfirstuse
+ mov newlocation,40
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Usewire proc near
+
+ cmp withobject,255
+ jnz gotwirewith
+ call withwhat
+ ret
+gotwirewith: mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"N"
+ mov dl,"F"
+ mov dh,"E"
+ call compare
+ jz wireknife
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"A"
+ mov ch,"X"
+ mov dl,"E"
+ mov dh,"D"
+ call compare
+ jz wireaxe
+
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+wireaxe: mov cx,300
+ mov al,16
+ call showpuztext
+ call putbackobstuff
+ ret
+
+wireknife: mov al,51
+ call removesetobject
+ mov al,52
+ call placesetobject
+ mov cx,300
+ mov al,11
+ call showpuztext
+ inc progresspoints
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usehandle proc near
+
+ mov al,"C"
+ mov ah,"U"
+ mov cl,"T"
+ mov ch,"W"
+ call findsetobject
+ mov al,[es:bx+58]
+ cmp al,255
+ jnz havecutwire
+ mov cx,300
+ mov al,12
+ call showpuztext
+ mov getback,1
+ ret
+
+havecutwire: mov cx,300
+ mov al,13
+ call showpuztext
+ mov newlocation,22
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Useelevator1 proc near
+
+ call showfirstuse
+ call selectlocation
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+
+Showfirstuse proc near ;shows but does not delete the
+ ;first bit of text after the
+ call getobtextstart ;description
+ call findnextcolon
+ call findnextcolon
+ call usetext
+ mov cx,400
+ call hangonp
+ ret
+
+ endp
+
+
+
+
+
+Useelevator3 proc near
+
+ call showfirstuse
+ mov counttoclose,20
+ mov newlocation,34
+ mov reeltowatch,46
+ mov endwatchreel,63
+ mov watchspeed,1
+ mov speedcount,1
+ mov watchingtime,80 ;40
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Useelevator4 proc near
+
+ call showfirstuse
+ mov reeltowatch,0
+ mov endwatchreel,11
+ mov watchspeed,1
+ mov speedcount,1
+ mov counttoclose,20
+ mov watchingtime,80 ;40
+ mov getback,1
+ mov newlocation,24
+ ret
+
+ endp
+
+
+
+Useelevator2 proc near
+
+ cmp location,23
+ jz inpoolhall
+ call showfirstuse
+ mov newlocation,23
+ mov counttoclose,20
+ mov counttoopen,0
+ mov watchingtime,80
+ mov getback,1
+ ret
+inpoolhall: call showfirstuse
+ mov newlocation,31
+ mov counttoclose,20
+ mov counttoopen,0
+ mov watchingtime,80
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+Useelevator5 proc near
+
+ mov al,4
+ call placesetobject
+ mov al,0
+ call removesetobject
+ mov newlocation,20
+ mov watchingtime,80
+ mov liftflag,1
+ mov counttoclose,8
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Usekey proc near
+
+ cmp location,5
+ jz usekey1
+ cmp location,30
+ jz usekey1
+ cmp location,21
+ jz usekey2
+ mov cx,200
+ mov al,1
+ call showpuztext
+ call putbackobstuff
+ ret
+
+usekey1: cmp mapx,22
+ jnz wrongroom1
+ cmp mapy,10
+ jnz wrongroom1
+ mov cx,300
+ mov al,0
+ call showpuztext
+ mov counttoclose,100
+ mov getback,1
+ ret
+
+usekey2: cmp mapx,11
+ jnz wrongroom1
+ cmp mapy,10
+ jnz wrongroom1
+ mov cx,300
+ mov al,3
+ call showpuztext
+ mov newlocation,30
+ mov al,2
+ call fadescreendown
+ call showfirstuse
+ call putbackobstuff
+ ret
+
+wrongroom1: mov cx,200
+ mov al,2
+ call showpuztext
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usestereo proc near
+
+ cmp location,0
+ jz stereook
+ mov cx,400 ;Ryan isn't in his flat.
+ mov al,4
+ call showpuztext
+ call putbackobstuff
+ ret
+
+stereook: cmp mapx,11
+ jnz stereonotok
+ cmp mapy,0
+ jz stereook2
+stereonotok: mov cx,400 ;Ryan isn't in his bedroom.
+ mov al,5
+ call showpuztext
+ call putbackobstuff
+ ret
+
+stereook2: mov al,"C"
+ mov ah,"D"
+ mov cl,"P"
+ mov ch,"L"
+ call findsetobject ;find object number of CD player
+ mov ah,1 ;searching for inside a set ob
+ call checkinside ;see if there is anything inside
+ cmp cl,numexobjects
+ jnz cdinside
+ mov al,6 ;Need a CD inside
+ mov cx,400
+ call showpuztext
+ call putbackobstuff
+ call getanyad ;if the CD's been taken out,
+ mov al,255 ;make sure the player isn't still
+ mov [es:bx+10],al ;playing, ie:reset the puzzle
+ ret ;flag for the remote.
+
+cdinside: call getanyad
+ mov al,[es:bx+10]
+ xor al,1
+ mov [es:bx+10],al
+ cmp al,255
+ jz stereoon
+ mov al,7 ;The stereo works
+ mov cx,400
+ call showpuztext
+ call putbackobstuff
+ ret
+
+stereoon: mov al,8 ;Stereo was already on,
+ mov cx,400 ;so switch it off
+ call showpuztext
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Usecooker proc near
+
+ mov al,command
+ mov ah,objecttype
+ call checkinside ;see if there is anything inside
+ cmp cl,numexobjects
+ jnz foodinside
+ call showfirstuse
+ call putbackobstuff
+ ret ;flag for the remote.
+
+foodinside: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Useaxe proc near
+
+ cmp reallocation,22
+ jnz notinpool
+ cmp mapy,10
+ jz axeondoor
+ call showseconduse
+ inc progresspoints
+ mov lastweapon,2
+ mov getback,1
+ call removeobfrominv
+ ret
+
+notinpool: call showfirstuse
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Useelvdoor proc near
+
+ cmp withobject,255
+ jnz gotdoorwith
+ call withwhat
+ ret
+gotdoorwith: mov al,withobject
+ mov ah,withtype
+ mov cl,"A"
+ mov ch,"X"
+ mov dl,"E"
+ mov dh,"D"
+ call compare
+ jz axeondoor
+ mov al,14
+ mov cx,300
+ call showpuztext
+ call putbackobstuff
+ ret
+
+axeondoor: mov al,15
+ mov cx,300
+ call showpuztext
+ inc progresspoints
+
+ mov watchingtime,46*2
+ mov reeltowatch,31
+ mov endwatchreel,77
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+;------------------------------------------------------------------------------
+
+Withwhat proc near ;Gets player to identify object
+ ;to use selected item with.
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ mov al,command
+ mov ah,objecttype
+ push cs
+ pop es
+ mov di,offset cs:commandline
+ call copyname
+
+ mov di,100
+ mov bx,21
+ mov dl,200
+ mov al,63
+ mov ah,2
+ call printmessage2
+
+ mov di,lastxpos
+ add di,5
+ mov bx,21
+ push cs
+ pop es
+ mov si,offset cs:commandline
+ mov dl,220
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ mov di,lastxpos
+ add di,5
+ mov bx,21
+ mov dl,200
+ mov al,63
+ mov ah,3
+ call printmessage2
+
+ call fillryan
+ mov commandtype,255
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ mov invopen,2
+ ret
+
+ endp
+
+
+
+
+
+Selectob proc near
+
+ call findinvpos
+ mov ax,[es:bx]
+ cmp al,255
+ jnz canselectob
+ call blank
+ ret
+
+canselectob: mov withobject,al
+ mov withtype,ah
+ cmp ax,oldsubject
+ jnz diffsub3
+ cmp commandtype,221
+ jz alreadyselob
+ mov commandtype,221
+
+diffsub3: mov oldsubject,ax
+ mov bx,ax
+ mov al,0
+ call commandwithob
+alreadyselob: mov ax,mousebutton
+ cmp ax,oldbutton
+ jz notselob
+ and ax,1
+ jnz doselob
+notselob: ret
+
+doselob: call delpointer
+ mov invopen,0
+ call useroutine
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Compare proc near
+
+ sub dl,"A"
+ sub dh,"A"
+ sub cl,"A"
+ sub ch,"A"
+ push cx dx
+ call getanyaddir
+ pop dx cx
+ cmp [es:bx+12],cx
+ jnz comparefin
+ cmp [es:bx+14],dx
+comparefin: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Findsetobject proc near ;searches set object ID's
+ ;for contents of ax,cx
+ sub al,"A" ;returns number in al and data
+ sub ah,"A" ;start point in es:bx
+ sub cl,"A"
+ sub ch,"A"
+ mov es,setdat
+ mov bx,0
+ mov dl,0 ;dl counts object number
+findsetloop: cmp al,[es:bx+12]
+ jnz nofind
+ cmp ah,[es:bx+13]
+ jnz nofind
+ cmp cl,[es:bx+14]
+ jnz nofind
+ cmp ch,[es:bx+15]
+ jnz nofind
+ mov al,dl
+ ret
+nofind: add bx,64
+ inc dl
+ cmp dl,128 ;number of objects to search
+ jnz findsetloop
+ mov al,dl
+ ret
+
+ endp
+
+
+
+
+
+
+Findexobject proc near ;searches ex object ID's
+ ;for contents of ax,cx
+ sub al,"A" ;returns number in al and data
+ sub ah,"A" ;start point in es:bx
+ sub cl,"A"
+ sub ch,"A"
+ mov es,extras
+ mov bx,exdata
+ mov dl,0 ;dl counts object number
+findexloop: cmp al,[es:bx+12]
+ jnz nofindex
+ cmp ah,[es:bx+13]
+ jnz nofindex
+ cmp cl,[es:bx+14]
+ jnz nofindex
+ cmp ch,[es:bx+15]
+ jnz nofindex
+ mov al,dl
+ ret
+nofindex: add bx,16
+ inc dl
+ cmp dl,numexobjects ;number of objects to search
+ jnz findexloop
+ mov al,dl
+ ret
+
+ endp
+
+
+
+Isryanholding proc near
+
+ sub al,"A" ;returns number in al and data
+ sub ah,"A" ;start point in es:bx
+ sub cl,"A"
+ sub ch,"A"
+ mov es,extras
+ mov bx,exdata
+ mov dl,0 ;dl counts object number
+searchinv: cmp byte ptr [es:bx+2],4
+ jnz nofindininv
+ cmp al,[es:bx+12]
+ jnz nofindininv
+ cmp ah,[es:bx+13]
+ jnz nofindininv
+ cmp cl,[es:bx+14]
+ jnz nofindininv
+ cmp ch,[es:bx+15]
+ jnz nofindininv
+ mov al,dl
+ cmp al,numexobjects
+ ret
+nofindininv: add bx,16
+ inc dl
+ cmp dl,numexobjects ;number of objects to search
+ jnz searchinv
+ mov al,dl
+ cmp al,numexobjects ;if not zero he is holding
+ ret ;if zero, he is not holding
+
+ endp
+
+
+
+
+Checkinside proc near ;finds an extra object inside
+ ;object number al, type ah
+
+ mov es,extras
+ mov bx,exdata
+ mov cl,0
+insideloop: cmp al,[es:bx+3] ;OI! might need to check room number!!!
+ jnz notfoundinside
+ cmp ah,[es:bx+2]
+ jnz notfoundinside
+ ret
+notfoundinside: add bx,16
+ inc cl
+ cmp cl,numexobjects
+ jnz insideloop
+ ret ;ch returns the object number
+ ;in the extras list
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Usetext proc near
+
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call obicons
+ pop si es
+
+ mov di,36
+ mov bx,104
+ mov dl,241
+ mov al,0
+ mov ah,0
+ call printdirect
+
+ call worktoscreenm
+ ret
+
+ endp
+
+
+
+
+
+Putbackobstuff proc near
+
+ call createpanel
+ call showpanel
+ call showman
+ call obicons
+ call showexit
+ call obpicture
+ call describeob
+ call undertextline
+ mov commandtype,255
+ call readmouse
+ call showpointer
+ call worktoscreen
+ call delpointer
+ ret
+
+ endp
+
+
+
+
+
+
+
+Showpuztext proc near
+
+ push cx
+ call findpuztext
+ push es si
+ call createpanel
+ call showpanel
+ call showman
+ call showexit
+ call obicons
+ pop si es
+ mov di,36
+ mov bx,104
+ mov dl,241
+ mov ah,0
+ call printdirect
+ call worktoscreenm
+ pop cx
+ call hangonp
+ ret
+
+ endp
+
+
+
+Findpuztext proc near
+
+ mov ah,0
+ mov si,ax
+ add si,si
+ mov es,puzzletext
+ mov ax,[es:si]
+ add ax,textstart
+ mov si,ax
+ ret
+
+ endp
+
+
+
+;-------------------------------------------------------------------------------
+
+Placesetobject proc near
+
+ push es bx
+ mov cl,0
+ mov ch,0
+ call findormake
+ call getsetad
+ mov byte ptr [es:bx+58],0
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+Removesetobject proc near
+
+ push es bx
+ mov cl,255
+ mov ch,0
+ call findormake
+ call getsetad
+ mov byte ptr [es:bx+58],255
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+Issetobonmap proc near
+
+ push es bx
+ call getsetad
+ mov al,[es:bx+58]
+ pop bx es
+ cmp al,0
+ ret
+
+ endp
+
+
+
+
+
+
+Placefreeobject proc near
+
+ push es bx
+ mov cl,0
+ mov ch,1
+ call findormake
+ call getfreead
+ mov byte ptr [es:bx+2],0
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+Removefreeobject proc near
+
+ push es bx
+ ;mov cl,255
+ ;mov ch,1
+ ;call findormake
+ call getfreead
+ mov byte ptr [es:bx+2],255
+ pop bx es
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Findormake proc near
+
+ mov bx,listofchanges
+ push ax
+ mov es,buffers
+ mov ah,reallocation
+changeloop: cmp byte ptr [es:bx],255
+ jz haventfound
+ cmp ax,[es:bx]
+ jnz nofoundchange
+ cmp ch,[es:bx+3]
+ jz foundchange
+nofoundchange: add bx,4
+ jmp changeloop
+foundchange: pop ax
+ mov [es:bx+2],cl
+ ret
+haventfound: mov [es:bx],ax
+ mov [es:bx+2],cx
+ pop ax
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Switchryanon proc near
+
+ mov ryanon,255
+ ret
+
+ endp
+
+
+
+
+
+Switchryanoff proc near
+
+ mov ryanon,1
+ ret
+
+ endp
+
+
+
+Setallchanges proc near
+
+ mov es,buffers
+ mov bx,listofchanges
+setallloop: mov ax,[es:bx]
+ cmp al,255
+ jz endsetloop
+ mov cx,[es:bx+2]
+ add bx,4
+ cmp ah,reallocation
+ jnz setallloop
+ push es bx
+ call dochange
+ pop bx es
+ jmp setallloop
+endsetloop: ret
+
+ endp
+
+
+
+
+
+
+Dochange proc near
+
+ cmp ch,0
+ jz object
+ cmp ch,1
+ jz freeobject
+
+path: push cx
+ mov ah,0
+ add ax,ax
+ add ax,ax
+ add ax,ax
+ push ax
+ mov al,ch
+ sub al,100
+ mov ah,0
+ mov cx,144
+ mul cx
+ pop bx
+ add bx,ax
+ add bx,pathdata
+ mov es,reels
+ pop cx
+ mov byte ptr [es:bx+6],cl
+nopath: ret
+
+object: push cx
+ call getsetad
+ pop cx
+ mov [es:bx+58],cl
+ ret
+
+freeobject: push cx
+ call getfreead
+ pop cx
+ cmp byte ptr [es:bx+2],255
+ jnz beenpickedup
+ mov [es:bx+2],cl
+beenpickedup: ret
+
+ endp
+
+
+
+Autoappear proc near ;places objects that appear
+ ;in rooms after certain
+ cmp location,32 ;conditions are met.
+ jnz notinalley
+ mov al,5 ;switch off travel to
+ call resetlocation ;hotel after kill
+ mov al,10
+ call setlocation
+ mov destpos,10
+ ret
+notinalley: cmp reallocation,24
+ jnz notinedens
+ cmp generaldead,1
+ jnz edenspart2
+ inc generaldead
+ mov al,44
+ call placesetobject
+ mov al,18
+ call placesetobject
+ mov al,93
+ call placesetobject
+ mov al,92
+ call removesetobject
+ mov al,55
+ call removesetobject
+ mov al,75
+ call removesetobject
+ mov al,84
+ call removesetobject
+ mov al,85
+ call removesetobject
+ ret
+edenspart2: cmp sartaindead,1
+ jnz notedens2
+ mov al,44
+ call removesetobject
+ mov al,93
+ call removesetobject
+ mov al,55
+ call placesetobject
+ inc sartaindead
+notedens2: ret
+notinedens: cmp reallocation,25
+ jnz notonsartroof
+ mov newsitem,3
+ mov al,6
+ call resetlocation ;turn off Sartain Industries
+ mov al,11
+ call setlocation ;turn on carpark for later
+ mov destpos,11
+ ret
+notonsartroof: cmp reallocation,2
+ jnz notinlouiss
+ cmp rockstardead,0
+ jz notinlouiss
+ mov al,23
+ call placesetobject
+notinlouiss: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+;--------------------------------------------------------- Timed text stuff ----
+
+
+
+Getundertimed proc near
+
+ mov al,timedy
+ if foreign
+ sub al,3
+ endif
+ mov ah,0
+ mov bx,ax
+ mov al,timedx
+ mov ah,0
+ mov di,ax
+ mov ch,undertimedysize
+ mov cl,240
+ mov ds,buffers
+ mov si,undertimedtext
+ call multiget
+ ret
+
+ endp
+
+
+
+
+Putundertimed proc near
+
+ mov al,timedy
+ if foreign
+ sub al,3
+ endif
+ mov ah,0
+ mov bx,ax
+ mov al,timedx
+ mov ah,0
+ mov di,ax
+ mov ch,undertimedysize
+ mov cl,240
+ mov ds,buffers
+ mov si,undertimedtext
+ call multiput
+ ret
+
+ endp
+
+
+
+
+
+
+Dumptimedtext proc near
+
+ cmp needtodumptimed,1
+ jnz nodumptimed
+ mov al,timedy
+ if foreign
+ sub al,3
+ endif
+ mov ah,0
+ mov bx,ax
+ mov al,timedx
+ mov ah,0
+ mov di,ax
+ mov cl,240
+ mov ch,undertimedysize
+ call multidump
+ mov needtodumptimed,0
+nodumptimed: ret
+
+ endp
+
+
+
+
+
+
+
+
+Setuptimeduse proc near
+
+ cmp timecount,0
+ jnz cantsetup
+
+ mov timedy,bh
+ mov timedx,bl
+ mov counttotimed,cx
+ add dx,cx
+ mov timecount,dx
+ mov bl,al
+ mov bh,0
+ add bx,bx
+ mov es,puzzletext
+ mov cx,textstart
+ mov ax,[es:bx]
+ add ax,cx
+ mov bx,ax
+ mov timedseg,es
+ mov timedoffset,bx
+cantsetup: ret
+
+ endp
+
+
+
+Setuptimedtemp proc near
+
+ if cd
+ cmp ah,0
+ jz notloadspeech3
+ mov dl,"T"
+ mov dh,ah
+ mov cl,"T"
+ mov ah,0
+ call loadspeech
+ cmp speechloaded,1
+ jnz notloadspeech3
+ mov al,50+12
+ call playchannel1
+ ret
+notloadspeech3:
+ endif
+ cmp timecount,0
+ jnz cantsetup2
+ mov timedy,bh
+ mov timedx,bl
+ mov counttotimed,cx
+ add dx,cx
+ mov timecount,dx
+ mov bl,al
+ mov bh,0
+ add bx,bx
+ mov es,textfile1
+ mov cx,textstart
+ mov ax,[es:bx]
+ add ax,cx
+ mov bx,ax
+ mov timedseg,es
+ mov timedoffset,bx
+cantsetup2: ret
+
+ endp
+
+
+
+
+
+
+
+Usetimedtext proc near
+
+ cmp timecount,0
+ jz notext
+ dec timecount
+ cmp timecount,0
+ jz deltimedtext
+ mov ax,timecount
+ cmp ax,counttotimed
+ jz firsttimed
+ jnc notext
+ jmp notfirsttimed
+firsttimed: call getundertimed
+notfirsttimed: mov bl,timedy
+ mov bh,0
+ mov al,timedx
+ mov ah,0
+ mov di,ax
+ mov es,timedseg
+ mov si,timedoffset
+ mov dl,237
+ mov ah,0
+ call printdirect
+ mov needtodumptimed,1
+notext: ret
+
+deltimedtext: call putundertimed
+ mov needtodumptimed,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Edenscdplayer proc near
+
+ call showfirstuse
+ mov watchingtime,18*2
+ mov reeltowatch,25
+ mov endwatchreel,42
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ ret
+
+ endp
+
+
+
+
+
+Usewall proc near
+
+ call showfirstuse
+ cmp manspath,3
+ jz gobackover
+ mov watchingtime,30*2
+ mov reeltowatch,2
+ mov endwatchreel,31
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ mov al,3
+ call turnpathon
+ mov al,4
+ call turnpathon
+ mov al,0
+ call turnpathoff
+ mov al,1
+ call turnpathoff
+ mov al,2
+ call turnpathoff
+ mov al,5
+ call turnpathoff
+ mov manspath,3
+ mov finaldest,3
+ call findxyfrompath
+ mov resetmanxy,1
+ call switchryanoff
+ ret
+gobackover: mov watchingtime,30*2
+ mov reeltowatch,34
+ mov endwatchreel,60
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ mov al,3
+ call turnpathoff
+ mov al,4
+ call turnpathoff
+ mov al,0
+ call turnpathon
+ mov al,1
+ call turnpathon
+ mov al,2
+ call turnpathon
+ mov al,5
+ call turnpathon
+ mov manspath,5
+ mov finaldest,5
+ call findxyfrompath
+ mov resetmanxy,1
+ call switchryanoff
+ ret
+
+ endp
+
+
+
+
+
+
+
+Usechurchgate proc near
+
+ cmp withobject,255
+ jnz gatewith
+ call withwhat
+ ret
+gatewith: mov al,withobject
+ mov ah,withtype
+ mov cl,"C"
+ mov ch,"U"
+ mov dl,"T"
+ mov dh,"T"
+ call compare
+ jz cutgate
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+cutgate: call showfirstuse
+ mov watchingtime,64*2
+ mov reeltowatch,4
+ mov endwatchreel,70
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ inc progresspoints
+ mov al,3
+ call turnpathon
+ cmp aidedead,0
+ jz notopenchurch
+ mov al,2
+ call turnpathon
+notopenchurch: ret
+
+ endp
+
+
+
+
+
+Usegun proc near
+
+ cmp objecttype,4
+ jz istakengun
+ call showseconduse
+ call putbackobstuff
+ ret
+istakengun: cmp reallocation,22
+ jnz notinpoolroom
+ mov cx,300
+ mov al,34
+ call showpuztext
+ mov lastweapon,1
+ mov combatcount,39
+ mov getback,1
+ inc progresspoints
+ ret
+notinpoolroom: cmp reallocation,25
+ jnz nothelicopter
+ mov cx,300
+ mov al,34
+ call showpuztext
+ mov lastweapon,1
+ mov combatcount,19
+ mov getback,1
+ mov dreamnumber,2
+ mov roomafterdream,38
+ mov sartaindead,1
+ inc progresspoints
+ ret
+nothelicopter: cmp reallocation,27
+ jnz notinrockroom
+ mov cx,300
+ mov al,46
+ call showpuztext
+ mov pointermode,2 ;0
+ mov rockstardead,1
+ mov lastweapon,1
+ mov newsitem,1
+ mov getback,1
+ mov roomafterdream,32 ; skip
+ mov dreamnumber,0
+ inc progresspoints
+ ret
+notinrockroom: cmp reallocation,8
+ jnz notbystudio
+ cmp mapx,22
+ jnz notbystudio
+ cmp mapy,40
+ jnz notbystudio
+ mov al,92
+ call issetobonmap
+ jz notbystudio
+ cmp manspath,9
+ jz notbystudio
+ mov destination,9
+ mov finaldest,9
+ call autosetwalk
+ mov lastweapon,1
+ mov getback,1
+ inc progresspoints
+ ret
+notbystudio: cmp reallocation,6
+ jnz notsarters
+ cmp mapx,11
+ jnz notsarters
+ cmp mapy,20
+ jnz notsarters
+ mov al,5
+ call issetobonmap
+ jnz notsarters
+ mov destination,1
+ mov finaldest,1
+ call autosetwalk
+ mov al,5
+ call removesetobject
+ mov al,6
+ call placesetobject
+ mov al,1
+ mov ah,roomnum
+ dec ah
+ call turnanypathon
+ mov liftflag,1
+ mov watchingtime,40*2
+ mov reeltowatch,4
+ mov endwatchreel,43
+ mov watchspeed,1
+ mov speedcount,1
+ mov getback,1
+ inc progresspoints
+ ret
+notsarters: cmp reallocation,29
+ jnz notaide
+ mov getback,1
+ mov al,13
+ call resetlocation
+ mov al,12
+ call setlocation
+ mov destpos,12
+ mov destination,2
+ mov finaldest,2
+ call autosetwalk
+ mov watchingtime,164*2
+ mov reeltowatch,3
+ mov endwatchreel,164
+ mov watchspeed,1
+ mov speedcount,1
+ mov aidedead,1
+ mov dreamnumber,3
+ mov roomafterdream,33
+ inc progresspoints
+ ret
+notaide: cmp reallocation,23
+ jnz notwithboss
+ cmp mapx,0
+ jnz notwithboss
+ cmp mapy,50
+ jnz notwithboss
+ cmp manspath,5
+ jz pathokboss
+ mov destination,5
+ mov finaldest,5
+ call autosetwalk
+pathokboss: mov lastweapon,1
+ mov getback,1
+ ret
+notwithboss: cmp reallocation,8
+ jnz nottvsoldier
+ cmp mapx,11
+ jnz nottvsoldier
+ cmp mapy,10
+ jnz nottvsoldier
+ cmp manspath,2
+ jz pathoktv
+ mov destination,2
+ mov finaldest,2
+ call autosetwalk
+pathoktv: mov lastweapon,1
+ mov getback,1
+ ret
+nottvsoldier: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+Useshield proc near
+
+ cmp reallocation,20
+ jnz notinsartroom
+ cmp combatcount,0
+ jz notinsartroom
+ mov lastweapon,3
+ call showseconduse
+ mov getback,1
+ inc progresspoints
+ call removeobfrominv
+ ret
+notinsartroom: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+Usebuttona proc near
+
+ mov al,95
+ call issetobonmap
+ jz donethisbit
+
+ call showfirstuse
+ mov al,0
+ mov ah,roomnum
+ dec ah
+ call turnanypathon
+ mov al,9
+ call removesetobject
+ mov al,95
+ call placesetobject
+
+ mov watchingtime,15*2
+ mov reeltowatch,71
+ mov endwatchreel,85
+ mov watchspeed,1
+ mov speedcount,1
+
+ mov getback,1
+ inc progresspoints
+ ret
+donethisbit: call showseconduse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+Useplate proc near
+
+ cmp withobject,255
+ jnz platewith
+ call withwhat
+ ret
+platewith: mov al,withobject
+ mov ah,withtype
+ mov cl,"S"
+ mov ch,"C"
+ mov dl,"R"
+ mov dh,"W"
+ call compare
+ jz unscrewplate
+ mov al,withobject
+ mov ah,withtype
+ mov cl,"K"
+ mov ch,"N"
+ mov dl,"F"
+ mov dh,"E"
+ call compare
+ jz triedknife
+ mov cx,300
+ mov al,14
+ call showpuztext
+ call putbackobstuff
+ ret
+
+unscrewplate: mov al,20
+ call playchannel1
+ call showfirstuse
+ mov al,28
+ call placesetobject
+ mov al,24
+ call placesetobject
+ mov al,25
+ call removesetobject
+ mov al,0
+ call placefreeobject
+ inc progresspoints
+ mov getback,1
+ ret
+
+triedknife: mov cx,300
+ mov al,54
+ call showpuztext
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+Usewinch proc near
+
+ mov al,40
+ mov ah,1
+ call checkinside
+ cmp cl,numexobjects
+ jz nowinch
+ mov al,cl
+ mov ah,4
+ mov cl,"F"
+ mov ch,"U"
+ mov dl,"S"
+ mov dh,"E"
+ call compare
+ jnz nowinch
+
+ mov watchingtime,217*2
+ mov reeltowatch,0
+ mov endwatchreel,217
+ mov watchspeed,1
+ mov speedcount,1
+ mov destpos,1
+ mov newlocation,45
+ mov dreamnumber,1
+ mov roomafterdream,44
+ mov generaldead,1
+ mov newsitem,2
+ mov getback,1
+ inc progresspoints
+ ret
+
+nowinch: call showfirstuse
+ call putbackobstuff
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/vars.asm b/devtools/tasmrecover/dreamweb/vars.asm
new file mode 100644
index 0000000000..b72f180d74
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/vars.asm
@@ -0,0 +1,564 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+;---------------------------------------------------Equates and definitions----
+
+Inputport equ 63h
+Mapwidth equ 66 ;132/2
+Maplength equ 60 ;6/2
+Tablesize equ 32 ;size of each entry in spritetable
+Itempicsize equ 44 ;size of inventory slots
+Opsy equ 52
+Opsx equ 60
+Inventx equ 80
+Inventy equ 58
+Zoomx equ 8
+Zoomy equ 132
+Keypadx equ 36+112
+Keypady equ 72
+Diaryx equ 68+24
+Diaryy equ 48+12
+Symbolx equ 64
+Symboly equ 56
+Menux equ 80+40
+Menuy equ 60
+
+ if foreign
+Undertextsizex equ 228
+Undertextsizey equ 13
+Undertimedysize equ 30
+ else
+Undertextsizex equ 180
+Undertextsizey equ 10
+Undertimedysize equ 24
+ endif
+
+Numchanges equ 250
+
+Textunder equ 0 ;offsets for items in buffer segment
+Openinvlist equ textunder+(undertextsizex*undertextsizey)
+Ryaninvlist equ openinvlist+32
+Pointerback equ ryaninvlist+60
+Mapflags equ pointerback+(32*32)
+Startpal equ mapflags+(11*10*3)
+Endpal equ startpal+768
+Maingamepal equ endpal+768
+Spritetable equ maingamepal+768
+Setlist equ spritetable+(32*tablesize)
+Freelist equ setlist+(128*5)
+Exlist equ freelist+(80*5)
+Peoplelist equ exlist+(100*5)
+Zoomspace equ peoplelist+(12*5)
+Printedlist equ zoomspace+(46*40)
+Listofchanges equ printedlist+(5*80)
+Undertimedtext equ listofchanges+(numchanges*4)
+Rainlist equ undertimedtext+(256*undertimedysize)
+Initialreelrouts equ rainlist+(6*64)
+Initialvars equ initialreelrouts+lenofreelrouts
+Lengthofbuffer equ initialvars+lengthofvars
+
+Flags equ 0 ;offsets of items in backdrop segment
+Blocks equ flags+192
+Map equ 0
+Lengthofmap equ map+(mapwidth*maplength)
+
+Intextdat equ 0
+Intext equ intextdat+(38*2)
+Blocktextdat equ 0
+Blocktext equ blocktextdat+(98*2)
+Settextdat equ 0
+Settext equ settextdat+(130*2)
+Freetextdat equ 0
+Freetext equ freetextdat+(82*2)
+
+Numexobjects equ 114
+Exframeslen equ 30000
+Extextlen equ 18000
+
+Exframedata equ 0
+Exframes equ exframedata+2080
+Exdata equ exframes+exframeslen
+Extextdat equ exdata+(16*numexobjects)
+Extext equ extextdat+((numexobjects+2)*2)
+Lengthofextra equ extext+extextlen
+
+Framedata equ 0
+Frames equ framedata+2080
+
+Frframedata equ 0
+Frframes equ frframedata+2080
+
+Personframes equ 0
+Persontxtdat equ personframes+24
+Persontext equ persontxtdat+(1026*2)
+
+Pathdata equ 0
+Reellist equ pathdata+(36*144)
+
+Lenofmapstore equ 22*8*20*8
+Maplen equ mapwidth*maplength
+Freedatlen equ 16*80
+Setdatlen equ 64*128
+Textstart equ 66*2
+
+;-----------------------------------------------------------------Variables----
+
+
+startvars db 0
+progresspoints db 0
+watchon db 0
+shadeson db 0
+secondcount db 0
+minutecount db 30
+hourcount db 19
+zoomon db 1
+location db 0
+expos db 0
+exframepos dw 0
+extextpos dw 0
+card1money dw 0
+listpos dw 0
+ryanpage db 0
+
+
+watchingtime dw 0
+reeltowatch dw -1 ;reel plays from here in mode 0
+endwatchreel dw 0 ;and stops here. Mode set to 1
+speedcount db 0
+watchspeed db 0
+reeltohold dw -1 ;if mode is 1 hold on this reel
+endofholdreel dw -1 ;if mode is 2 then play to end of
+watchmode db -1 ;hold reel. Set mode back to -1
+destafterhold db 0 ;set walking destination.
+
+newsitem db 0
+
+liftflag db 0
+liftpath db 0
+lockstatus db 1
+doorpath db 0
+counttoopen db 0
+counttoclose db 0
+rockstardead db 0
+generaldead db 0
+sartaindead db 0
+aidedead db 0
+beenmugged db 0
+
+gunpassflag db 0
+canmovealtar db 0
+talkedtoattendant db 0
+talkedtosparky db 0
+talkedtoboss db 0
+talkedtorecep db 0
+cardpassflag db 0
+madmanflag db 0
+keeperflag db 0
+lasttrigger db 0
+mandead db 0
+seed db 1,2,3
+needtotravel db 0
+throughdoor db 0
+newobs db 0
+ryanon db 255
+combatcount db 0
+lastweapon db -1
+
+dreamnumber db 0
+roomafterdream db 0
+
+shakecounter db 48
+
+lengthofvars equ $-startvars
+
+
+speechcount db 0
+
+charshift dw 0
+kerning db 0
+
+brightness db 0
+
+roomloaded db 0
+
+didzoom db 0
+
+linespacing dw 10
+textaddressx dw 13
+textaddressy dw 182 ;address on screen for text
+textlen db 0
+lastxpos dw 0
+
+icontop dw 0
+iconleft dw 0
+itemframe db 0
+itemtotran db 0
+roomad dw 0
+oldsubject dw 0
+
+withobject db 0
+withtype db 0
+
+lookcounter dw 0
+
+command db 0
+commandtype db 0
+oldcommandtype db 0
+objecttype db 0
+getback db 0
+invopen db 0
+mainmode db 0
+pickup db 0
+lastinvpos db 0
+examagain db 0
+newtextline db 0
+
+openedob db 0
+openedtype db 0
+
+oldmapadx dw 0
+oldmapady dw 0
+mapadx dw 0
+mapady dw 0
+mapoffsetx dw 104
+mapoffsety dw 38
+
+mapxstart dw 0
+mapystart dw 0
+mapxsize db 0
+mapysize db 0
+
+havedoneobs db 0
+manisoffscreen db 0
+rainspace db 0
+
+facing db 0
+leavedirection db 0
+turntoface db 0
+turndirection db 0
+
+maintimer dw 0
+introcount db 0
+arrowad dw 0
+currentkey db 0
+oldkey db 0
+useddirection db 0
+currentkey2 db 0
+
+timercount db 0
+oldtimercount db 0
+
+mapx db 0
+mapy db 0
+newscreen db 0
+ryanx db 0
+ryany db 0
+lastflag db 0
+lastflagex db 0
+flagx db 0
+flagy db 0
+
+currentex db 0
+currentfree db 0
+currentframe dw 0
+framesad dw 0
+dataad dw 0
+frsegment dw 0
+objectx dw 0
+objecty dw 0
+offsetx dw 0
+offsety dw 0
+savesize dw 0
+savesource dw 0
+savex db 0
+savey db 0
+currentob db 0
+priority db 0
+
+destpos db 0
+
+reallocation db 0 ;----------;some rooms have more than one
+roomnum db 0 ;place in the Roomdata list, to
+ ;account for different start points
+nowinnewroom db 0 ;this variable holds the rooms
+resetmanxy db 0 ;real value - ie:which file it's in
+newlocation db -1 ;if set then room is loaded at end of watch mode, or straight away if not in watch mode
+autolocation db -1
+mustload db 0
+answered db 0
+saidno db 0
+
+doorcheck1 db 0
+doorcheck2 db 0
+doorcheck3 db 0
+doorcheck4 db 0
+
+mousex dw 0
+mousey dw 0
+mousebutton dw 0
+mousebutton1 dw 0
+mousebutton2 dw 0
+mousebutton3 dw 0
+mousebutton4 dw 0
+oldbutton dw 0
+oldx dw 0
+oldy dw 0
+lastbutton dw 0
+oldpointerx dw 0
+oldpointery dw 0
+delherex dw 0
+delherey dw 0
+pointerxs db 32
+pointerys db 32
+delxs db 0
+delys db 0
+pointerframe db 0
+pointerpower db 0
+auxpointerframe db 0
+pointermode db 0
+pointerspeed db 0
+pointercount db 0
+inmaparea db 0
+
+reelpointer dw 0
+slotdata db 0
+thisslot db 0
+slotflags db 0
+takeoff dw 0
+
+talkmode db 0
+talkpos db 0
+character db 0
+persondata dw 0
+talknum db 0
+numberinroom db 0
+
+currentcel db 0
+oldselection db 0
+
+stopwalking db 0
+
+mouseon db 0
+played dw 0
+timer1 db 0
+timer2 db 0
+timer3 db 0
+wholetimer dw 0
+timer1to db 0
+timer2to db 0
+timer3to db 0
+
+watchdump db 0
+
+currentset dw 0
+
+logonum db 0
+oldlogonum db 0
+newlogonum db 0
+netseg dw 0
+netpoint dw 0
+keynum db 0
+cursorstate db 0
+
+pressed db 0
+presspointer dw 0
+graphicpress db 0
+presscount db 0
+keypadax dw 0
+keypadcx dw 0
+lightcount db 0
+folderpage db 0
+diarypage db 0
+menucount db 0
+symboltopx db 0
+symboltopnum db 0
+symboltopdir db 0
+symbolbotx db 0
+symbolbotnum db 0
+symbolbotdir db 0
+
+symboltolight db 0
+symbol1 db 0
+symbol2 db 0
+symbol3 db 0
+symbolnum db 0
+dumpx dw 0
+dumpy dw 0
+
+walkandexam db 0
+walkexamtype db 0
+walkexamnum db 0
+
+cursloc dw 0
+curslocx dw 0
+curslocy dw 0
+curpos dw 0
+monadx dw 0
+monady dw 0
+gotfrom dw 0
+
+monsource dw 0
+numtodo dw 0
+
+timecount dw 0
+counttotimed dw 0
+timedseg dw 0
+timedoffset dw 0
+timedy db 0
+timedx db 0
+needtodumptimed db 0
+
+;recordpos dw 0
+;rechandle dw 0
+handle dw 0
+
+loadingorsave db 0 ;1 if load 2 if save
+currentslot db 0
+cursorpos db 0
+
+colourpos db 0
+fadedirection db 0
+numtofade db 0
+fadecount db 0
+addtogreen db 0
+addtored db 0
+addtoblue db 0
+
+
+lastsoundreel dw 0
+
+soundbuffer dw 0
+soundbufferad dw 0
+soundbufferpage db 0
+soundtimes db 0
+needsoundbuff db 0
+
+oldint9seg dw -1
+oldint9add dw -1
+oldint8seg dw -1
+oldint8add dw -1
+oldsoundintseg dw 0
+oldsoundintadd dw 0
+soundbaseadd dw 0
+dsp_status dw 0
+dsp_write dw 0
+dmaaddress db 0
+soundint db 5
+sounddmachannel db 1
+sampleplaying db 255
+testresult db 0
+currentirq db 0
+speechloaded db 0
+speechlength dw 0
+volume db 0
+volumeto db 0
+volumedirection db 0
+volumecount db 0
+
+playblock db 0
+
+wongame db 0
+
+lasthardkey db 0
+bufferin dw 0
+bufferout dw 0
+
+extras dw 0 ;for allocated memory
+workspace dw 0 ;allocated mem for screen buffer
+mapstore dw 0 ;allocated mem for copy of room
+charset1 dw 0 ;allocated mem for normal charset
+tempcharset dw 0 ;monitor char set
+icons1 dw 0 ;allocated mem for on screen stuff
+icons2 dw 0
+buffers dw 0 ;allocated mem for buffers
+mainsprites dw 0 ;allocated mem for Ryan sprites
+backdrop dw 0
+mapdata dw 0
+
+sounddata dw 0
+sounddata2 dw 0
+
+recordspace dw 0
+
+freedat dw 0
+setdat dw 0
+
+reel1 dw -1
+reel2 dw -1
+reel3 dw -1
+roomdesc dw -1
+freedesc dw -1
+setdesc dw -1
+blockdesc dw -1
+setframes dw -1
+freeframes dw -1
+people dw -1
+reels dw -1
+commandtext dw -1
+puzzletext dw -1
+traveltext dw -1
+tempgraphics dw -1
+tempgraphics2 dw -1
+tempgraphics3 dw -1
+tempsprites dw -1
+
+textfile1 dw -1
+textfile2 dw -1
+textfile3 dw -1
+
+blinkframe db 23
+blinkcount db 0
+
+
+reasseschanges db 0 ; if it's a 1 then obname will assume that
+pointerspath db 0 ;the command has changed.
+manspath db 0 ;ie. from "walk to" to "Examine"
+pointerfirstpath db 0
+finaldest db 0
+destination db 0
+linestartx dw 0
+linestarty dw 0
+lineendx dw 0
+lineendy dw 0
+increment1 dw 0
+increment2 dw 0
+lineroutine db 0
+linepointer db 0
+linedirection db 0
+linelength db 0
+
+liftsoundcount db 0
+
+emmhandle dw 0
+emmpageframe dw 0
+emmhardwarepage db 0
+
+ch0emmpage dw 0
+ch0offset dw 0
+ch0blockstocopy dw 0
+
+ch0playing db 0
+ch0repeat db 0
+ch0oldemmpage dw 0
+ch0oldoffset dw 0
+ch0oldblockstocopy dw 0
+
+ch1playing db 255
+ch1emmpage dw 0
+ch1offset dw 0
+ch1blockstocopy dw 0
+ch1blocksplayed dw 0
+
+soundbufferwrite dw 0
+
+soundemmpage dw 0
+speechemmpage dw 0
+
+currentsample db -1
+roomssample db 0
+
+gameerror db 0
+
+howmuchalloc dw 0
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/vgafades.asm b/devtools/tasmrecover/dreamweb/vgafades.asm
new file mode 100644
index 0000000000..e4a5b97c45
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/vgafades.asm
@@ -0,0 +1,867 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Fadedos proc near
+
+ call vsync
+ mov es,buffers
+ mov di,startpal
+ mov al,0
+ mov dx,3c7h
+ out dx,al
+ mov dx,3c9h
+ mov cx,768/4
+dos1: in al,dx
+ stosb
+ loop dos1
+
+ mov cx,64
+fadedosloop: push cx
+
+ mov ds,buffers
+ mov si,startpal
+ mov cx,768
+dos3: lodsb
+ cmp al,0
+ jz nodown
+ dec al
+nodown: mov [si-1],al
+ loop dos3
+
+ call vsync
+ mov ds,buffers
+ mov si,startpal
+ mov al,0
+ mov dx,3c8h
+ out dx,al
+ inc dx
+ mov cx,768/4
+dos2: lodsb
+ out dx,al
+ loop dos2
+
+ pop cx
+ loop fadedosloop
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Dofade proc near
+
+ cmp fadedirection,0
+ jz finishfade
+ mov cl,numtofade
+ mov ch,0
+ mov al,colourpos
+ mov ah,0
+ mov ds,buffers
+ mov si,startpal
+ add si,ax
+ add si,ax
+ add si,ax
+ call showgroup
+ mov al,numtofade
+ add al,colourpos
+ mov colourpos,al
+ cmp al,0
+ jnz finishfade
+ call fadecalculation
+finishfade: ret
+
+ endp
+
+
+
+
+
+
+
+Clearendpal proc near
+
+ mov es,buffers
+ mov di,endpal
+ mov cx,768
+ mov al,0
+ rep stosb
+ ret
+
+ endp
+
+
+
+
+Clearpalette proc near
+
+ mov fadedirection,0
+ call clearstartpal
+ call dumpcurrent
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Fadescreenup proc near
+
+ call clearstartpal
+ call paltoendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ ret
+
+ endp
+
+
+
+
+Fadetowhite proc near
+
+ mov es,buffers
+ mov di,endpal
+ mov cx,768
+ mov al,63
+ rep stosb
+ mov di,endpal
+ mov al,0
+ stosb
+ stosb
+ stosb
+ call paltostartpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ ret
+
+ endp
+
+
+
+Fadefromwhite proc near
+
+ mov es,buffers
+ mov di,startpal
+ mov cx,768
+ mov al,63
+ rep stosb
+ mov di,startpal
+ mov al,0
+ stosb
+ stosb
+ stosb
+ call paltoendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Fadescreenups proc near
+
+ call clearstartpal
+ call paltoendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,64
+ ret
+
+ endp
+
+
+
+Fadescreendownhalf proc near
+
+ call paltostartpal
+ call paltoendpal
+ mov cx,768
+ mov es,buffers
+ mov bx,endpal
+halfend: mov al,[es:bx]
+ shr al,1
+ mov [es:bx],al
+ inc bx
+ loop halfend
+
+ mov ds,buffers
+ mov es,buffers
+ mov si,startpal+(56*3)
+ mov di,endpal+(56*3)
+ mov cx,3*5
+ rep movsb
+ mov si,startpal+(77*3)
+ mov di,endpal+(77*3)
+ mov cx,3*2
+ rep movsb
+
+ mov fadedirection,1
+ mov fadecount,31
+ mov colourpos,0
+ mov numtofade,32
+ ret
+
+ endp
+
+
+Fadescreenuphalf proc near
+
+ call endpaltostart
+ call paltoendpal
+ mov fadedirection,1
+ mov fadecount,31
+ mov colourpos,0
+ mov numtofade,32
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Fadescreendown proc near
+
+ call paltostartpal
+ call clearendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ ret
+
+ endp
+
+
+
+Fadescreendowns proc near
+
+ call paltostartpal
+ call clearendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,64
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Clearstartpal proc near
+
+ mov es,buffers
+ mov di,startpal
+ mov cx,256
+wholeloop1: mov ax,0
+ stosw
+ mov al,0
+ stosb
+ loop wholeloop1
+ ret
+
+ endp
+
+
+
+
+
+
+Showgun proc near
+
+ mov addtored,0 ;12
+ mov addtogreen,0
+ mov addtoblue,0
+ call paltostartpal
+ call paltoendpal
+ call greyscalesum
+
+; mov es,buffers
+; mov di,endpal+3
+; mov cx,255
+; mov ax,0
+;reds: mov byte ptr [es:di],63
+; inc di
+; stosw
+; loop reds
+
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,130
+ call hangon
+ call endpaltostart
+ call clearendpal
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,200
+ call hangon
+ mov roomssample,34
+ call loadroomssample
+ mov volume,0
+ mov dx,offset cs:gungraphic
+ call loadintotemp
+ call createpanel2
+ mov ds,tempgraphics
+ mov al,0
+ mov ah,0
+ mov di,100
+ mov bx,4
+ call showframe
+ mov ds,tempgraphics
+ mov al,1
+ mov ah,0
+ mov di,158
+ mov bx,106
+ call showframe
+ call worktoscreen
+ call getridoftemp
+ call fadescreenup
+ mov cx,160
+ call hangon
+ mov al,12
+ mov ah,0
+ call playchannel0
+ mov dx,offset cs:endtextname
+ call loadtemptext
+ call rollendcredits2
+ call getridoftemptext
+ ret
+
+ endp
+
+
+
+
+
+Rollendcredits2 proc near
+
+ call rollem
+ ret
+
+ endp
+
+
+
+
+Rollem proc near
+
+ mov cl,160
+ mov ch,160
+ mov di,25
+ mov bx,20
+ mov ds,mapstore
+ mov si,0
+ call multiget
+
+ mov es,textfile1
+ mov si,49*2
+ mov ax,[es:si]
+ mov si,ax
+ add si,textstart
+
+ mov cx,80
+endcredits21: push cx
+
+ mov bx,10
+ mov cx,linespacing
+endcredits22: push cx si di es bx
+
+ call vsync
+ mov cl,160
+ mov ch,160
+ mov di,25
+ mov bx,20
+ mov ds,mapstore
+ mov si,0
+ call multiput
+ call vsync
+ pop bx es di si
+ push si di es bx
+
+ mov cx,18
+onelot2: push cx
+ mov di,25 ;75
+ mov dx,161
+ mov ax,0
+ call printdirect
+ add bx,linespacing
+ pop cx
+ loop onelot2
+
+ call vsync
+ mov cl,160
+ mov ch,160
+ mov di,25 ;75
+ mov bx,20
+ call multidump
+
+ pop bx es di si cx
+ cmp lasthardkey,1
+ jz endearly2
+ dec bx
+ loop endcredits22
+ pop cx
+looknext2: mov al,[es:si]
+ inc si
+ cmp al,":"
+ jz gotnext2
+ cmp al,0
+ jz gotnext2
+ jmp looknext2
+gotnext2: cmp lasthardkey,1
+ jz endearly
+ loop endcredits21
+
+ mov cx,120
+ call hangone
+ ret
+endearly2: pop cx
+endearly: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Fadecalculation proc near
+
+ cmp fadecount,0
+ jz nomorefading
+ mov bl,fadecount
+ mov es,buffers
+ mov si,startpal
+ mov di,endpal
+ mov cx,768
+fadecolloop: mov al,[es:si]
+ mov ah,[es:di]
+ cmp al,ah
+ jz gotthere
+ jc lesscolour
+ dec byte ptr [es:si]
+ jmp gotthere
+lesscolour: cmp bl,ah
+ jz withit
+ jnc gotthere
+withit: inc byte ptr [es:si]
+gotthere: inc si
+ inc di
+ loop fadecolloop
+ dec fadecount
+ ret
+nomorefading: mov fadedirection,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Greyscalesum proc near ;converts palette to grey scale
+ ;summed using formula:
+ mov es,buffers ; .20xred + .59xGreen + .11xBlue
+ mov si,maingamepal
+ mov di,endpal
+ mov cx,256 ;convert 256 colours
+
+greysumloop1: push cx
+ mov bx,0
+ mov al,[es:si]
+ mov ah,0
+ mov cx,20
+ mul cx
+ add bx,ax
+ mov al,[es:si+1]
+ mov ah,0
+ mov cx,59
+ mul cx
+ add bx,ax
+ mov al,[es:si+2]
+ mov ah,0
+ mov cx,11
+ mul cx
+ add bx,ax ;bx holds equationx100
+
+ mov al,-1 ;divide result by 100
+greysumloop2: inc al
+ sub bx,100
+ jnc greysumloop2 ;ah holds grey scale number
+ mov bl,al
+
+ mov al,bl
+ mov ah,addtored
+ cmp al,0
+ ;jz noaddr
+ add al,ah
+noaddr: stosb
+ mov ah,addtogreen
+ mov al,bl
+ cmp al,0
+ jz noaddg
+ add al,ah
+noaddg: stosb ;store result in red, green and
+ mov ah,addtoblue
+ mov al,bl
+ cmp al,0
+ jz noaddb
+ add al,ah
+noaddb: stosb ;blue portions of palette.
+
+ add si,3
+ pop cx
+ loop greysumloop1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showgroup proc near
+
+ mov dx,3c8h
+ out dx,al
+ mov dx,3c9h
+showgroup1: lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ loop showgroup1
+ ret
+
+ endp
+
+
+
+
+
+Paltostartpal proc near
+
+ mov es,buffers
+ mov ds,buffers
+ mov si,maingamepal
+ mov di,startpal
+ mov cx,768/2
+ rep movsw
+ ret
+
+ endp
+
+
+
+Endpaltostart proc near
+
+ mov es,buffers
+ mov ds,buffers
+ mov si,endpal
+ mov di,startpal
+ mov cx,768/2
+ rep movsw
+ ret
+
+ endp
+
+
+Startpaltoend proc near
+
+ mov es,buffers
+ mov ds,buffers
+ mov di,endpal
+ mov si,startpal
+ mov cx,768/2
+ rep movsw
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Paltoendpal proc near
+
+ mov es,buffers
+ mov ds,buffers
+ mov di,endpal
+ mov si,maingamepal
+ mov cx,768/2
+ rep movsw
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+
+Allpalette proc near
+
+ mov es,buffers
+ mov ds,buffers
+ mov di,startpal
+ mov si,maingamepal
+ mov cx,768/2
+ rep movsw
+ call dumpcurrent
+ ret
+
+ endp
+
+
+
+
+
+Dumpcurrent proc near
+
+ mov si,startpal
+ mov ds,buffers
+ call vsync
+ mov al,0
+ mov cx,128
+ call showgroup
+ call vsync
+ mov al,128
+ mov cx,128
+ call showgroup
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+Fadedownmon proc near
+
+ call paltostartpal
+ call paltoendpal
+ mov es,buffers
+ mov di,endpal+(231*3)
+ mov cx,3*8
+ mov ax,0
+ rep stosb
+ mov di,endpal+(246*3)
+ stosb
+ stosw
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,64 ;100
+ call hangon ;curs
+ ret
+
+ endp
+
+
+
+
+
+Fadeupmon proc near
+
+ call paltostartpal
+ call paltoendpal
+ mov es,buffers
+ mov di,startpal+(231*3)
+ mov cx,3*8
+ mov ax,0
+ rep stosb
+ mov di,startpal+(246*3)
+ stosb
+ stosw
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,128
+ call hangon ;curs
+ ret
+
+ endp
+
+
+
+
+
+Fadeupmonfirst proc near
+
+ call paltostartpal
+ call paltoendpal
+ mov es,buffers
+ mov di,startpal+(231*3)
+ mov cx,3*8
+ mov ax,0
+ rep stosb
+ mov di,startpal+(246*3)
+ stosb
+ stosw
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,64
+ call hangon
+ mov al,26
+ call playchannel1
+ mov cx,64
+ call hangon
+
+ ret
+
+ endp
+
+
+
+
+
+
+
+Fadeupyellows proc near
+
+ ;call startpaltoend
+ call paltoendpal
+ mov es,buffers
+ mov di,endpal+(231*3)
+ mov cx,3*8
+ mov ax,0
+ rep stosb
+ mov di,endpal+(246*3)
+ stosb
+ stosw
+ mov fadedirection,1
+ mov fadecount,63
+ mov colourpos,0
+ mov numtofade,128
+ mov cx,128
+ call hangon
+ ret
+
+ endp
+
+
+
+Initialmoncols proc near
+
+ call paltostartpal
+ mov es,buffers
+ mov di,startpal+(230*3)
+ mov cx,3*9
+ mov ax,0
+ rep stosb
+ mov di,startpal+(246*3)
+ stosb
+ stosw
+ mov ds,buffers
+ mov si,startpal+(230*3)
+ mov al,230
+ mov cx,18
+ call showgroup
+ ret
+
+ endp
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/dreamweb/vgagrafx.asm b/devtools/tasmrecover/dreamweb/vgagrafx.asm
new file mode 100644
index 0000000000..4c89412952
--- /dev/null
+++ b/devtools/tasmrecover/dreamweb/vgagrafx.asm
@@ -0,0 +1,1763 @@
+;Copyright (c) 1990-2011 by Neil Dodwell
+;Released with permission from Neil Dodwell under GPLv2
+;See LICENSE file for full license text
+Screenwidth equ 320 ;physical width of screen
+
+
+
+Allocatework proc near
+
+ mov bx,1000h
+ call allocatemem
+ mov workspace,ax
+ ret
+
+ endp
+
+
+
+
+
+Showpcx proc near
+
+ call openfile
+ mov bx,handle
+ mov ds,workspace
+ mov ah,3fh
+ mov cx,128
+ mov dx,0
+ int 21h
+
+ mov ds,workspace
+ mov si,16
+ mov cx,48
+ mov es,buffers
+ mov di,maingamepal
+pcxpal: push cx
+ call readabyte
+ shr al,1
+ shr al,1
+ stosb
+ pop cx
+ loop pcxpal
+ mov cx,768-48
+ mov ax,0ffffh
+ rep stosw
+
+ call readoneblock
+ mov si,0
+ mov di,0
+ mov cx,480
+convertpcx: push cx
+ push di
+ mov ds,workspace
+ mov es,buffers
+ mov di,pointerback
+ mov bx,0
+sameline: call readabyte
+ mov ah,al
+ and ah,11000000b
+ cmp ah,11000000b
+ jnz normal
+ mov cl,al
+ and cl,00111111b
+ mov ch,0
+ push cx
+ call readabyte
+ pop cx
+ add bx,cx
+ rep stosb
+ cmp bx,4*80
+ jnz sameline
+ jmp endline
+normal: stosb
+ inc bx
+ cmp bx,4*80
+ jnz sameline
+
+endline: pop di
+ push si
+ mov dx,0a000h
+ mov es,dx
+ mov si,pointerback
+ mov ds,buffers
+
+ mov dx,03c4h
+ mov al,2
+ mov ah,1
+ out dx,ax
+ mov cx,40
+ push di
+ rep movsw
+ pop di
+ mov ah,2
+ out dx,ax
+ mov cx,40
+ push di
+ rep movsw
+ pop di
+ mov ah,4
+ out dx,ax
+ mov cx,40
+ push di
+ rep movsw
+ pop di
+ mov ah,8
+ out dx,ax
+ mov cx,40
+ rep movsw
+
+ pop si
+ pop cx
+ loop convertpcx
+
+ mov bx,handle
+ call closefile
+ ret
+
+ endp
+
+
+
+
+Readabyte proc near
+
+ cmp si,30000
+ jnz notendblock
+ push bx es di ds si
+ call readoneblock
+ pop si ds di es bx
+ mov si,0
+notendblock: lodsb
+ ret
+
+ endp
+
+
+
+
+Readoneblock proc near
+
+ mov bx,handle
+ mov ah,3fh
+ mov ds,workspace
+ mov ah,3fh
+ mov cx,30000
+ mov dx,0
+ int 21h
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Loadpalfromiff proc near
+
+ mov dx,offset cs:palettescreen
+ call openfile
+ mov cx,2000
+ mov ds,mapstore
+ mov dx,0
+ call readfromfile
+ call closefile
+ mov es,buffers
+ mov di,maingamepal
+ mov ds,mapstore
+ mov si,30h
+ mov cx,768
+palloop: lodsb
+ shr al,1
+ shr al,1
+
+ cmp brightness,1
+ jnz nought
+ cmp al,0
+ jz nought
+ mov ah,al
+ shr ah,1
+ add al,ah
+ shr ah,1
+ add al,ah
+ cmp al,64
+ jc nought
+ mov al,63
+
+nought: stosb
+ loop palloop
+ ret
+
+ endp
+
+
+
+
+
+
+Setmode proc near
+
+ call vsync
+ mov ah,12h
+ mov al,1
+ mov bl,33h
+ int 10h
+
+ mov ah,0
+ mov al,13h
+ int 10h
+
+ mov al,6 ; sets graphic controller
+ mov dx,3ceh ; register 6 (MM) to 1 - 64K
+ out dx,al
+ inc dx
+ in al,dx
+ and al,11110011b
+ or al,00000100b
+ out dx,al
+
+ mov al,4 ; sets sequencer
+ mov dx,3c4h ; register 4 (EM) to 1 - >64K
+ out dx,al
+ inc dx
+ in al,dx
+ and al,11111101b
+ or al,00000010b
+ out dx,al
+
+ mov al,13h ;give screen 16 extra hidden
+ mov dx,3d4h ;pixels at one side
+ out dx,al
+ inc dx
+ mov al,screenwidth/8 ; width of screen
+ out dx,al
+
+ mov al,8h
+ mov dx,3d4h
+ out dx,al
+ inc dx
+ mov al,00000000b
+ out dx,al
+
+ mov al,11h
+ mov dx,3d4h
+ out dx,al
+ inc dx
+ in al,dx
+ or al,128
+ out dx,al
+
+ mov al,00
+ mov dx,3d4h
+ out dx,al
+ inc dx
+ mov al,3fh
+ out dx,al
+ mov al,01
+ mov dx,3d4h
+ out dx,al
+ inc dx
+ mov al,3fh
+ out dx,al
+ ret
+
+ endp
+
+
+
+Cls proc near
+
+ mov ax,0a000h
+ mov es,ax
+ mov di,0
+ mov cx,7fffh
+ mov ax,0
+ rep stosw
+ ret
+
+ endp
+
+
+
+Printundermon proc near ;prints workspace through the text
+
+ mov si,(screenwidth*43)+76
+ mov di,si
+ mov es,workspace
+ add si,8*screenwidth
+ mov dx,0a000h
+ mov ds,dx
+ mov cx,104
+scrollmonloop1: push cx di si
+ mov cx,170
+scrollmonloop2: lodsb
+ cmp al,231
+ jnc dontplace
+placeit: stosb
+ loop scrollmonloop2
+ jmp finmonscroll
+dontplace: inc di
+ loop scrollmonloop2
+
+finmonscroll: pop si di cx
+ add si,screenwidth
+ add di,screenwidth
+ loop scrollmonloop1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+Worktoscreen proc near
+
+ call vsync
+ mov si,0
+ mov di,0
+ mov cx,25
+ mov ds,workspace
+ mov dx,0a000h
+ mov es,dx
+
+dumpallloop: call width160
+ call width160
+ call width160
+ call width160
+ call width160
+ call width160
+ call width160
+ call width160
+ loop dumpallloop
+
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+;
+;Worktoscreen2 proc near
+;
+; call showpointer
+;
+; mov ds,workspace
+; mov dx,0a000h
+; mov es,dx
+;
+; mov si,320-16
+; mov di,320-16
+; mov bl,33
+; mov cx,16
+;screen2loop1: push di si cx
+; call vsync
+; cmp bl,21
+; jc screen2loop2
+; sub cx,16
+; jz isoneblock
+;screen2loop2: movsw
+; movsw
+; movsw
+; movsw
+; movsw
+; movsw
+; movsw
+; movsw
+; add di,320-15
+; add si,320-15
+; loop screen2loop2
+;isoneblock: mov cx,16
+; mov ax,320-15
+;oneblockloop: push cx
+; rep movsb
+; pop cx
+; add si,ax
+; add di,ax
+; inc ax
+; loop oneblockloop
+;
+; pop cx si di
+; add cx,16
+; cmp cx,200
+; jc itsallright
+; mov cx,200
+;itsallright: sub si,16
+; sub di,16
+; dec bl
+; jnz screen2loop1
+;
+; call delpointer
+; ret
+;
+; endp
+;
+;
+;
+;
+
+
+
+
+Paneltomap proc near
+
+ mov di,mapxstart
+ add di,mapadx
+ mov bx,mapystart
+ add bx,mapady
+ mov ds,mapstore
+ mov si,0
+ mov cl,mapxsize
+ mov ch,mapysize
+ call multiget
+ ret
+
+ endp
+
+
+
+Maptopanel proc near
+
+ mov di,mapxstart
+ add di,mapadx
+ mov bx,mapystart
+ add bx,mapady
+ mov ds,mapstore
+ mov si,0
+ mov cl,mapxsize
+ mov ch,mapysize
+ call multiput
+
+ ret
+
+ endp
+
+
+
+
+
+Dumpmap proc near
+
+ mov di,mapxstart
+ add di,mapadx
+ mov bx,mapystart
+ add bx,mapady
+ mov cl,mapxsize
+ mov ch,mapysize
+ call multidump
+ ret
+
+ endp
+
+
+
+
+Pixelcheckset proc near ;al=x, ah=y, es:bx=setlist pos
+ ;checks exact pixel in a frame
+ push ax
+ sub al,[es:bx] ;for detection.
+ sub ah,[es:bx+1] ;al,ah now holds offset within
+ ;the frame
+ push es bx cx ax
+ mov al,[es:bx+4] ;object number
+ call getsetad
+ mov al,[es:bx+17] ;finds frame number
+ mov es,setframes
+ mov bx,framedata
+ mov ah,0
+ mov cx,6
+ mul cx
+ add bx,ax ;get data for this frame in es:bx
+ pop ax
+
+ push ax
+ mov al,ah
+ mov ah,0
+ mov cl,[es:bx]
+ mov ch,0
+ mul cx
+ pop cx
+ mov ch,0
+ add ax,cx ;ax now holds offset from corner
+ ;of the frame
+ add ax,[es:bx+2]
+ mov bx,ax ;es:bx now holds offset of pixel!
+ add bx,frames
+
+ mov al,[es:bx]
+ mov dl,al
+ pop cx bx es ax
+ cmp dl,0
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+
+
+Createpanel proc near
+
+ mov di,0
+ mov bx,8
+ mov ds,icons2
+ mov al,0
+ mov ah,2
+ call showframe ;spritef
+ mov di,160
+ mov bx,8
+ mov ds,icons2
+ mov al,0
+ mov ah,2
+ call showframe ;spritef
+ mov di,0
+ mov bx,104
+ mov ds,icons2
+ mov al,0
+ mov ah,2
+ call showframe ;spritef
+ mov di,160
+ mov bx,104
+ mov ds,icons2
+ mov al,0
+ mov ah,2
+ call showframe ;spritef
+ ret
+
+ endp
+
+
+
+Createpanel2 proc near
+
+ call createpanel
+ mov di,0
+ mov bx,0
+ mov ds,icons2
+ mov al,5
+ mov ah,2
+ call showframe
+ mov di,160
+ mov bx,0
+ mov ds,icons2
+ mov al,5
+ mov ah,2
+ call showframe
+ ret
+
+ endp
+
+
+
+
+
+
+;Showspritef proc near
+;
+; mov ax,bx
+; mov bx,screenwidth
+; mul bx
+; add di,ax
+; mov dx,screenwidth
+; mov es,workspace
+; mov si,2080
+; mov ah,0
+; add ax,ax
+; mov bx,ax
+; add ax,ax
+; add bx,ax
+; add si,[bx+2]
+; mov cx,[bx+0]
+;spritefloop: push cx di
+; call width80
+; pop di cx
+; add di,dx
+; dec ch
+; jnz spritefloop
+; ret
+;
+; endp
+;
+;
+
+
+
+
+
+
+
+
+Clearwork proc near
+
+ mov ax,0h
+ mov es,workspace
+ mov di,0
+ mov cx,(200*320)/64
+clearloop: stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ loop clearloop
+ ret
+
+ endp
+
+
+
+
+
+
+Vsync proc near
+
+ push ax bx cx dx si di ds es
+
+ mov dx,03dah
+loop2: in al,dx
+ test al,8
+ jz loop2
+loop1: in al,dx
+ test al,8
+ jnz loop1
+
+ call doshake
+ call dofade
+ if debuglevel2
+ call debugkeys
+ endif
+ pop es ds di si dx cx bx ax
+ ret
+
+ endp
+
+
+
+Doshake proc near
+
+ cmp shakecounter,48
+ jz finishshake
+ inc shakecounter
+ mov bl,shakecounter
+ mov bh,0
+ add bx,offset cs:shaketable
+ mov al,10h
+ mov dx,3d4h
+ out dx,al
+ inc dx
+ mov al,[cs:bx]
+ out dx,al
+finishshake: ret
+
+shaketable: db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh
+ db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9ch
+
+ endp
+
+
+
+
+
+
+Zoom proc near
+
+ cmp watchingtime,0
+ jnz inwatching
+ cmp zoomon,1
+ jz zoomswitch
+inwatching: ret
+
+zoomswitch: cmp commandtype,199
+ jc zoomit
+cantzoom: call putunderzoom
+ ret
+
+zoomit: mov ax,oldpointery
+ sub ax,9
+ mov cx,screenwidth
+ mul cx
+ add ax,oldpointerx
+ sub ax,11
+ mov si,ax
+
+ mov ax,zoomy+4
+ mov cx,screenwidth
+ mul cx
+ add ax,zoomx+5
+ mov di,ax
+ mov es,workspace
+ mov ds,workspace
+
+ mov cx,20
+zoomloop: push cx
+ mov cx,23
+zoomloop2: lodsb
+ mov ah,al
+ stosw
+ mov [es:di+screenwidth-2],ax
+ loop zoomloop2
+ add si,screenwidth-23
+ add di,screenwidth-46+screenwidth
+ pop cx
+ loop zoomloop
+
+ call crosshair
+ mov didzoom,1
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Delthisone proc near
+
+ push ax
+ push ax
+ mov al,ah
+ mov ah,0
+ add ax,mapady
+ mov bx,screenwidth
+ mul bx
+ pop bx
+ mov bh,0
+ add bx,mapadx
+ add ax,bx
+ mov di,ax
+ pop ax
+ push ax
+ mov al,ah
+ mov ah,0
+ mov bx,22*8
+ mul bx
+ pop bx
+ mov bh,0
+ add ax,bx
+ mov si,ax
+
+ mov es,workspace
+ mov ds,mapstore
+ mov dl,cl
+ mov dh,0
+ mov ax,screenwidth
+ sub ax,dx
+ neg dx
+ add dx,22*8
+deloneloop: push cx
+ mov ch,0
+ rep movsb
+ pop cx
+ add di,ax
+ add si,dx
+ dec ch
+ jnz deloneloop
+ ret
+
+ endp
+
+
+
+
+
+
+
+;------------------------------------------------------------Pointer update----
+
+
+Multiget proc near ;di,bx = dest x,y
+ ;cl,ch = size
+ mov ax,bx ;si,di = storage
+ mov bx,screenwidth
+ mul bx
+ add di,ax
+
+ mov es,workspace
+ push es ds
+ pop es ds
+ xchg di,si
+ mov al,cl
+ mov ah,0
+ mov dx,screenwidth
+ sub dx,ax
+
+ mov al,cl
+ and al,1
+ jnz oddwidth2
+
+ mov bl,cl
+ mov bh,0
+ mov ax,offset cs:width0
+ shr bx,1
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+multiloop3: call ax
+ add si,dx
+ loop multiloop3
+ ret
+
+oddwidth2: mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+multiloop4: call ax
+ movsb
+ add si,dx
+ loop multiloop4
+ ret
+
+ endp
+
+
+
+
+
+
+
+Multiput proc near ;di,bx = dest x,y
+ ;cl,ch = size
+ mov ax,bx ;si,di = storage
+ mov bx,screenwidth
+ mul bx
+ add di,ax
+
+ mov es,workspace
+ mov al,cl
+ mov ah,0
+ mov dx,screenwidth
+ sub dx,ax
+
+ mov al,cl
+ and al,1
+ jnz oddwidth3
+
+ mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+multiloop5: call ax
+ add di,dx
+ loop multiloop5
+ ret
+
+oddwidth3: mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+multiloop6: call ax
+ movsb
+ add di,dx
+ loop multiloop6
+ ret
+
+
+ endp
+
+
+
+
+
+
+
+
+
+Multidump proc near ;di,bx = dest x,y
+ ;cl,ch = size
+ mov dx,0a000h
+ mov es,dx
+ mov ds,workspace
+
+ mov ax,bx
+ mov bx,screenwidth
+ mul bx
+ add di,ax
+ mov dx,screenwidth
+ mov si,di
+
+ mov al,cl
+ and al,1
+ jnz oddwidth
+
+ mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov bl,cl
+ mov bh,0
+ neg bx
+ add bx,dx
+ mov cl,ch
+ mov ch,0
+multiloop1: call ax
+ add di,bx
+ add si,bx
+ loop multiloop1
+ ret
+
+oddwidth: mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov bl,cl
+ mov bh,0
+ neg bx
+ add bx,screenwidth
+ mov cl,ch
+ mov ch,0
+multiloop2: call ax
+ movsb
+ add di,bx
+ add si,bx
+ loop multiloop2
+ ret
+
+ endp
+
+
+
+
+
+Width160 proc near
+
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+width128: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+width110: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+width88: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+width80: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+width63: movsw
+width62: movsw
+width61: movsw
+width60: movsw
+width59: movsw
+width58: movsw
+width57: movsw
+width56: movsw
+width55: movsw
+width54: movsw
+width53: movsw
+width52: movsw
+width51: movsw
+width50: movsw
+width49: movsw
+width48: movsw
+width47: movsw
+width46: movsw
+width45: movsw
+width44: movsw
+width43: movsw
+width42: movsw
+width41: movsw
+width40: movsw
+width39: movsw
+width38: movsw
+width37: movsw
+width36: movsw
+width35: movsw
+width34: movsw
+width33: movsw
+width32: movsw
+width31: movsw
+width30: movsw
+width29: movsw
+width28: movsw
+width27: movsw
+width26: movsw
+width25: movsw
+width24: movsw
+width23: movsw
+width22: movsw
+width21: movsw
+width20: movsw
+width19: movsw
+width18: movsw
+width17: movsw
+width16: movsw
+width15: movsw
+width14: movsw
+width13: movsw
+width12: movsw
+width11: movsw
+width10: movsw
+width9: movsw
+width8: movsw
+width7: movsw
+width6: movsw
+width5: movsw
+width4: movsw
+width3: movsw
+width2: movsw
+width1: movsw
+width0: ret
+
+ endp
+
+
+
+
+
+
+
+
+
+Doblocks proc near
+
+ mov es,workspace
+ mov ax,mapady
+ mov cx,screenwidth
+ mul cx
+ mov di,mapadx
+ add di,ax
+
+ mov al,mapy
+ mov ah,0
+ mov bx,mapwidth
+ mul bx
+ mov bl,mapx
+ mov bh,0
+ add ax,bx
+
+ mov si,map
+ add si,ax
+
+ mov cx,10
+loop120: push di cx
+ mov cx,11
+loop124: push cx di
+
+ mov ds,mapdata
+ lodsb
+ mov ds,backdrop
+
+ push si
+ cmp al,0
+ jz zeroblock
+ mov ah,al
+ mov al,0
+ mov si,blocks
+ add si,ax
+ mov bh,14
+
+
+ mov bh,4
+firstbitofblock: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ add di,screenwidth-16
+ dec bh
+ jnz firstbitofblock
+
+ mov bh,12
+loop125: movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ movsw
+ mov ax,0dfdfh
+ stosw
+ stosw
+
+ add di,screenwidth-20
+ dec bh
+ jnz loop125
+
+ add di,4
+ mov ax,0dfdfh
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ add di,screenwidth-16
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ add di,screenwidth-16
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ add di,screenwidth-16
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+ stosw
+
+
+zeroblock: pop si
+
+ pop di cx
+ add di,16
+ loop loop124
+ add si,mapwidth-11
+ pop cx di
+ add di,screenwidth*16
+ loop loop120
+ ret
+
+ endp
+
+
+
+
+
+
+
+;----------------------------------------------General sprite output routine----
+
+Showframe proc near ; shows a frame from sprites
+
+ push dx ax ; es=destination
+ mov cx,ax ; ds=source
+ and cx,511 ; di=x, bx=y
+ add cx,cx ; al=frame number
+ mov si,cx ; ah=effects flag
+ add cx,cx
+ add si,cx
+ cmp word ptr [si],0
+ jnz notblankshow
+ pop ax dx
+ mov cx,0
+ ret
+
+notblankshow: test ah,128
+ jnz skipoffsets
+ mov al,[si+4]
+ mov ah,0
+ add di,ax
+ mov al,[si+5]
+ mov ah,0
+ add bx,ax
+skipoffsets: mov cx,[si+0]
+ mov ax,[si+2]
+ add ax,2080
+ mov si,ax
+ pop ax dx
+ cmp ah,0
+ jz noeffects
+
+ test ah,128
+ jz notcentred
+ push ax
+ mov al,cl
+ mov ah,0
+ shr ax,1
+ sub di,ax
+ mov al,ch
+ mov ah,0
+ shr ax,1
+ sub bx,ax
+ pop ax
+
+notcentred: test ah,64
+ jz notdiffdest
+ push cx
+ call frameoutfx
+ pop cx
+ ret
+
+notdiffdest: test ah,8
+ jz notprintlist
+ push ax
+ mov ax,di
+ sub ax,mapadx
+ push bx
+ sub bx,mapady
+ mov ah,bl
+ pop bx
+ ;call addtoprintlist
+ pop ax
+
+notprintlist: test ah,4
+ jz notflippedx
+ mov dx,screenwidth
+ mov es,workspace
+ push cx
+ call frameoutfx
+ pop cx
+ ret
+
+notflippedx: test ah,2
+ jz notnomask
+ mov dx,screenwidth
+ mov es,workspace
+ push cx
+ call frameoutnm
+ pop cx
+ ret
+
+notnomask: test ah,32
+ jz noeffects
+ mov dx,screenwidth
+ mov es,workspace
+ push cx
+ call frameoutbh
+ pop cx
+ ret
+
+noeffects: mov dx,screenwidth
+ mov es,workspace
+ push cx
+ call frameoutv
+ pop cx ; returns size printed in cx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Frameoutv proc near
+
+ push dx
+ mov ax,bx
+ mov bx,dx
+ mul bx
+ add di,ax
+ pop dx
+
+ push cx
+ mov ch,0
+ sub dx,cx
+ pop cx
+
+frameloop1: push cx
+ mov ch,0
+
+frameloop2: lodsb
+ cmp al,0
+ jnz backtosolid
+backtoother: inc di
+ loop frameloop2
+ pop cx
+ add di,dx
+ dec ch
+ jnz frameloop1
+ ret
+
+frameloop3: lodsb
+ cmp al,0
+ jz backtoother
+backtosolid: stosb
+ loop frameloop3
+ pop cx
+ add di,dx
+ dec ch
+ jnz frameloop1
+ ret
+
+ endp
+
+
+
+
+
+
+Frameoutnm proc near
+
+ push dx
+ mov ax,bx
+ mov bx,dx
+ mul bx
+ add di,ax
+ pop dx
+
+ push cx
+ mov ch,0
+ sub dx,cx
+ pop cx
+
+ mov al,cl
+ and al,1
+ jnz oddwidthframe
+
+ mov bl,cl
+ mov bh,0
+ mov ax,offset cs:width0
+ shr bx,1
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+nmloop1: call ax
+ add di,dx
+ loop nmloop1
+ ret
+
+oddwidthframe: mov bl,cl
+ mov bh,0
+ shr bx,1
+ mov ax,offset cs:width0
+ sub ax,bx
+ mov cl,ch
+ mov ch,0
+nmloop2: call ax
+ movsb
+ add di,dx
+ loop nmloop2
+ ret
+
+ endp
+
+
+
+
+
+
+Frameoutbh proc near
+
+ push dx
+ mov ax,bx
+ mov bx,dx
+ mul bx
+ add di,ax
+ pop dx
+
+ push cx
+ mov ch,0
+ sub dx,cx
+ pop cx
+
+bhloop2: push cx
+ mov ch,0
+ mov ah,255
+bhloop1: cmp [es:di],ah
+ jnz nofill
+ movsb
+ loop bhloop1
+ jmp nextline
+nofill: inc di
+ inc si
+ loop bhloop1
+nextline: add di,dx
+ pop cx
+ dec ch
+ jnz bhloop2
+ ret
+
+ endp
+
+
+
+
+
+
+
+Frameoutfx proc near
+
+ push dx
+ mov ax,bx
+ mov bx,dx
+ mul bx
+ add di,ax
+ pop dx
+
+ push cx
+ mov ch,0
+ add dx,cx
+ pop cx
+
+frameloopfx1: push cx
+ mov ch,0
+
+frameloopfx2: lodsb
+ cmp al,0
+ jnz backtosolidfx
+backtootherfx: dec di
+ loop frameloopfx2
+ pop cx
+ add di,dx
+ dec ch
+ jnz frameloopfx1
+ ret
+
+frameloopfx3: lodsb
+ cmp al,0
+ jz backtootherfx
+backtosolidfx: mov [es:di],al
+ dec di
+ loop frameloopfx3
+ pop cx
+ add di,dx
+ dec ch
+ jnz frameloopfx1
+ ret
+
+ endp
+
+
+
+
+;---------------------------------------------------Transfers for extra data----
+
+Transferinv proc near
+
+ mov di,exframepos
+ push di
+ mov al,expos
+ mov ah,0
+ mov bx,ax
+ add ax,ax
+ add ax,bx
+ inc ax
+ mov cx,6
+ mul cx
+ mov es,extras
+ mov bx,exframedata
+ add bx,ax
+ add di,exframes
+
+ push bx
+ mov al,itemtotran
+ mov ah,0
+ mov bx,ax
+ add ax,ax
+ add ax,bx
+ inc ax
+ mov cx,6
+ mul cx
+ mov ds,freeframes
+ mov bx,frframedata
+ add bx,ax
+ mov si,frframes
+ mov al,[bx]
+ mov ah,0
+ mov cl,[bx+1]
+ mov ch,0
+ add si,[bx+2] ;we have si, and length
+ mov dx,[bx+4]
+ pop bx
+ mov [es:bx+0],al
+ mov [es:bx+1],cl
+ mov [es:bx+4],dx
+
+ mul cx
+ mov cx,ax
+ push cx
+ rep movsb
+ pop cx
+ pop ax
+ mov [es:bx+2],ax
+ add exframepos,cx
+ ret
+
+ endp
+
+
+
+
+
+
+
+
+
+
+Transfermap proc near
+
+ mov di,exframepos
+ push di
+ mov al,expos
+ mov ah,0
+ mov bx,ax
+ add ax,ax
+ add ax,bx
+ mov cx,6
+ mul cx
+ mov es,extras
+ mov bx,exframedata
+ add bx,ax
+ add di,exframes
+
+ push bx
+ mov al,itemtotran
+ mov ah,0
+ mov bx,ax
+ add ax,ax
+ add ax,bx
+ mov cx,6
+ mul cx
+ mov ds,freeframes
+ mov bx,frframedata
+ add bx,ax
+ mov si,frframes
+ mov al,[bx]
+ mov ah,0
+ mov cl,[bx+1]
+ mov ch,0
+ add si,[bx+2] ;we have si, and length
+ mov dx,[bx+4]
+ pop bx
+ mov [es:bx+0],al
+ mov [es:bx+1],cl
+ mov [es:bx+4],dx
+
+ mul cx
+ mov cx,ax
+ push cx
+ rep movsb
+ pop cx
+ pop ax
+ mov [es:bx+2],ax
+ add exframepos,cx
+ ret
+
+ endp
+
+
+;------------------------------------------------------------------Filenames----
+
+
+Spritename1 db "DREAMWEB.S00",0
+Spritename3 db "DREAMWEB.S02",0
+
+Idname db "INSTALL.DAT",0
+
+Characterset1 db "DREAMWEB.C00",0
+Characterset2 db "DREAMWEB.C01",0
+Characterset3 db "DREAMWEB.C02",0
+
+Samplename db "DREAMWEB.V00",0
+
+Basicsample db "DREAMWEB.V99",0
+
+Icongraphics0 db "DREAMWEB.G00",0
+Icongraphics1 db "DREAMWEB.G01",0
+Extragraphics1 db "DREAMWEB.G02",0
+Icongraphics8 db "DREAMWEB.G08",0
+Mongraphicname db "DREAMWEB.G03",0
+Mongraphics2 db "DREAMWEB.G07",0
+Cityname db "DREAMWEB.G04",0
+Travelgraphic1 db "DREAMWEB.G05",0
+Travelgraphic2 db "DREAMWEB.G06",0
+Diarygraphic db "DREAMWEB.G14",0
+
+Monitorfile1 db "DREAMWEB.T01",0
+Monitorfile2 db "DREAMWEB.T02",0
+Monitorfile10 db "DREAMWEB.T10",0 ;News items 10-13
+Monitorfile11 db "DREAMWEB.T11",0
+Monitorfile12 db "DREAMWEB.T12",0
+Monitorfile13 db "DREAMWEB.T13",0
+Monitorfile20 db "DREAMWEB.T20",0
+Monitorfile21 db "DREAMWEB.T21",0 ;Ryan's private stuff
+Monitorfile22 db "DREAMWEB.T22",0 ;Use for blank carts
+Monitorfile23 db "DREAMWEB.T23",0 ;Use for edens cart
+Monitorfile24 db "DREAMWEB.T24",0 ;Use for church cart
+Foldertext db "DREAMWEB.T50",0
+Diarytext db "DREAMWEB.T51",0
+Puzzletextname db "DREAMWEB.T80",0 ;puzzle text
+Traveltextname db "DREAMWEB.T81",0 ;location descriptions
+Introtextname db "DREAMWEB.T82",0 ;intro sequence
+Endtextname db "DREAMWEB.T83",0 ;end sequence/credits
+Commandtextname db "DREAMWEB.T84",0 ;commands
+
+Volumetabname db "DREAMWEB.VOL",0
+
+Foldergraphic1 db "DREAMWEB.G09",0
+Foldergraphic2 db "DREAMWEB.G10",0
+Foldergraphic3 db "DREAMWEB.G11",0
+Symbolgraphic db "DREAMWEB.G12",0
+Gungraphic db "DREAMWEB.G13",0
+Monkface db "DREAMWEB.G15",0
+
+Title0graphics db "DREAMWEB.I00",0
+Title1graphics db "DREAMWEB.I01",0
+Title2graphics db "DREAMWEB.I02",0
+Title3graphics db "DREAMWEB.I03",0
+Title4graphics db "DREAMWEB.I04",0
+Title5graphics db "DREAMWEB.I05",0
+Title6graphics db "DREAMWEB.I06",0
+Title7graphics db "DREAMWEB.I07",0
+
+Palettescreen db "DREAMWEB.PAL",0
+
+
+ \ No newline at end of file
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
new file mode 100755
index 0000000000..4c27cb5939
--- /dev/null
+++ b/devtools/tasmrecover/tasm-recover
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+from tasm.parser import parser
+from tasm.cpp import cpp
+
+p = parser()
+p.strip_path = 3
+context = p.parse('dreamweb/dreamweb.asm')
+p.link()
+generator = cpp(context, "dreamgen", blacklist = [
+ 'randomnumber',
+ 'quickquit',
+ 'quickquit2',
+ 'seecommandtail',
+ 'multiget',
+ 'multiput',
+ 'multidump',
+ 'frameoutnm',
+ 'cls',
+ 'printundermon',
+ 'worktoscreen',
+ ])
+generator.generate('dreamweb') #start routine
diff --git a/devtools/tasmrecover/tasm/__init__.py b/devtools/tasmrecover/tasm/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/devtools/tasmrecover/tasm/__init__.py
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
new file mode 100644
index 0000000000..888f0bf9bd
--- /dev/null
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -0,0 +1,576 @@
+import op, traceback, re, proc
+from copy import copy
+proc_module = proc
+
+class CrossJump(Exception):
+ pass
+
+def parse_bin(s):
+ b = s.group(1)
+ v = hex(int(b, 2))
+ #print "BINARY: %s -> %s" %(b, v)
+ return v
+
+class cpp:
+ def __init__(self, context, namespace, skip_first = 0, blacklist = []):
+ self.namespace = namespace
+ fname = namespace + ".cpp"
+ header = namespace + ".h"
+ self.fd = open(fname, "wt")
+ self.hd = open(header, "wt")
+ self.context = context
+ self.data_seg = context.binary_data
+ self.procs = context.proc_list
+ self.skip_first = skip_first
+ self.proc_queue = []
+ self.proc_done = []
+ self.blacklist = blacklist
+ self.failed = list(blacklist)
+ self.translated = []
+ self.proc_addr = []
+ self.forwards = []
+ self.fd.write("""#include \"%s\"
+
+namespace %s {
+
+""" %(header, namespace))
+
+ def expand_cb(self, match):
+ name = match.group(0).lower()
+ if len(name) == 2 and \
+ ((name[0] in ['a', 'b', 'c', 'd'] and name[1] in ['h', 'x', 'l']) or name in ['si', 'di', 'es', 'ds', 'cs']):
+ return "context.%s" %name
+
+ if self.indirection == -1:
+ try:
+ offset,p,p = self.context.get_offset(name)
+ print "OFFSET = %d" %offset
+ self.indirection = 0
+ return str(offset)
+ except:
+ pass
+
+ g = self.context.get_global(name)
+ if isinstance(g, op.const):
+ value = self.expand_equ(g.value)
+ print "equ: %s -> %s" %(name, value)
+ elif isinstance(g, proc.proc):
+ if self.indirection != -1:
+ raise Exception("invalid proc label usage")
+ value = str(g.offset)
+ self.indirection = 0
+ else:
+ size = g.size
+ if size == 0:
+ raise Exception("invalid var '%s' size %u" %(name, size))
+ if self.indirection == 0:
+ value = "context.data.%s(k%s)" %("byte" if size == 1 else "word", name.capitalize())
+ elif self.indirection == -1:
+ value = "%s" %g.offset
+ self.indirection = 0
+ else:
+ raise Exception("invalid indirection %d" %self.indirection)
+ return value
+
+ def get_size(self, expr):
+ #print 'get_size("%s")' %expr
+ try:
+ v = self.context.parse_int(expr)
+ return 1 if v < 256 else 2
+ except:
+ pass
+
+ if re.match(r'byte\s+ptr\s', expr) is not None:
+ return 1
+
+ if re.match(r'word\s+ptr\s', expr) is not None:
+ return 2
+
+ if len(expr) == 2 and expr[0] in ['a', 'b', 'c', 'd'] and expr[1] in ['h', 'l']:
+ return 1
+ if expr in ['ax', 'bx', 'cx', 'dx', 'si', 'di', 'sp', 'bp', 'ds', 'cs', 'es', 'fs']:
+ return 2
+
+ m = re.match(r'[a-zA-Z_]\w*', expr)
+ if m is not None:
+ name = m.group(0)
+ try:
+ g = self.context.get_global(name)
+ return g.size
+ except:
+ pass
+
+ return 0
+
+ def expand_equ_cb(self, match):
+ name = match.group(0).lower()
+ g = self.context.get_global(name)
+ if isinstance(g, op.const):
+ return g.value
+ return str(g.offset)
+
+ def expand_equ(self, expr):
+ n = 1
+ while n > 0:
+ expr, n = re.subn(r'\b[a-zA-Z_][a-zA-Z0-9_]+\b', self.expand_equ_cb, expr)
+ expr = re.sub(r'\b([0-9][a-fA-F0-9]*)h', '0x\\1', expr)
+ return "(%s)" %expr
+
+ def expand(self, expr, def_size = 0):
+ #print "EXPAND \"%s\"" %expr
+ size = self.get_size(expr) if def_size == 0 else def_size
+ indirection = 0
+ seg = None
+ reg = True
+
+ m = re.match(r'seg\s+(.*?)$', expr)
+ if m is not None:
+ return "context.data"
+
+ match_id = True
+ m = re.match(r'offset\s+(.*?)$', expr)
+ if m is not None:
+ indirection -= 1
+ expr = m.group(1).strip()
+
+ m = re.match(r'byte\s+ptr\s+(.*?)$', expr)
+ if m is not None:
+ expr = m.group(1).strip()
+
+ m = re.match(r'word\s+ptr\s+(.*?)$', expr)
+ if m is not None:
+ expr = m.group(1).strip()
+
+ m = re.match(r'\[(.*)\]$', expr)
+ if m is not None:
+ indirection += 1
+ expr = m.group(1).strip()
+
+ m = re.match(r'(\w{2,2}):(.*)$', expr)
+ if m is not None:
+ seg_prefix = m.group(1)
+ expr = m.group(2).strip()
+ print "SEGMENT %s, remains: %s" %(seg_prefix, expr)
+ else:
+ seg_prefix = "ds"
+
+ m = re.match(r'(([abcd][xhl])|si|di|bp|sp)([\+-].*)?$', expr)
+ if m is not None:
+ reg = m.group(1)
+ plus = m.group(3)
+ if plus is not None:
+ plus = self.expand(plus)
+ else:
+ plus = ""
+ match_id = False
+ #print "COMMON_REG: ", reg, plus
+ expr = "context.%s%s" %(reg, plus)
+
+ expr = re.sub(r'\b([0-9][a-fA-F0-9]*)h', '0x\\1', expr)
+ expr = re.sub(r'\b([0-1]+)b', parse_bin, expr)
+ expr = re.sub(r'"(.)"', '\'\\1\'', expr)
+ if match_id:
+ #print "BEFORE: %d" %indirection
+ self.indirection = indirection
+ expr = re.sub(r'\b[a-zA-Z_][a-zA-Z0-9_]+\b', self.expand_cb, expr)
+ indirection = self.indirection
+ #print "AFTER: %d" %indirection
+
+ if indirection == 1:
+ if size == 1:
+ expr = "context.%s.byte(%s)" %(seg_prefix, expr)
+ elif size == 2:
+ expr = "context.%s.word(%s)" %(seg_prefix, expr)
+ else:
+ expr = "@invalid size 0"
+ elif indirection == 0:
+ pass
+ elif indirection == -1:
+ expr = "&%s" %expr
+ else:
+ raise Exception("invalid indirection %d" %indirection)
+ return expr
+
+ def mangle_label(self, name):
+ name = name.lower()
+ return re.sub(r'\$', '_tmp', name)
+
+ def resolve_label(self, name):
+ name = name.lower()
+ if not name in self.proc.labels:
+ try:
+ offset, proc, pos = self.context.get_offset(name)
+ except:
+ print "no label %s, trying procedure" %name
+ proc = self.context.get_global(name)
+ pos = 0
+ if not isinstance(proc, proc_module.proc):
+ raise CrossJump("cross-procedure jump to non label and non procedure %s" %(name))
+ self.proc.labels.add(name)
+ for i in xrange(0, len(self.unbounded)):
+ u = self.unbounded[i]
+ if u[1] == proc:
+ if pos < u[2]:
+ self.unbounded[i] = (name, proc, pos)
+ return self.mangle_label(name)
+ self.unbounded.append((name, proc, pos))
+
+ return self.mangle_label(name)
+
+ def jump_to_label(self, name):
+ jump_proc = False
+ if name in self.blacklist:
+ jump_proc = True
+
+ if self.context.has_global(name) :
+ g = self.context.get_global(name)
+ if isinstance(g, proc_module.proc):
+ jump_proc = True
+
+ if jump_proc:
+ self.add_forward(name)
+ return "{ %s(context); return; }" %name
+ else:
+ return "goto %s" %self.resolve_label(name)
+
+ def _label(self, name):
+ self.body += "%s:\n" %self.mangle_label(name)
+
+ def schedule(self, name):
+ name = name.lower()
+ if name in self.proc_queue or name in self.proc_done or name in self.failed:
+ return
+ print "+scheduling function %s..." %name
+ self.proc_queue.append(name)
+
+ def add_forward(self, name):
+ if name not in self.forwards and name not in self.failed:
+ self.forwards.append(name)
+
+ def _call(self, name):
+ name = name.lower()
+ if name == 'ax':
+ self.body += "\t__dispatch_call(context, %s);\n" %self.expand('ax', 2)
+ return
+ self.body += "\t%s(context);\n" %name
+ self.add_forward(name);
+ self.schedule(name)
+
+ def _ret(self):
+ self.body += "\t{assert(stack_depth == context.stack.size()); return; }\n"
+
+ def parse2(self, dst, src):
+ dst_size, src_size = self.get_size(dst), self.get_size(src)
+ if dst_size == 0:
+ if src_size == 0:
+ raise Exception("both sizes are 0")
+ dst_size = src_size
+ if src_size == 0:
+ src_size = dst_size
+
+ dst = self.expand(dst, dst_size)
+ src = self.expand(src, src_size)
+ return dst, src
+
+ def _mov(self, dst, src):
+ self.body += "\t%s = %s;\n" %self.parse2(dst, src)
+
+ def _add(self, dst, src):
+ self.body += "\tcontext._add(%s, %s);\n" %self.parse2(dst, src)
+
+ def _sub(self, dst, src):
+ self.body += "\tcontext._sub(%s, %s);\n" %self.parse2(dst, src)
+
+ def _and(self, dst, src):
+ self.body += "\tcontext._and(%s, %s);\n" %self.parse2(dst, src)
+
+ def _or(self, dst, src):
+ self.body += "\tcontext._or(%s, %s);\n" %self.parse2(dst, src)
+
+ def _xor(self, dst, src):
+ self.body += "\tcontext._xor(%s, %s);\n" %self.parse2(dst, src)
+
+ def _neg(self, dst):
+ dst = self.expand(dst)
+ self.body += "\tcontext._neg(%s);\n" %(dst)
+
+ def _cbw(self):
+ self.body += "\tcontext.ax.cbw();\n"
+
+ def _shr(self, dst, src):
+ self.body += "\tcontext._shr(%s, %s);\n" %self.parse2(dst, src)
+
+ def _shl(self, dst, src):
+ self.body += "\tcontext._shl(%s, %s);\n" %self.parse2(dst, src)
+
+ #def _sar(self, dst, src):
+ # self.body += "\tcontext._sar(%s%s);\n" %self.parse2(dst, src)
+
+ #def _sal(self, dst, src):
+ # self.body += "\tcontext._sal(%s, %s);\n" %self.parse2(dst, src)
+
+ #def _rcl(self, dst, src):
+ # self.body += "\tcontext._rcl(%s, %s);\n" %self.parse2(dst, src)
+
+ #def _rcr(self, dst, src):
+ # self.body += "\tcontext._rcr(%s, %s);\n" %self.parse2(dst, src)
+
+ def _mul(self, src):
+ src = self.expand(src)
+ self.body += "\tcontext._mul(%s);\n" %(src)
+
+ def _div(self, src):
+ src = self.expand(src)
+ self.body += "\tcontext._div(%s);\n" %(src)
+
+ def _inc(self, dst):
+ dst = self.expand(dst)
+ self.body += "\tcontext._inc(%s);\n" %(dst)
+
+ def _dec(self, dst):
+ dst = self.expand(dst)
+ self.body += "\tcontext._dec(%s);\n" %(dst)
+
+ def _cmp(self, a, b):
+ self.body += "\tcontext._cmp(%s, %s);\n" %self.parse2(a, b)
+
+ def _test(self, a, b):
+ self.body += "\tcontext._test(%s, %s);\n" %self.parse2(a, b)
+
+ def _js(self, label):
+ self.body += "\tif (context.flags.s()) %s;\n" %(self.jump_to_label(label))
+
+ def _jns(self, label):
+ self.body += "\tif (!context.flags.s()) %s;\n" %(self.jump_to_label(label))
+
+ def _jz(self, label):
+ self.body += "\tif (context.flags.z()) %s;\n" %(self.jump_to_label(label))
+
+ def _jnz(self, label):
+ self.body += "\tif (!context.flags.z()) %s;\n" %(self.jump_to_label(label))
+
+ def _jl(self, label):
+ self.body += "\tif (context.flags.l()) %s;\n" %(self.jump_to_label(label))
+
+ def _jg(self, label):
+ self.body += "\tif (!context.flags.le()) %s;\n" %(self.jump_to_label(label))
+
+ def _jle(self, label):
+ self.body += "\tif (context.flags.le()) %s;\n" %(self.jump_to_label(label))
+
+ def _jge(self, label):
+ self.body += "\tif (!context.flags.l()) %s;\n" %(self.jump_to_label(label))
+
+ def _jc(self, label):
+ self.body += "\tif (context.flags.c()) %s;\n" %(self.jump_to_label(label))
+
+ def _jnc(self, label):
+ self.body += "\tif (!context.flags.c()) %s;\n" %(self.jump_to_label(label))
+
+ def _xchg(self, dst, src):
+ self.body += "\tcontext._xchg(%s, %s);\n" %self.parse2(dst, src)
+
+ def _jmp(self, label):
+ self.body += "\t%s;\n" %(self.jump_to_label(label))
+
+ def _loop(self, label):
+ self.body += "\tif (--context.cx) %s;\n" %self.jump_to_label(label)
+
+ def _push(self, regs):
+ p = str();
+ for r in regs:
+ r = self.expand(r)
+ p += "\tcontext.push(%s);\n" %(r)
+ self.body += p
+
+ def _pop(self, regs):
+ p = str();
+ for r in regs:
+ self.temps_count -= 1
+ i = self.temps_count
+ r = self.expand(r)
+ p += "\t%s = context.pop();\n" %r
+ self.body += p
+
+ def _rep(self):
+ self.body += "\twhile(context.cx--) ";
+
+ def _lodsb(self):
+ self.body += "\tcontext._lodsb();\n";
+
+ def _lodsw(self):
+ self.body += "\tcontext._lodsw();\n";
+
+ def _stosb(self):
+ self.body += "\tcontext._stosb();\n";
+
+ def _stosw(self):
+ self.body += "\tcontext._stosw();\n";
+
+ def _movsb(self):
+ self.body += "\tcontext._movsb();\n ";
+
+ def _movsw(self):
+ self.body += "\tcontext._movsw();\n ";
+
+ def _stc(self):
+ self.body += "\tcontext.flags._c = true;\n ";
+
+ def _clc(self):
+ self.body += "\tcontext.flags._c = false;\n ";
+
+ def __proc(self, name, def_skip = 0):
+ try:
+ skip = def_skip
+ self.temps_count = 0
+ self.temps_max = 0
+ if self.context.has_global(name):
+ self.proc = self.context.get_global(name)
+ else:
+ print "No procedure named %s, trying label" %name
+ off, src_proc, skip = self.context.get_offset(name)
+
+ self.proc = proc_module.proc(name)
+ self.proc.stmts = copy(src_proc.stmts)
+ self.proc.labels = copy(src_proc.labels)
+ #for p in xrange(skip, len(self.proc.stmts)):
+ # s = self.proc.stmts[p]
+ # if isinstance(s, op.basejmp):
+ # o, p, s = self.context.get_offset(s.label)
+ # if p == src_proc and s < skip:
+ # skip = s
+
+
+ self.proc_addr.append((name, self.proc.offset))
+ self.body = str()
+ self.body += "void %s(Context & context) {\n\tuint stack_depth = context.stack.size();\n" %name;
+ self.proc.optimize()
+ self.unbounded = []
+ self.proc.visit(self, skip)
+
+ #adding remaining labels:
+ for i in xrange(0, len(self.unbounded)):
+ u = self.unbounded[i]
+ print "UNBOUNDED: ", u
+ proc = u[1]
+ for p in xrange(u[2], len(proc.stmts)):
+ s = proc.stmts[p]
+ if isinstance(s, op.basejmp):
+ self.resolve_label(s.label)
+
+ #adding statements
+ for label, proc, offset in self.unbounded:
+ self.body += "/*continuing to unbounded code: %s from %s:%d-%d*/\n" %(label, proc.name, offset, len(proc.stmts))
+ start = len(self.proc.stmts)
+ self.proc.add_label(label)
+ for s in proc.stmts[offset:]:
+ if isinstance(s, op.label):
+ self.proc.labels.add(s.name)
+ self.proc.stmts.append(s)
+ self.proc.add("ret")
+ print "skipping %d instructions, todo: %d" %(start, len(self.proc.stmts) - start)
+ self.proc.visit(self, start)
+ self.body += "}\n";
+ self.translated.insert(0, self.body)
+ self.proc = None
+ if self.temps_count > 0:
+ raise Exception("temps count == %d at the exit of proc" %self.temps_count);
+ return True
+ except (CrossJump, op.Unsupported) as e:
+ print "%s: ERROR: %s" %(name, e)
+ self.failed.append(name)
+ except:
+ raise
+
+ def get_type(self, width):
+ return "uint%d_t" %(width * 8)
+
+ def write_stubs(self, fname, procs):
+ fd = open(fname, "wt")
+ fd.write("namespace %s {\n" %self.namespace)
+ for p in procs:
+ fd.write("void %s(Context &context) {\n\t::error(\"%s\");\n}\n\n" %(p, p))
+ fd.write("} /*namespace %s */\n" %self.namespace)
+ fd.close()
+
+
+ def generate(self, start):
+ #print self.prologue()
+ #print context
+ self.proc_queue.append(start)
+ while len(self.proc_queue):
+ name = self.proc_queue.pop()
+ if name in self.failed or name in self.proc_done:
+ continue
+ if len(self.proc_queue) == 0 and len(self.procs) > 0:
+ print "queue's empty, adding remaining procs:"
+ for p in self.procs:
+ self.schedule(p)
+ self.procs = []
+ print "continuing on %s" %name
+ self.proc_done.append(name)
+ self.__proc(name)
+ self.write_stubs("_stubs.cpp", self.failed)
+ done, failed = len(self.proc_done), len(self.failed)
+
+ for f in self.forwards:
+ if f not in self.failed:
+ self.fd.write("void %s(Context &context);\n" %f)
+
+ self.fd.write("\n")
+ self.fd.write("\n".join(self.translated))
+ self.fd.write("\n\n")
+ print "%d ok, %d failed of %d, %.02g%% translated" %(done, failed, done + failed, 100.0 * done / (done + failed))
+ print "\n".join(self.failed)
+ data_bin = self.data_seg
+ data_impl = "\n\tstatic const uint8 src[] = {\n\t\t"
+ n = 0
+ for v in data_bin:
+ data_impl += "0x%02x, " %v
+ n += 1
+ if (n & 0xf) == 0:
+ data_impl += "\n\t\t"
+ data_impl += "};\n\tcontext.ds.assign(src, src + sizeof(src));\n"
+ hid = "TASMRECOVER_%s_STUBS_H__" %self.namespace.upper()
+ self.hd.write("""#ifndef %s
+#define %s
+""" %(hid, hid))
+ self.hd.write(
+"""\n#\tinclude "runtime.h"
+
+namespace %s {
+
+ void __dispatch_call(Context &context, unsigned addr);
+ void __start(Context &context);
+
+""" %(self.namespace))
+ for f in self.failed:
+ self.hd.write("\tvoid %s(Context &context);\n" %f)
+
+ offsets_decl = "\n"
+ offsets = []
+ for k, v in self.context.get_globals().items():
+ if isinstance(v, op.var):
+ offsets.append((k.capitalize(), v.offset))
+ elif isinstance(v, op.const):
+ offsets.append((k.capitalize(), self.expand_equ(v.value))) #fixme: try to save all constants here
+
+ offsets = sorted(offsets, key=lambda t: t[1])
+ for o in offsets:
+ offsets_decl += "\tconst static uint16 k%s = %s;\n" %o
+ offsets_decl += "\n"
+ self.hd.write(offsets_decl);
+
+ self.hd.write("\n}\n\n#endif\n")
+ self.hd.close()
+
+ self.fd.write("\nvoid __start(Context &context) { %s%s(context); \n}\n" %(data_impl, start))
+
+ self.fd.write("\nvoid __dispatch_call(Context &context, unsigned addr) {\n\tswitch(addr) {\n")
+ self.proc_addr.sort(cmp = lambda x, y: x[1] - y[1])
+ for name,addr in self.proc_addr:
+ self.fd.write("\t\tcase 0x%04x: %s(context); break;\n" %(addr, name))
+ self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)context.ax);")
+ self.fd.write("\n\t}\n}\n\n} /*namespace*/\n")
+
+ self.fd.close()
diff --git a/devtools/tasmrecover/tasm/lex.py b/devtools/tasmrecover/tasm/lex.py
new file mode 100644
index 0000000000..cf7e6e19bf
--- /dev/null
+++ b/devtools/tasmrecover/tasm/lex.py
@@ -0,0 +1,52 @@
+def parse_args(text):
+ #print "parsing: [%s]" %text
+ escape = False
+ string = False
+ result = []
+ token = str()
+ value = 0;
+ for c in text:
+ #print "[%s]%s: %s: %s" %(token, c, escape, string)
+ if c == '\\':
+ escape = True
+ continue
+
+ if escape:
+ if not string:
+ raise SyntaxError("escape found in no string: %s" %text);
+
+ #print "escaping[%s]" %c
+ escape = False
+ token += c
+ continue
+
+ if string:
+ if c == '\'' or c == '"':
+ string = False
+
+ token += c
+ continue
+
+ if c == '\'' or c == '"':
+ string = True
+ token += c
+ continue
+
+ if c == ',':
+ result.append(token.strip())
+ token = str()
+ continue
+
+ if c == ';': #comment, bailing out
+ break
+
+ token += c
+ #token = token.strip()
+ if len(token):
+ result.append(token)
+ #print result
+ return result
+
+def compile(width, data):
+ print data
+ return data
diff --git a/devtools/tasmrecover/tasm/op.py b/devtools/tasmrecover/tasm/op.py
new file mode 100644
index 0000000000..33f79c3e5c
--- /dev/null
+++ b/devtools/tasmrecover/tasm/op.py
@@ -0,0 +1,406 @@
+import re
+import lex
+
+class Unsupported(Exception):
+ pass
+
+class var:
+ def __init__(self, size, offset):
+ self.size = size
+ self.offset = offset
+
+class const:
+ def __init__(self, value):
+ self.value = value
+
+class reg:
+ def __init__(self, name):
+ self.name = name
+ def size(self):
+ return 2 if self.name[1] == 'x' else 1
+ def __str__(self):
+ return "<register %s>" %self.name
+
+class unref:
+ def __init__(self, exp):
+ self.exp = exp
+ def __str__(self):
+ return "<unref %s>" %self.exp
+
+class ref:
+ def __init__(self, name):
+ self.name = name
+ def __str__(self):
+ return "<ref %s>" %self.name
+
+class glob:
+ def __init__(self, name):
+ self.name = name
+ def __str__(self):
+ return "<global %s>" %self.name
+
+class segment:
+ def __init__(self, name):
+ self.name = name
+ def __str__(self):
+ return "<segment %s>" %self.name
+
+class baseop(object):
+ def parse_arg(self, arg):
+ return arg
+
+ def split(self, text):
+ a, b = lex.parse_args(text)
+ return self.parse_arg(a), self.parse_arg(b)
+ def __str__(self):
+ return str(self.__class__)
+
+class basejmp(baseop):
+ pass
+
+class _call(baseop):
+ def __init__(self, arg):
+ self.name = arg
+ def visit(self, visitor):
+ visitor._call(self.name)
+ def __str__(self):
+ return "call(%s)" %self.name
+
+class _rep(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._rep()
+
+class _mov(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._mov(self.dst, self.src)
+ def __str__(self):
+ return "mov(%s, %s)" %(self.dst, self.src)
+
+class _mov2(baseop):
+ def __init__(self, dst, src):
+ self.dst, self.src = dst, src
+ def visit(self, visitor):
+ visitor._mov(self.dst, self.src)
+
+class _shr(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._shr(self.dst, self.src)
+
+class _shl(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._shl(self.dst, self.src)
+
+class _ror(baseop):
+ def __init__(self, arg):
+ pass
+
+class _rol(baseop):
+ def __init__(self, arg):
+ pass
+
+class _sar(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._sar(self.dst, self.src)
+
+class _sal(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._sal(self.dst, self.src)
+
+class _rcl(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._rcl(self.dst, self.src)
+
+class _rcr(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._rcr(self.dst, self.src)
+
+class _neg(baseop):
+ def __init__(self, arg):
+ self.arg = arg
+ def visit(self, visitor):
+ visitor._neg(self.arg)
+
+class _dec(baseop):
+ def __init__(self, arg):
+ self.dst = arg
+ def visit(self, visitor):
+ visitor._dec(self.dst)
+
+class _inc(baseop):
+ def __init__(self, arg):
+ self.dst = arg
+ def visit(self, visitor):
+ visitor._inc(self.dst)
+
+class _add(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._add(self.dst, self.src)
+
+class _sub(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._sub(self.dst, self.src)
+
+class _mul(baseop):
+ def __init__(self, arg):
+ self.arg = self.parse_arg(arg)
+ def visit(self, visitor):
+ visitor._mul(self.arg)
+
+class _div(baseop):
+ def __init__(self, arg):
+ self.arg = self.parse_arg(arg)
+ def visit(self, visitor):
+ visitor._div(self.arg)
+
+class _and(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._and(self.dst, self.src)
+
+class _xor(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._xor(self.dst, self.src)
+
+class _or(baseop):
+ def __init__(self, arg):
+ self.dst, self.src = self.split(arg)
+ def visit(self, visitor):
+ visitor._or(self.dst, self.src)
+
+class _cmp(baseop):
+ def __init__(self, arg):
+ self.a, self.b = self.split(arg)
+ def visit(self, visitor):
+ visitor._cmp(self.a, self.b)
+
+class _test(baseop):
+ def __init__(self, arg):
+ self.a, self.b = self.split(arg)
+ def visit(self, visitor):
+ visitor._test(self.a, self.b)
+
+class _xchg(baseop):
+ def __init__(self, arg):
+ self.a, self.b = self.split(arg)
+ def visit(self, visitor):
+ visitor._xchg(self.a, self.b)
+
+class _jnz(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jnz(self.label)
+
+class _jz(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jz(self.label)
+
+class _jc(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jc(self.label)
+
+class _jnc(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jnc(self.label)
+
+class _js(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._js(self.label)
+
+class _jns(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jns(self.label)
+
+class _jl(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jl(self.label)
+
+class _jg(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jg(self.label)
+
+class _jle(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jle(self.label)
+
+class _jge(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jge(self.label)
+
+class _jmp(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._jmp(self.label)
+
+class _loop(basejmp):
+ def __init__(self, label):
+ self.label = label
+ def visit(self, visitor):
+ visitor._loop(self.label)
+
+class _push(baseop):
+ def __init__(self, arg):
+ self.regs = []
+ for r in arg.split():
+ self.regs.append(self.parse_arg(r))
+ def visit(self, visitor):
+ visitor._push(self.regs)
+
+class _pop(baseop):
+ def __init__(self, arg):
+ self.regs = []
+ for r in arg.split():
+ self.regs.append(self.parse_arg(r))
+ def visit(self, visitor):
+ visitor._pop(self.regs)
+
+class _ret(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._ret()
+
+class _lodsb(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._lodsb()
+
+class _lodsw(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._lodsw()
+
+class _stosw(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._stosw()
+
+class _stosb(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._stosb()
+
+class _movsw(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._movsw()
+
+class _movsb(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._movsb()
+
+class _in(baseop):
+ def __init__(self, arg):
+ self.arg = arg
+ def visit(self, visitor):
+ raise Unsupported("input from port: %s" %self.arg)
+
+class _out(baseop):
+ def __init__(self, arg):
+ self.arg = arg
+ def visit(self, visitor):
+ raise Unsupported("out to port: %s" %self.arg)
+
+class _cli(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ raise Unsupported("cli")
+
+class _sti(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ raise Unsupported("sli")
+
+class _int(baseop):
+ def __init__(self, arg):
+ self.arg = arg
+ def visit(self, visitor):
+ raise Unsupported("interrupt: %s" %self.arg)
+
+class _iret(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ raise Unsupported("interrupt return")
+
+class _cbw(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._cbw()
+
+class _nop(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ pass
+
+class _stc(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._stc()
+
+class _clc(baseop):
+ def __init__(self, arg):
+ pass
+ def visit(self, visitor):
+ visitor._clc()
+
+class label(baseop):
+ def __init__(self, name):
+ self.name = name
+ def visit(self, visitor):
+ visitor._label(self.name)
+
diff --git a/devtools/tasmrecover/tasm/parser.py b/devtools/tasmrecover/tasm/parser.py
new file mode 100644
index 0000000000..0583d851b4
--- /dev/null
+++ b/devtools/tasmrecover/tasm/parser.py
@@ -0,0 +1,259 @@
+import os, re
+from proc import proc
+import lex
+import op
+
+class parser:
+ def __init__(self):
+ self.strip_path = 0
+ self.__globals = {}
+ self.__offsets = {}
+ self.__stack = []
+ self.proc = None
+ self.proc_list = []
+ self.binary_data = []
+
+ self.symbols = []
+ self.link_later = []
+
+ def visible(self):
+ for i in self.__stack:
+ if not i or i == 0:
+ return False
+ return True
+
+ def push_if(self, text):
+ value = self.eval(text)
+ #print "if %s -> %s" %(text, value)
+ self.__stack.append(value)
+
+ def push_else(self):
+ #print "else"
+ self.__stack[-1] = not self.__stack[-1]
+
+ def pop_if(self):
+ #print "endif"
+ return self.__stack.pop()
+
+ def set_global(self, name, value):
+ if len(name) == 0:
+ raise Exception("empty name is not allowed")
+ name = name.lower()
+ #print "adding global %s -> %s" %(name, value)
+ if self.__globals.has_key(name):
+ raise Exception("global %s was already defined", name)
+ self.__globals[name] = value
+
+ def get_global(self, name):
+ name = name.lower()
+ return self.__globals[name]
+
+ def get_globals(self):
+ return self.__globals
+
+ def has_global(self, name):
+ name = name.lower()
+ return self.__globals.has_key(name)
+
+ def set_offset(self, name, value):
+ if len(name) == 0:
+ raise Exception("empty name is not allowed")
+ name = name.lower()
+ #print "adding global %s -> %s" %(name, value)
+ if self.__offsets.has_key(name):
+ raise Exception("global %s was already defined", name)
+ self.__offsets[name] = value
+
+ def get_offset(self, name):
+ name = name.lower()
+ return self.__offsets[name]
+
+ def include(self, basedir, fname):
+ path = fname.split('\\')[self.strip_path:]
+ path = os.path.join(basedir, os.path.pathsep.join(path))
+ #print "including %s" %(path)
+
+ self.parse(path)
+
+ def eval(self, stmt):
+ try:
+ return self.parse_int(stmt)
+ except:
+ pass
+ value = self.__globals[stmt.lower()].value
+ return int(value)
+
+ def expr_callback(self, match):
+ name = match.group(1).lower()
+ g = self.get_global(name)
+ if isinstance(g, op.const):
+ return g.value
+ else:
+ return "0x%04x" %g.offset
+
+ def eval_expr(self, expr):
+ n = 1
+ while n > 0:
+ expr, n = re.subn(r'\b([a-zA-Z_]+[a-zA-Z0-9_]*)', self.expr_callback, expr)
+ return eval(expr)
+
+ def expand_globals(self, text):
+ return text
+
+ def fix_dollar(self, v):
+ print("$ = %d" %len(self.binary_data))
+ return re.sub(r'\$', "%d" %len(self.binary_data), v)
+
+ def parse_int(self, v):
+ if re.match(r'[01]+b$', v):
+ v = int(v[:-1], 2)
+ if re.match(r'[\+-]?[0-9a-f]+h$', v):
+ v = int(v[:-1], 16)
+ return int(v)
+
+ def compact_data(self, width, data):
+ #print "COMPACTING %d %s" %(width, data)
+ r = []
+ base = 0x100 if width == 1 else 0x10000
+ for v in data:
+ if v[0] == '"':
+ if v[-1] != '"':
+ raise Exception("invalid string %s" %v)
+ if width == 2:
+ raise Exception("string with data width more than 1") #we could allow it :)
+ for i in xrange(1, len(v) - 1):
+ r.append(ord(v[i]))
+ continue
+
+ m = re.match(r'(\w+)\s+dup\s+\((\s*\S+\s*)\)', v)
+ if m is not None:
+ #we should parse that
+ n = self.parse_int(m.group(1))
+ if m.group(2) != '?':
+ value = self.parse_int(m.group(2))
+ else:
+ value = 0
+ for i in xrange(0, n):
+ v = value
+ for b in xrange(0, width):
+ r.append(v & 0xff);
+ v >>= 8
+ continue
+
+ try:
+ v = self.parse_int(v)
+ if v < 0:
+ v += base
+ except:
+ #global name
+ print "global/expr: %s" %v
+ try:
+ g = self.get_global(v)
+ v = g.offset
+ except:
+ print "unknown address %s" %(v)
+ self.link_later.append((len(self.binary_data) + len(r), v))
+ v = 0
+
+ for b in xrange(0, width):
+ r.append(v & 0xff);
+ v >>= 8
+ #print r
+ return r
+
+ def parse(self, fname):
+# print "opening file %s..." %(fname, basedir)
+ fd = open(fname, 'rb')
+ for line in fd:
+ line = line.strip()
+ if len(line) == 0 or line[0] == ';' or line[0] == chr(0x1a):
+ continue
+
+ #print line
+ m = re.match('(\w+)\s*?:', line)
+ if m is not None:
+ line = line[len(m.group(0)):].strip()
+ if self.visible():
+ name = m.group(1)
+ if self.proc is not None:
+ self.proc.add_label(name)
+ print "offset %s -> %d" %(name, len(self.binary_data))
+ self.set_offset(name, (len(self.binary_data), self.proc, len(self.proc.stmts) if self.proc is not None else 0))
+ #print line
+
+ cmd = line.split()
+ if len(cmd) == 0:
+ continue
+
+ cmd0 = str(cmd[0])
+ if cmd0 == 'if':
+ self.push_if(cmd[1])
+ continue
+ elif cmd0 == 'else':
+ self.push_else()
+ continue
+ elif cmd0 == 'endif':
+ self.pop_if()
+ continue
+
+ if not self.visible():
+ continue
+
+ if cmd0 == 'db' or cmd0 == 'dw' or cmd0 == 'dd':
+ arg = line[len(cmd0):].strip()
+ print "%d:1: %s" %(len(self.binary_data), arg) #fixme: COPYPASTE
+ binary_width = {'b': 1, 'w': 2, 'd': 4}[cmd0[1]]
+ self.binary_data += self.compact_data(binary_width, lex.parse_args(arg))
+ continue
+ elif cmd0 == 'include':
+ self.include(os.path.dirname(fname), cmd[1])
+ continue
+ elif cmd0 == 'endp':
+ self.proc = None
+ continue
+ elif cmd0 == 'assume':
+ print "skipping: %s" %line
+ continue
+ elif cmd0 == 'rep':
+ self.proc.add(cmd0)
+ self.proc.add(" ".join(cmd[1:]))
+ continue
+
+ if len(cmd) >= 3:
+ cmd1 = cmd[1]
+ if cmd1 == 'equ':
+ v = cmd[2]
+ self.set_global(cmd0, op.const(self.fix_dollar(v)))
+ elif cmd1 == 'db' or cmd1 == 'dw' or cmd1 == 'dd':
+ binary_width = {'b': 1, 'w': 2, 'd': 4}[cmd1[1]]
+ offset = len(self.binary_data)
+ arg = line[len(cmd0):].strip()
+ arg = arg[len(cmd1):].strip()
+ print "%d: %s" %(offset, arg)
+ self.binary_data += self.compact_data(binary_width, lex.parse_args(arg))
+ self.set_global(cmd0.lower(), op.var(binary_width, offset))
+ continue
+ elif cmd1 == 'proc':
+ name = cmd0.lower()
+ self.proc = proc(name)
+ print "procedure %s, #%d" %(name, len(self.proc_list))
+ self.proc_list.append(name)
+ self.set_global(name, self.proc)
+ continue
+ if (self.proc):
+ self.proc.add(line)
+ else:
+ #print line
+ pass
+
+ fd.close()
+ return self
+
+ def link(self):
+ for addr, expr in self.link_later:
+ v = self.eval_expr(expr)
+ print "link: patching %04x -> %04x" %(addr, v)
+ while v != 0:
+ self.binary_data[addr] = v & 0xff
+ addr += 1
+ v >>= 8
diff --git a/devtools/tasmrecover/tasm/proc.py b/devtools/tasmrecover/tasm/proc.py
new file mode 100644
index 0000000000..4337d4c936
--- /dev/null
+++ b/devtools/tasmrecover/tasm/proc.py
@@ -0,0 +1,84 @@
+import re
+import op
+
+class proc:
+ last_addr = 0xc000
+
+ def __init__(self, name):
+ self.name = name
+ self.calls = []
+ self.stmts = []
+ self.labels = set()
+ self.__label_re = re.compile(r'^(\S+):(.*)$')
+ self.offset = proc.last_addr
+ proc.last_addr += 4
+
+ def add_label(self, label):
+ self.stmts.append(op.label(label))
+ self.labels.add(label)
+
+ def optimize(self):
+ print "optimizing..."
+ #trivial simplifications, removing last ret
+ while len(self.stmts) and isinstance(self.stmts[-1], op.label):
+ print "stripping last label"
+ self.stmts.pop()
+ #if isinstance(self.stmts[-1], op._ret) and (len(self.stmts) < 2 or not isinstance(self.stmts[-2], op.label)):
+ # print "stripping last ret"
+ # self.stmts.pop()
+ #merging push ax pop bx constructs
+ i = 0
+ while i + 1 < len(self.stmts):
+ a, b = self.stmts[i], self.stmts[i + 1]
+ if isinstance(a, op._push) and isinstance(b, op._pop):
+ ar, br = a.regs, b.regs
+ movs = []
+ while len(ar) and len(br):
+ src = ar.pop()
+ dst = br.pop(0)
+ movs.append(op._mov2(dst, src))
+ if len(br) == 0:
+ self.stmts.pop(i + 1)
+ print "merging %d push-pops into movs" %(len(movs))
+ for m in movs:
+ print "\t%s <- %s" %(m.dst, m.src)
+ self.stmts[i + 1:i + 1] = movs
+ if len(ar) == 0:
+ self.stmts.pop(i)
+ else:
+ i += 1
+ #fixme: add local?
+
+ def add(self, stmt):
+ #print stmt
+ comment = stmt.rfind(';')
+ if comment >= 0:
+ stmt = stmt[:comment]
+ stmt = stmt.strip()
+
+ r = self.__label_re.search(stmt)
+ if r is not None:
+ #label
+ self.add_label(r.group(1).lower())
+ #print "remains: %s" %r.group(2)
+ stmt = r.group(2).strip()
+
+ if len(stmt) == 0:
+ return
+
+ s = stmt.split(None)
+ cmd = s[0]
+ cl = getattr(op, '_' + cmd)
+ arg = " ".join(s[1:]) if len(s) > 1 else str()
+ o = cl(arg)
+ self.stmts.append(o)
+
+ def __str__(self):
+ r = []
+ for i in self.stmts:
+ r.append(i.__str__())
+ return "\n".join(r)
+
+ def visit(self, visitor, skip = 0):
+ for i in xrange(skip, len(self.stmts)):
+ self.stmts[i].visit(visitor)
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 &reg) : _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
+
diff --git a/engines/engines.mk b/engines/engines.mk
index f8ff823c13..dc09fbd54e 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -46,6 +46,11 @@ DEFINES += -DENABLE_DRASCULA=$(ENABLE_DRASCULA)
MODULES += engines/drascula
endif
+ifdef ENABLE_DREAMWEB
+DEFINES += -DENABLE_DREAMWEB=$(ENABLE_DREAMWEB)
+MODULES += engines/dreamweb
+endif
+
ifdef ENABLE_GOB
DEFINES += -DENABLE_GOB=$(ENABLE_GOB)
MODULES += engines/gob