aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-08-17 23:22:49 +0200
committerWillem Jan Palenstijn2011-08-18 00:18:08 +0200
commit0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0 (patch)
tree2f3c7035d985e2695aeb11cc85c378106f7cdee7
parentf1a0df46dc9bbdae6fd3215d6fa78af4174fff54 (diff)
downloadscummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.tar.gz
scummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.tar.bz2
scummvm-rg350-0ac5544b64322b55f0dab2c1dbf6582a7c4b9da0.zip
DREAMWEB: Emit symbolic constants for data offsets
-rw-r--r--devtools/tasmrecover/tasm/cpp.py13
-rw-r--r--engines/dreamweb/dreamgen.cpp108
-rw-r--r--engines/dreamweb/dreamgen.h49
3 files changed, 113 insertions, 57 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index 4ed89f650d..db7855e0d0 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -82,6 +82,7 @@ class cpp:
self.skip_output = skip_output
self.translated = []
self.proc_addr = []
+ self.used_data_offsets = set()
self.methods = []
self.fd.write("""%s
@@ -99,11 +100,13 @@ namespace %s {
if self.indirection == -1:
try:
offset,p,p = self.context.get_offset(name)
- print "OFFSET = %d" %offset
- self.indirection = 0
- return str(offset)
except:
pass
+ else:
+ print "OFFSET = %d" %offset
+ self.indirection = 0
+ self.used_data_offsets.add((name,offset))
+ return "offset_%s" % (name,)
g = self.context.get_global(name)
if isinstance(g, op.const):
@@ -604,6 +607,10 @@ public:
for name,addr in self.proc_addr:
self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
+
+ for name,addr in self.used_data_offsets:
+ self.hd.write("\tstatic const uint16 offset_%s = 0x%04x;\n" %(name, addr))
+
offsets = []
for k, v in self.context.get_globals().items():
if isinstance(v, op.var):
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 1d974996cc..2ecdbac3fa 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2327,7 +2327,7 @@ void DreamGenContext::initrain() {
STACK_CHECK;
es = data.word(kBuffers);
di = (0+(228*13)+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*30));
- bx = 1113;
+ bx = offset_rainlocations;
checkmorerain:
al = cs.byte(bx);
_cmp(al, 255);
@@ -4375,15 +4375,15 @@ waitexam:
dumptextline();
delpointer();
data.byte(kGetback) = 0;
- bx = 2494;
+ bx = offset_examlist;
_cmp(data.byte(kInvopen), 0);
if (flags.z())
goto notuseinv;
- bx = 2556;
+ bx = offset_invlist1;
_cmp(data.byte(kInvopen), 1);
if (flags.z())
goto notuseinv;
- bx = 2618;
+ bx = offset_withlist1;
notuseinv:
checkcoords();
_cmp(data.byte(kExamagain), 0);
@@ -4514,7 +4514,7 @@ void DreamGenContext::openob() {
STACK_CHECK;
al = data.byte(kOpenedob);
ah = data.byte(kOpenedtype);
- di = 5847;
+ di = offset_commandline;
copyname();
di = (80);
bx = (58)+86;
@@ -4525,7 +4525,7 @@ void DreamGenContext::openob() {
_add(di, 5);
bx = (58)+86;
es = cs;
- si = 5847;
+ si = offset_commandline;
dl = 220;
al = 0;
ah = 0;
@@ -4537,7 +4537,7 @@ void DreamGenContext::openob() {
cx = (44);
_mul(cx);
_add(ax, (80));
- bx = 2588;
+ bx = offset_openchangesize;
cs.word(bx) = ax;
}
@@ -4889,15 +4889,15 @@ waitexam:
dumptextline();
delpointer();
data.byte(kGetback) = 0;
- bx = 2494;
+ bx = offset_examlist;
_cmp(data.byte(kInvopen), 0);
if (flags.z())
goto notuseinv;
- bx = 2556;
+ bx = offset_invlist1;
_cmp(data.byte(kInvopen), 1);
if (flags.z())
goto notuseinv;
- bx = 2618;
+ bx = offset_withlist1;
notuseinv:
checkcoords();
_cmp(data.byte(kExamagain), 0);
@@ -6921,7 +6921,7 @@ waittalk:
dumppointer();
dumptextline();
data.byte(kGetback) = 0;
- bx = 2660;
+ bx = offset_talklist;
checkcoords();
_cmp(data.byte(kQuitrequested), 0);
if (!flags.z())
@@ -7215,7 +7215,7 @@ hangloopq:
vsync();
dumppointer();
dumptextline();
- bx = 2692;
+ bx = offset_quitlist;
checkcoords();
bx = pop();
cx = pop();
@@ -7350,7 +7350,7 @@ select:
_cmp(data.byte(kGetback), 1);
if (flags.z())
goto quittravel;
- bx = 2714;
+ bx = offset_destlist;
checkcoords();
_cmp(data.byte(kNewlocation), 255);
if (flags.z())
@@ -7774,12 +7774,12 @@ void DreamGenContext::usemon() {
al = 32;
_stosb(cx, true);
es = cs;
- di = 2942+1;
+ di = offset_operand1+1;
cx = 12;
al = 32;
_stosb(cx, true);
es = cs;
- di = 2836;
+ di = offset_keys;
es.byte(di) = 1;
_add(di, 26);
cx = 3;
@@ -8277,7 +8277,7 @@ void DreamGenContext::delchar() {
void DreamGenContext::execcommand() {
STACK_CHECK;
es = cs;
- bx = 2776;
+ bx = offset_comlist;
ds = cs;
si = 8045;
al = ds.byte(si);
@@ -8376,7 +8376,7 @@ void DreamGenContext::dircom() {
dirroot:
data.byte(kLogonum) = 0;
ds = cs;
- si = 2956;
+ si = offset_rootdir;
_inc(si);
es = cs;
di = 2970;
@@ -8417,7 +8417,7 @@ void DreamGenContext::signon() {
parser();
_inc(di);
ds = cs;
- si = 2836;
+ si = offset_keys;
cx = 4;
signonloop:
push(cx);
@@ -8521,7 +8521,7 @@ void DreamGenContext::showkeys() {
al = 18;
monmessage();
es = cs;
- bx = 2836;
+ bx = offset_keys;
cx = 4;
keysloop:
push(cx);
@@ -8588,7 +8588,7 @@ foundfile2:
return;
keyok1:
es = cs;
- di = 2942;
+ di = offset_operand1;
ds = data.word(kMonsource);
searchforstring();
_cmp(al, 0);
@@ -8680,7 +8680,7 @@ keyok2:
push(es);
push(bx);
ds = cs;
- si = 2942+1;
+ si = offset_operand1+1;
es = cs;
di = 2970+1;
cx = 12;
@@ -8727,7 +8727,7 @@ void DreamGenContext::getkeyandlogo() {
cx = 26;
_mul(cx);
es = cs;
- bx = 2836;
+ bx = offset_keys;
_add(bx, ax);
al = es.byte(bx);
_cmp(al, 1);
@@ -8801,11 +8801,11 @@ notfound:
void DreamGenContext::parser() {
STACK_CHECK;
es = cs;
- di = 2942;
+ di = offset_operand1;
cx = 13;
al = 0;
_stosb(cx, true);
- di = 2942;
+ di = offset_operand1;
al = '=';
_stosb();
ds = cs;
@@ -8834,7 +8834,7 @@ copyin1:
if (!flags.z())
goto copyin1;
finishpars:
- di = 2942;
+ di = offset_operand1;
}
void DreamGenContext::scrollmonitor() {
@@ -9128,7 +9128,7 @@ nodream7:
getanyad();
dx = data;
ds = dx;
- si = 2984;
+ si = offset_uselist;
checkuselist:
push(si);
_lodsb();
@@ -10552,7 +10552,7 @@ _tmp1:
di = 160;
bx = 155;
es = cs;
- si = 3474;
+ si = offset_money1poke;
data.word(kCharshift) = 91*2+75;
al = 0;
ah = 0;
@@ -10561,7 +10561,7 @@ _tmp1:
di = 187;
bx = 155;
es = cs;
- si = 3479;
+ si = offset_money2poke;
data.word(kCharshift) = 91*2+85;
al = 0;
ah = 0;
@@ -10629,7 +10629,7 @@ void DreamGenContext::lookatcard() {
void DreamGenContext::moneypoke() {
STACK_CHECK;
- bx = 3474;
+ bx = offset_money1poke;
cl = 48-1;
numberpoke0:
_inc(cl);
@@ -10665,7 +10665,7 @@ numberpoke3:
goto numberpoke3;
_add(ax, 10);
cs.byte(bx) = cl;
- bx = 3479;
+ bx = offset_money2poke;
_add(al, 48);
cs.byte(bx) = al;
}
@@ -11128,7 +11128,7 @@ void DreamGenContext::withwhat() {
al = data.byte(kCommand);
ah = data.byte(kObjecttype);
es = cs;
- di = 5847;
+ di = offset_commandline;
copyname();
di = 100;
bx = 21;
@@ -11140,7 +11140,7 @@ void DreamGenContext::withwhat() {
_add(di, 5);
bx = 21;
es = cs;
- si = 5847;
+ si = offset_commandline;
dl = 220;
al = 0;
ah = 0;
@@ -12126,7 +12126,7 @@ afterpress:
dumppointer();
dumpkeypad();
dumptextline();
- bx = 3482;
+ bx = offset_keypadlist;
checkcoords();
_cmp(data.byte(kGetback), 1);
if (flags.z())
@@ -12466,7 +12466,7 @@ menuloop:
dumppointer();
dumpmenu();
dumptextline();
- bx = 3614;
+ bx = offset_menulist;
checkcoords();
_cmp(data.byte(kGetback), 1);
if (!flags.z())
@@ -12579,7 +12579,7 @@ folderloop:
vsync();
dumppointer();
dumptextline();
- bx = 3636;
+ bx = offset_folderlist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -12623,7 +12623,7 @@ donextf:
delpointer();
showfolder();
data.word(kMousebutton) = 0;
- bx = 3636;
+ bx = offset_folderlist;
checkcoords();
worktoscreenm();
}
@@ -12710,7 +12710,7 @@ dolastf:
delpointer();
showfolder();
data.word(kMousebutton) = 0;
- bx = 3636;
+ bx = offset_folderlist;
checkcoords();
worktoscreenm();
}
@@ -12972,7 +12972,7 @@ symbolloop:
dumppointer();
dumptextline();
dumpsymbol();
- bx = 3678;
+ bx = offset_symbollist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -13343,7 +13343,7 @@ diaryloop:
dumppointer();
dumpdiarykeys();
dumptextline();
- bx = 3740;
+ bx = offset_diarylist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -13679,7 +13679,7 @@ waitops:
dumppointer();
dumptextline();
delpointer();
- bx = 3782;
+ bx = offset_opslist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -13807,7 +13807,7 @@ loadops:
vsync();
dumppointer();
dumptextline();
- bx = 3824;
+ bx = offset_loadlist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -13891,7 +13891,7 @@ discopsloop:
vsync();
dumppointer();
dumptextline();
- bx = 3866;
+ bx = offset_discopslist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -13941,7 +13941,7 @@ saveops:
vsync();
dumppointer();
dumptextline();
- bx = 3908;
+ bx = offset_savelist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -14568,7 +14568,7 @@ _tmp1:
dumppointer();
dumptextline();
delpointer();
- bx = 5057;
+ bx = offset_decidelist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -14634,7 +14634,7 @@ loadops:
vsync();
dumppointer();
dumptextline();
- bx = 3824;
+ bx = offset_loadlist;
checkcoords();
_cmp(data.byte(kGetback), 0);
if (flags.z())
@@ -14689,7 +14689,7 @@ alreadyloadold:
void DreamGenContext::createname() {
STACK_CHECK;
push(ax);
- di = 5105;
+ di = offset_speechfile;
cs.byte(di+0) = dl;
cs.byte(di+3) = cl;
al = dh;
@@ -15789,11 +15789,11 @@ toofaraway:
void DreamGenContext::mainscreen() {
STACK_CHECK;
data.byte(kInmaparea) = 0;
- bx = 5122;
+ bx = offset_mainlist;
_cmp(data.byte(kWatchon), 1);
if (flags.z())
goto checkmain;
- bx = 5184;
+ bx = offset_mainlist2;
checkmain:
checkcoords();
_cmp(data.byte(kWalkandexam), 0);
@@ -16309,7 +16309,7 @@ void DreamGenContext::atmospheres() {
STACK_CHECK;
cl = data.byte(kMapx);
ch = data.byte(kMapy);
- bx = 5246;
+ bx = offset_atmospherelist;
nextatmos:
al = cs.byte(bx);
_cmp(al, 255);
@@ -17156,7 +17156,7 @@ void DreamGenContext::showblink() {
al = 6;
nomorethan6:
ah = 0;
- bx = 5888;
+ bx = offset_blinktab;
_add(bx, ax);
al = cs.byte(bx);
ds = data.word(kIcons1);
@@ -17556,7 +17556,7 @@ rightspeed3:
finflashmouse:
al = data.byte(kPointercount);
ah = 0;
- bx = 5895;
+ bx = offset_flashmousetab;
_add(bx, ax);
al = cs.byte(bx);
data.byte(kPointerframe) = al;
@@ -17649,7 +17649,7 @@ void DreamGenContext::readkey() {
_inc(bx);
_and(bx, 15);
data.word(kBufferout) = bx;
- di = 5912;
+ di = offset_keybuffer;
_add(di, bx);
al = cs.byte(di);
data.byte(kCurrentkey) = al;
@@ -18127,7 +18127,7 @@ void DreamGenContext::readsetdata() {
void DreamGenContext::makename() {
STACK_CHECK;
si = dx;
- di = 6061;
+ di = offset_place;
transfer:
al = cs.byte(si);
cs.byte(di) = al;
@@ -18136,7 +18136,7 @@ transfer:
_cmp(al, 0);
if (!flags.z())
goto transfer;
- dx = 6059;
+ dx = offset_id;
}
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index b9ac99efd3..1021049c06 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -700,6 +700,55 @@ public:
static const uint16 addr_foghornsound = 0xc008;
static const uint16 addr_intromusic = 0xc004;
static const uint16 addr_alleybarksound = 0xc000;
+ static const uint16 offset_place = 0x17ad;
+ static const uint16 offset_quitlist = 0x0a84;
+ static const uint16 offset_savelist = 0x0f44;
+ static const uint16 offset_mainlist = 0x1402;
+ static const uint16 offset_gameerror8 = 0x113f;
+ static const uint16 offset_keys = 0x0b14;
+ static const uint16 offset_blinktab = 0x1700;
+ static const uint16 offset_error2patch = 0x0ff6;
+ static const uint16 offset_openchangesize = 0x0a1c;
+ static const uint16 offset_loadlist = 0x0ef0;
+ static const uint16 offset_mainlist2 = 0x1440;
+ static const uint16 offset_uselist = 0x0ba8;
+ static const uint16 offset_gameerror2 = 0x0fb2;
+ static const uint16 offset_id = 0x17ab;
+ static const uint16 offset_gameerror6 = 0x10be;
+ static const uint16 offset_flashmousetab = 0x1707;
+ static const uint16 offset_speechfile = 0x13f1;
+ static const uint16 offset_atmospherelist = 0x147e;
+ static const uint16 offset_gameerror4 = 0x1037;
+ static const uint16 offset_gameerror1 = 0x0f6e;
+ static const uint16 offset_examlist = 0x09be;
+ static const uint16 offset_gameinfo = 0x1170;
+ static const uint16 offset_decidelist = 0x13c1;
+ static const uint16 offset_invlist1 = 0x09fc;
+ static const uint16 offset_money2poke = 0x0d97;
+ static const uint16 offset_talklist = 0x0a64;
+ static const uint16 offset_menulist = 0x0e1e;
+ static const uint16 offset_comlist = 0x0ad8;
+ static const uint16 offset_withlist1 = 0x0a3a;
+ static const uint16 offset_money1poke = 0x0d92;
+ static const uint16 offset_gameerror7 = 0x1104;
+ static const uint16 offset_discopslist = 0x0f1a;
+ static const uint16 offset_commandline = 0x16d7;
+ static const uint16 offset_destlist = 0x0a9a;
+ static const uint16 offset_shaketable = 0x06af;
+ static const uint16 offset_error6patch = 0x10fe;
+ static const uint16 offset_keybuffer = 0x1718;
+ static const uint16 offset_speechfilename = 0x13eb;
+ static const uint16 offset_folderlist = 0x0e34;
+ static const uint16 offset_rootdir = 0x0b8c;
+ static const uint16 offset_gameerror3 = 0x1003;
+ static const uint16 offset_rainlocations = 0x0459;
+ static const uint16 offset_diarylist = 0x0e9c;
+ static const uint16 offset_opslist = 0x0ec6;
+ static const uint16 offset_symbollist = 0x0e5e;
+ static const uint16 offset_gameerror5 = 0x1074;
+ static const uint16 offset_facelist = 0x0451;
+ static const uint16 offset_operand1 = 0x0b7e;
+ static const uint16 offset_keypadlist = 0x0d9a;
const static uint16 kStartvars = 0;
const static uint16 kProgresspoints = 1;
const static uint16 kWatchon = 2;