[Scummvm-cvs-logs] scummvm master -> 6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a
whoozle
whoozle at yandex.ru
Thu Jun 16 22:33:31 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6fe3e63ed1 DREAMWEB: replaced generated code with c++ style stubs
Commit: 6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a
https://github.com/scummvm/scummvm/commit/6fe3e63ed1dc190c9ef6cf21b0d1890b5ebea03a
Author: Vladimir Menshakov (whoozle at yandex.ru)
Date: 2011-06-16T13:31:36-07:00
Commit Message:
DREAMWEB: replaced generated code with c++ style stubs
Changed paths:
devtools/tasmrecover/tasm/cpp.py
devtools/tasmrecover/tasm/proc.py
engines/dreamweb/dreamgen.cpp
engines/dreamweb/dreamgen.h
engines/dreamweb/dreamweb.cpp
engines/dreamweb/dreamweb.h
engines/dreamweb/runtime.h
engines/dreamweb/stubs.cpp
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index da21efe..3247721 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -36,20 +36,19 @@ class cpp:
self.failed = list(blacklist)
self.translated = []
self.proc_addr = []
- self.forwards = []
+ self.methods = []
self.fd.write("""%s
#include \"%s\"
namespace %s {
-
""" %(banner, 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
+ return "%s" %name
if self.indirection == -1:
try:
@@ -74,7 +73,7 @@ namespace %s {
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())
+ value = "data.%s(k%s)" %("byte" if size == 1 else "word", name.capitalize())
elif self.indirection == -1:
value = "%s" %g.offset
self.indirection = 0
@@ -135,7 +134,7 @@ namespace %s {
m = re.match(r'seg\s+(.*?)$', expr)
if m is not None:
- return "context.data"
+ return "data"
match_id = True
m = re.match(r'offset\s+(.*?)$', expr)
@@ -174,7 +173,7 @@ namespace %s {
plus = ""
match_id = False
#print "COMMON_REG: ", reg, plus
- expr = "context.%s%s" %(reg, plus)
+ expr = "%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)
@@ -188,9 +187,9 @@ namespace %s {
if indirection == 1:
if size == 1:
- expr = "context.%s.byte(%s)" %(seg_prefix, expr)
+ expr = "%s.byte(%s)" %(seg_prefix, expr)
elif size == 2:
- expr = "context.%s.word(%s)" %(seg_prefix, expr)
+ expr = "%s.word(%s)" %(seg_prefix, expr)
else:
expr = "@invalid size 0"
elif indirection == 0:
@@ -238,12 +237,11 @@ namespace %s {
jump_proc = True
if jump_proc:
- self.add_forward(name)
- return "{ %s(context); return; }" %name
+ return "{ %s(); return; }" %name
else:
# TODO: name or self.resolve_label(name) or self.mangle_label(name)??
if name in self.proc.retlabels:
- return "return /* (%s) */" % (name,)
+ return "return /* (%s) */" % (name)
return "goto %s" %self.resolve_label(name)
def _label(self, name):
@@ -256,17 +254,12 @@ namespace %s {
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)
+ self.body += "\t__dispatch_call(%s);\n" %self.expand('ax', 2)
return
- self.body += "\t%s(context);\n" %name
- self.add_forward(name);
+ self.body += "\t%s();\n" %name
self.schedule(name)
def _ret(self):
@@ -289,111 +282,111 @@ namespace %s {
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)
+ self.body += "\t_add(%s, %s);\n" %self.parse2(dst, src)
def _sub(self, dst, src):
- self.body += "\tcontext._sub(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_sub(%s, %s);\n" %self.parse2(dst, src)
def _and(self, dst, src):
- self.body += "\tcontext._and(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_and(%s, %s);\n" %self.parse2(dst, src)
def _or(self, dst, src):
- self.body += "\tcontext._or(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_or(%s, %s);\n" %self.parse2(dst, src)
def _xor(self, dst, src):
- self.body += "\tcontext._xor(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_xor(%s, %s);\n" %self.parse2(dst, src)
def _neg(self, dst):
dst = self.expand(dst)
- self.body += "\tcontext._neg(%s);\n" %(dst)
+ self.body += "\t_neg(%s);\n" %(dst)
def _cbw(self):
- self.body += "\tcontext.ax.cbw();\n"
+ self.body += "\tax.cbw();\n"
def _shr(self, dst, src):
- self.body += "\tcontext._shr(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_shr(%s, %s);\n" %self.parse2(dst, src)
def _shl(self, dst, src):
- self.body += "\tcontext._shl(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_shl(%s, %s);\n" %self.parse2(dst, src)
#def _sar(self, dst, src):
- # self.body += "\tcontext._sar(%s%s);\n" %self.parse2(dst, src)
+ # self.body += "\t_sar(%s%s);\n" %self.parse2(dst, src)
#def _sal(self, dst, src):
- # self.body += "\tcontext._sal(%s, %s);\n" %self.parse2(dst, src)
+ # self.body += "\t_sal(%s, %s);\n" %self.parse2(dst, src)
#def _rcl(self, dst, src):
- # self.body += "\tcontext._rcl(%s, %s);\n" %self.parse2(dst, src)
+ # self.body += "\t_rcl(%s, %s);\n" %self.parse2(dst, src)
#def _rcr(self, dst, src):
- # self.body += "\tcontext._rcr(%s, %s);\n" %self.parse2(dst, src)
+ # self.body += "\t_rcr(%s, %s);\n" %self.parse2(dst, src)
def _mul(self, src):
src = self.expand(src)
- self.body += "\tcontext._mul(%s);\n" %(src)
+ self.body += "\t_mul(%s);\n" %(src)
def _div(self, src):
src = self.expand(src)
- self.body += "\tcontext._div(%s);\n" %(src)
+ self.body += "\t_div(%s);\n" %(src)
def _inc(self, dst):
dst = self.expand(dst)
- self.body += "\tcontext._inc(%s);\n" %(dst)
+ self.body += "\t_inc(%s);\n" %(dst)
def _dec(self, dst):
dst = self.expand(dst)
- self.body += "\tcontext._dec(%s);\n" %(dst)
+ self.body += "\t_dec(%s);\n" %(dst)
def _cmp(self, a, b):
- self.body += "\tcontext._cmp(%s, %s);\n" %self.parse2(a, b)
+ self.body += "\t_cmp(%s, %s);\n" %self.parse2(a, b)
def _test(self, a, b):
- self.body += "\tcontext._test(%s, %s);\n" %self.parse2(a, b)
+ self.body += "\t_test(%s, %s);\n" %self.parse2(a, b)
def _js(self, label):
- self.body += "\tif (context.flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jns(self, label):
- self.body += "\tif (!context.flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (!flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jz(self, label):
- self.body += "\tif (context.flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jnz(self, label):
- self.body += "\tif (!context.flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (!flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jl(self, label):
- self.body += "\tif (context.flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jg(self, label):
- self.body += "\tif (!context.flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (!flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jle(self, label):
- self.body += "\tif (context.flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jge(self, label):
- self.body += "\tif (!context.flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (!flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jc(self, label):
- self.body += "\tif (context.flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
def _jnc(self, label):
- self.body += "\tif (!context.flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
+ self.body += "\tif (!flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
def _xchg(self, dst, src):
- self.body += "\tcontext._xchg(%s, %s);\n" %self.parse2(dst, src)
+ self.body += "\t_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)\n\t\t%s;\n" %self.jump_to_label(label)
+ self.body += "\tif (--cx)\n\t\t%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)
+ p += "\tpush(%s);\n" %(r)
self.body += p
def _pop(self, regs):
@@ -402,35 +395,35 @@ namespace %s {
self.temps_count -= 1
i = self.temps_count
r = self.expand(r)
- p += "\t%s = context.pop();\n" %r
+ p += "\t%s = pop();\n" %r
self.body += p
def _rep(self):
- self.body += "\twhile(context.cx--)\n\t"
+ self.body += "\twhile(cx--)\n\t"
def _lodsb(self):
- self.body += "\tcontext._lodsb();\n"
+ self.body += "\t_lodsb();\n"
def _lodsw(self):
- self.body += "\tcontext._lodsw();\n"
+ self.body += "\t_lodsw();\n"
def _stosb(self, n):
- self.body += "\tcontext._stosb(%s);\n" %("" if n == 1 else n)
+ self.body += "\t_stosb(%s);\n" %("" if n == 1 else n)
def _stosw(self, n):
- self.body += "\tcontext._stosw(%s);\n" %("" if n == 1 else n)
+ self.body += "\t_stosw(%s);\n" %("" if n == 1 else n)
def _movsb(self, n):
- self.body += "\tcontext._movsb(%s);\n" %("" if n == 1 else n)
+ self.body += "\t_movsb(%s);\n" %("" if n == 1 else n)
def _movsw(self, n):
- self.body += "\tcontext._movsw(%s);\n" %("" if n == 1 else n)
+ self.body += "\t_movsw(%s);\n" %("" if n == 1 else n)
def _stc(self):
- self.body += "\tcontext.flags._c = true;\n "
+ self.body += "\tflags._c = true;\n "
def _clc(self):
- self.body += "\tcontext.flags._c = false;\n "
+ self.body += "\tflags._c = false;\n "
def __proc(self, name, def_skip = 0):
try:
@@ -457,7 +450,7 @@ namespace %s {
self.proc_addr.append((name, self.proc.offset))
self.body = str()
- self.body += "void %s(Context &context) {\n\tSTACK_CHECK(context);\n" %name;
+ self.body += "void %sContext::%s() {\n\tSTACK_CHECK;\n" %(self.namespace, name);
self.proc.optimize()
self.unbounded = []
self.proc.visit(self, skip)
@@ -505,7 +498,7 @@ namespace %s {
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("void %sContext::%s() {\n\t::error(\"%s\");\n}\n\n" %(self.namespace, p, p))
fd.write("} /*namespace %s */\n" %self.namespace)
fd.close()
@@ -526,13 +519,11 @@ namespace %s {
print "continuing on %s" %name
self.proc_done.append(name)
self.__proc(name)
+ self.methods.append(name)
self.write_stubs("_stubs.cpp", self.failed)
+ self.methods += 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")
@@ -546,20 +537,19 @@ namespace %s {
n += 1
if (n & 0xf) == 0:
data_impl += "\n\t\t"
- data_impl += "};\n\tcontext.ds.assign(src, src + sizeof(src));\n"
+ data_impl += "};\n\tds.assign(src, src + sizeof(src));\n"
self.hd.write(
"""\n#include "dreamweb/runtime.h"
namespace %s {
- void __dispatch_call(Context &context, unsigned addr);
- void __start(Context &context);
+class %sContext : public Context {
+public:
+ void __start();
+ void __dispatch_call(uint16 addr);
-""" %(self.namespace))
- for f in self.failed:
- self.hd.write("\tvoid %s(Context &context);\n" %f)
-
- offsets_decl = "\n"
+"""
+%(self.namespace, self.namespace))
offsets = []
for k, v in self.context.get_globals().items():
if isinstance(v, op.var):
@@ -569,20 +559,21 @@ namespace %s {
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("\tconst static uint16 k%s = %s;\n" %o)
+ self.hd.write("\n")
+ for p in set(self.methods):
+ self.hd.write("\tvoid %s();\n" %p)
- self.hd.write("\n}\n\n#endif\n")
+ 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 %sContext::__start() { %s%s(); \n}\n" %(self.namespace, data_impl, start))
- self.fd.write("\nvoid __dispatch_call(Context &context, unsigned addr) {\n\tswitch(addr) {\n")
+ self.fd.write("\nvoid %sContext::__dispatch_call(uint16 addr) {\n\tswitch(addr) {\n" %self.namespace)
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("\t\tcase 0x%04x: %s(); break;\n" %(addr, name))
+ self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)ax);")
self.fd.write("\n\t}\n}\n\n} /*namespace*/\n")
self.fd.close()
diff --git a/devtools/tasmrecover/tasm/proc.py b/devtools/tasmrecover/tasm/proc.py
index 6db3b7a..c304438 100644
--- a/devtools/tasmrecover/tasm/proc.py
+++ b/devtools/tasmrecover/tasm/proc.py
@@ -61,7 +61,7 @@ class proc:
if i + 1 >= len(stmts):
break
if isinstance(stmts[i + 1], cls):
- stmts[i + 1].repeat = 'context.cx'
+ stmts[i + 1].repeat = 'cx'
del stmts[i]
i += 1
return
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 7ad10a2..135daa5 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4,21880 +4,21407 @@
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) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._dec(context.ax);
- context._cmp(context.ax, 0);
- if (!context.flags.z())
+void DreamGenContext::alleybarksound() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _dec(ax);
+ _cmp(ax, 0);
+ if (!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;
+ push(bx);
+ push(es);
+ al = 14;
+ playchannel1();
+ es = pop();
+ bx = pop();
+ ax = 1000;
nobark:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
}
-void intromusic(Context &context) {
- STACK_CHECK(context);
+void DreamGenContext::intromusic() {
+ STACK_CHECK;
}
-void foghornsound(Context &context) {
- STACK_CHECK(context);
- randomnumber(context);
- context._cmp(context.al, 198);
- if (!context.flags.z())
+void DreamGenContext::foghornsound() {
+ STACK_CHECK;
+ randomnumber();
+ _cmp(al, 198);
+ if (!flags.z())
return /* (nofog) */;
- context.al = 13;
- playchannel1(context);
+ al = 13;
+ playchannel1();
}
-void receptionist(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::receptionist() {
+ STACK_CHECK;
+ checkspeed();
+ if (!flags.z())
goto gotrecep;
- context._cmp(context.data.byte(kCardpassflag), 1);
- if (!context.flags.z())
+ _cmp(data.byte(kCardpassflag), 1);
+ if (!flags.z())
goto notsetcard;
- context._inc(context.data.byte(kCardpassflag));
- context.es.byte(context.bx+7) = 1;
- context.es.word(context.bx+3) = 64;
+ _inc(data.byte(kCardpassflag));
+ es.byte(bx+7) = 1;
+ es.word(bx+3) = 64;
notsetcard:
- context._cmp(context.es.word(context.bx+3), 58);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 58);
+ if (!flags.z())
goto notdes1;
- randomnumber(context);
- context._cmp(context.al, 30);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 30);
+ if (flags.c())
goto notdes2;
- context.es.word(context.bx+3) = 55;
+ es.word(bx+3) = 55;
goto gotrecep;
notdes1:
- context._cmp(context.es.word(context.bx+3), 60);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 60);
+ if (!flags.z())
goto notdes2;
- randomnumber(context);
- context._cmp(context.al, 240);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 240);
+ if (flags.c())
goto gotrecep;
- context.es.word(context.bx+3) = 53;
+ es.word(bx+3) = 53;
goto gotrecep;
notdes2:
- context._cmp(context.es.word(context.bx+3), 88);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 88);
+ if (!flags.z())
goto notendcard;
- context.es.word(context.bx+3) = 53;
+ es.word(bx+3) = 53;
goto gotrecep;
notendcard:
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
gotrecep:
- showgamereel(context);
- addtopeoplelist(context);
- context.al = context.es.byte(context.bx+7);
- context._and(context.al, 128);
- if (context.flags.z())
+ showgamereel();
+ addtopeoplelist();
+ al = es.byte(bx+7);
+ _and(al, 128);
+ if (flags.z())
return /* (nottalkedrecep) */;
- context.data.byte(kTalkedtorecep) = 1;
+ data.byte(kTalkedtorecep) = 1;
}
-void smokebloke(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kRockstardead), 0);
- if (!context.flags.z())
+void DreamGenContext::smokebloke() {
+ STACK_CHECK;
+ _cmp(data.byte(kRockstardead), 0);
+ if (!flags.z())
goto notspokento;
- context.al = context.es.byte(context.bx+7);
- context._and(context.al, 128);
- if (context.flags.z())
+ al = es.byte(bx+7);
+ _and(al, 128);
+ if (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();
+ push(es);
+ push(bx);
+ al = 5;
+ setlocation();
+ bx = pop();
+ es = pop();
notspokento:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto gotsmokeb;
- context._cmp(context.es.word(context.bx+3), 100);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 100);
+ if (!flags.z())
goto notsmokeb1;
- randomnumber(context);
- context._cmp(context.al, 30);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 30);
+ if (flags.c())
goto notsmokeb2;
- context.es.word(context.bx+3) = 96;
+ es.word(bx+3) = 96;
goto gotsmokeb;
notsmokeb1:
- context._cmp(context.es.word(context.bx+3), 117);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 117);
+ if (!flags.z())
goto notsmokeb2;
- context.es.word(context.bx+3) = 96;
+ es.word(bx+3) = 96;
goto gotsmokeb;
notsmokeb2:
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
gotsmokeb:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void attendant(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
- context.al = context.es.byte(context.bx+7);
- context._and(context.al, 128);
- if (context.flags.z())
+void DreamGenContext::attendant() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
+ al = es.byte(bx+7);
+ _and(al, 128);
+ if (flags.z())
return /* (nottalked) */;
- context.data.byte(kTalkedtoattendant) = 1;
+ data.byte(kTalkedtoattendant) = 1;
}
-void manasleep(Context &context) {
- STACK_CHECK(context);
- 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);
+void DreamGenContext::manasleep() {
+ STACK_CHECK;
+ al = es.byte(bx+7);
+ _and(al, 127);
+ es.byte(bx+7) = al;
+ showgamereel();
+ addtopeoplelist();
}
-void eden(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kGeneraldead), 0);
- if (!context.flags.z())
+void DreamGenContext::eden() {
+ STACK_CHECK;
+ _cmp(data.byte(kGeneraldead), 0);
+ if (!flags.z())
return /* (notinbed) */;
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void edeninbath(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kGeneraldead), 0);
- if (context.flags.z())
+void DreamGenContext::edeninbath() {
+ STACK_CHECK;
+ _cmp(data.byte(kGeneraldead), 0);
+ if (flags.z())
return /* (notinbath) */;
- context._cmp(context.data.byte(kSartaindead), 0);
- if (!context.flags.z())
+ _cmp(data.byte(kSartaindead), 0);
+ if (!flags.z())
return /* (notinbath) */;
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void malefan(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::malefan() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void femalefan(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::femalefan() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void louis(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kRockstardead), 0);
- if (!context.flags.z())
+void DreamGenContext::louis() {
+ STACK_CHECK;
+ _cmp(data.byte(kRockstardead), 0);
+ if (!flags.z())
return /* (notlouis1) */;
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void louischair(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kRockstardead), 0);
- if (context.flags.z())
+void DreamGenContext::louischair() {
+ STACK_CHECK;
+ _cmp(data.byte(kRockstardead), 0);
+ if (flags.z())
return /* (notlouis2) */;
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 191);
+ if (flags.z())
goto restartlouis;
- context._cmp(context.ax, 185);
- if (context.flags.z())
+ _cmp(ax, 185);
+ if (flags.z())
goto randomlouis;
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
goto notlouisanim;
randomlouis:
- context.es.word(context.bx+3) = context.ax;
- randomnumber(context);
- context._cmp(context.al, 245);
- if (!context.flags.c())
+ es.word(bx+3) = ax;
+ randomnumber();
+ _cmp(al, 245);
+ if (!flags.c())
goto notlouisanim;
restartlouis:
- context.ax = 182;
- context.es.word(context.bx+3) = context.ax;
+ ax = 182;
+ es.word(bx+3) = ax;
notlouisanim:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void manasleep2(Context &context) {
- STACK_CHECK(context);
- 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);
+void DreamGenContext::manasleep2() {
+ STACK_CHECK;
+ al = es.byte(bx+7);
+ _and(al, 127);
+ es.byte(bx+7) = al;
+ showgamereel();
+ addtopeoplelist();
}
-void mansatstill(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::mansatstill() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void tattooman(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::tattooman() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void drinker(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::drinker() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ _inc(es.word(bx+3));
+ _cmp(es.word(bx+3), 115);
+ if (!flags.z())
goto notdrinker1;
- context.es.word(context.bx+3) = 105;
+ es.word(bx+3) = 105;
goto gotdrinker;
notdrinker1:
- context._cmp(context.es.word(context.bx+3), 106);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 106);
+ if (!flags.z())
goto gotdrinker;
- randomnumber(context);
- context._cmp(context.al, 3);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 3);
+ if (flags.c())
goto gotdrinker;
- context.es.word(context.bx+3) = 105;
+ es.word(bx+3) = 105;
gotdrinker:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void bartender(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::bartender() {
+ STACK_CHECK;
+ checkspeed();
+ if (!flags.z())
goto gotsmoket;
- context._cmp(context.es.word(context.bx+3), 86);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 86);
+ if (!flags.z())
goto notsmoket1;
- randomnumber(context);
- context._cmp(context.al, 18);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 18);
+ if (flags.c())
goto notsmoket2;
- context.es.word(context.bx+3) = 81;
+ es.word(bx+3) = 81;
goto gotsmoket;
notsmoket1:
- context._cmp(context.es.word(context.bx+3), 103);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 103);
+ if (!flags.z())
goto notsmoket2;
- context.es.word(context.bx+3) = 81;
+ es.word(bx+3) = 81;
goto gotsmoket;
notsmoket2:
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
gotsmoket:
- showgamereel(context);
- context._cmp(context.data.byte(kGunpassflag), 1);
- if (!context.flags.z())
+ showgamereel();
+ _cmp(data.byte(kGunpassflag), 1);
+ if (!flags.z())
goto notgotgun;
- context.es.byte(context.bx+7) = 9;
+ es.byte(bx+7) = 9;
notgotgun:
- addtopeoplelist(context);
+ addtopeoplelist();
}
-void othersmoker(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::othersmoker() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void barwoman(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
+void DreamGenContext::barwoman() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
}
-void interviewer(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.word(kReeltowatch), 68);
- if (!context.flags.z())
+void DreamGenContext::interviewer() {
+ STACK_CHECK;
+ _cmp(data.word(kReeltowatch), 68);
+ if (!flags.z())
goto notgeneralstart;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
notgeneralstart:
- context._cmp(context.es.word(context.bx+3), 250);
- if (context.flags.z())
+ _cmp(es.word(bx+3), 250);
+ if (flags.z())
goto talking;
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto talking;
- context._cmp(context.es.word(context.bx+3), 259);
- if (context.flags.z())
+ _cmp(es.word(bx+3), 259);
+ if (flags.z())
goto talking;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
talking:
- showgamereel(context);
+ showgamereel();
}
-void soldier1(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.es.word(context.bx+3), 0);
- if (context.flags.z())
+void DreamGenContext::soldier1() {
+ STACK_CHECK;
+ _cmp(es.word(bx+3), 0);
+ if (flags.z())
goto soldierwait;
- context.data.word(kWatchingtime) = 10;
- context._cmp(context.es.word(context.bx+3), 30);
- if (!context.flags.z())
+ data.word(kWatchingtime) = 10;
+ _cmp(es.word(bx+3), 30);
+ if (!flags.z())
goto notaftersshot;
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 40);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 40);
+ if (!flags.z())
goto gotsoldframe;
- context.data.byte(kMandead) = 2;
+ data.byte(kMandead) = 2;
goto gotsoldframe;
notaftersshot:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto gotsoldframe;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
goto gotsoldframe;
soldierwait:
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto gotsoldframe;
- context.data.word(kWatchingtime) = 10;
- context._cmp(context.data.byte(kManspath), 2);
- if (!context.flags.z())
+ data.word(kWatchingtime) = 10;
+ _cmp(data.byte(kManspath), 2);
+ if (!flags.z())
goto gotsoldframe;
- context._cmp(context.data.byte(kFacing), 4);
- if (!context.flags.z())
+ _cmp(data.byte(kFacing), 4);
+ if (!flags.z())
goto gotsoldframe;
- context._inc(context.es.word(context.bx+3));
- context.data.byte(kLastweapon) = -1;
- context.data.byte(kCombatcount) = 0;
+ _inc(es.word(bx+3));
+ data.byte(kLastweapon) = -1;
+ data.byte(kCombatcount) = 0;
gotsoldframe:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void rockstar(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 303);
- if (context.flags.z())
+void DreamGenContext::rockstar() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _cmp(ax, 303);
+ if (flags.z())
goto rockcombatend;
- context._cmp(context.ax, 118);
- if (context.flags.z())
+ _cmp(ax, 118);
+ if (flags.z())
goto rockcombatend;
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 118);
+ if (!flags.z())
goto notbeforedead;
- context.data.byte(kMandead) = 2;
+ data.byte(kMandead) = 2;
goto gotrockframe;
notbeforedead:
- context._cmp(context.ax, 79);
- if (!context.flags.z())
+ _cmp(ax, 79);
+ if (!flags.z())
goto gotrockframe;
- context._dec(context.ax);
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _dec(ax);
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto notgunonrock;
- context.data.byte(kLastweapon) = -1;
- context.ax = 123;
+ data.byte(kLastweapon) = -1;
+ ax = 123;
goto gotrockframe;
notgunonrock:
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 40);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 40);
+ if (!flags.z())
goto gotrockframe;
- context.data.byte(kCombatcount) = 0;
- context.ax = 79;
+ data.byte(kCombatcount) = 0;
+ ax = 79;
gotrockframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
rockspeed:
- showgamereel(context);
- context._cmp(context.es.word(context.bx+3), 78);
- if (!context.flags.z())
+ showgamereel();
+ _cmp(es.word(bx+3), 78);
+ if (!flags.z())
goto notalkrock;
- addtopeoplelist(context);
- context.data.byte(kPointermode) = 2;
- context.data.word(kWatchingtime) = 0;
+ addtopeoplelist();
+ data.byte(kPointermode) = 2;
+ data.word(kWatchingtime) = 0;
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;
+ data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ al = data.byte(kMapy);
+ es.byte(bx+2) = al;
return;
rockcombatend:
- context.data.byte(kNewlocation) = 45;
- showgamereel(context);
+ data.byte(kNewlocation) = 45;
+ showgamereel();
}
-void helicopter(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 203);
- if (context.flags.z())
+void DreamGenContext::helicopter() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _cmp(ax, 203);
+ if (flags.z())
goto heliwon;
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 53);
+ if (!flags.z())
goto notbeforehdead;
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 8);
- if (context.flags.c())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 8);
+ if (flags.c())
goto waitabit;
- context.data.byte(kMandead) = 2;
+ data.byte(kMandead) = 2;
waitabit:
- context.ax = 49;
+ ax = 49;
goto gotheliframe;
notbeforehdead:
- context._cmp(context.ax, 9);
- if (!context.flags.z())
+ _cmp(ax, 9);
+ if (!flags.z())
goto gotheliframe;
- context._dec(context.ax);
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _dec(ax);
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto notgunonheli;
- context.data.byte(kLastweapon) = -1;
- context.ax = 55;
+ data.byte(kLastweapon) = -1;
+ 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())
+ ax = 5;
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 20);
+ if (!flags.z())
goto gotheliframe;
- context.data.byte(kCombatcount) = 0;
- context.ax = 9;
+ data.byte(kCombatcount) = 0;
+ ax = 9;
gotheliframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
helispeed:
- showgamereel(context);
- context.al = context.data.byte(kMapx);
- context.es.byte(context.bx+1) = context.al;
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 9);
- if (!context.flags.c())
+ showgamereel();
+ al = data.byte(kMapx);
+ es.byte(bx+1) = al;
+ ax = es.word(bx+3);
+ _cmp(ax, 9);
+ if (!flags.c())
goto notwaitingheli;
- context._cmp(context.data.byte(kCombatcount), 7);
- if (context.flags.c())
+ _cmp(data.byte(kCombatcount), 7);
+ if (flags.c())
goto notwaitingheli;
- context.data.byte(kPointermode) = 2;
- context.data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 2;
+ data.word(kWatchingtime) = 0;
return;
notwaitingheli:
- context.data.byte(kPointermode) = 0;
- context.data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
return;
heliwon:
- context.data.byte(kPointermode) = 0;
+ data.byte(kPointermode) = 0;
}
-void mugger(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 138);
- if (context.flags.z())
+void DreamGenContext::mugger() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _cmp(ax, 138);
+ if (flags.z())
goto endmugger1;
- context._cmp(context.ax, 176);
- if (context.flags.z())
+ _cmp(ax, 176);
+ if (flags.z())
return /* (endmugger2) */;
- context._cmp(context.ax, 2);
- if (!context.flags.z())
+ _cmp(ax, 2);
+ if (!flags.z())
goto havesetwatch;
- context.data.word(kWatchingtime) = 175*2;
+ data.word(kWatchingtime) = 175*2;
havesetwatch:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto notmugger;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
notmugger:
- showgamereel(context);
- context.al = context.data.byte(kMapx);
- context.es.byte(context.bx+1) = context.al;
+ showgamereel();
+ al = data.byte(kMapx);
+ es.byte(bx+1) = al;
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();
-}
-
-void aide(Context &context) {
- STACK_CHECK(context);
- showgamereel(context);
- addtopeoplelist(context);
-}
-
-void businessman(Context &context) {
- STACK_CHECK(context);
- 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())
+ push(es);
+ push(bx);
+ createpanel2();
+ showicon();
+ al = 41;
+ findpuztext();
+ di = 33+20;
+ bx = 104;
+ dl = 241;
+ ah = 0;
+ printdirect();
+ worktoscreen();
+ cx = 300;
+ hangon();
+ bx = pop();
+ es = pop();
+ push(es);
+ push(bx);
+ es.word(bx+3) = 140;
+ data.byte(kManspath) = 2;
+ data.byte(kFinaldest) = 2;
+ findxyfrompath();
+ data.byte(kResetmanxy) = 1;
+ al = 'W';
+ ah = 'E';
+ cl = 'T';
+ ch = 'A';
+ findexobject();
+ data.byte(kCommand) = al;
+ data.byte(kObjecttype) = 4;
+ removeobfrominv();
+ al = 'W';
+ ah = 'E';
+ cl = 'T';
+ ch = 'B';
+ findexobject();
+ data.byte(kCommand) = al;
+ data.byte(kObjecttype) = 4;
+ removeobfrominv();
+ makemainscreen();
+ al = 48;
+ bl = 68-32;
+ bh = 54+64;
+ cx = 70;
+ dx = 10;
+ setuptimeduse();
+ data.byte(kBeenmugged) = 1;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::aide() {
+ STACK_CHECK;
+ showgamereel();
+ addtopeoplelist();
+}
+
+void DreamGenContext::businessman() {
+ STACK_CHECK;
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
+ ax = es.word(bx+3);
+ _cmp(ax, 2);
+ if (!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();
+ push(ax);
+ push(bx);
+ push(es);
+ al = 49;
+ cx = 30;
+ dx = 1;
+ bl = 68;
+ bh = 174;
+ setuptimeduse();
+ es = pop();
+ bx = pop();
+ ax = pop();
notfirstbiz:
- context._cmp(context.ax, 95);
- if (context.flags.z())
+ _cmp(ax, 95);
+ if (flags.z())
goto buscombatwonend;
- context._cmp(context.ax, 49);
- if (context.flags.z())
+ _cmp(ax, 49);
+ if (flags.z())
return /* (buscombatend) */;
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 48);
+ if (!flags.z())
goto notbeforedeadb;
- context.data.byte(kMandead) = 2;
+ data.byte(kMandead) = 2;
goto gotbusframe;
notbeforedeadb:
- context._cmp(context.ax, 15);
- if (!context.flags.z())
+ _cmp(ax, 15);
+ if (!flags.z())
goto buscombatwon;
- context._dec(context.ax);
- context._cmp(context.data.byte(kLastweapon), 3);
- if (!context.flags.z())
+ _dec(ax);
+ _cmp(data.byte(kLastweapon), 3);
+ if (!flags.z())
goto notshieldonbus;
- context.data.byte(kLastweapon) = -1;
- context.data.byte(kCombatcount) = 0;
- context.ax = 51;
+ data.byte(kLastweapon) = -1;
+ data.byte(kCombatcount) = 0;
+ ax = 51;
goto gotbusframe;
notshieldonbus:
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 20);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 20);
+ if (!flags.z())
goto gotbusframe;
- context.data.byte(kCombatcount) = 0;
- context.ax = 15;
+ data.byte(kCombatcount) = 0;
+ ax = 15;
goto gotbusframe;
buscombatwon:
- context._cmp(context.ax, 91);
- if (!context.flags.z())
+ _cmp(ax, 91);
+ if (!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;
+ push(bx);
+ push(es);
+ al = 0;
+ turnpathon();
+ al = 1;
+ turnpathon();
+ al = 2;
+ turnpathon();
+ al = 3;
+ turnpathoff();
+ data.byte(kManspath) = 5;
+ data.byte(kFinaldest) = 5;
+ findxyfrompath();
+ data.byte(kResetmanxy) = 1;
+ es = pop();
+ bx = pop();
+ ax = 92;
goto gotbusframe;
gotbusframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = 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())
+ showgamereel();
+ al = data.byte(kMapy);
+ es.byte(bx+2) = al;
+ ax = es.word(bx+3);
+ _cmp(ax, 14);
+ if (!flags.z())
return /* (buscombatend) */;
- context.data.word(kWatchingtime) = 0;
- context.data.byte(kPointermode) = 2;
+ data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 2;
return;
buscombatwonend:
- context.data.byte(kPointermode) = 0;
- context.data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 0;
}
-void poolguard(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 214);
- if (context.flags.z())
+void DreamGenContext::poolguard() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _cmp(ax, 214);
+ if (flags.z())
goto combatover2;
- context._cmp(context.ax, 258);
- if (context.flags.z())
+ _cmp(ax, 258);
+ if (flags.z())
goto combatover2;
- context._cmp(context.ax, 185);
- if (context.flags.z())
+ _cmp(ax, 185);
+ if (flags.z())
goto combatover1;
- context._cmp(context.ax, 0);
- if (!context.flags.z())
+ _cmp(ax, 0);
+ if (!flags.z())
goto notfirstpool;
- context.al = 0;
- turnpathon(context);
+ al = 0;
+ turnpathon();
notfirstpool:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 122);
+ if (!flags.z())
goto notendguard1;
- context._dec(context.ax);
- context._cmp(context.data.byte(kLastweapon), 2);
- if (!context.flags.z())
+ _dec(ax);
+ _cmp(data.byte(kLastweapon), 2);
+ if (!flags.z())
goto notaxeonpool;
- context.data.byte(kLastweapon) = -1;
- context.ax = 122;
+ data.byte(kLastweapon) = -1;
+ ax = 122;
goto gotguardframe;
notaxeonpool:
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 40);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 40);
+ if (!flags.z())
goto gotguardframe;
- context.data.byte(kCombatcount) = 0;
- context.ax = 195;
+ data.byte(kCombatcount) = 0;
+ ax = 195;
goto gotguardframe;
notendguard1:
- context._cmp(context.ax, 147);
- if (!context.flags.z())
+ _cmp(ax, 147);
+ if (!flags.z())
goto gotguardframe;
- context._dec(context.ax);
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _dec(ax);
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto notgunonpool;
- context.data.byte(kLastweapon) = -1;
- context.ax = 147;
+ data.byte(kLastweapon) = -1;
+ ax = 147;
goto gotguardframe;
notgunonpool:
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 40);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 40);
+ if (!flags.z())
goto gotguardframe;
- context.data.byte(kCombatcount) = 0;
- context.ax = 220;
+ data.byte(kCombatcount) = 0;
+ ax = 220;
gotguardframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
guardspeed:
- showgamereel(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 121);
- if (context.flags.z())
+ showgamereel();
+ ax = es.word(bx+3);
+ _cmp(ax, 121);
+ if (flags.z())
goto iswaitingpool;
- context._cmp(context.ax, 146);
- if (context.flags.z())
+ _cmp(ax, 146);
+ if (flags.z())
goto iswaitingpool;
- context.data.byte(kPointermode) = 0;
- context.data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
return;
iswaitingpool:
- context.data.byte(kPointermode) = 2;
- context.data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 2;
+ data.word(kWatchingtime) = 0;
return;
combatover1:
- context.data.word(kWatchingtime) = 0;
- context.data.byte(kPointermode) = 0;
- context.al = 0;
- turnpathon(context);
- context.al = 1;
- turnpathoff(context);
+ data.word(kWatchingtime) = 0;
+ data.byte(kPointermode) = 0;
+ al = 0;
+ turnpathon();
+ al = 1;
+ turnpathoff();
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())
+ showgamereel();
+ data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 100);
+ if (flags.c())
return /* (doneover2) */;
- context.data.word(kWatchingtime) = 0;
- context.data.byte(kMandead) = 2;
+ data.word(kWatchingtime) = 0;
+ data.byte(kMandead) = 2;
}
-void security(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.es.word(context.bx+3), 32);
- if (context.flags.z())
+void DreamGenContext::security() {
+ STACK_CHECK;
+ _cmp(es.word(bx+3), 32);
+ if (flags.z())
goto securwait;
- context._cmp(context.es.word(context.bx+3), 69);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 69);
+ if (!flags.z())
goto notaftersec;
return;
notaftersec:
- context.data.word(kWatchingtime) = 10;
- checkspeed(context);
- if (!context.flags.z())
+ data.word(kWatchingtime) = 10;
+ checkspeed();
+ if (!flags.z())
goto gotsecurframe;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
goto gotsecurframe;
securwait:
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto gotsecurframe;
- context.data.word(kWatchingtime) = 10;
- context._cmp(context.data.byte(kManspath), 9);
- if (!context.flags.z())
+ data.word(kWatchingtime) = 10;
+ _cmp(data.byte(kManspath), 9);
+ if (!flags.z())
goto gotsecurframe;
- context._cmp(context.data.byte(kFacing), 0);
- if (!context.flags.z())
+ _cmp(data.byte(kFacing), 0);
+ if (!flags.z())
goto gotsecurframe;
- context.data.byte(kLastweapon) = -1;
- context._inc(context.es.word(context.bx+3));
+ data.byte(kLastweapon) = -1;
+ _inc(es.word(bx+3));
gotsecurframe:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void heavy(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::heavy() {
+ STACK_CHECK;
+ al = es.byte(bx+7);
+ _and(al, 127);
+ es.byte(bx+7) = al;
+ _cmp(es.word(bx+3), 43);
+ if (flags.z())
goto heavywait;
- context.data.word(kWatchingtime) = 10;
- context._cmp(context.es.word(context.bx+3), 70);
- if (!context.flags.z())
+ data.word(kWatchingtime) = 10;
+ _cmp(es.word(bx+3), 70);
+ if (!flags.z())
goto notafterhshot;
- context._inc(context.data.byte(kCombatcount));
- context._cmp(context.data.byte(kCombatcount), 80);
- if (!context.flags.z())
+ _inc(data.byte(kCombatcount));
+ _cmp(data.byte(kCombatcount), 80);
+ if (!flags.z())
goto gotheavyframe;
- context.data.byte(kMandead) = 2;
+ data.byte(kMandead) = 2;
goto gotheavyframe;
notafterhshot:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto gotheavyframe;
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
goto gotheavyframe;
heavywait:
- context._cmp(context.data.byte(kLastweapon), 1);
- if (!context.flags.z())
+ _cmp(data.byte(kLastweapon), 1);
+ if (!flags.z())
goto gotheavyframe;
- context._cmp(context.data.byte(kManspath), 5);
- if (!context.flags.z())
+ _cmp(data.byte(kManspath), 5);
+ if (!flags.z())
goto gotheavyframe;
- context._cmp(context.data.byte(kFacing), 4);
- if (!context.flags.z())
+ _cmp(data.byte(kFacing), 4);
+ if (!flags.z())
goto gotheavyframe;
- context.data.byte(kLastweapon) = -1;
- context._inc(context.es.word(context.bx+3));
- context.data.byte(kCombatcount) = 0;
+ data.byte(kLastweapon) = -1;
+ _inc(es.word(bx+3));
+ data.byte(kCombatcount) = 0;
gotheavyframe:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void bossman(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::bossman() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 4);
+ if (flags.z())
goto firstdes;
- context._cmp(context.ax, 20);
- if (context.flags.z())
+ _cmp(ax, 20);
+ if (flags.z())
goto secdes;
- context._cmp(context.ax, 41);
- if (!context.flags.z())
+ _cmp(ax, 41);
+ if (!flags.z())
goto gotallboss;
- context.ax = 0;
- context._inc(context.data.byte(kGunpassflag));
- context.es.byte(context.bx+7) = 10;
+ ax = 0;
+ _inc(data.byte(kGunpassflag));
+ es.byte(bx+7) = 10;
goto gotallboss;
firstdes:
- context._cmp(context.data.byte(kGunpassflag), 1);
- if (context.flags.z())
+ _cmp(data.byte(kGunpassflag), 1);
+ if (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())
+ push(ax);
+ randomnumber();
+ cl = al;
+ ax = pop();
+ _cmp(cl, 10);
+ if (flags.c())
goto gotallboss;
- context.ax = 0;
+ ax = 0;
goto gotallboss;
secdes:
- context._cmp(context.data.byte(kGunpassflag), 1);
- if (context.flags.z())
+ _cmp(data.byte(kGunpassflag), 1);
+ if (flags.z())
goto gotallboss;
- context.ax = 0;
+ ax = 0;
gotallboss:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
notboss:
- showgamereel(context);
- addtopeoplelist(context);
- context.al = context.es.byte(context.bx+7);
- context._and(context.al, 128);
- if (context.flags.z())
+ showgamereel();
+ addtopeoplelist();
+ al = es.byte(bx+7);
+ _and(al, 128);
+ if (flags.z())
return /* (nottalkedboss) */;
- context.data.byte(kTalkedtoboss) = 1;
+ data.byte(kTalkedtoboss) = 1;
}
-void gamer(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::gamer() {
+ STACK_CHECK;
+ checkspeed();
+ if (!flags.z())
goto gamerfin;
gameragain:
- randomnum1(context);
- context._and(context.al, 7);
- context._cmp(context.al, 5);
- if (!context.flags.c())
+ randomnum1();
+ _and(al, 7);
+ _cmp(al, 5);
+ if (!flags.c())
goto gameragain;
- context._add(context.al, 20);
- context._cmp(context.al, context.es.byte(context.bx+3));
- if (context.flags.z())
+ _add(al, 20);
+ _cmp(al, es.byte(bx+3));
+ if (flags.z())
goto gameragain;
- context.ah = 0;
- context.es.word(context.bx+3) = context.ax;
+ ah = 0;
+ es.word(bx+3) = ax;
gamerfin:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void sparkydrip(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::sparkydrip() {
+ STACK_CHECK;
+ checkspeed();
+ if (!flags.z())
return /* (cantdrip) */;
- context.al = 14;
- context.ah = 0;
- playchannel0(context);
+ al = 14;
+ ah = 0;
+ playchannel0();
}
-void carparkdrip(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::carparkdrip() {
+ STACK_CHECK;
+ checkspeed();
+ if (!flags.z())
return /* (cantdrip2) */;
- context.al = 14;
- playchannel1(context);
+ al = 14;
+ playchannel1();
}
-void keeper(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kKeeperflag), 0);
- if (!context.flags.z())
+void DreamGenContext::keeper() {
+ STACK_CHECK;
+ _cmp(data.byte(kKeeperflag), 0);
+ if (!flags.z())
goto notwaiting;
- context._cmp(context.data.word(kReeltowatch), 190);
- if (context.flags.c())
+ _cmp(data.word(kReeltowatch), 190);
+ if (flags.c())
return /* (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())
+ _inc(data.byte(kKeeperflag));
+ ah = es.byte(bx+7);
+ _and(ah, 127);
+ _cmp(ah, data.byte(kDreamnumber));
+ if (flags.z())
return /* (notdiff) */;
- context.al = context.data.byte(kDreamnumber);
- context.es.byte(context.bx+7) = context.al;
+ al = data.byte(kDreamnumber);
+ es.byte(bx+7) = al;
return;
notwaiting:
- addtopeoplelist(context);
- showgamereel(context);
+ addtopeoplelist();
+ showgamereel();
}
-void candles1(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::candles1() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 44);
+ if (!flags.z())
goto notendcandle1;
- context.ax = 39;
+ ax = 39;
notendcandle1:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
candle1:
- showgamereel(context);
+ showgamereel();
}
-void smallcandle(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::smallcandle() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 37);
+ if (!flags.z())
goto notendsmallcandle;
- context.ax = 25;
+ ax = 25;
notendsmallcandle:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
smallcandlef:
- showgamereel(context);
+ showgamereel();
}
-void intromagic1(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::intromagic1() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 145);
+ if (!flags.z())
goto gotintrom1;
- context.ax = 121;
+ ax = 121;
gotintrom1:
- context.es.word(context.bx+3) = context.ax;
- context._cmp(context.ax, 121);
- if (!context.flags.z())
+ es.word(bx+3) = ax;
+ _cmp(ax, 121);
+ if (!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())
+ _inc(data.byte(kIntrocount));
+ push(es);
+ push(bx);
+ intro1text();
+ bx = pop();
+ es = pop();
+ _cmp(data.byte(kIntrocount), 8);
+ if (!flags.z())
goto introm1fin;
- context._add(context.data.byte(kMapy), 10);
- context.data.byte(kNowinnewroom) = 1;
+ _add(data.byte(kMapy), 10);
+ data.byte(kNowinnewroom) = 1;
introm1fin:
- showgamereel(context);
+ showgamereel();
}
-void candles(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::candles() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 167);
+ if (!flags.z())
goto gotcandles;
- context.ax = 162;
+ ax = 162;
gotcandles:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
candlesfin:
- showgamereel(context);
+ showgamereel();
}
-void candles2(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::candles2() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 238);
+ if (!flags.z())
goto gotcandles2;
- context.ax = 233;
+ ax = 233;
gotcandles2:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
candles2fin:
- showgamereel(context);
+ showgamereel();
}
-void gates(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::gates() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 116);
+ if (!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();
+ push(ax);
+ push(bx);
+ push(es);
+ al = 17;
+ playchannel1();
+ es = pop();
+ bx = pop();
+ ax = pop();
notbang:
- context._cmp(context.ax, 110);
- if (context.flags.c())
+ _cmp(ax, 110);
+ if (flags.c())
goto slowgates;
- context.es.byte(context.bx+5) = 2;
+ es.byte(bx+5) = 2;
slowgates:
- context._cmp(context.ax, 120);
- if (!context.flags.z())
+ _cmp(ax, 120);
+ if (!flags.z())
goto gotgates;
- context.data.byte(kGetback) = 1;
- context.ax = 119;
+ data.byte(kGetback) = 1;
+ 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();
+ es.word(bx+3) = ax;
+ push(es);
+ push(bx);
+ intro3text();
+ bx = pop();
+ es = pop();
gatesfin:
- showgamereel(context);
+ showgamereel();
}
-void intromagic2(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::intromagic2() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 216);
+ if (!flags.z())
goto gotintrom2;
- context.ax = 192;
+ ax = 192;
gotintrom2:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
introm2fin:
- showgamereel(context);
+ showgamereel();
}
-void intromagic3(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::intromagic3() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 218);
+ if (!flags.z())
goto gotintrom3;
- context.data.byte(kGetback) = 1;
+ data.byte(kGetback) = 1;
gotintrom3:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
introm3fin:
- showgamereel(context);
- context.al = context.data.byte(kMapx);
- context.es.byte(context.bx+1) = context.al;
+ showgamereel();
+ al = data.byte(kMapx);
+ es.byte(bx+1) = al;
}
-void intromonks1(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::intromonks1() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 80);
+ if (!flags.z())
goto notendmonk1;
- context._add(context.data.byte(kMapy), 10);
- context.data.byte(kNowinnewroom) = 1;
- showgamereel(context);
+ _add(data.byte(kMapy), 10);
+ data.byte(kNowinnewroom) = 1;
+ showgamereel();
return;
notendmonk1:
- context._cmp(context.ax, 30);
- if (!context.flags.z())
+ _cmp(ax, 30);
+ if (!flags.z())
goto gotintromonk1;
- context._sub(context.data.byte(kMapy), 10);
- context.data.byte(kNowinnewroom) = 1;
- context.ax = 51;
+ _sub(data.byte(kMapy), 10);
+ data.byte(kNowinnewroom) = 1;
+ ax = 51;
gotintromonk1:
- context.es.word(context.bx+3) = context.ax;
- context._cmp(context.ax, 5);
- if (context.flags.z())
+ es.word(bx+3) = ax;
+ _cmp(ax, 5);
+ if (flags.z())
goto waitstep;
- context._cmp(context.ax, 15);
- if (context.flags.z())
+ _cmp(ax, 15);
+ if (flags.z())
goto waitstep;
- context._cmp(context.ax, 25);
- if (context.flags.z())
+ _cmp(ax, 25);
+ if (flags.z())
goto waitstep;
- context._cmp(context.ax, 61);
- if (context.flags.z())
+ _cmp(ax, 61);
+ if (flags.z())
goto waitstep;
- context._cmp(context.ax, 71);
- if (context.flags.z())
+ _cmp(ax, 71);
+ if (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;
+ push(es);
+ push(bx);
+ intro2text();
+ bx = pop();
+ es = pop();
+ es.byte(bx+6) = -20;
intromonk1fin:
- showgamereel(context);
- context.al = context.data.byte(kMapy);
- context.es.byte(context.bx+2) = context.al;
+ showgamereel();
+ al = data.byte(kMapy);
+ es.byte(bx+2) = al;
}
-void intromonks2(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::intromonks2() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 87);
+ if (!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())
+ _inc(data.byte(kIntrocount));
+ push(es);
+ push(bx);
+ monks2text();
+ bx = pop();
+ es = pop();
+ _cmp(data.byte(kIntrocount), 19);
+ if (!flags.z())
goto notlasttalk1;
- context.ax = 87;
+ ax = 87;
goto gotintromonk2;
notlasttalk1:
- context.ax = 74;
+ ax = 74;
goto gotintromonk2;
nottalk1:
- context._cmp(context.ax, 110);
- if (!context.flags.z())
+ _cmp(ax, 110);
+ if (!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())
+ _inc(data.byte(kIntrocount));
+ push(es);
+ push(bx);
+ monks2text();
+ bx = pop();
+ es = pop();
+ _cmp(data.byte(kIntrocount), 35);
+ if (!flags.z())
goto notlastraise;
- context.ax = 111;
+ ax = 111;
goto gotintromonk2;
notlastraise:
- context.ax = 98;
+ ax = 98;
goto gotintromonk2;
notraisearm:
- context._cmp(context.ax, 176);
- if (!context.flags.z())
+ _cmp(ax, 176);
+ if (!flags.z())
goto notendmonk2;
- context.data.byte(kGetback) = 1;
+ data.byte(kGetback) = 1;
goto gotintromonk2;
notendmonk2:
- context._cmp(context.ax, 125);
- if (!context.flags.z())
+ _cmp(ax, 125);
+ if (!flags.z())
goto gotintromonk2;
- context.ax = 140;
+ ax = 140;
gotintromonk2:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
intromonk2fin:
- showgamereel(context);
+ showgamereel();
}
-void handclap(Context &context) {
- STACK_CHECK(context);
+void DreamGenContext::handclap() {
+ STACK_CHECK;
}
-void monks2text(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kIntrocount), 1);
- if (!context.flags.z())
+void DreamGenContext::monks2text() {
+ STACK_CHECK;
+ _cmp(data.byte(kIntrocount), 1);
+ if (!flags.z())
goto notmonk2text1;
- context.al = 8;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 8;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text1:
- context._cmp(context.data.byte(kIntrocount), 4);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 4);
+ if (!flags.z())
goto notmonk2text2;
- context.al = 9;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 9;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text2:
- context._cmp(context.data.byte(kIntrocount), 7);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 7);
+ if (!flags.z())
goto notmonk2text3;
- context.al = 10;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 10;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text3:
- context._cmp(context.data.byte(kIntrocount), 10);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 10);
+ if (!flags.z())
goto notmonk2text4;
- context.data.byte(kIntrocount) = 12;
- context.al = 11;
- context.bl = 0;
- context.bh = 105;
- context.cx = 100;
+ data.byte(kIntrocount) = 12;
+ al = 11;
+ bl = 0;
+ bh = 105;
+ cx = 100;
goto gotmonks2text;
notmonk2text4:
- context._cmp(context.data.byte(kIntrocount), 13);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 13);
+ if (!flags.z())
goto notmonk2text5;
- context.data.byte(kIntrocount) = 17;
+ data.byte(kIntrocount) = 17;
return;
- context.al = 12;
- context.bl = 0;
- context.bh = 120;
- context.cx = 100;
+ al = 12;
+ bl = 0;
+ bh = 120;
+ cx = 100;
goto gotmonks2text;
notmonk2text5:
- context._cmp(context.data.byte(kIntrocount), 16);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 16);
+ if (!flags.z())
goto notmonk2text6;
- context.al = 13;
- context.bl = 0;
- context.bh = 135;
- context.cx = 100;
+ al = 13;
+ bl = 0;
+ bh = 135;
+ cx = 100;
goto gotmonks2text;
notmonk2text6:
- context._cmp(context.data.byte(kIntrocount), 19);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 19);
+ if (!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; };
+ al = 14;
+ bl = 36;
+ bh = 160;
+ cx = 100;
+ dx = 1;
+ ah = 82;
+ { setuptimedtemp(); return; };
notmonk2text7:
- context._cmp(context.data.byte(kIntrocount), 22);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 22);
+ if (!flags.z())
goto notmonk2text8;
- context.al = 15;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 15;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text8:
- context._cmp(context.data.byte(kIntrocount), 25);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 25);
+ if (!flags.z())
goto notmonk2text9;
- context.al = 16;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 16;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text9:
- context._cmp(context.data.byte(kIntrocount), 27);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 27);
+ if (!flags.z())
goto notmonk2text10;
- context.al = 17;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 17;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
notmonk2text10:
- context._cmp(context.data.byte(kIntrocount), 31);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 31);
+ if (!flags.z())
return /* (notmonk2text11) */;
- context.al = 18;
- context.bl = 36;
- context.bh = 160;
- context.cx = 100;
+ al = 18;
+ bl = 36;
+ bh = 160;
+ cx = 100;
goto gotmonks2text;
return;
gotmonks2text:
- context.dx = 1;
- context.cx = 120;
- context.ah = 82;
- setuptimedtemp(context);
+ dx = 1;
+ cx = 120;
+ ah = 82;
+ setuptimedtemp();
}
-void intro1text(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kIntrocount), 2);
- if (!context.flags.z())
+void DreamGenContext::intro1text() {
+ STACK_CHECK;
+ _cmp(data.byte(kIntrocount), 2);
+ if (!flags.z())
goto notintro1text1;
- context.al = 40;
- context.bl = 34;
- context.bh = 130;
- context.cx = 90;
+ al = 40;
+ bl = 34;
+ bh = 130;
+ cx = 90;
goto gotintro1text;
notintro1text1:
- context._cmp(context.data.byte(kIntrocount), 4);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 4);
+ if (!flags.z())
goto notintro1text2;
- context.al = 41;
- context.bl = 34;
- context.bh = 130;
- context.cx = 90;
+ al = 41;
+ bl = 34;
+ bh = 130;
+ cx = 90;
goto gotintro1text;
notintro1text2:
- context._cmp(context.data.byte(kIntrocount), 6);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 6);
+ if (!flags.z())
return /* (notintro1text3) */;
- context.al = 42;
- context.bl = 34;
- context.bh = 130;
- context.cx = 90;
+ al = 42;
+ bl = 34;
+ bh = 130;
+ cx = 90;
goto gotintro1text;
return;
gotintro1text:
- context.dx = 1;
- context.ah = 82;
- context._cmp(context.data.byte(kCh1playing), 255);
- if (context.flags.z())
+ dx = 1;
+ ah = 82;
+ _cmp(data.byte(kCh1playing), 255);
+ if (flags.z())
goto oktalk2;
- context._dec(context.data.byte(kIntrocount));
+ _dec(data.byte(kIntrocount));
return;
oktalk2:
- setuptimedtemp(context);
+ setuptimedtemp();
}
-void intro2text(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.ax, 5);
- if (!context.flags.z())
+void DreamGenContext::intro2text() {
+ STACK_CHECK;
+ _cmp(ax, 5);
+ if (!flags.z())
goto notintro2text1;
- context.al = 43;
- context.bl = 34;
- context.bh = 40;
- context.cx = 90;
+ al = 43;
+ bl = 34;
+ bh = 40;
+ cx = 90;
goto gotintro2text;
notintro2text1:
- context._cmp(context.ax, 15);
- if (!context.flags.z())
+ _cmp(ax, 15);
+ if (!flags.z())
return /* (notintro2text2) */;
- context.al = 44;
- context.bl = 34;
- context.bh = 40;
- context.cx = 90;
+ al = 44;
+ bl = 34;
+ bh = 40;
+ cx = 90;
goto gotintro2text;
return;
gotintro2text:
- context.dx = 1;
- context.ah = 82;
- setuptimedtemp(context);
+ dx = 1;
+ ah = 82;
+ setuptimedtemp();
}
-void intro3text(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.ax, 107);
- if (!context.flags.z())
+void DreamGenContext::intro3text() {
+ STACK_CHECK;
+ _cmp(ax, 107);
+ if (!flags.z())
goto notintro3text1;
- context.al = 45;
- context.bl = 36;
- context.bh = 56;
- context.cx = 100;
+ al = 45;
+ bl = 36;
+ bh = 56;
+ cx = 100;
goto gotintro3text;
notintro3text1:
- context._cmp(context.ax, 108);
- if (!context.flags.z())
+ _cmp(ax, 108);
+ if (!flags.z())
return /* (notintro3text2) */;
- context.al = 46;
- context.bl = 36;
- context.bh = 56;
- context.cx = 100;
+ al = 46;
+ bl = 36;
+ bh = 56;
+ cx = 100;
goto gotintro3text;
return;
gotintro3text:
- context.dx = 1;
- context.ah = 82;
- setuptimedtemp(context);
+ dx = 1;
+ ah = 82;
+ setuptimedtemp();
}
-void monkandryan(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::monkandryan() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 83);
+ if (!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())
+ _inc(data.byte(kIntrocount));
+ push(es);
+ push(bx);
+ textformonk();
+ bx = pop();
+ es = pop();
+ ax = 77;
+ _cmp(data.byte(kIntrocount), 57);
+ if (!flags.z())
goto gotmonkryan;
- context.data.byte(kGetback) = 1;
+ data.byte(kGetback) = 1;
return;
gotmonkryan:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
notmonkryan:
- showgamereel(context);
+ showgamereel();
}
-void endgameseq(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::endgameseq() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 51);
+ if (!flags.z())
goto gotendseq;
- context._cmp(context.data.byte(kIntrocount), 140);
- if (context.flags.z())
+ _cmp(data.byte(kIntrocount), 140);
+ if (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;
+ _inc(data.byte(kIntrocount));
+ push(es);
+ push(bx);
+ textforend();
+ bx = pop();
+ es = pop();
+ ax = 50;
gotendseq:
- context.es.word(context.bx+3) = context.ax;
- context._cmp(context.ax, 134);
- if (!context.flags.z())
+ es.word(bx+3) = ax;
+ _cmp(ax, 134);
+ if (!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();
+ push(es);
+ push(bx);
+ push(ax);
+ fadescreendownhalf();
+ ax = pop();
+ bx = pop();
+ es = pop();
goto notendseq;
notfadedown:
- context._cmp(context.ax, 324);
- if (!context.flags.z())
+ _cmp(ax, 324);
+ if (!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();
+ push(es);
+ push(bx);
+ push(ax);
+ fadescreendowns();
+ data.byte(kVolumeto) = 7;
+ data.byte(kVolumedirection) = 1;
+ ax = pop();
+ bx = pop();
+ es = pop();
notfadeend:
- context._cmp(context.ax, 340);
- if (!context.flags.z())
+ _cmp(ax, 340);
+ if (!flags.z())
goto notendseq;
- context.data.byte(kGetback) = 1;
+ 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())
+ showgamereel();
+ al = data.byte(kMapy);
+ es.byte(bx+2) = al;
+ ax = es.word(bx+3);
+ _cmp(ax, 145);
+ if (!flags.z())
return /* (notendcreds) */;
- context.es.word(context.bx+3) = 146;
- rollendcredits(context);
-}
-
-void rollendcredits(Context &context) {
- STACK_CHECK(context);
- 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;
+ es.word(bx+3) = 146;
+ rollendcredits();
+}
+
+void DreamGenContext::rollendcredits() {
+ STACK_CHECK;
+ al = 16;
+ ah = 255;
+ playchannel0();
+ data.byte(kVolume) = 7;
+ data.byte(kVolumeto) = 0;
+ data.byte(kVolumedirection) = -1;
+ cl = 160;
+ ch = 160;
+ di = 75;
+ bx = 20;
+ ds = data.word(kMapstore);
+ si = 0;
+ multiget();
+ es = data.word(kTextfile1);
+ si = 3*2;
+ ax = es.word(si);
+ si = ax;
+ _add(si, (66*2));
+ cx = 254;
endcredits1:
- context.push(context.cx);
- context.bx = 10;
- context.cx = context.data.word(kLinespacing);
+ push(cx);
+ bx = 10;
+ cx = 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;
+ push(cx);
+ push(si);
+ push(di);
+ push(es);
+ push(bx);
+ vsync();
+ cl = 160;
+ ch = 160;
+ di = 75;
+ bx = 20;
+ ds = data.word(kMapstore);
+ si = 0;
+ multiput();
+ vsync();
+ bx = pop();
+ es = pop();
+ di = pop();
+ si = pop();
+ push(si);
+ push(di);
+ push(es);
+ push(bx);
+ 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)
+ push(cx);
+ di = 75;
+ dx = 161;
+ ax = 0;
+ printdirect();
+ _add(bx, data.word(kLinespacing));
+ cx = pop();
+ if (--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)
+ vsync();
+ cl = 160;
+ ch = 160;
+ di = 75;
+ bx = 20;
+ multidump();
+ bx = pop();
+ es = pop();
+ di = pop();
+ si = pop();
+ cx = pop();
+ _dec(bx);
+ if (--cx)
goto endcredits2;
- context.cx = context.pop();
+ cx = pop();
looknext:
- context.al = context.es.byte(context.si);
- context._inc(context.si);
- context._cmp(context.al, ':');
- if (context.flags.z())
+ al = es.byte(si);
+ _inc(si);
+ _cmp(al, ':');
+ if (flags.z())
goto gotnext;
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _cmp(al, 0);
+ if (flags.z())
goto gotnext;
goto looknext;
gotnext:
- if (--context.cx)
+ if (--cx)
goto endcredits1;
- context.cx = 100;
- hangon(context);
- paneltomap(context);
- fadescreenuphalf(context);
+ cx = 100;
+ hangon();
+ paneltomap();
+ fadescreenuphalf();
}
-void priest(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.es.word(context.bx+3), 8);
- if (context.flags.z())
+void DreamGenContext::priest() {
+ STACK_CHECK;
+ _cmp(es.word(bx+3), 8);
+ if (flags.z())
return /* (priestspoken) */;
- context.data.byte(kPointermode) = 0;
- context.data.word(kWatchingtime) = 2;
- checkspeed(context);
- if (!context.flags.z())
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
+ checkspeed();
+ if (!flags.z())
return /* (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();
-}
-
-void madmanstelly(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._inc(context.ax);
- context._cmp(context.ax, 307);
- if (!context.flags.z())
+ _inc(es.word(bx+3));
+ push(es);
+ push(bx);
+ priesttext();
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::madmanstelly() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 307);
+ if (!flags.z())
goto notendtelly;
- context.ax = 300;
+ ax = 300;
notendtelly:
- context.es.word(context.bx+3) = context.ax;
- showgamereel(context);
+ es.word(bx+3) = ax;
+ showgamereel();
}
-void madman(Context &context) {
- STACK_CHECK(context);
- context.data.word(kWatchingtime) = 2;
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::madman() {
+ STACK_CHECK;
+ data.word(kWatchingtime) = 2;
+ checkspeed();
+ if (!flags.z())
goto nomadspeed;
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 364);
- if (!context.flags.c())
+ ax = es.word(bx+3);
+ _cmp(ax, 364);
+ if (!flags.c())
goto ryansded;
- context._cmp(context.ax, 10);
- if (!context.flags.z())
+ _cmp(ax, 10);
+ if (!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;
+ push(es);
+ push(bx);
+ push(ax);
+ dx = 2247;
+ loadtemptext();
+ ax = pop();
+ bx = pop();
+ es = pop();
+ data.byte(kCombatcount) = -1;
+ data.byte(kSpeechcount) = 0;
notfirstmad:
- context._inc(context.ax);
- context._cmp(context.ax, 294);
- if (context.flags.z())
+ _inc(ax);
+ _cmp(ax, 294);
+ if (flags.z())
goto madmanspoken;
- context._cmp(context.ax, 66);
- if (!context.flags.z())
+ _cmp(ax, 66);
+ if (!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())
+ _inc(data.byte(kCombatcount));
+ push(es);
+ push(bx);
+ madmantext();
+ bx = pop();
+ es = pop();
+ ax = 53;
+ _cmp(data.byte(kCombatcount), 64);
+ if (flags.c())
goto nomadspeak;
- context._cmp(context.data.byte(kCombatcount), 70);
- if (context.flags.z())
+ _cmp(data.byte(kCombatcount), 70);
+ if (flags.z())
goto killryan;
- context._cmp(context.data.byte(kLastweapon), 8);
- if (!context.flags.z())
+ _cmp(data.byte(kLastweapon), 8);
+ if (!flags.z())
goto nomadspeak;
- context.data.byte(kCombatcount) = 72;
- context.data.byte(kLastweapon) = -1;
- context.data.byte(kMadmanflag) = 1;
- context.ax = 67;
+ data.byte(kCombatcount) = 72;
+ data.byte(kLastweapon) = -1;
+ data.byte(kMadmanflag) = 1;
+ ax = 67;
goto nomadspeak;
killryan:
- context.ax = 310;
+ ax = 310;
nomadspeak:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
nomadspeed:
- showgamereel(context);
- context.al = context.data.byte(kMapx);
- context.es.byte(context.bx+1) = context.al;
- madmode(context);
+ showgamereel();
+ al = data.byte(kMapx);
+ es.byte(bx+1) = al;
+ madmode();
return;
madmanspoken:
- context._cmp(context.data.byte(kWongame), 1);
- if (context.flags.z())
+ _cmp(data.byte(kWongame), 1);
+ if (flags.z())
return /* (alreadywon) */;
- context.data.byte(kWongame) = 1;
- context.push(context.es);
- context.push(context.bx);
- getridoftemptext(context);
- context.bx = context.pop();
- context.es = context.pop();
+ data.byte(kWongame) = 1;
+ push(es);
+ push(bx);
+ getridoftemptext();
+ bx = pop();
+ es = pop();
return;
ryansded:
- context.data.byte(kMandead) = 2;
- showgamereel(context);
+ data.byte(kMandead) = 2;
+ showgamereel();
}
-void madmantext(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kSpeechcount), 63);
- if (!context.flags.c())
+void DreamGenContext::madmantext() {
+ STACK_CHECK;
+ _cmp(data.byte(kSpeechcount), 63);
+ if (!flags.c())
return /* (nomadtext) */;
- context._cmp(context.data.byte(kCh1playing), 255);
- if (!context.flags.z())
+ _cmp(data.byte(kCh1playing), 255);
+ if (!flags.z())
return /* (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);
-}
-
-void madmode(Context &context) {
- STACK_CHECK(context);
- context.data.word(kWatchingtime) = 2;
- context.data.byte(kPointermode) = 0;
- context._cmp(context.data.byte(kCombatcount), 65);
- if (context.flags.c())
+ al = data.byte(kSpeechcount);
+ _inc(data.byte(kSpeechcount));
+ _add(al, 47);
+ bl = 72;
+ bh = 80;
+ cx = 90;
+ dx = 1;
+ ah = 82;
+ setuptimedtemp();
+}
+
+void DreamGenContext::madmode() {
+ STACK_CHECK;
+ data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ _cmp(data.byte(kCombatcount), 65);
+ if (flags.c())
return /* (iswatchmad) */;
- context._cmp(context.data.byte(kCombatcount), 70);
- if (!context.flags.c())
+ _cmp(data.byte(kCombatcount), 70);
+ if (!flags.c())
return /* (iswatchmad) */;
- context.data.byte(kPointermode) = 2;
+ data.byte(kPointermode) = 2;
}
-void priesttext(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.es.word(context.bx+3), 2);
- if (context.flags.c())
+void DreamGenContext::priesttext() {
+ STACK_CHECK;
+ _cmp(es.word(bx+3), 2);
+ if (flags.c())
return /* (nopriesttext) */;
- context._cmp(context.es.word(context.bx+3), 7);
- if (!context.flags.c())
+ _cmp(es.word(bx+3), 7);
+ if (!flags.c())
return /* (nopriesttext) */;
- context.al = context.es.byte(context.bx+3);
- context._and(context.al, 1);
- if (!context.flags.z())
+ al = es.byte(bx+3);
+ _and(al, 1);
+ if (!flags.z())
return /* (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);
-}
-
-void textforend(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kIntrocount), 20);
- if (!context.flags.z())
+ al = es.byte(bx+3);
+ _shr(al, 1);
+ _add(al, 50);
+ bl = 72;
+ bh = 80;
+ cx = 54;
+ dx = 1;
+ setuptimeduse();
+}
+
+void DreamGenContext::textforend() {
+ STACK_CHECK;
+ _cmp(data.byte(kIntrocount), 20);
+ if (!flags.z())
goto notendtext1;
- context.al = 0;
- context.bl = 34;
- context.bh = 20;
- context.cx = 60;
+ al = 0;
+ bl = 34;
+ bh = 20;
+ cx = 60;
goto gotendtext;
notendtext1:
- context._cmp(context.data.byte(kIntrocount), 50);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 50);
+ if (!flags.z())
goto notendtext2;
- context.al = 1;
- context.bl = 34;
- context.bh = 20;
- context.cx = 60;
+ al = 1;
+ bl = 34;
+ bh = 20;
+ cx = 60;
goto gotendtext;
notendtext2:
- context._cmp(context.data.byte(kIntrocount), 85);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 85);
+ if (!flags.z())
return /* (notendtext3) */;
- context.al = 2;
- context.bl = 34;
- context.bh = 20;
- context.cx = 60;
+ al = 2;
+ bl = 34;
+ bh = 20;
+ cx = 60;
goto gotendtext;
return;
gotendtext:
- context.dx = 1;
- context.ah = 83;
- setuptimedtemp(context);
+ dx = 1;
+ ah = 83;
+ setuptimedtemp();
}
-void textformonk(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kIntrocount), 1);
- if (!context.flags.z())
+void DreamGenContext::textformonk() {
+ STACK_CHECK;
+ _cmp(data.byte(kIntrocount), 1);
+ if (!flags.z())
goto notmonktext1;
- context.al = 19;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 19;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext1:
- context._cmp(context.data.byte(kIntrocount), 5);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 5);
+ if (!flags.z())
goto notmonktext2;
- context.al = 20;
- context.bl = 68;
- context.bh = 38;
- context.cx = 120;
+ al = 20;
+ bl = 68;
+ bh = 38;
+ cx = 120;
goto gotmonktext;
notmonktext2:
- context._cmp(context.data.byte(kIntrocount), 9);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 9);
+ if (!flags.z())
goto notmonktext3;
- context.al = 21;
- context.bl = 48;
- context.bh = 154;
- context.cx = 120;
+ al = 21;
+ bl = 48;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext3:
- context._cmp(context.data.byte(kIntrocount), 13);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 13);
+ if (!flags.z())
goto notmonktext4;
- context.al = 22;
- context.bl = 68;
- context.bh = 38;
- context.cx = 120;
+ al = 22;
+ bl = 68;
+ bh = 38;
+ cx = 120;
goto gotmonktext;
notmonktext4:
- context._cmp(context.data.byte(kIntrocount), 15);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 15);
+ if (!flags.z())
goto notmonktext5;
- context.al = 23;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 23;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext5:
- context._cmp(context.data.byte(kIntrocount), 21);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 21);
+ if (!flags.z())
goto notmonktext6;
- context.al = 24;
- context.bl = 68;
- context.bh = 38;
- context.cx = 120;
+ al = 24;
+ bl = 68;
+ bh = 38;
+ cx = 120;
goto gotmonktext;
notmonktext6:
- context._cmp(context.data.byte(kIntrocount), 25);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 25);
+ if (!flags.z())
goto notmonktext7;
- context.al = 25;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 25;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext7:
- context._cmp(context.data.byte(kIntrocount), 29);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 29);
+ if (!flags.z())
goto notmonktext8;
- context.al = 26;
- context.bl = 68;
- context.bh = 38;
- context.cx = 120;
+ al = 26;
+ bl = 68;
+ bh = 38;
+ cx = 120;
goto gotmonktext;
notmonktext8:
- context._cmp(context.data.byte(kIntrocount), 33);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 33);
+ if (!flags.z())
goto notmonktext9;
- context.al = 27;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 27;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext9:
- context._cmp(context.data.byte(kIntrocount), 37);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 37);
+ if (!flags.z())
goto notmonktext10;
- context.al = 28;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 28;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext10:
- context._cmp(context.data.byte(kIntrocount), 41);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 41);
+ if (!flags.z())
goto notmonktext11;
- context.al = 29;
- context.bl = 68;
- context.bh = 38;
- context.cx = 120;
+ al = 29;
+ bl = 68;
+ bh = 38;
+ cx = 120;
goto gotmonktext;
notmonktext11:
- context._cmp(context.data.byte(kIntrocount), 45);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 45);
+ if (!flags.z())
goto notmonktext12;
- context.al = 30;
- context.bl = 68;
- context.bh = 154;
- context.cx = 120;
+ al = 30;
+ bl = 68;
+ bh = 154;
+ cx = 120;
goto gotmonktext;
notmonktext12:
- context._cmp(context.data.byte(kIntrocount), 52);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 52);
+ if (!flags.z())
goto notmonktext13;
- context.al = 31;
- context.bl = 68;
- context.bh = 154;
- context.cx = 220;
+ al = 31;
+ bl = 68;
+ bh = 154;
+ cx = 220;
goto gotmonktext;
notmonktext13:
- context._cmp(context.data.byte(kIntrocount), 53);
- if (!context.flags.z())
+ _cmp(data.byte(kIntrocount), 53);
+ if (!flags.z())
return /* (notendtitles) */;
- fadescreendowns(context);
- context.data.byte(kVolumeto) = 7;
- context.data.byte(kVolumedirection) = 1;
+ fadescreendowns();
+ data.byte(kVolumeto) = 7;
+ data.byte(kVolumedirection) = 1;
return;
gotmonktext:
- context.dx = 1;
- context.ah = 82;
- context._cmp(context.data.byte(kCh1playing), 255);
- if (context.flags.z())
+ dx = 1;
+ ah = 82;
+ _cmp(data.byte(kCh1playing), 255);
+ if (flags.z())
goto oktalk;
- context._dec(context.data.byte(kIntrocount));
+ _dec(data.byte(kIntrocount));
return;
oktalk:
- setuptimedtemp(context);
+ setuptimedtemp();
}
-void drunk(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kGeneraldead), 0);
- if (!context.flags.z())
+void DreamGenContext::drunk() {
+ STACK_CHECK;
+ _cmp(data.byte(kGeneraldead), 0);
+ if (!flags.z())
return /* (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);
+ al = es.byte(bx+7);
+ _and(al, 127);
+ es.byte(bx+7) = al;
+ showgamereel();
+ addtopeoplelist();
}
-void advisor(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::advisor() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 123);
+ if (!flags.z())
goto notendadvis;
- context.ax = 106;
+ ax = 106;
goto gotadvframe;
notendadvis:
- context._cmp(context.ax, 108);
- if (!context.flags.z())
+ _cmp(ax, 108);
+ if (!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())
+ push(ax);
+ randomnumber();
+ cl = al;
+ ax = pop();
+ _cmp(cl, 3);
+ if (flags.c())
goto gotadvframe;
- context.ax = 106;
+ ax = 106;
gotadvframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
noadvisor:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void copper(Context &context) {
- STACK_CHECK(context);
- checkspeed(context);
- if (!context.flags.z())
+void DreamGenContext::copper() {
+ STACK_CHECK;
+ checkspeed();
+ if (!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())
+ ax = es.word(bx+3);
+ _inc(ax);
+ _cmp(ax, 94);
+ if (!flags.z())
goto notendcopper;
- context.ax = 64;
+ ax = 64;
goto gotcopframe;
notendcopper:
- context._cmp(context.ax, 81);
- if (context.flags.z())
+ _cmp(ax, 81);
+ if (flags.z())
goto mightwait;
- context._cmp(context.ax, 66);
- if (!context.flags.z())
+ _cmp(ax, 66);
+ if (!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())
+ push(ax);
+ randomnumber();
+ cl = al;
+ ax = pop();
+ _cmp(cl, 7);
+ if (flags.c())
goto gotcopframe;
- context._dec(context.ax);
+ _dec(ax);
gotcopframe:
- context.es.word(context.bx+3) = context.ax;
+ es.word(bx+3) = ax;
nocopper:
- showgamereel(context);
- addtopeoplelist(context);
+ showgamereel();
+ addtopeoplelist();
}
-void sparky(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.word(kCard1money), 0);
- if (context.flags.z())
+void DreamGenContext::sparky() {
+ STACK_CHECK;
+ _cmp(data.word(kCard1money), 0);
+ if (flags.z())
goto animsparky;
- context.es.byte(context.bx+7) = 3;
+ es.byte(bx+7) = 3;
goto animsparky;
animsparky:
- checkspeed(context);
- if (!context.flags.z())
+ checkspeed();
+ if (!flags.z())
goto finishsparky;
- context._cmp(context.es.word(context.bx+3), 34);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 34);
+ if (!flags.z())
goto notsparky1;
- randomnumber(context);
- context._cmp(context.al, 30);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 30);
+ if (flags.c())
goto dosparky;
- context.es.word(context.bx+3) = 27;
+ es.word(bx+3) = 27;
goto finishsparky;
notsparky1:
- context._cmp(context.es.word(context.bx+3), 48);
- if (!context.flags.z())
+ _cmp(es.word(bx+3), 48);
+ if (!flags.z())
goto dosparky;
- context.es.word(context.bx+3) = 27;
+ es.word(bx+3) = 27;
goto finishsparky;
dosparky:
- context._inc(context.es.word(context.bx+3));
+ _inc(es.word(bx+3));
finishsparky:
- showgamereel(context);
- addtopeoplelist(context);
- context.al = context.es.byte(context.bx+7);
- context._and(context.al, 128);
- if (context.flags.z())
+ showgamereel();
+ addtopeoplelist();
+ al = es.byte(bx+7);
+ _and(al, 128);
+ if (flags.z())
return /* (nottalkedsparky) */;
- context.data.byte(kTalkedtosparky) = 1;
+ data.byte(kTalkedtosparky) = 1;
}
-void train(Context &context) {
- STACK_CHECK(context);
+void DreamGenContext::train() {
+ STACK_CHECK;
return;
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 21);
- if (!context.flags.c())
+ ax = es.word(bx+3);
+ _cmp(ax, 21);
+ if (!flags.c())
goto notrainyet;
- context._inc(context.ax);
+ _inc(ax);
goto gottrainframe;
notrainyet:
- randomnumber(context);
- context._cmp(context.al, 253);
- if (context.flags.c())
+ randomnumber();
+ _cmp(al, 253);
+ if (flags.c())
return /* (notrainatall) */;
- context._cmp(context.data.byte(kManspath), 5);
- if (!context.flags.z())
+ _cmp(data.byte(kManspath), 5);
+ if (!flags.z())
return /* (notrainatall) */;
- context._cmp(context.data.byte(kFinaldest), 5);
- if (!context.flags.z())
+ _cmp(data.byte(kFinaldest), 5);
+ if (!flags.z())
return /* (notrainatall) */;
- context.ax = 5;
+ ax = 5;
gottrainframe:
- context.es.word(context.bx+3) = context.ax;
- showgamereel(context);
-}
-
-void addtopeoplelist(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void showgamereel(Context &context) {
- STACK_CHECK(context);
- context.ax = context.es.word(context.bx+3);
- context._cmp(context.ax, 512);
- if (!context.flags.c())
+ es.word(bx+3) = ax;
+ showgamereel();
+}
+
+void DreamGenContext::addtopeoplelist() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ push(bx);
+ cl = es.byte(bx+7);
+ ax = es.word(bx+3);
+ bx = data.word(kListpos);
+ es = data.word(kBuffers);
+ es.word(bx) = ax;
+ ax = pop();
+ es.word(bx+2) = ax;
+ es.byte(bx+4) = cl;
+ bx = pop();
+ es = pop();
+ _add(data.word(kListpos), 5);
+}
+
+void DreamGenContext::showgamereel() {
+ STACK_CHECK;
+ ax = es.word(bx+3);
+ _cmp(ax, 512);
+ if (!flags.c())
return /* (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;
-}
-
-void checkspeed(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kLastweapon), -1);
- if (!context.flags.z())
+ data.word(kReelpointer) = ax;
+ push(es);
+ push(bx);
+ plotreel();
+ bx = pop();
+ es = pop();
+ ax = data.word(kReelpointer);
+ es.word(bx+3) = ax;
+}
+
+void DreamGenContext::checkspeed() {
+ STACK_CHECK;
+ _cmp(data.byte(kLastweapon), -1);
+ if (!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())
+ _inc(es.byte(bx+6));
+ al = es.byte(bx+6);
+ _cmp(al, es.byte(bx+5));
+ if (!flags.z())
return /* (notspeed) */;
- context.al = 0;
- context.es.byte(context.bx+6) = context.al;
- context._cmp(context.al, context.al);
+ al = 0;
+ es.byte(bx+6) = al;
+ _cmp(al, al);
return;
forcenext:
- context._cmp(context.al, context.al);
+ _cmp(al, al);
}
-void clearsprites(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
+void DreamGenContext::clearsprites() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
+ al = 255;
+ cx = (32)*16;
+ _stosb(cx);
}
-void makesprite(Context &context) {
- STACK_CHECK(context);
- context.es = context.data.word(kBuffers);
- context.bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
+void DreamGenContext::makesprite() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ 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())
+ _cmp(es.byte(bx+15), 255);
+ if (flags.z())
goto _tmp17a;
- context._add(context.bx, (32));
+ _add(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;
-}
-
-void delsprite(Context &context) {
- STACK_CHECK(context);
- context.di = context.bx;
- context.cx = (32);
- context.al = 255;
- context._stosb(context.cx);
-}
-
-void spriteupdate(Context &context) {
- STACK_CHECK(context);
- 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;
+ es.word(bx) = cx;
+ es.word(bx+10) = si;
+ es.word(bx+6) = dx;
+ es.word(bx+8) = di;
+ es.word(bx+2) = 0x0ffff;
+ es.byte(bx+15) = 0;
+ es.byte(bx+18) = 0;
+}
+
+void DreamGenContext::delsprite() {
+ STACK_CHECK;
+ di = bx;
+ cx = (32);
+ al = 255;
+ _stosb(cx);
+}
+
+void DreamGenContext::spriteupdate() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
+ al = data.byte(kRyanon);
+ es.byte(bx+31) = al;
+ es = data.word(kBuffers);
+ bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
+ 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())
+ push(cx);
+ push(bx);
+ ax = es.word(bx);
+ _cmp(ax, 0x0ffff);
+ if (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();
+ push(es);
+ push(ds);
+ cx = es.word(bx+2);
+ es.word(bx+24) = cx;
+ __dispatch_call(ax);
+ ds = pop();
+ es = pop();
_tmp18a:
- context.bx = context.pop();
- context.cx = context.pop();
- context._cmp(context.data.byte(kNowinnewroom), 1);
- if (context.flags.z())
+ bx = pop();
+ cx = pop();
+ _cmp(data.byte(kNowinnewroom), 1);
+ if (flags.z())
return /* ($18b) */;
- context._add(context.bx, (32));
- if (--context.cx)
+ _add(bx, (32));
+ if (--cx)
goto _tmp18;
}
-void printsprites(Context &context) {
- STACK_CHECK(context);
- context.es = context.data.word(kBuffers);
- context.cx = 0;
+void DreamGenContext::printsprites() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ 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;
+ push(cx);
+ data.byte(kPriority) = cl;
+ bx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
+ 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())
+ push(cx);
+ push(bx);
+ ax = es.word(bx);
+ _cmp(ax, 0x0ffff);
+ if (flags.z())
goto skipsprite;
- context.al = context.data.byte(kPriority);
- context._cmp(context.al, context.es.byte(context.bx+23));
- if (!context.flags.z())
+ al = data.byte(kPriority);
+ _cmp(al, es.byte(bx+23));
+ if (!flags.z())
goto skipsprite;
- context._cmp(context.es.byte(context.bx+31), 1);
- if (context.flags.z())
+ _cmp(es.byte(bx+31), 1);
+ if (flags.z())
goto skipsprite;
- printasprite(context);
+ printasprite();
skipsprite:
- context.bx = context.pop();
- context.cx = context.pop();
- context._add(context.bx, (32));
- if (--context.cx)
+ bx = pop();
+ cx = pop();
+ _add(bx, (32));
+ if (--cx)
goto prtspriteloop;
- context.cx = context.pop();
- context._inc(context.cx);
- context._cmp(context.cx, 7);
- if (!context.flags.z())
+ cx = pop();
+ _inc(cx);
+ _cmp(cx, 7);
+ if (!flags.z())
goto priorityloop;
}
-void printasprite(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::printasprite() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ si = bx;
+ ds = es.word(si+6);
+ al = es.byte(si+11);
+ ah = 0;
+ _cmp(al, 220);
+ if (flags.c())
goto notnegative1;
- context.ah = 255;
+ 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())
+ bx = ax;
+ _add(bx, data.word(kMapady));
+ al = es.byte(si+10);
+ ah = 0;
+ _cmp(al, 220);
+ if (flags.c())
goto notnegative2;
- context.ah = 255;
+ 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())
+ di = ax;
+ _add(di, data.word(kMapadx));
+ al = es.byte(si+15);
+ ah = 0;
+ _cmp(es.byte(si+30), 0);
+ if (flags.z())
goto steadyframe;
- context.ah = 8;
+ ah = 8;
steadyframe:
- context._cmp(context.data.byte(kPriority), 6);
- if (!context.flags.z())
+ _cmp(data.byte(kPriority), 6);
+ if (!flags.z())
goto notquickp;
notquickp:
- showframe(context);
- context.bx = context.pop();
- context.es = context.pop();
-}
-
-void checkone(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void findsource(Context &context) {
- STACK_CHECK(context);
- context.ax = context.data.word(kCurrentframe);
- context._cmp(context.ax, 160);
- if (!context.flags.c())
+ showframe();
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::checkone() {
+ STACK_CHECK;
+ push(cx);
+ al = ch;
+ ah = 0;
+ cl = 4;
+ _shr(ax, cl);
+ dl = al;
+ cx = pop();
+ al = cl;
+ ah = 0;
+ cl = 4;
+ _shr(ax, cl);
+ ah = dl;
+ push(ax);
+ ch = 0;
+ cl = al;
+ push(cx);
+ al = ah;
+ ah = 0;
+ cx = 11;
+ _mul(cx);
+ cx = pop();
+ _add(ax, cx);
+ cx = 3;
+ _mul(cx);
+ si = ax;
+ ds = data.word(kBuffers);
+ _add(si, (0+(180*10)+32+60+(32*32)));
+ _lodsw();
+ cx = ax;
+ _lodsb();
+ dx = pop();
+}
+
+void DreamGenContext::findsource() {
+ STACK_CHECK;
+ ax = data.word(kCurrentframe);
+ _cmp(ax, 160);
+ if (!flags.c())
goto over1000;
- context.ds = context.data.word(kReel1);
- context.data.word(kTakeoff) = 0;
+ ds = data.word(kReel1);
+ data.word(kTakeoff) = 0;
return;
over1000:
- context._cmp(context.ax, 320);
- if (!context.flags.c())
+ _cmp(ax, 320);
+ if (!flags.c())
goto over1001;
- context.ds = context.data.word(kReel2);
- context.data.word(kTakeoff) = 160;
+ ds = data.word(kReel2);
+ data.word(kTakeoff) = 160;
return;
over1001:
- context.ds = context.data.word(kReel3);
- context.data.word(kTakeoff) = 320;
-}
-
-void initman(Context &context) {
- STACK_CHECK(context);
- 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;
-}
-
-void mainman(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kResetmanxy), 1);
- if (!context.flags.z())
+ ds = data.word(kReel3);
+ data.word(kTakeoff) = 320;
+}
+
+void DreamGenContext::initman() {
+ STACK_CHECK;
+ al = data.byte(kRyanx);
+ ah = data.byte(kRyany);
+ si = ax;
+ cx = 49464;
+ dx = data.word(kMainsprites);
+ di = 0;
+ makesprite();
+ es.byte(bx+23) = 4;
+ es.byte(bx+22) = 0;
+ es.byte(bx+29) = 0;
+}
+
+void DreamGenContext::mainman() {
+ STACK_CHECK;
+ _cmp(data.byte(kResetmanxy), 1);
+ if (!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;
+ data.byte(kResetmanxy) = 0;
+ al = data.byte(kRyanx);
+ ah = data.byte(kRyany);
+ es.word(bx+10) = ax;
+ es.byte(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())
+ _dec(es.byte(bx+22));
+ _cmp(es.byte(bx+22), -1);
+ if (flags.z())
goto executewalk;
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())
+ es.byte(bx+22) = 0;
+ al = data.byte(kTurntoface);
+ _cmp(al, data.byte(kFacing));
+ if (flags.z())
goto facingok;
- aboutturn(context);
+ aboutturn();
goto notwalk;
facingok:
- context._cmp(context.data.byte(kTurndirection), 0);
- if (context.flags.z())
+ _cmp(data.byte(kTurndirection), 0);
+ if (flags.z())
goto alreadyturned;
- context._cmp(context.data.byte(kLinepointer), 254);
- if (!context.flags.z())
+ _cmp(data.byte(kLinepointer), 254);
+ if (!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())
+ data.byte(kReasseschanges) = 1;
+ al = data.byte(kFacing);
+ _cmp(al, data.byte(kLeavedirection));
+ if (!flags.z())
goto alreadyturned;
- checkforexit(context);
+ checkforexit();
alreadyturned:
- context.data.byte(kTurndirection) = 0;
- context._cmp(context.data.byte(kLinepointer), 254);
- if (!context.flags.z())
+ data.byte(kTurndirection) = 0;
+ _cmp(data.byte(kLinepointer), 254);
+ if (!flags.z())
goto walkman;
- context.es.byte(context.bx+29) = 0;
+ es.byte(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())
+ al = es.byte(bx+29);
+ _inc(al);
+ _cmp(al, 11);
+ if (!flags.z())
goto notanimend1;
- context.al = 1;
+ al = 1;
notanimend1:
- context.es.byte(context.bx+29) = context.al;
- walking(context);
- context._cmp(context.data.byte(kLinepointer), 254);
- if (context.flags.z())
+ es.byte(bx+29) = al;
+ walking();
+ _cmp(data.byte(kLinepointer), 254);
+ if (flags.z())
goto afterwalk;
- context.al = context.data.byte(kFacing);
- context._and(context.al, 1);
- if (context.flags.z())
+ al = data.byte(kFacing);
+ _and(al, 1);
+ if (flags.z())
goto isdouble;
- context.al = context.es.byte(context.bx+29);
- context._cmp(context.al, 2);
- if (context.flags.z())
+ al = es.byte(bx+29);
+ _cmp(al, 2);
+ if (flags.z())
goto afterwalk;
- context._cmp(context.al, 7);
- if (context.flags.z())
+ _cmp(al, 7);
+ if (flags.z())
goto afterwalk;
isdouble:
- walking(context);
+ walking();
afterwalk:
- context._cmp(context.data.byte(kLinepointer), 254);
- if (!context.flags.z())
+ _cmp(data.byte(kLinepointer), 254);
+ if (!flags.z())
goto notwalk;
- context.al = context.data.byte(kTurntoface);
- context._cmp(context.al, context.data.byte(kFacing));
- if (!context.flags.z())
+ al = data.byte(kTurntoface);
+ _cmp(al, data.byte(kFacing));
+ if (!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())
+ data.byte(kReasseschanges) = 1;
+ al = data.byte(kFacing);
+ _cmp(al, data.byte(kLeavedirection));
+ if (!flags.z())
goto notwalk;
- checkforexit(context);
+ checkforexit();
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;
-}
-
-void aboutturn(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kTurndirection), 1);
- if (context.flags.z())
+ al = data.byte(kFacing);
+ ah = 0;
+ di = 1105;
+ _add(di, ax);
+ al = cs.byte(di);
+ _add(al, es.byte(bx+29));
+ es.byte(bx+15) = al;
+ ax = es.word(bx+10);
+ data.byte(kRyanx) = al;
+ data.byte(kRyany) = ah;
+}
+
+void DreamGenContext::aboutturn() {
+ STACK_CHECK;
+ _cmp(data.byte(kTurndirection), 1);
+ if (flags.z())
goto incdir;
- context._cmp(context.data.byte(kTurndirection), -1);
- if (context.flags.z())
+ _cmp(data.byte(kTurndirection), -1);
+ if (flags.z())
goto decdir;
- context.al = context.data.byte(kFacing);
- context._sub(context.al, context.data.byte(kTurntoface));
- if (!context.flags.c())
+ al = data.byte(kFacing);
+ _sub(al, data.byte(kTurntoface));
+ if (!flags.c())
goto higher;
- context._neg(context.al);
- context._cmp(context.al, 4);
- if (!context.flags.c())
+ _neg(al);
+ _cmp(al, 4);
+ if (!flags.c())
goto decdir;
goto incdir;
higher:
- context._cmp(context.al, 4);
- if (!context.flags.c())
+ _cmp(al, 4);
+ if (!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;
+ data.byte(kTurndirection) = 1;
+ al = data.byte(kFacing);
+ _inc(al);
+ _and(al, 7);
+ data.byte(kFacing) = al;
+ es.byte(bx+29) = 0;
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;
-}
-
-void walking(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kLinedirection), 0);
- if (context.flags.z())
+ data.byte(kTurndirection) = -1;
+ al = data.byte(kFacing);
+ _dec(al);
+ _and(al, 7);
+ data.byte(kFacing) = al;
+ es.byte(bx+29) = 0;
+}
+
+void DreamGenContext::walking() {
+ STACK_CHECK;
+ _cmp(data.byte(kLinedirection), 0);
+ if (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())
+ al = data.byte(kLinepointer);
+ _dec(al);
+ data.byte(kLinepointer) = al;
+ _cmp(al, 200);
+ if (!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())
+ al = data.byte(kLinepointer);
+ _inc(al);
+ data.byte(kLinepointer) = al;
+ _cmp(al, data.byte(kLinelength));
+ if (!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();
- context.es.word(context.bx+10) = context.ax;
+ ah = 0;
+ _add(ax, ax);
+ push(es);
+ push(bx);
+ dx = data;
+ es = dx;
+ bx = 8173;
+ _add(bx, ax);
+ ax = es.word(bx);
+ bx = pop();
+ es = pop();
+ es.word(bx+10) = ax;
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())
+ data.byte(kLinepointer) = 254;
+ al = data.byte(kDestination);
+ data.byte(kManspath) = al;
+ _cmp(al, data.byte(kFinaldest));
+ if (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();
+ al = data.byte(kFinaldest);
+ data.byte(kDestination) = al;
+ push(es);
+ push(bx);
+ autosetwalk();
+ bx = pop();
+ es = pop();
return;
finishedwalk:
- facerightway(context);
-}
-
-void facerightway(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void checkforexit(Context &context) {
- STACK_CHECK(context);
- 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())
+ facerightway();
+}
+
+void DreamGenContext::facerightway() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ getroomspaths();
+ al = data.byte(kManspath);
+ ah = 0;
+ _add(ax, ax);
+ _add(ax, ax);
+ _add(ax, ax);
+ _add(bx, ax);
+ al = es.byte(bx+7);
+ data.byte(kTurntoface) = al;
+ data.byte(kLeavedirection) = al;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::checkforexit() {
+ STACK_CHECK;
+ cl = data.byte(kRyanx);
+ _add(cl, 12);
+ ch = data.byte(kRyany);
+ _add(ch, 12);
+ checkone();
+ data.byte(kLastflag) = cl;
+ data.byte(kLastflagex) = ch;
+ data.byte(kFlagx) = dl;
+ data.byte(kFlagy) = dh;
+ al = data.byte(kLastflag);
+ _test(al, 64);
+ if (flags.z())
goto notnewdirect;
- context.al = context.data.byte(kLastflagex);
- context.data.byte(kAutolocation) = context.al;
+ al = data.byte(kLastflagex);
+ data.byte(kAutolocation) = al;
return;
notnewdirect:
- context._test(context.al, 32);
- if (context.flags.z())
+ _test(al, 32);
+ if (flags.z())
goto notleave;
- context.push(context.es);
- context.push(context.bx);
- context._cmp(context.data.byte(kReallocation), 2);
- if (!context.flags.z())
+ push(es);
+ push(bx);
+ _cmp(data.byte(kReallocation), 2);
+ if (!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())
+ bl = 0;
+ push(bx);
+ al = 'W';
+ ah = 'E';
+ cl = 'T';
+ ch = 'A';
+ isryanholding();
+ bx = pop();
+ if (flags.z())
goto noshoe1;
- context._inc(context.bl);
+ _inc(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())
+ push(bx);
+ al = 'W';
+ ah = 'E';
+ cl = 'T';
+ ch = 'B';
+ isryanholding();
+ bx = pop();
+ if (flags.z())
goto noshoe2;
- context._inc(context.bl);
+ _inc(bl);
noshoe2:
- context._cmp(context.bl, 2);
- if (context.flags.z())
+ _cmp(bl, 2);
+ if (flags.z())
goto notlouis;
- context.al = 42;
- context._cmp(context.bl, 0);
- if (context.flags.z())
+ al = 42;
+ _cmp(bl, 0);
+ if (flags.z())
goto notravmessage;
- context._inc(context.al);
+ _inc(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();
+ cx = 80;
+ dx = 10;
+ bl = 68;
+ bh = 64;
+ setuptimeduse();
+ al = data.byte(kFacing);
+ _add(al, 4);
+ _and(al, 7);
+ data.byte(kTurntoface) = al;
+ bx = pop();
+ es = pop();
return;
notlouis:
- context.bx = context.pop();
- context.es = context.pop();
- context.data.byte(kNeedtotravel) = 1;
+ bx = pop();
+ es = pop();
+ data.byte(kNeedtotravel) = 1;
return;
notleave:
- context._test(context.al, 4);
- if (context.flags.z())
+ _test(al, 4);
+ if (flags.z())
goto notaleft;
- adjustleft(context);
+ adjustleft();
return;
notaleft:
- context._test(context.al, 2);
- if (context.flags.z())
+ _test(al, 2);
+ if (flags.z())
goto notaright;
- adjustright(context);
+ adjustright();
return;
notaright:
- context._test(context.al, 8);
- if (context.flags.z())
+ _test(al, 8);
+ if (flags.z())
goto notadown;
- adjustdown(context);
+ adjustdown();
return;
notadown:
- context._test(context.al, 16);
- if (context.flags.z())
+ _test(al, 16);
+ if (flags.z())
return /* (notanup) */;
- adjustup(context);
-}
-
-void adjustdown(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void adjustup(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void adjustleft(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void adjustright(Context &context) {
- STACK_CHECK(context);
- 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();
-}
-
-void reminders(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kReallocation), 24);
- if (!context.flags.z())
+ adjustup();
+}
+
+void DreamGenContext::adjustdown() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ _add(data.byte(kMapy), 10);
+ al = data.byte(kLastflagex);
+ cl = 16;
+ _mul(cl);
+ es.byte(bx+11) = al;
+ data.byte(kNowinnewroom) = 1;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::adjustup() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ _sub(data.byte(kMapy), 10);
+ al = data.byte(kLastflagex);
+ cl = 16;
+ _mul(cl);
+ es.byte(bx+11) = al;
+ data.byte(kNowinnewroom) = 1;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::adjustleft() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ data.byte(kLastflag) = 0;
+ _sub(data.byte(kMapx), 11);
+ al = data.byte(kLastflagex);
+ cl = 16;
+ _mul(cl);
+ es.byte(bx+10) = al;
+ data.byte(kNowinnewroom) = 1;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::adjustright() {
+ STACK_CHECK;
+ push(es);
+ push(bx);
+ _add(data.byte(kMapx), 11);
+ al = data.byte(kLastflagex);
+ cl = 16;
+ _mul(cl);
+ _sub(al, 2);
+ es.byte(bx+10) = al;
+ data.byte(kNowinnewroom) = 1;
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::reminders() {
+ STACK_CHECK;
+ _cmp(data.byte(kReallocation), 24);
+ if (!flags.z())
return /* (notinedenslift) */;
- context._cmp(context.data.byte(kMapx), 44);
- if (!context.flags.z())
+ _cmp(data.byte(kMapx), 44);
+ if (!flags.z())
return /* (notinedenslift) */;
- context._cmp(context.data.byte(kProgresspoints), 0);
- if (!context.flags.z())
+ _cmp(data.byte(kProgresspoints), 0);
+ if (!flags.z())
return /* (notfirst) */;
- context.al = 'D';
- context.ah = 'K';
- context.cl = 'E';
- context.ch = 'Y';
- isryanholding(context);
- if (context.flags.z())
+ al = 'D';
+ ah = 'K';
+ cl = 'E';
+ ch = 'Y';
+ isryanholding();
+ if (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())
+ al = 'C';
+ ah = 'S';
+ cl = 'H';
+ ch = 'R';
+ findexobject();
+ _cmp(al, (114));
+ if (flags.z())
goto forgotone;
- context.ax = context.es.word(context.bx+2);
- context._cmp(context.al, 4);
- if (!context.flags.z())
+ ax = es.word(bx+2);
+ _cmp(al, 4);
+ if (!flags.z())
goto forgotone;
- context._cmp(context.ah, 255);
- if (context.flags.z())
+ _cmp(ah, 255);
+ if (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())
+ cl = 'P';
+ ch = 'U';
+ dl = 'R';
+ dh = 'S';
+ _xchg(al, ah);
+ compare();
+ if (!flags.z())
goto forgotone;
havegotcard:
- context._inc(context.data.byte(kProgresspoints));
+ _inc(data.byte(kProgresspoints));
return;
forgotone:
- context.al = 50;
- context.bl = 54;
- context.bh = 70;
- context.cx = 48;
- context.dx = 8;
- setuptimeduse(context);
-}
-
-void initrain(Context &context) {
- STACK_CHECK(context);
- 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;
+ al = 50;
+ bl = 54;
+ bh = 70;
+ cx = 48;
+ dx = 8;
+ setuptimeduse();
+}
+
+void DreamGenContext::initrain() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ 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));
+ bx = 1113;
checkmorerain:
- context.al = context.cs.byte(context.bx);
- context._cmp(context.al, 255);
- if (context.flags.z())
+ al = cs.byte(bx);
+ _cmp(al, 255);
+ if (flags.z())
goto finishinitrain;
- context._cmp(context.al, context.data.byte(kReallocation));
- if (!context.flags.z())
+ _cmp(al, data.byte(kReallocation));
+ if (!flags.z())
goto checkrain;
- context.al = context.cs.byte(context.bx+1);
- context._cmp(context.al, context.data.byte(kMapx));
- if (!context.flags.z())
+ al = cs.byte(bx+1);
+ _cmp(al, data.byte(kMapx));
+ if (!flags.z())
goto checkrain;
- context.al = context.cs.byte(context.bx+2);
- context._cmp(context.al, context.data.byte(kMapy));
- if (!context.flags.z())
+ al = cs.byte(bx+2);
+ _cmp(al, data.byte(kMapy));
+ if (!flags.z())
goto checkrain;
- context.al = context.cs.byte(context.bx+3);
- context.data.byte(kRainspace) = context.al;
+ al = cs.byte(bx+3);
+ data.byte(kRainspace) = al;
goto dorain;
checkrain:
- context._add(context.bx, 4);
+ _add(bx, 4);
goto checkmorerain;
dorain:
- context.cx = 4;
+ 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())
+ randomnumber();
+ _and(al, 31);
+ _add(al, 3);
+ _cmp(al, data.byte(kRainspace));
+ if (!flags.c())
goto initraintop;
- context._add(context.cl, context.al);
- context._cmp(context.cl, context.data.byte(kMapxsize));
- if (!context.flags.c())
+ _add(cl, al);
+ _cmp(cl, data.byte(kMapxsize));
+ if (!flags.c())
goto initrainside;
- context.push(context.cx);
- splitintolines(context);
- context.cx = context.pop();
+ push(cx);
+ splitintolines();
+ cx = pop();
goto initraintop;
initrainside:
- context.cl = context.data.byte(kMapxsize);
- context._dec(context.cl);
+ cl = data.byte(kMapxsize);
+ _dec(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())
+ randomnumber();
+ _and(al, 31);
+ _add(al, 3);
+ _cmp(al, data.byte(kRainspace));
+ if (!flags.c())
goto initrainside2;
- context._add(context.ch, context.al);
- context._cmp(context.ch, context.data.byte(kMapysize));
- if (!context.flags.c())
+ _add(ch, al);
+ _cmp(ch, data.byte(kMapysize));
+ if (!flags.c())
goto finishinitrain;
- context.push(context.cx);
- splitintolines(context);
- context.cx = context.pop();
+ push(cx);
+ splitintolines();
+ cx = pop();
goto initrainside2;
finishinitrain:
- context.al = 255;
- context._stosb();
+ al = 255;
+ _stosb();
}
-void splitintolines(Context &context) {
- STACK_CHECK(context);
+void DreamGenContext::splitintolines() {
+ STACK_CHECK;
lookforlinestart:
- getblockofpixel(context);
- context._cmp(context.al, 0);
- if (!context.flags.z())
+ getblockofpixel();
+ _cmp(al, 0);
+ if (!flags.z())
goto foundlinestart;
- context._dec(context.cl);
- context._inc(context.ch);
- context._cmp(context.cl, 0);
- if (context.flags.z())
+ _dec(cl);
+ _inc(ch);
+ _cmp(cl, 0);
+ if (flags.z())
return /* (endofthisline) */;
- context._cmp(context.ch, context.data.byte(kMapysize));
- if (!context.flags.c())
+ _cmp(ch, data.byte(kMapysize));
+ if (!flags.c())
return /* (endofthisline) */;
goto lookforlinestart;
foundlinestart:
- context.es.word(context.di) = context.cx;
- context.bh = 1;
+ es.word(di) = cx;
+ bh = 1;
lookforlineend:
- getblockofpixel(context);
- context._cmp(context.al, 0);
- if (context.flags.z())
+ getblockofpixel();
+ _cmp(al, 0);
+ if (flags.z())
goto foundlineend;
- context._dec(context.cl);
- context._inc(context.ch);
- context._cmp(context.cl, 0);
- if (context.flags.z())
+ _dec(cl);
+ _inc(ch);
+ _cmp(cl, 0);
+ if (flags.z())
goto foundlineend;
- context._cmp(context.ch, context.data.byte(kMapysize));
- if (!context.flags.c())
+ _cmp(ch, data.byte(kMapysize));
+ if (!flags.c())
goto foundlineend;
- context._inc(context.bh);
+ _inc(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())
+ push(cx);
+ es.byte(di+2) = bh;
+ randomnumber();
+ es.byte(di+3) = al;
+ randomnumber();
+ es.byte(di+4) = al;
+ randomnumber();
+ _and(al, 3);
+ _add(al, 4);
+ es.byte(di+5) = al;
+ _add(di, 6);
+ cx = pop();
+ _cmp(cl, 0);
+ if (flags.z())
return /* (endofthisline) */;
- context._cmp(context.ch, context.data.byte(kMapysize));
- if (!context.flags.c())
+ _cmp(ch, data.byte(kMapysize));
+ if (!flags.c())
return /* (endofthisline) */;
goto lookforlinestart;
}
-void getblockofpixel(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::getblockofpixel() {
+ STACK_CHECK;
+ push(cx);
+ push(es);
+ push(di);
+ ax = data.word(kMapxstart);
+ _add(cl, al);
+ ax = data.word(kMapystart);
+ _add(ch, al);
+ checkone();
+ _and(cl, 1);
+ if (!flags.z())
goto failrain;
- context.di = context.pop();
- context.es = context.pop();
- context.cx = context.pop();
+ di = pop();
+ es = pop();
+ cx = pop();
return;
failrain:
- context.di = context.pop();
- context.es = context.pop();
- context.cx = context.pop();
- context.al = 0;
-}
-
-void showrain(Context &context) {
- STACK_CHECK(context);
- 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())
+ di = pop();
+ es = pop();
+ cx = pop();
+ al = 0;
+}
+
+void DreamGenContext::showrain() {
+ STACK_CHECK;
+ ds = data.word(kMainsprites);
+ si = 6*58;
+ ax = ds.word(si+2);
+ si = ax;
+ _add(si, 2080);
+ 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));
+ es = data.word(kBuffers);
+ _cmp(es.byte(bx), 255);
+ if (flags.z())
return /* (nothunder) */;
morerain:
- context.es = context.data.word(kBuffers);
- context._cmp(context.es.byte(context.bx), 255);
- if (context.flags.z())
+ es = data.word(kBuffers);
+ _cmp(es.byte(bx), 255);
+ if (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;
+ al = es.byte(bx+1);
+ ah = 0;
+ _add(ax, data.word(kMapady));
+ _add(ax, data.word(kMapystart));
+ cx = 320;
+ _mul(cx);
+ cl = es.byte(bx);
+ ch = 0;
+ _add(ax, cx);
+ _add(ax, data.word(kMapadx));
+ _add(ax, data.word(kMapxstart));
+ di = ax;
+ cl = es.byte(bx+2);
+ ch = 0;
+ ax = es.word(bx+3);
+ dl = es.byte(bx+5);
+ dh = 0;
+ _sub(ax, dx);
+ _and(ax, 511);
+ es.word(bx+3) = ax;
+ _add(bx, 6);
+ push(si);
+ _add(si, ax);
+ es = data.word(kWorkspace);
+ ah = 0;
+ dx = 320-2;
rainloop:
- context._lodsb();
- context._cmp(context.al, context.ah);
- if (context.flags.z())
+ _lodsb();
+ _cmp(al, ah);
+ if (flags.z())
goto noplot;
- context._stosb();
- context._add(context.di, context.dx);
- if (--context.cx)
+ _stosb();
+ _add(di, dx);
+ if (--cx)
goto rainloop;
- context.si = context.pop();
+ si = pop();
goto morerain;
noplot:
- context._add(context.di, 320-1);
- if (--context.cx)
+ _add(di, 320-1);
+ if (--cx)
goto rainloop;
- context.si = context.pop();
+ si = pop();
goto morerain;
finishrain:
- context._cmp(context.data.word(kCh1blockstocopy), 0);
- if (!context.flags.z())
+ _cmp(data.word(kCh1blockstocopy), 0);
+ if (!flags.z())
return /* (nothunder) */;
- context._cmp(context.data.byte(kReallocation), 2);
- if (!context.flags.z())
+ _cmp(data.byte(kReallocation), 2);
+ if (!flags.z())
goto notlouisthund;
- context._cmp(context.data.byte(kBeenmugged), 1);
- if (!context.flags.z())
+ _cmp(data.byte(kBeenmugged), 1);
+ if (!flags.z())
return /* (nothunder) */;
notlouisthund:
- context._cmp(context.data.byte(kReallocation), 55);
- if (context.flags.z())
+ _cmp(data.byte(kReallocation), 55);
+ if (flags.z())
return /* (nothunder) */;
- randomnum1(context);
- context._cmp(context.al, 1);
- if (!context.flags.c())
+ randomnum1();
+ _cmp(al, 1);
+ if (!flags.c())
return /* (nothunder) */;
- context.al = 7;
- context._cmp(context.data.byte(kCh0playing), 6);
- if (context.flags.z())
+ al = 7;
+ _cmp(data.byte(kCh0playing), 6);
+ if (flags.z())
goto isthunder1;
- context.al = 4;
+ al = 4;
isthunder1:
- playchannel1(context);
+ playchannel1();
}
-void backobject(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::backobject() {
+ STACK_CHECK;
+ ds = data.word(kSetdat);
+ di = es.word(bx+20);
+ al = es.byte(bx+18);
+ _cmp(al, 0);
+ if (flags.z())
goto _tmp48z;
- context._dec(context.al);
- context.es.byte(context.bx+18) = context.al;
+ _dec(al);
+ es.byte(bx+18) = al;
return /* (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())
+ al = ds.byte(di+7);
+ es.byte(bx+18) = al;
+ al = ds.byte(di+8);
+ _cmp(al, 6);
+ if (!flags.z())
goto notwidedoor;
- widedoor(context);
+ widedoor();
return /* (finishback) */;
notwidedoor:
- context._cmp(context.al, 5);
- if (!context.flags.z())
+ _cmp(al, 5);
+ if (!flags.z())
goto notrandom;
- random(context);
+ random();
return /* (finishback) */;
notrandom:
- context._cmp(context.al, 4);
- if (!context.flags.z())
+ _cmp(al, 4);
+ if (!flags.z())
goto notlockdoor;
- lockeddoorway(context);
+ lockeddoorway();
return /* (finishback) */;
notlockdoor:
- context._cmp(context.al, 3);
- if (!context.flags.z())
+ _cmp(al, 3);
+ if (!flags.z())
goto notlift;
- liftsprite(context);
+ liftsprite();
return /* (finishback) */;
notlift:
- context._cmp(context.al, 2);
- if (!context.flags.z())
+ _cmp(al, 2);
+ if (!flags.z())
goto notdoor;
- doorway(context);
+ doorway();
return /* (finishback) */;
notdoor:
- context._cmp(context.al, 1);
- if (!context.flags.z())
+ _cmp(al, 1);
+ if (!flags.z())
goto steadyob;
- constant(context);
+ constant();
return /* (finishback) */;
steadyob:
- steady(context);
+ steady();
}
-void liftsprite(Context &context) {
- STACK_CHECK(context);
- context.al = context.data.byte(kLiftflag);
- context._cmp(context.al, 0);
- if (context.flags.z())
+void DreamGenContext::liftsprite() {
+ STACK_CHECK;
+ al = data.byte(kLiftflag);
+ _cmp(al, 0);
+ if (flags.z())
goto liftclosed;
- context._cmp(context.al, 1);
- if (context.flags.z())
+ _cmp(al, 1);
+ if (flags.z())
goto liftopen;
- context._cmp(context.al, 3);
- if (context.flags.z())
+ _cmp(al, 3);
+ if (flags.z())
goto openlift;
- context.al = context.es.byte(context.bx+19);
- context._cmp(context.al, 0);
- if (context.flags.z())
+ al = es.byte(bx+19);
+ _cmp(al, 0);
+ if (flags.z())
goto finishclose;
- context._dec(context.al);
- context._cmp(context.al, 11);
- if (!context.flags.z())
+ _dec(al);
+ _cmp(al, 11);
+ if (!flags.z())
goto pokelift;
- context.push(context.ax);
- context.al = 3;
- liftnoise(context);
- context.ax = context.pop();
+ push(ax);
+ al = 3;
+ liftnoise();
+ ax = pop();
goto pokelift;
finishclose:
- context.data.byte(kLiftflag) = 0;
+ data.byte(kLiftflag) = 0;
return;
openlift:
- context.al = context.es.byte(context.bx+19);
- context._cmp(context.al, 12);
- if (context.flags.z())
+ al = es.byte(bx+19);
+ _cmp(al, 12);
+ if (flags.z())
goto endoflist;
- context._inc(context.al);
- context._cmp(context.al, 1);
- if (!context.flags.z())
+ _inc(al);
+ _cmp(al, 1);
+ if (!flags.z())
goto pokelift;
- context.push(context.ax);
- context.al = 2;
- liftnoise(context);
- context.ax = context.pop();
+ push(ax);
+ al = 2;
+ liftnoise();
+ ax = 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;
+ es.byte(bx+19) = al;
+ ah = 0;
+ push(di);
+ _add(di, ax);
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
return;
endoflist:
- context.data.byte(kLiftflag) = 1;
+ data.byte(kLiftflag) = 1;
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())
+ al = data.byte(kLiftpath);
+ push(es);
+ push(bx);
+ turnpathon();
+ bx = pop();
+ es = pop();
+ _cmp(data.byte(kCounttoclose), 0);
+ if (flags.z())
goto nocountclose;
- context._dec(context.data.byte(kCounttoclose));
- context._cmp(context.data.byte(kCounttoclose), 0);
- if (!context.flags.z())
+ _dec(data.byte(kCounttoclose));
+ _cmp(data.byte(kCounttoclose), 0);
+ if (!flags.z())
goto nocountclose;
- context.data.byte(kLiftflag) = 2;
+ data.byte(kLiftflag) = 2;
nocountclose:
- context.al = 12;
+ 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())
+ al = data.byte(kLiftpath);
+ push(es);
+ push(bx);
+ turnpathoff();
+ bx = pop();
+ es = pop();
+ _cmp(data.byte(kCounttoopen), 0);
+ if (flags.z())
goto nocountopen;
- context._dec(context.data.byte(kCounttoopen));
- context._cmp(context.data.byte(kCounttoopen), 0);
- if (!context.flags.z())
+ _dec(data.byte(kCounttoopen));
+ _cmp(data.byte(kCounttoopen), 0);
+ if (!flags.z())
goto nocountopen;
- context.data.byte(kLiftflag) = 3;
+ data.byte(kLiftflag) = 3;
nocountopen:
- context.al = 0;
+ al = 0;
goto pokelift;
}
-void liftnoise(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kReallocation), 5);
- if (context.flags.z())
+void DreamGenContext::liftnoise() {
+ STACK_CHECK;
+ _cmp(data.byte(kReallocation), 5);
+ if (flags.z())
goto hissnoise;
- context._cmp(context.data.byte(kReallocation), 21);
- if (context.flags.z())
+ _cmp(data.byte(kReallocation), 21);
+ if (flags.z())
goto hissnoise;
- playchannel1(context);
+ playchannel1();
return;
hissnoise:
- context.al = 13;
- playchannel1(context);
-}
-
-void random(Context &context) {
- STACK_CHECK(context);
- 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;
-}
-
-void steady(Context &context) {
- STACK_CHECK(context);
- context.al = context.ds.byte(context.di+18);
- context.ds.byte(context.di+17) = context.al;
- context.es.byte(context.bx+15) = context.al;
-}
-
-void constant(Context &context) {
- STACK_CHECK(context);
- 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())
+ al = 13;
+ playchannel1();
+}
+
+void DreamGenContext::random() {
+ STACK_CHECK;
+ randomnum1();
+ push(di);
+ _and(ax, 7);
+ _add(di, 18);
+ _add(di, ax);
+ al = ds.byte(di);
+ di = pop();
+ es.byte(bx+15) = al;
+}
+
+void DreamGenContext::steady() {
+ STACK_CHECK;
+ al = ds.byte(di+18);
+ ds.byte(di+17) = al;
+ es.byte(bx+15) = al;
+}
+
+void DreamGenContext::constant() {
+ STACK_CHECK;
+ _inc(es.byte(bx+19));
+ cl = es.byte(bx+19);
+ ch = 0;
+ _add(di, cx);
+ _cmp(ds.byte(di+18), 255);
+ if (!flags.z())
goto gotconst;
- context._sub(context.di, context.cx);
- context.cx = 0;
- context.es.byte(context.bx+19) = context.cl;
+ _sub(di, cx);
+ cx = 0;
+ es.byte(bx+19) = 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;
-}
-
-void doorway(Context &context) {
- STACK_CHECK(context);
- context.data.byte(kDoorcheck1) = -24;
- context.data.byte(kDoorcheck2) = 10;
- context.data.byte(kDoorcheck3) = -30;
- context.data.byte(kDoorcheck4) = 10;
- dodoor(context);
-}
-
-void widedoor(Context &context) {
- STACK_CHECK(context);
- context.data.byte(kDoorcheck1) = -24;
- context.data.byte(kDoorcheck2) = 24;
- context.data.byte(kDoorcheck3) = -30;
- context.data.byte(kDoorcheck4) = 24;
- dodoor(context);
-}
-
-void dodoor(Context &context) {
- STACK_CHECK(context);
- 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())
+ al = ds.byte(di+18);
+ _sub(di, cx);
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+}
+
+void DreamGenContext::doorway() {
+ STACK_CHECK;
+ data.byte(kDoorcheck1) = -24;
+ data.byte(kDoorcheck2) = 10;
+ data.byte(kDoorcheck3) = -30;
+ data.byte(kDoorcheck4) = 10;
+ dodoor();
+}
+
+void DreamGenContext::widedoor() {
+ STACK_CHECK;
+ data.byte(kDoorcheck1) = -24;
+ data.byte(kDoorcheck2) = 24;
+ data.byte(kDoorcheck3) = -30;
+ data.byte(kDoorcheck4) = 24;
+ dodoor();
+}
+
+void DreamGenContext::dodoor() {
+ STACK_CHECK;
+ al = data.byte(kRyanx);
+ ah = data.byte(kRyany);
+ cl = es.byte(bx+10);
+ ch = es.byte(bx+11);
+ _cmp(al, cl);
+ if (!flags.c())
goto rtofdoor;
- context._sub(context.al, context.cl);
- context._cmp(context.al, context.data.byte(kDoorcheck1));
- if (!context.flags.c())
+ _sub(al, cl);
+ _cmp(al, data.byte(kDoorcheck1));
+ if (!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())
+ _sub(al, cl);
+ _cmp(al, data.byte(kDoorcheck2));
+ if (!flags.c())
goto shutdoor;
upordown:
- context._cmp(context.ah, context.ch);
- if (!context.flags.c())
+ _cmp(ah, ch);
+ if (!flags.c())
goto botofdoor;
- context._sub(context.ah, context.ch);
- context._cmp(context.ah, context.data.byte(kDoorcheck3));
- if (context.flags.c())
+ _sub(ah, ch);
+ _cmp(ah, data.byte(kDoorcheck3));
+ if (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())
+ _sub(ah, ch);
+ _cmp(ah, data.byte(kDoorcheck4));
+ if (!flags.c())
goto shutdoor;
opendoor:
- context.cl = context.es.byte(context.bx+19);
- context._cmp(context.data.byte(kThroughdoor), 1);
- if (!context.flags.z())
+ cl = es.byte(bx+19);
+ _cmp(data.byte(kThroughdoor), 1);
+ if (!flags.z())
goto notthrough;
- context._cmp(context.cl, 0);
- if (!context.flags.z())
+ _cmp(cl, 0);
+ if (!flags.z())
goto notthrough;
- context.cl = 6;
+ cl = 6;
notthrough:
- context._inc(context.cl);
- context._cmp(context.cl, 1);
- if (!context.flags.z())
+ _inc(cl);
+ _cmp(cl, 1);
+ if (!flags.z())
goto notdoorsound2;
- context.al = 0;
- context._cmp(context.data.byte(kReallocation), 5);
- if (!context.flags.z())
+ al = 0;
+ _cmp(data.byte(kReallocation), 5);
+ if (!flags.z())
goto nothoteldoor2;
- context.al = 13;
+ al = 13;
nothoteldoor2:
- playchannel1(context);
+ playchannel1();
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())
+ ch = 0;
+ push(di);
+ _add(di, cx);
+ al = ds.byte(di+18);
+ _cmp(al, 255);
+ if (!flags.z())
goto atlast1;
- context._dec(context.di);
- context._dec(context.cl);
+ _dec(di);
+ _dec(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;
+ es.byte(bx+19) = cl;
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+ data.byte(kThroughdoor) = 1;
return;
shutdoor:
- context.cl = context.es.byte(context.bx+19);
- context._cmp(context.cl, 5);
- if (!context.flags.z())
+ cl = es.byte(bx+19);
+ _cmp(cl, 5);
+ if (!flags.z())
goto notdoorsound1;
- context.al = 1;
- context._cmp(context.data.byte(kReallocation), 5);
- if (!context.flags.z())
+ al = 1;
+ _cmp(data.byte(kReallocation), 5);
+ if (!flags.z())
goto nothoteldoor1;
- context.al = 13;
+ al = 13;
nothoteldoor1:
- playchannel1(context);
+ playchannel1();
notdoorsound1:
- context._cmp(context.cl, 0);
- if (context.flags.z())
+ _cmp(cl, 0);
+ if (flags.z())
goto atlast2;
- context._dec(context.cl);
- context.es.byte(context.bx+19) = context.cl;
+ _dec(cl);
+ es.byte(bx+19) = 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())
+ ch = 0;
+ push(di);
+ _add(di, cx);
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+ _cmp(cl, 5);
+ if (!flags.z())
return /* (notnearly) */;
- context.data.byte(kThroughdoor) = 0;
+ data.byte(kThroughdoor) = 0;
}
-void lockeddoorway(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::lockeddoorway() {
+ STACK_CHECK;
+ al = data.byte(kRyanx);
+ ah = data.byte(kRyany);
+ cl = es.byte(bx+10);
+ ch = es.byte(bx+11);
+ _cmp(al, cl);
+ if (!flags.c())
goto rtofdoor2;
- context._sub(context.al, context.cl);
- context._cmp(context.al, -24);
- if (!context.flags.c())
+ _sub(al, cl);
+ _cmp(al, -24);
+ if (!flags.c())
goto upordown2;
goto shutdoor2;
rtofdoor2:
- context._sub(context.al, context.cl);
- context._cmp(context.al, 10);
- if (!context.flags.c())
+ _sub(al, cl);
+ _cmp(al, 10);
+ if (!flags.c())
goto shutdoor2;
upordown2:
- context._cmp(context.ah, context.ch);
- if (!context.flags.c())
+ _cmp(ah, ch);
+ if (!flags.c())
goto botofdoor2;
- context._sub(context.ah, context.ch);
- context._cmp(context.ah, -30);
- if (context.flags.c())
+ _sub(ah, ch);
+ _cmp(ah, -30);
+ if (flags.c())
goto shutdoor2;
goto opendoor2;
botofdoor2:
- context._sub(context.ah, context.ch);
- context._cmp(context.ah, 12);
- if (!context.flags.c())
+ _sub(ah, ch);
+ _cmp(ah, 12);
+ if (!flags.c())
goto shutdoor2;
opendoor2:
- context._cmp(context.data.byte(kThroughdoor), 1);
- if (context.flags.z())
+ _cmp(data.byte(kThroughdoor), 1);
+ if (flags.z())
goto mustbeopen;
- context._cmp(context.data.byte(kLockstatus), 1);
- if (context.flags.z())
+ _cmp(data.byte(kLockstatus), 1);
+ if (flags.z())
goto shutdoor;
mustbeopen:
- context.cl = context.es.byte(context.bx+19);
- context._cmp(context.cl, 1);
- if (!context.flags.z())
+ cl = es.byte(bx+19);
+ _cmp(cl, 1);
+ if (!flags.z())
goto notdoorsound4;
- context.al = 0;
- playchannel1(context);
+ al = 0;
+ playchannel1();
notdoorsound4:
- context._cmp(context.cl, 6);
- if (!context.flags.z())
+ _cmp(cl, 6);
+ if (!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();
+ al = data.byte(kDoorpath);
+ push(es);
+ push(bx);
+ turnpathon();
+ bx = pop();
+ es = pop();
noturnonyet:
- context.cl = context.es.byte(context.bx+19);
- context._cmp(context.data.byte(kThroughdoor), 1);
- if (!context.flags.z())
+ cl = es.byte(bx+19);
+ _cmp(data.byte(kThroughdoor), 1);
+ if (!flags.z())
goto notthrough2;
- context._cmp(context.cl, 0);
- if (!context.flags.z())
+ _cmp(cl, 0);
+ if (!flags.z())
goto notthrough2;
- context.cl = 6;
+ 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())
+ _inc(cl);
+ ch = 0;
+ push(di);
+ _add(di, cx);
+ al = ds.byte(di+18);
+ _cmp(al, 255);
+ if (!flags.z())
goto atlast3;
- context._dec(context.di);
- context._dec(context.cl);
+ _dec(di);
+ _dec(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())
+ es.byte(bx+19) = cl;
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+ _cmp(cl, 5);
+ if (!flags.z())
return /* (justshutting) */;
- context.data.byte(kThroughdoor) = 1;
+ data.byte(kThroughdoor) = 1;
return;
shutdoor2:
- context.cl = context.es.byte(context.bx+19);
- context._cmp(context.cl, 5);
- if (!context.flags.z())
+ cl = es.byte(bx+19);
+ _cmp(cl, 5);
+ if (!flags.z())
goto notdoorsound3;
- context.al = 1;
- playchannel1(context);
+ al = 1;
+ playchannel1();
notdoorsound3:
- context._cmp(context.cl, 0);
- if (context.flags.z())
+ _cmp(cl, 0);
+ if (flags.z())
goto atlast4;
- context._dec(context.cl);
- context.es.byte(context.bx+19) = context.cl;
+ _dec(cl);
+ es.byte(bx+19) = 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())
+ ch = 0;
+ data.byte(kThroughdoor) = 0;
+ push(di);
+ _add(di, cx);
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+ _cmp(cl, 0);
+ if (!flags.z())
return /* (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;
+ al = data.byte(kDoorpath);
+ push(es);
+ push(bx);
+ turnpathoff();
+ bx = pop();
+ es = pop();
+ data.byte(kLockstatus) = 1;
/*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())
+ cl = es.byte(bx+19);
+ _cmp(cl, 5);
+ if (!flags.z())
goto notdoorsound1;
- context.al = 1;
- context._cmp(context.data.byte(kReallocation), 5);
- if (!context.flags.z())
+ al = 1;
+ _cmp(data.byte(kReallocation), 5);
+ if (!flags.z())
goto nothoteldoor1;
- context.al = 13;
+ al = 13;
nothoteldoor1:
- playchannel1(context);
+ playchannel1();
notdoorsound1:
- context._cmp(context.cl, 0);
- if (context.flags.z())
+ _cmp(cl, 0);
+ if (flags.z())
goto atlast2;
- context._dec(context.cl);
- context.es.byte(context.bx+19) = context.cl;
+ _dec(cl);
+ es.byte(bx+19) = 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())
+ ch = 0;
+ push(di);
+ _add(di, cx);
+ al = ds.byte(di+18);
+ di = pop();
+ es.byte(bx+15) = al;
+ ds.byte(di+17) = al;
+ _cmp(cl, 5);
+ if (!flags.z())
return /* (notnearly) */;
- context.data.byte(kThroughdoor) = 0;
-}
-
-void updatepeople(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- context._inc(context.data.word(kMaintimer));
- context.es = context.cs;
- context.bx = 534;
- context.di = 991;
+ data.byte(kThroughdoor) = 0;
+}
+
+void DreamGenContext::updatepeople() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5));
+ data.word(kListpos) = di;
+ cx = 12*5;
+ al = 255;
+ _stosb(cx);
+ _inc(data.word(kMaintimer));
+ es = cs;
+ bx = 534;
+ di = 991;
updateloop:
- context.al = context.es.byte(context.bx);
- context._cmp(context.al, 255);
- if (context.flags.z())
+ al = es.byte(bx);
+ _cmp(al, 255);
+ if (flags.z())
return /* (endupdate) */;
- context._cmp(context.al, context.data.byte(kReallocation));
- if (!context.flags.z())
+ _cmp(al, data.byte(kReallocation));
+ if (!flags.z())
goto notinthisroom;
- context.cx = context.es.word(context.bx+1);
- context._cmp(context.cl, context.data.byte(kMapx));
- if (!context.flags.z())
+ cx = es.word(bx+1);
+ _cmp(cl, data.byte(kMapx));
+ if (!flags.z())
goto notinthisroom;
- context._cmp(context.ch, context.data.byte(kMapy));
- if (!context.flags.z())
+ _cmp(ch, data.byte(kMapy));
+ if (!flags.z())
goto notinthisroom;
- context.push(context.di);
- context.ax = context.cs.word(context.di);
- __dispatch_call(context, context.ax);
- context.di = context.pop();
+ push(di);
+ ax = cs.word(di);
+ __dispatch_call(ax);
+ di = pop();
notinthisroom:
- context._add(context.bx, 8);
- context._add(context.di, 2);
+ _add(bx, 8);
+ _add(di, 2);
goto updateloop;
}
-void getreelframeax(Context &context) {
- STACK_CHECK(context);
- 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;
-}
-
-void reelsonscreen(Context &context) {
- STACK_CHECK(context);
- reconstruct(context);
- updatepeople(context);
- watchreel(context);
- showrain(context);
- usetimedtext(context);
-}
-
-void plotreel(Context &context) {
- STACK_CHECK(context);
- getreelstart(context);
+void DreamGenContext::getreelframeax() {
+ STACK_CHECK;
+ push(ds);
+ data.word(kCurrentframe) = ax;
+ findsource();
+ es = ds;
+ ds = pop();
+ ax = data.word(kCurrentframe);
+ _sub(ax, data.word(kTakeoff));
+ _add(ax, ax);
+ cx = ax;
+ _add(ax, ax);
+ _add(ax, cx);
+ bx = ax;
+}
+
+void DreamGenContext::reelsonscreen() {
+ STACK_CHECK;
+ reconstruct();
+ updatepeople();
+ watchreel();
+ showrain();
+ usetimedtext();
+}
+
+void DreamGenContext::plotreel() {
+ STACK_CHECK;
+ getreelstart();
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())
+ push(es);
+ push(si);
+ ax = es.word(si+2);
+ _cmp(al, 220);
+ if (flags.c())
goto normalreel;
- context._cmp(context.al, 255);
- if (context.flags.z())
+ _cmp(al, 255);
+ if (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);
+ dealwithspecial();
+ _inc(data.word(kReelpointer));
+ si = pop();
+ es = pop();
+ _add(si, 40);
goto retryreel;
normalreel:
- context.cx = 8;
+ 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())
+ push(cx);
+ push(es);
+ push(si);
+ ax = es.word(si);
+ _cmp(ax, 0x0ffff);
+ if (flags.z())
goto notplot;
- showreelframe(context);
+ showreelframe();
notplot:
- context.si = context.pop();
- context.es = context.pop();
- context.cx = context.pop();
- context._add(context.si, 5);
- if (--context.cx)
+ si = pop();
+ es = pop();
+ cx = pop();
+ _add(si, 5);
+ if (--cx)
goto plotloop;
- soundonreels(context);
- context.bx = context.pop();
- context.es = context.pop();
-}
-
-void soundonreels(Context &context) {
- STACK_CHECK(context);
- 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);
+ soundonreels();
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::soundonreels() {
+ STACK_CHECK;
+ bl = data.byte(kReallocation);
+ _add(bl, bl);
+ _xor(bh, bh);
+ _add(bx, 1214);
+ si = cs.word(bx);
reelsoundloop:
- context.al = context.cs.byte(context.si);
- context._cmp(context.al, 255);
- if (context.flags.z())
+ al = cs.byte(si);
+ _cmp(al, 255);
+ if (flags.z())
goto endreelsound;
- context.ax = context.cs.word(context.si+1);
- context._cmp(context.ax, context.data.word(kReelpointer));
- if (!context.flags.z())
+ ax = cs.word(si+1);
+ _cmp(ax, data.word(kReelpointer));
+ if (!flags.z())
goto skipreelsound;
- context._cmp(context.ax, context.data.word(kLastsoundreel));
- if (context.flags.z())
+ _cmp(ax, data.word(kLastsoundreel));
+ if (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())
+ data.word(kLastsoundreel) = ax;
+ al = cs.byte(si);
+ _cmp(al, 64);
+ if (flags.c())
+ { playchannel1(); return; };
+ _cmp(al, 128);
+ if (flags.c())
goto channel0once;
- context._and(context.al, 63);
- context.ah = 255;
- { playchannel0(context); return; };
+ _and(al, 63);
+ ah = 255;
+ { playchannel0(); return; };
channel0once:
- context._and(context.al, 63);
- context.ah = 0;
- { playchannel0(context); return; };
+ _and(al, 63);
+ ah = 0;
+ { playchannel0(); return; };
skipreelsound:
- context._add(context.si, 3);
+ _add(si, 3);
goto reelsoundloop;
endreelsound:
- context.ax = context.data.word(kLastsoundreel);
- context._cmp(context.ax, context.data.word(kReelpointer));
- if (context.flags.z())
+ ax = data.word(kLastsoundreel);
+ _cmp(ax, data.word(kReelpointer));
+ if (flags.z())
return /* (nochange2) */;
- context.data.word(kLastsoundreel) = -1;
+ data.word(kLastsoundreel) = -1;
}
-void reconstruct(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kHavedoneobs), 0);
- if (context.flags.z())
+void DreamGenContext::reconstruct() {
+ STACK_CHECK;
+ _cmp(data.byte(kHavedoneobs), 0);
+ if (flags.z())
return /* (noneedtorecon) */;
- context.data.byte(kNewobs) = 1;
- drawfloor(context);
- spriteupdate(context);
- printsprites(context);
- context.data.byte(kHavedoneobs) = 0;
-}
-
-void dealwithspecial(Context &context) {
- STACK_CHECK(context);
- context._sub(context.al, 220);
- context._cmp(context.al, 0);
- if (!context.flags.z())
+ data.byte(kNewobs) = 1;
+ drawfloor();
+ spriteupdate();
+ printsprites();
+ data.byte(kHavedoneobs) = 0;
+}
+
+void DreamGenContext::dealwithspecial() {
+ STACK_CHECK;
+ _sub(al, 220);
+ _cmp(al, 0);
+ if (!flags.z())
goto notplset;
- context.al = context.ah;
- placesetobject(context);
- context.data.byte(kHavedoneobs) = 1;
+ al = ah;
+ placesetobject();
+ data.byte(kHavedoneobs) = 1;
return;
notplset:
- context._cmp(context.al, 1);
- if (!context.flags.z())
+ _cmp(al, 1);
+ if (!flags.z())
goto notremset;
- context.al = context.ah;
- removesetobject(context);
- context.data.byte(kHavedoneobs) = 1;
+ al = ah;
+ removesetobject();
+ data.byte(kHavedoneobs) = 1;
return;
notremset:
- context._cmp(context.al, 2);
- if (!context.flags.z())
+ _cmp(al, 2);
+ if (!flags.z())
goto notplfree;
- context.al = context.ah;
- placefreeobject(context);
- context.data.byte(kHavedoneobs) = 1;
+ al = ah;
+ placefreeobject();
+ data.byte(kHavedoneobs) = 1;
return;
notplfree:
- context._cmp(context.al, 3);
- if (!context.flags.z())
+ _cmp(al, 3);
+ if (!flags.z())
goto notremfree;
- context.al = context.ah;
- removefreeobject(context);
- context.data.byte(kHavedoneobs) = 1;
+ al = ah;
+ removefreeobject();
+ data.byte(kHavedoneobs) = 1;
return;
notremfree:
- context._cmp(context.al, 4);
- if (!context.flags.z())
+ _cmp(al, 4);
+ if (!flags.z())
goto notryanoff;
- switchryanoff(context);
+ switchryanoff();
return;
notryanoff:
- context._cmp(context.al, 5);
- if (!context.flags.z())
+ _cmp(al, 5);
+ if (!flags.z())
goto notryanon;
- context.data.byte(kTurntoface) = context.ah;
- context.data.byte(kFacing) = context.ah;
- switchryanon(context);
+ data.byte(kTurntoface) = ah;
+ data.byte(kFacing) = ah;
+ switchryanon();
return;
notryanon:
- context._cmp(context.al, 6);
- if (!context.flags.z())
+ _cmp(al, 6);
+ if (!flags.z())
goto notchangeloc;
- context.data.byte(kNewlocation) = context.ah;
+ data.byte(kNewlocation) = ah;
return;
notchangeloc:
- movemap(context);
+ movemap();
}
-void movemap(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.ah, 32);
- if (!context.flags.z())
+void DreamGenContext::movemap() {
+ STACK_CHECK;
+ _cmp(ah, 32);
+ if (!flags.z())
goto notmapup2;
- context._sub(context.data.byte(kMapy), 20);
- context.data.byte(kNowinnewroom) = 1;
+ _sub(data.byte(kMapy), 20);
+ data.byte(kNowinnewroom) = 1;
return;
notmapup2:
- context._cmp(context.ah, 16);
- if (!context.flags.z())
+ _cmp(ah, 16);
+ if (!flags.z())
goto notmapupspec;
- context._sub(context.data.byte(kMapy), 10);
- context.data.byte(kNowinnewroom) = 1;
+ _sub(data.byte(kMapy), 10);
+ data.byte(kNowinnewroom) = 1;
return;
notmapupspec:
- context._cmp(context.ah, 8);
- if (!context.flags.z())
+ _cmp(ah, 8);
+ if (!flags.z())
goto notmapdownspec;
- context._add(context.data.byte(kMapy), 10);
- context.data.byte(kNowinnewroom) = 1;
+ _add(data.byte(kMapy), 10);
+ data.byte(kNowinnewroom) = 1;
return;
notmapdownspec:
- context._cmp(context.ah, 2);
- if (!context.flags.z())
+ _cmp(ah, 2);
+ if (!flags.z())
goto notmaprightspec;
- context._add(context.data.byte(kMapx), 11);
- context.data.byte(kNowinnewroom) = 1;
+ _add(data.byte(kMapx), 11);
+ data.byte(kNowinnewroom) = 1;
return;
notmaprightspec:
- context._sub(context.data.byte(kMapx), 11);
- context.data.byte(kNowinnewroom) = 1;
-}
-
-void getreelstart(Context &context) {
- STACK_CHECK(context);
- 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)));
-}
-
-void showreelframe(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void deleverything(Context &context) {
- STACK_CHECK(context);
- 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())
+ _sub(data.byte(kMapx), 11);
+ data.byte(kNowinnewroom) = 1;
+}
+
+void DreamGenContext::getreelstart() {
+ STACK_CHECK;
+ ax = data.word(kReelpointer);
+ cx = 40;
+ _mul(cx);
+ es = data.word(kReels);
+ si = ax;
+ _add(si, (0+(36*144)));
+}
+
+void DreamGenContext::showreelframe() {
+ STACK_CHECK;
+ al = es.byte(si+2);
+ ah = 0;
+ di = ax;
+ _add(di, data.word(kMapadx));
+ al = es.byte(si+3);
+ bx = ax;
+ _add(bx, data.word(kMapady));
+ ax = es.word(si);
+ data.word(kCurrentframe) = ax;
+ findsource();
+ ax = data.word(kCurrentframe);
+ _sub(ax, data.word(kTakeoff));
+ ah = 8;
+ showframe();
+}
+
+void DreamGenContext::deleverything() {
+ STACK_CHECK;
+ al = data.byte(kMapysize);
+ ah = 0;
+ _add(ax, data.word(kMapoffsety));
+ _cmp(ax, 182);
+ if (!flags.c())
goto bigroom;
- maptopanel(context);
+ maptopanel();
return;
bigroom:
- context._sub(context.data.byte(kMapysize), 8);
- maptopanel(context);
- context._add(context.data.byte(kMapysize), 8);
+ _sub(data.byte(kMapysize), 8);
+ maptopanel();
+ _add(data.byte(kMapysize), 8);
}
-void dumpeverything(Context &context) {
- STACK_CHECK(context);
- 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));
+void DreamGenContext::dumpeverything() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ 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())
+ ax = es.word(bx);
+ cx = es.word(bx+2);
+ _cmp(ax, 0x0ffff);
+ if (flags.z())
goto finishevery1;
- context._cmp(context.ax, context.es.word(context.bx+(40*5)));
- if (!context.flags.z())
+ _cmp(ax, es.word(bx+(40*5)));
+ if (!flags.z())
goto notskip1;
- context._cmp(context.cx, context.es.word(context.bx+(40*5)+2));
- if (context.flags.z())
+ _cmp(cx, es.word(bx+(40*5)+2));
+ if (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();
+ push(bx);
+ push(es);
+ push(ds);
+ bl = ah;
+ bh = 0;
+ ah = 0;
+ di = ax;
+ _add(di, data.word(kMapadx));
+ _add(bx, data.word(kMapady));
+ multidump();
+ ds = pop();
+ es = pop();
+ bx = pop();
skip1:
- context._add(context.bx, 5);
+ _add(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);
+ 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())
+ ax = es.word(bx);
+ cx = es.word(bx+2);
+ _cmp(ax, 0x0ffff);
+ if (flags.z())
return /* (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);
+ push(bx);
+ push(es);
+ push(ds);
+ bl = ah;
+ bh = 0;
+ ah = 0;
+ di = ax;
+ _add(di, data.word(kMapadx));
+ _add(bx, data.word(kMapady));
+ multidump();
+ ds = pop();
+ es = pop();
+ bx = pop();
+ _add(bx, 5);
goto dumpevery2;
}
-void allocatework(Context &context) {
- STACK_CHECK(context);
- context.bx = 0x1000;
- allocatemem(context);
- context.data.word(kWorkspace) = context.ax;
+void DreamGenContext::allocatework() {
+ STACK_CHECK;
+ bx = 0x1000;
+ allocatemem();
+ data.word(kWorkspace) = ax;
}
-void readabyte(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.si, 30000);
- if (!context.flags.z())
+void DreamGenContext::readabyte() {
+ STACK_CHECK;
+ _cmp(si, 30000);
+ if (!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;
+ push(bx);
+ push(es);
+ push(di);
+ push(ds);
+ push(si);
+ readoneblock();
+ si = pop();
+ ds = pop();
+ di = pop();
+ es = pop();
+ bx = pop();
+ si = 0;
notendblock:
- context._lodsb();
-}
-
-void loadpalfromiff(Context &context) {
- STACK_CHECK(context);
- 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;
+ _lodsb();
+}
+
+void DreamGenContext::loadpalfromiff() {
+ STACK_CHECK;
+ dx = 2481;
+ openfile();
+ cx = 2000;
+ ds = data.word(kMapstore);
+ dx = 0;
+ readfromfile();
+ closefile();
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
+ ds = data.word(kMapstore);
+ si = 0x30;
+ 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())
+ _lodsb();
+ _shr(al, 1);
+ _shr(al, 1);
+ _cmp(data.byte(kBrightness), 1);
+ if (!flags.z())
goto nought;
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _cmp(al, 0);
+ if (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())
+ ah = al;
+ _shr(ah, 1);
+ _add(al, ah);
+ _shr(ah, 1);
+ _add(al, ah);
+ _cmp(al, 64);
+ if (flags.c())
goto nought;
- context.al = 63;
+ al = 63;
nought:
- context._stosb();
- if (--context.cx)
+ _stosb();
+ if (--cx)
goto palloop;
}
-void paneltomap(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void maptopanel(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void dumpmap(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void pixelcheckset(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void createpanel(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void createpanel2(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void clearwork(Context &context) {
- STACK_CHECK(context);
- context.ax = 0x0;
- context.es = context.data.word(kWorkspace);
- context.di = 0;
- context.cx = (200*320)/64;
+void DreamGenContext::paneltomap() {
+ STACK_CHECK;
+ di = data.word(kMapxstart);
+ _add(di, data.word(kMapadx));
+ bx = data.word(kMapystart);
+ _add(bx, data.word(kMapady));
+ ds = data.word(kMapstore);
+ si = 0;
+ cl = data.byte(kMapxsize);
+ ch = data.byte(kMapysize);
+ multiget();
+}
+
+void DreamGenContext::maptopanel() {
+ STACK_CHECK;
+ di = data.word(kMapxstart);
+ _add(di, data.word(kMapadx));
+ bx = data.word(kMapystart);
+ _add(bx, data.word(kMapady));
+ ds = data.word(kMapstore);
+ si = 0;
+ cl = data.byte(kMapxsize);
+ ch = data.byte(kMapysize);
+ multiput();
+}
+
+void DreamGenContext::dumpmap() {
+ STACK_CHECK;
+ di = data.word(kMapxstart);
+ _add(di, data.word(kMapadx));
+ bx = data.word(kMapystart);
+ _add(bx, data.word(kMapady));
+ cl = data.byte(kMapxsize);
+ ch = data.byte(kMapysize);
+ multidump();
+}
+
+void DreamGenContext::pixelcheckset() {
+ STACK_CHECK;
+ push(ax);
+ _sub(al, es.byte(bx));
+ _sub(ah, es.byte(bx+1));
+ push(es);
+ push(bx);
+ push(cx);
+ push(ax);
+ al = es.byte(bx+4);
+ getsetad();
+ al = es.byte(bx+17);
+ es = data.word(kSetframes);
+ bx = (0);
+ ah = 0;
+ cx = 6;
+ _mul(cx);
+ _add(bx, ax);
+ ax = pop();
+ push(ax);
+ al = ah;
+ ah = 0;
+ cl = es.byte(bx);
+ ch = 0;
+ _mul(cx);
+ cx = pop();
+ ch = 0;
+ _add(ax, cx);
+ _add(ax, es.word(bx+2));
+ bx = ax;
+ _add(bx, (0+2080));
+ al = es.byte(bx);
+ dl = al;
+ cx = pop();
+ bx = pop();
+ es = pop();
+ ax = pop();
+ _cmp(dl, 0);
+}
+
+void DreamGenContext::createpanel() {
+ STACK_CHECK;
+ di = 0;
+ bx = 8;
+ ds = data.word(kIcons2);
+ al = 0;
+ ah = 2;
+ showframe();
+ di = 160;
+ bx = 8;
+ ds = data.word(kIcons2);
+ al = 0;
+ ah = 2;
+ showframe();
+ di = 0;
+ bx = 104;
+ ds = data.word(kIcons2);
+ al = 0;
+ ah = 2;
+ showframe();
+ di = 160;
+ bx = 104;
+ ds = data.word(kIcons2);
+ al = 0;
+ ah = 2;
+ showframe();
+}
+
+void DreamGenContext::createpanel2() {
+ STACK_CHECK;
+ createpanel();
+ di = 0;
+ bx = 0;
+ ds = data.word(kIcons2);
+ al = 5;
+ ah = 2;
+ showframe();
+ di = 160;
+ bx = 0;
+ ds = data.word(kIcons2);
+ al = 5;
+ ah = 2;
+ showframe();
+}
+
+void DreamGenContext::clearwork() {
+ STACK_CHECK;
+ ax = 0x0;
+ es = data.word(kWorkspace);
+ di = 0;
+ cx = (200*320)/64;
clearloop:
- context._stosw(32);
- if (--context.cx)
+ _stosw(32);
+ if (--cx)
goto clearloop;
}
-void zoom(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.word(kWatchingtime), 0);
- if (!context.flags.z())
+void DreamGenContext::zoom() {
+ STACK_CHECK;
+ _cmp(data.word(kWatchingtime), 0);
+ if (!flags.z())
return /* (inwatching) */;
- context._cmp(context.data.byte(kZoomon), 1);
- if (context.flags.z())
+ _cmp(data.byte(kZoomon), 1);
+ if (flags.z())
goto zoomswitch;
return;
zoomswitch:
- context._cmp(context.data.byte(kCommandtype), 199);
- if (context.flags.c())
+ _cmp(data.byte(kCommandtype), 199);
+ if (flags.c())
goto zoomit;
- putunderzoom(context);
+ putunderzoom();
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;
+ ax = data.word(kOldpointery);
+ _sub(ax, 9);
+ cx = (320);
+ _mul(cx);
+ _add(ax, data.word(kOldpointerx));
+ _sub(ax, 11);
+ si = ax;
+ ax = (132)+4;
+ cx = (320);
+ _mul(cx);
+ _add(ax, (8)+5);
+ di = ax;
+ es = data.word(kWorkspace);
+ ds = data.word(kWorkspace);
+ cx = 20;
zoomloop:
- context.push(context.cx);
- context.cx = 23;
+ push(cx);
+ cx = 23;
zoomloop2:
- context._lodsb();
- context.ah = context.al;
- context._stosw();
- context.es.word(context.di+(320)-2) = context.ax;
- if (--context.cx)
+ _lodsb();
+ ah = al;
+ _stosw();
+ es.word(di+(320)-2) = ax;
+ if (--cx)
goto zoomloop2;
- context._add(context.si, (320)-23);
- context._add(context.di, (320)-46+(320));
- context.cx = context.pop();
- if (--context.cx)
+ _add(si, (320)-23);
+ _add(di, (320)-46+(320));
+ cx = pop();
+ if (--cx)
goto zoomloop;
- crosshair(context);
- context.data.byte(kDidzoom) = 1;
-}
-
-void delthisone(Context &context) {
- STACK_CHECK(context);
- 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);
+ crosshair();
+ data.byte(kDidzoom) = 1;
+}
+
+void DreamGenContext::delthisone() {
+ STACK_CHECK;
+ push(ax);
+ push(ax);
+ al = ah;
+ ah = 0;
+ _add(ax, data.word(kMapady));
+ bx = (320);
+ _mul(bx);
+ bx = pop();
+ bh = 0;
+ _add(bx, data.word(kMapadx));
+ _add(ax, bx);
+ di = ax;
+ ax = pop();
+ push(ax);
+ al = ah;
+ ah = 0;
+ bx = 22*8;
+ _mul(bx);
+ bx = pop();
+ bh = 0;
+ _add(ax, bx);
+ si = ax;
+ es = data.word(kWorkspace);
+ ds = data.word(kMapstore);
+ dl = cl;
+ dh = 0;
+ ax = (320);
+ _sub(ax, dx);
+ _neg(dx);
+ _add(dx, 22*8);
deloneloop:
- context.push(context.cx);
- context.ch = 0;
- context._movsb(context.cx);
- context.cx = context.pop();
- context._add(context.di, context.ax);
- context._add(context.si, context.dx);
- context._dec(context.ch);
- if (!context.flags.z())
+ push(cx);
+ ch = 0;
+ _movsb(cx);
+ cx = pop();
+ _add(di, ax);
+ _add(si, dx);
+ _dec(ch);
+ if (!flags.z())
goto deloneloop;
}
-void doblocks(Context &context) {
- STACK_CHECK(context);
- 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;
+void DreamGenContext::doblocks() {
+ STACK_CHECK;
+ es = data.word(kWorkspace);
+ ax = data.word(kMapady);
+ cx = (320);
+ _mul(cx);
+ di = data.word(kMapadx);
+ _add(di, ax);
+ al = data.byte(kMapy);
+ ah = 0;
+ bx = (66);
+ _mul(bx);
+ bl = data.byte(kMapx);
+ bh = 0;
+ _add(ax, bx);
+ si = (0);
+ _add(si, ax);
+ cx = 10;
loop120:
- context.push(context.di);
- context.push(context.cx);
- context.cx = 11;
+ push(di);
+ push(cx);
+ 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())
+ push(cx);
+ push(di);
+ ds = data.word(kMapdata);
+ _lodsb();
+ ds = data.word(kBackdrop);
+ push(si);
+ _cmp(al, 0);
+ if (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;
+ ah = al;
+ al = 0;
+ si = (0+192);
+ _add(si, ax);
+ bh = 14;
+ bh = 4;
firstbitofblock:
- context._movsw(8);
- context._add(context.di, (320)-16);
- context._dec(context.bh);
- if (!context.flags.z())
+ _movsw(8);
+ _add(di, (320)-16);
+ _dec(bh);
+ if (!flags.z())
goto firstbitofblock;
- context.bh = 12;
+ bh = 12;
loop125:
- context._movsw(8);
- context.ax = 0x0dfdf;
- context._stosw(2);
- context._add(context.di, (320)-20);
- context._dec(context.bh);
- if (!context.flags.z())
+ _movsw(8);
+ ax = 0x0dfdf;
+ _stosw(2);
+ _add(di, (320)-20);
+ _dec(bh);
+ if (!flags.z())
goto loop125;
- context._add(context.di, 4);
- context.ax = 0x0dfdf;
- context._stosw(8);
- context._add(context.di, (320)-16);
- context._stosw(8);
- context._add(context.di, (320)-16);
- context._stosw(8);
- context._add(context.di, (320)-16);
- context._stosw(8);
+ _add(di, 4);
+ ax = 0x0dfdf;
+ _stosw(8);
+ _add(di, (320)-16);
+ _stosw(8);
+ _add(di, (320)-16);
+ _stosw(8);
+ _add(di, (320)-16);
+ _stosw(8);
zeroblock:
- context.si = context.pop();
- context.di = context.pop();
- context.cx = context.pop();
- context._add(context.di, 16);
- if (--context.cx)
+ si = pop();
+ di = pop();
+ cx = pop();
+ _add(di, 16);
+ if (--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)
+ _add(si, (66)-11);
+ cx = pop();
+ di = pop();
+ _add(di, (320)*16);
+ if (--cx)
goto loop120;
}
-void showframe(Context &context) {
- STACK_CHECK(context);
- 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())
+void DreamGenContext::showframe() {
+ STACK_CHECK;
+ push(dx);
+ push(ax);
+ cx = ax;
+ _and(cx, 511);
+ _add(cx, cx);
+ si = cx;
+ _add(cx, cx);
+ _add(si, cx);
+ _cmp(ds.word(si), 0);
+ if (!flags.z())
goto notblankshow;
- context.ax = context.pop();
- context.dx = context.pop();
- context.cx = 0;
+ ax = pop();
+ dx = pop();
+ cx = 0;
return;
notblankshow:
- context._test(context.ah, 128);
- if (!context.flags.z())
+ _test(ah, 128);
+ if (!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);
+ al = ds.byte(si+4);
+ ah = 0;
+ _add(di, ax);
+ al = ds.byte(si+5);
+ ah = 0;
+ _add(bx, 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())
+ cx = ds.word(si+0);
+ ax = ds.word(si+2);
+ _add(ax, 2080);
+ si = ax;
+ ax = pop();
+ dx = pop();
+ _cmp(ah, 0);
+ if (flags.z())
goto noeffects;
- context._test(context.ah, 128);
- if (context.flags.z())
+ _test(ah, 128);
+ if (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();
+ push(ax);
+ al = cl;
+ ah = 0;
+ _shr(ax, 1);
+ _sub(di, ax);
+ al = ch;
+ ah = 0;
+ _shr(ax, 1);
+ _sub(bx, ax);
+ ax = pop();
notcentred:
- context._test(context.ah, 64);
- if (context.flags.z())
+ _test(ah, 64);
+ if (flags.z())
goto notdiffdest;
- context.push(context.cx);
- frameoutfx(context);
- context.cx = context.pop();
+ push(cx);
+ frameoutfx();
+ cx = pop();
return;
notdiffdest:
- context._test(context.ah, 8);
- if (context.flags.z())
+ _test(ah, 8);
+ if (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();
+ push(ax);
+ ax = di;
+ _sub(ax, data.word(kMapadx));
+ push(bx);
+ _sub(bx, data.word(kMapady));
+ ah = bl;
+ bx = pop();
+ ax = pop();
notprintlist:
- context._test(context.ah, 4);
- if (context.flags.z())
+ _test(ah, 4);
+ if (flags.z())
goto notflippedx;
- context.dx = (320);
- context.es = context.data.word(kWorkspace);
- context.push(context.cx);
- frameoutfx(context);
- context.cx = context.pop();
+ dx = (320);
+ es = data.word(kWorkspace);
+ push(cx);
+ frameoutfx();
+ cx = pop();
return;
notflippedx:
- context._test(context.ah, 2);
- if (context.flags.z())
+ _test(ah, 2);
+ if (flags.z())
goto notnomask;
- context.dx = (320);
- context.es = context.data.word(kWorkspace);
- context.push(context.cx);
- frameoutnm(context);
- context.cx = context.pop();
+ dx = (320);
+ es = data.word(kWorkspace);
+ push(cx);
+ frameoutnm();
+ cx = pop();
return;
notnomask:
- context._test(context.ah, 32);
- if (context.flags.z())
+ _test(ah, 32);
+ if (flags.z())
goto noeffects;
- context.dx = (320);
- context.es = context.data.word(kWorkspace);
- context.push(context.cx);
- frameoutbh(context);
- context.cx = context.pop();
+ dx = (320);
+ es = data.word(kWorkspace);
+ push(cx);
+ frameoutbh();
+ cx = pop();
return;
noeffects:
- context.dx = (320);
- context.es = context.data.word(kWorkspace);
- context.push(context.cx);
- frameoutv(context);
- context.cx = context.pop();
-}
-
-void frameoutv(Context &context) {
- STACK_CHECK(context);
- 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();
+ dx = (320);
+ es = data.word(kWorkspace);
+ push(cx);
+ frameoutv();
+ cx = pop();
+}
+
+void DreamGenContext::frameoutv() {
+ STACK_CHECK;
+ push(dx);
+ ax = bx;
+ bx = dx;
+ _mul(bx);
+ _add(di, ax);
+ dx = pop();
+ push(cx);
+ ch = 0;
+ _sub(dx, cx);
+ cx = pop();
frameloop1:
- context.push(context.cx);
- context.ch = 0;
+ push(cx);
+ ch = 0;
frameloop2:
- context._lodsb();
- context._cmp(context.al, 0);
- if (!context.flags.z())
+ _lodsb();
+ _cmp(al, 0);
+ if (!flags.z())
goto backtosolid;
backtoother:
- context._inc(context.di);
- if (--context.cx)
+ _inc(di);
+ if (--cx)
goto frameloop2;
- context.cx = context.pop();
- context._add(context.di, context.dx);
- context._dec(context.ch);
- if (!context.flags.z())
+ cx = pop();
+ _add(di, dx);
+ _dec(ch);
+ if (!flags.z())
goto frameloop1;
return;
frameloop3:
- context._lodsb();
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _lodsb();
+ _cmp(al, 0);
+ if (flags.z())
goto backtoother;
backtosolid:
- context._stosb();
- if (--context.cx)
+ _stosb();
+ if (--cx)
goto frameloop3;
- context.cx = context.pop();
- context._add(context.di, context.dx);
- context._dec(context.ch);
- if (!context.flags.z())
+ cx = pop();
+ _add(di, dx);
+ _dec(ch);
+ if (!flags.z())
goto frameloop1;
}
-void frameoutbh(Context &context) {
- STACK_CHECK(context);
- 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();
+void DreamGenContext::frameoutbh() {
+ STACK_CHECK;
+ push(dx);
+ ax = bx;
+ bx = dx;
+ _mul(bx);
+ _add(di, ax);
+ dx = pop();
+ push(cx);
+ ch = 0;
+ _sub(dx, cx);
+ cx = pop();
bhloop2:
- context.push(context.cx);
- context.ch = 0;
- context.ah = 255;
+ push(cx);
+ ch = 0;
+ ah = 255;
bhloop1:
- context._cmp(context.es.byte(context.di), context.ah);
- if (!context.flags.z())
+ _cmp(es.byte(di), ah);
+ if (!flags.z())
goto nofill;
- context._movsb();
- if (--context.cx)
+ _movsb();
+ if (--cx)
goto bhloop1;
goto nextline;
nofill:
- context._inc(context.di);
- context._inc(context.si);
- if (--context.cx)
+ _inc(di);
+ _inc(si);
+ if (--cx)
goto bhloop1;
nextline:
- context._add(context.di, context.dx);
- context.cx = context.pop();
- context._dec(context.ch);
- if (!context.flags.z())
+ _add(di, dx);
+ cx = pop();
+ _dec(ch);
+ if (!flags.z())
goto bhloop2;
}
-void frameoutfx(Context &context) {
- STACK_CHECK(context);
- 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();
+void DreamGenContext::frameoutfx() {
+ STACK_CHECK;
+ push(dx);
+ ax = bx;
+ bx = dx;
+ _mul(bx);
+ _add(di, ax);
+ dx = pop();
+ push(cx);
+ ch = 0;
+ _add(dx, cx);
+ cx = pop();
frameloopfx1:
- context.push(context.cx);
- context.ch = 0;
+ push(cx);
+ ch = 0;
frameloopfx2:
- context._lodsb();
- context._cmp(context.al, 0);
- if (!context.flags.z())
+ _lodsb();
+ _cmp(al, 0);
+ if (!flags.z())
goto backtosolidfx;
backtootherfx:
- context._dec(context.di);
- if (--context.cx)
+ _dec(di);
+ if (--cx)
goto frameloopfx2;
- context.cx = context.pop();
- context._add(context.di, context.dx);
- context._dec(context.ch);
- if (!context.flags.z())
+ cx = pop();
+ _add(di, dx);
+ _dec(ch);
+ if (!flags.z())
goto frameloopfx1;
return;
frameloopfx3:
- context._lodsb();
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _lodsb();
+ _cmp(al, 0);
+ if (flags.z())
goto backtootherfx;
backtosolidfx:
- context.es.byte(context.di) = context.al;
- context._dec(context.di);
- if (--context.cx)
+ es.byte(di) = al;
+ _dec(di);
+ if (--cx)
goto frameloopfx3;
- context.cx = context.pop();
- context._add(context.di, context.dx);
- context._dec(context.ch);
- if (!context.flags.z())
+ cx = pop();
+ _add(di, dx);
+ _dec(ch);
+ if (!flags.z())
goto frameloopfx1;
}
-void transferinv(Context &context) {
- STACK_CHECK(context);
- 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);
- context._movsb(context.cx);
- context.cx = context.pop();
- context.ax = context.pop();
- context.es.word(context.bx+2) = context.ax;
- context._add(context.data.word(kExframepos), context.cx);
-}
-
-void transfermap(Context &context) {
- STACK_CHECK(context);
- 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);
- context._movsb(context.cx);
- context.cx = context.pop();
- context.ax = context.pop();
- context.es.word(context.bx+2) = context.ax;
- context._add(context.data.word(kExframepos), context.cx);
-}
-
-void dofade(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kFadedirection), 0);
- if (context.flags.z())
+void DreamGenContext::transferinv() {
+ STACK_CHECK;
+ di = data.word(kExframepos);
+ push(di);
+ al = data.byte(kExpos);
+ ah = 0;
+ bx = ax;
+ _add(ax, ax);
+ _add(ax, bx);
+ _inc(ax);
+ cx = 6;
+ _mul(cx);
+ es = data.word(kExtras);
+ bx = (0);
+ _add(bx, ax);
+ _add(di, (0+2080));
+ push(bx);
+ al = data.byte(kItemtotran);
+ ah = 0;
+ bx = ax;
+ _add(ax, ax);
+ _add(ax, bx);
+ _inc(ax);
+ cx = 6;
+ _mul(cx);
+ ds = data.word(kFreeframes);
+ bx = (0);
+ _add(bx, ax);
+ si = (0+2080);
+ al = ds.byte(bx);
+ ah = 0;
+ cl = ds.byte(bx+1);
+ ch = 0;
+ _add(si, ds.word(bx+2));
+ dx = ds.word(bx+4);
+ bx = pop();
+ es.byte(bx+0) = al;
+ es.byte(bx+1) = cl;
+ es.word(bx+4) = dx;
+ _mul(cx);
+ cx = ax;
+ push(cx);
+ _movsb(cx);
+ cx = pop();
+ ax = pop();
+ es.word(bx+2) = ax;
+ _add(data.word(kExframepos), cx);
+}
+
+void DreamGenContext::transfermap() {
+ STACK_CHECK;
+ di = data.word(kExframepos);
+ push(di);
+ al = data.byte(kExpos);
+ ah = 0;
+ bx = ax;
+ _add(ax, ax);
+ _add(ax, bx);
+ cx = 6;
+ _mul(cx);
+ es = data.word(kExtras);
+ bx = (0);
+ _add(bx, ax);
+ _add(di, (0+2080));
+ push(bx);
+ al = data.byte(kItemtotran);
+ ah = 0;
+ bx = ax;
+ _add(ax, ax);
+ _add(ax, bx);
+ cx = 6;
+ _mul(cx);
+ ds = data.word(kFreeframes);
+ bx = (0);
+ _add(bx, ax);
+ si = (0+2080);
+ al = ds.byte(bx);
+ ah = 0;
+ cl = ds.byte(bx+1);
+ ch = 0;
+ _add(si, ds.word(bx+2));
+ dx = ds.word(bx+4);
+ bx = pop();
+ es.byte(bx+0) = al;
+ es.byte(bx+1) = cl;
+ es.word(bx+4) = dx;
+ _mul(cx);
+ cx = ax;
+ push(cx);
+ _movsb(cx);
+ cx = pop();
+ ax = pop();
+ es.word(bx+2) = ax;
+ _add(data.word(kExframepos), cx);
+}
+
+void DreamGenContext::dofade() {
+ STACK_CHECK;
+ _cmp(data.byte(kFadedirection), 0);
+ if (flags.z())
return /* (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())
+ cl = data.byte(kNumtofade);
+ ch = 0;
+ al = data.byte(kColourpos);
+ ah = 0;
+ ds = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ _add(si, ax);
+ _add(si, ax);
+ _add(si, ax);
+ showgroup();
+ al = data.byte(kNumtofade);
+ _add(al, data.byte(kColourpos));
+ data.byte(kColourpos) = al;
+ _cmp(al, 0);
+ if (!flags.z())
return /* (finishfade) */;
- fadecalculation(context);
-}
-
-void clearendpal(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
-}
-
-void clearpalette(Context &context) {
- STACK_CHECK(context);
- context.data.byte(kFadedirection) = 0;
- clearstartpal(context);
- dumpcurrent(context);
-}
-
-void fadescreenup(Context &context) {
- STACK_CHECK(context);
- clearstartpal(context);
- paltoendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 128;
-}
-
-void fadetowhite(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
- context.al = 0;
- context._stosb(3);
- paltostartpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 128;
-}
-
-void fadefromwhite(Context &context) {
- STACK_CHECK(context);
- context.es = context.data.word(kBuffers);
- context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
- context.cx = 768;
- context.al = 63;
- context._stosb(context.cx);
- context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
- context.al = 0;
- context._stosb(3);
- paltoendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 128;
-}
-
-void fadescreenups(Context &context) {
- STACK_CHECK(context);
- clearstartpal(context);
- paltoendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 64;
-}
-
-void fadescreendownhalf(Context &context) {
- STACK_CHECK(context);
- 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);
+ fadecalculation();
+}
+
+void DreamGenContext::clearendpal() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ cx = 768;
+ al = 0;
+ _stosb(cx);
+}
+
+void DreamGenContext::clearpalette() {
+ STACK_CHECK;
+ data.byte(kFadedirection) = 0;
+ clearstartpal();
+ dumpcurrent();
+}
+
+void DreamGenContext::fadescreenup() {
+ STACK_CHECK;
+ clearstartpal();
+ paltoendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamGenContext::fadetowhite() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ cx = 768;
+ al = 63;
+ _stosb(cx);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ al = 0;
+ _stosb(3);
+ paltostartpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamGenContext::fadefromwhite() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ cx = 768;
+ al = 63;
+ _stosb(cx);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ al = 0;
+ _stosb(3);
+ paltoendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamGenContext::fadescreenups() {
+ STACK_CHECK;
+ clearstartpal();
+ paltoendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 64;
+}
+
+void DreamGenContext::fadescreendownhalf() {
+ STACK_CHECK;
+ paltostartpal();
+ paltoendpal();
+ cx = 768;
+ es = data.word(kBuffers);
+ 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)
+ al = es.byte(bx);
+ _shr(al, 1);
+ es.byte(bx) = al;
+ _inc(bx);
+ if (--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;
- context._movsb(context.cx);
- 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;
- context._movsb(context.cx);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 31;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 32;
-}
-
-void fadescreenuphalf(Context &context) {
- STACK_CHECK(context);
- endpaltostart(context);
- paltoendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 31;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 32;
-}
-
-void fadescreendown(Context &context) {
- STACK_CHECK(context);
- paltostartpal(context);
- clearendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 128;
-}
-
-void fadescreendowns(Context &context) {
- STACK_CHECK(context);
- paltostartpal(context);
- clearendpal(context);
- context.data.byte(kFadedirection) = 1;
- context.data.byte(kFadecount) = 63;
- context.data.byte(kColourpos) = 0;
- context.data.byte(kNumtofade) = 64;
-}
-
-void clearstartpal(Context &context) {
- STACK_CHECK(context);
- context.es = context.data.word(kBuffers);
- context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
- context.cx = 256;
+ ds = data.word(kBuffers);
+ es = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(56*3);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(56*3);
+ cx = 3*5;
+ _movsb(cx);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(77*3);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(77*3);
+ cx = 3*2;
+ _movsb(cx);
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 31;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 32;
+}
+
+void DreamGenContext::fadescreenuphalf() {
+ STACK_CHECK;
+ endpaltostart();
+ paltoendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 31;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 32;
+}
+
+void DreamGenContext::fadescreendown() {
+ STACK_CHECK;
+ paltostartpal();
+ clearendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamGenContext::fadescreendowns() {
+ STACK_CHECK;
+ paltostartpal();
+ clearendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 64;
+}
+
+void DreamGenContext::clearstartpal() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ cx = 256;
wholeloop1:
- context.ax = 0;
- context._stosw();
- context.al = 0;
- context._stosb();
- if (--context.cx)
+ ax = 0;
+ _stosw();
+ al = 0;
+ _stosb();
+ if (--cx)
goto wholeloop1;
}
-void showgun(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void rollendcredits2(Context &context) {
- STACK_CHECK(context);
- rollem(context);
-}
-
-void rollem(Context &context) {
- STACK_CHECK(context);
- 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;
+void DreamGenContext::showgun() {
+ STACK_CHECK;
+ data.byte(kAddtored) = 0;
+ data.byte(kAddtogreen) = 0;
+ data.byte(kAddtoblue) = 0;
+ paltostartpal();
+ paltoendpal();
+ greyscalesum();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ cx = 130;
+ hangon();
+ endpaltostart();
+ clearendpal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ cx = 200;
+ hangon();
+ data.byte(kRoomssample) = 34;
+ loadroomssample();
+ data.byte(kVolume) = 0;
+ dx = 2351;
+ loadintotemp();
+ createpanel2();
+ ds = data.word(kTempgraphics);
+ al = 0;
+ ah = 0;
+ di = 100;
+ bx = 4;
+ showframe();
+ ds = data.word(kTempgraphics);
+ al = 1;
+ ah = 0;
+ di = 158;
+ bx = 106;
+ showframe();
+ worktoscreen();
+ getridoftemp();
+ fadescreenup();
+ cx = 160;
+ hangon();
+ al = 12;
+ ah = 0;
+ playchannel0();
+ dx = 2260;
+ loadtemptext();
+ rollendcredits2();
+ getridoftemptext();
+}
+
+void DreamGenContext::rollendcredits2() {
+ STACK_CHECK;
+ rollem();
+}
+
+void DreamGenContext::rollem() {
+ STACK_CHECK;
+ cl = 160;
+ ch = 160;
+ di = 25;
+ bx = 20;
+ ds = data.word(kMapstore);
+ si = 0;
+ multiget();
+ es = data.word(kTextfile1);
+ si = 49*2;
+ ax = es.word(si);
+ si = ax;
+ _add(si, (66*2));
+ cx = 80;
endcredits21:
- context.push(context.cx);
- context.bx = 10;
- context.cx = context.data.word(kLinespacing);
+ push(cx);
+ bx = 10;
+ cx = 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;
+ push(cx);
+ push(si);
+ push(di);
+ push(es);
+ push(bx);
+ vsync();
+ cl = 160;
+ ch = 160;
+ di = 25;
+ bx = 20;
+ ds = data.word(kMapstore);
+ si = 0;
+ multiput();
+ vsync();
+ bx = pop();
+ es = pop();
+ di = pop();
+ si = pop();
+ push(si);
+ push(di);
+ push(es);
+ push(bx);
+ 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)
+ push(cx);
+ di = 25;
+ dx = 161;
+ ax = 0;
+ printdirect();
+ _add(bx, data.word(kLinespacing));
+ cx = pop();
+ if (--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())
+ vsync();
+ cl = 160;
+ ch = 160;
+ di = 25;
+ bx = 20;
+ multidump();
+ bx = pop();
+ es = pop();
+ di = pop();
+ si = pop();
+ cx = pop();
+ _cmp(data.byte(kLasthardkey), 1);
+ if (flags.z())
goto endearly2;
- context._dec(context.bx);
- if (--context.cx)
+ _dec(bx);
+ if (--cx)
goto endcredits22;
- context.cx = context.pop();
+ cx = pop();
looknext2:
- context.al = context.es.byte(context.si);
- context._inc(context.si);
- context._cmp(context.al, ':');
- if (context.flags.z())
+ al = es.byte(si);
+ _inc(si);
+ _cmp(al, ':');
+ if (flags.z())
goto gotnext2;
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _cmp(al, 0);
+ if (flags.z())
goto gotnext2;
goto looknext2;
gotnext2:
- context._cmp(context.data.byte(kLasthardkey), 1);
- if (context.flags.z())
+ _cmp(data.byte(kLasthardkey), 1);
+ if (flags.z())
return /* (endearly) */;
- if (--context.cx)
+ if (--cx)
goto endcredits21;
- context.cx = 120;
- hangone(context);
+ cx = 120;
+ hangone();
return;
endearly2:
- context.cx = context.pop();
+ cx = pop();
}
-void fadecalculation(Context &context) {
- STACK_CHECK(context);
- context._cmp(context.data.byte(kFadecount), 0);
- if (context.flags.z())
+void DreamGenContext::fadecalculation() {
+ STACK_CHECK;
+ _cmp(data.byte(kFadecount), 0);
+ if (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;
+ bl = data.byte(kFadecount);
+ es = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ 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())
+ al = es.byte(si);
+ ah = es.byte(di);
+ _cmp(al, ah);
+ if (flags.z())
goto gotthere;
- if (context.flags.c())
+ if (flags.c())
goto lesscolour;
- context._dec(context.es.byte(context.si));
+ _dec(es.byte(si));
goto gotthere;
lesscolour:
- context._cmp(context.bl, context.ah);
- if (context.flags.z())
+ _cmp(bl, ah);
+ if (flags.z())
goto withit;
- if (!context.flags.c())
+ if (!flags.c())
goto gotthere;
withit:
- context._inc(context.es.byte(context.si));
+ _inc(es.byte(si));
gotthere:
- context._inc(context.si);
- context._inc(context.di);
- if (--context.cx)
+ _inc(si);
+ _inc(di);
+ if (--cx)
goto fadecolloop;
- context._dec(context.data.byte(kFadecount));
+ _dec(data.byte(kFadecount));
return;
nomorefading:
- context.data.byte(kFadedirection) = 0;
+ data.byte(kFadedirection) = 0;
}
-void greyscalesum(Context &context) {
- STACK_CHECK(context);
- 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;
+void DreamGenContext::greyscalesum() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ 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;
+ push(cx);
+ bx = 0;
+ al = es.byte(si);
+ ah = 0;
+ cx = 20;
+ _mul(cx);
+ _add(bx, ax);
+ al = es.byte(si+1);
+ ah = 0;
+ cx = 59;
+ _mul(cx);
+ _add(bx, ax);
+ al = es.byte(si+2);
+ ah = 0;
+ cx = 11;
+ _mul(cx);
+ _add(bx, ax);
+ al = -1;
greysumloop2:
- context._inc(context.al);
- context._sub(context.bx, 100);
- if (!context.flags.c())
+ _inc(al);
+ _sub(bx, 100);
+ if (!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);
- context._stosb();
- context.ah = context.data.byte(kAddtogreen);
- context.al = context.bl;
- context._cmp(context.al, 0);
- if (context.flags.z())
+ bl = al;
+ al = bl;
+ ah = data.byte(kAddtored);
+ _cmp(al, 0);
+ _add(al, ah);
+ _stosb();
+ ah = data.byte(kAddtogreen);
+ al = bl;
+ _cmp(al, 0);
+ if (flags.z())
goto noaddg;
- context._add(context.al, context.ah);
+ _add(al, ah);
noaddg:
- context._stosb();
- context.ah = context.data.byte(kAddtoblue);
- context.al = context.bl;
- context._cmp(context.al, 0);
- if (context.flags.z())
+ _stosb();
+ ah = data.byte(kAddtoblue);
+ al = bl;
+ _cmp(al, 0);
+ if (flags.z())
goto noaddb;
- context._add(context.al, context.ah);
+ _add(al, ah);
noaddb:
- context._stosb();
- context._add(context.si, 3);
- context.cx = context.pop();
- if (--context.cx)
+ _stosb();
+ _add(si, 3);
+ cx = pop();
+ if (--cx)
goto greysumloop1;
}
-void paltostartpal(Context &context) {
- STACK_CHECK(context);
- 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;
- context._movsw(context.cx);
-}
-
-void endpaltostart(Context &context) {
- STACK_CHECK(context);
- 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;
- context._movsw(context.cx);
-}
-
-void startpaltoend(Context &context) {
- STACK_CHECK(context);
- 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;
- context._movsw(context.cx);
-}
-
-void paltoendpal(Context &context) {
- STACK_CHECK(context);
- 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;
- context._movsw(context.cx);
-}
-
-void allpalette(Context &context) {
- STACK_CHECK(context);
- 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;
- context._movsw(context.cx);
- dumpcurrent(context);
-}
-
-void dumpcurrent(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void fadedownmon(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- 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);
-}
-
-void fadeupmon(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- 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);
-}
-
-void fadeupmonfirst(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- 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);
-}
-
-void fadeupyellows(Context &context) {
- STACK_CHECK(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;
- context._stosb(context.cx);
- 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);
-}
-
-void initialmoncols(Context &context) {
- STACK_CHECK(context);
- 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;
- context._stosb(context.cx);
- 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);
-}
-
-void titles(Context &context) {
- STACK_CHECK(context);
- clearpalette(context);
- biblequote(context);
- intro(context);
-}
-
-void endgame(Context &context) {
- STACK_CHECK(context);
- 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);
-}
-
-void monkspeaking(Context &context) {
- STACK_CHECK(context);
- 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;
+void DreamGenContext::paltostartpal() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ ds = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ cx = 768/2;
+ _movsw(cx);
+}
+
+void DreamGenContext::endpaltostart() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ ds = data.word(kBuffers);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ cx = 768/2;
+ _movsw(cx);
+}
+
+void DreamGenContext::startpaltoend() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ ds = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ cx = 768/2;
+ _movsw(cx);
+}
+
+void DreamGenContext::paltoendpal() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ ds = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
+ cx = 768/2;
+ _movsw(cx);
+}
+
+void DreamGenContext::allpalette() {
+ STACK_CHECK;
+ es = data.word(kBuffers);
+ ds = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
+ cx = 768/2;
+ _movsw(cx);
+ dumpcurrent();
+}
+
+void DreamGenContext::dumpcurrent() {
+ STACK_CHECK;
+ si = (0+(180*10)+32+60+(32*32)+(11*10*3));
+ ds = data.word(kBuffers);
+ vsync();
+ al = 0;
+ cx = 128;
+ showgroup();
+ vsync();
+ al = 128;
+ cx = 128;
+ showgroup();
+}
+
+void DreamGenContext::fadedownmon() {
+ STACK_CHECK;
+ paltostartpal();
+ paltoendpal();
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(231*3);
+ cx = 3*8;
+ ax = 0;
+ _stosb(cx);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(246*3);
+ _stosb();
+ _stosw();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ cx = 64;
+ hangon();
+}
+
+void DreamGenContext::fadeupmon() {
+ STACK_CHECK;
+ paltostartpal();
+ paltoendpal();
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3);
+ cx = 3*8;
+ ax = 0;
+ _stosb(cx);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3);
+ _stosb();
+ _stosw();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ cx = 128;
+ hangon();
+}
+
+void DreamGenContext::fadeupmonfirst() {
+ STACK_CHECK;
+ paltostartpal();
+ paltoendpal();
+ es = data.word(kBuffers);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3);
+ cx = 3*8;
+ ax = 0;
+ _stosb(cx);
+ di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3);
+ _stosb();
+ _stosw();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ cx = 64;
+ hangon();
+ al = 26;
+ playchannel1();
+ cx = 64;
+ hangon();
+}
More information about the Scummvm-git-logs
mailing list