diff options
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 190 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 32 | ||||
-rw-r--r-- | engines/dreamweb/monitor.cpp | 72 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
5 files changed, 139 insertions, 159 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 03e831f79b..1ddb900d31 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -52,6 +52,8 @@ p = parser(skip_binary_data = [ 'keypadlist', 'symbollist', 'diarylist', + # monitor.asm + 'comlist', # newplace.asm 'destlist', # object.asm @@ -374,6 +376,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'examinventory', 'examineob', 'examineobtext', + 'execcommand', 'facerightway', 'fadecalculation', 'fadedos', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e8e577e51b..ef96461d17 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2731,14 +2731,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1244; + si = 1184; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1260; + si = 1200; _add(si, ax); ax = pop(); } @@ -2790,7 +2790,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1244); + _add(bx, 1184); es.byte(bx) = 0; } @@ -2821,88 +2821,6 @@ void DreamGenContext::makeCaps() { _sub(al, 32); } -void DreamGenContext::execCommand() { - STACK_CHECK; - es = cs; - bx = offset_comlist; - ds = cs; - si = 1278; - al = ds.byte(si); - _cmp(al, 0); - if (!flags.z()) - goto notblankinp; - scrollMonitor(); - return; -notblankinp: - cl = 0; -comloop: - push(bx); - push(si); -comloop2: - al = ds.byte(si); - _add(si, 2); - ah = es.byte(bx); - _inc(bx); - _cmp(ah, 32); - if (flags.z()) - goto foundcom; - _cmp(al, ah); - if (flags.z()) - goto comloop2; - si = pop(); - bx = pop(); - _add(bx, 10); - _inc(cl); - _cmp(cl, 6); - if (!flags.z()) - goto comloop; - netError(); - al = 0; - return; -foundcom: - si = pop(); - bx = pop(); - _cmp(cl, 1); - if (flags.z()) - goto testcom; - _cmp(cl, 2); - if (flags.z()) - goto directory; - _cmp(cl, 3); - if (flags.z()) - goto accesscom; - _cmp(cl, 4); - if (flags.z()) - goto signoncom; - _cmp(cl, 5); - if (flags.z()) - goto keyscom; - goto quitcom; -directory: - dirCom(); - al = 0; - return; -signoncom: - signOn(); - al = 0; - return; -accesscom: - read(); - al = 0; - return; -keyscom: - showKeys(); - al = 0; - return; -testcom: - al = 6; - monMessage(); - al = 0; - return; -quitcom: - al = 1; -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; @@ -2919,7 +2837,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1120; + di = 1060; _inc(di); cx = 12; _movsb(cx, true); @@ -3021,7 +2939,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1278; + si = 1218; checkpass: _lodsw(); ah = es.byte(bx); @@ -3092,7 +3010,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1120; + di = 1060; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -3222,7 +3140,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1120+1; + di = 1060+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3349,7 +3267,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1278; + si = 1218; notspace1: _lodsw(); _cmp(al, 32); @@ -4167,7 +4085,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1244; + di = 1184; al = 1; _stosb(2); al = 0; @@ -4474,51 +4392,51 @@ void DreamGenContext::__start() { //0x0370: ...2 .... ...2 .... 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, //0x0380: ...2 ...! (..2 ...D - 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x45, 0x58, - //0x0390: REAM WEB. V99. ..EX - 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, - //0x03a0: IT HELP - 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, - //0x03b0: LI ST READ - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03c0: LO GON - 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, - //0x03d0: KEYS .. PUBL - 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, - //0x03e0: IC PUBL IC - 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, - //0x03f0: . ..BL ACKD RAGO - 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - //0x0400: N RY AN ... - 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, - //0x0410: HEND RIX LOUI - 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, - //0x0420: S . ..SE PTIM - 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, - //0x0430: US BE CKET T - 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0440: ... - 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x0450: ."R OOT . - 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, - //0x0460: " .00 - 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, - //0x0470: 00.0 0... ..$O BJEC - 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0480: T NA ME O NE + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, + //0x0390: REAM WEB. V99. .... + 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, + //0x03a0: PUBL IC PUBL + 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, + //0x03b0: IC . ..BL ACKD + 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03c0: RAGO N RY AN + 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03d0: ... HEND RIX + 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, + //0x03e0: LOUI S . ..SE + 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, + //0x03f0: PTIM US BE CKET + 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0400: T ... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0410: ."R OOT + 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0420: . " + 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, + //0x0430: .00 00.0 0... ..$O + 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, + //0x0440: BJEC T NA ME O NE 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0490: - 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x04a0: . .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, - //0x04b0: .... .... .... D:.. + //0x0450: + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, + //0x0460: . .... .... + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + //0x0470: .... .... .... .... + 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0480: D:.. .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0490: .... .... .... .... + 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x04a0: .... .... .... .... + 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, + //0x04b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04c0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04d0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04e0: .... .... .... .... - 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0500: .... .... .... .... @@ -4528,15 +4446,7 @@ void DreamGenContext::__start() { //0x0520: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0530: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0540: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0550: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0560: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - //0x0570: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 43f93ee238..dc06f1f9e5 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,14 +32,13 @@ namespace DreamGen { -static const uint16 offset_money1poke = 0x046e; -static const uint16 offset_operand1 = 0x0444; -static const uint16 offset_comlist = 0x039e; -static const uint16 offset_commandline = 0x047b; -static const uint16 offset_rootdir = 0x0452; -static const uint16 offset_money2poke = 0x0473; +static const uint16 offset_commandline = 0x043f; +static const uint16 offset_rootdir = 0x0416; +static const uint16 offset_money2poke = 0x0437; +static const uint16 offset_operand1 = 0x0408; +static const uint16 offset_keys = 0x039e; +static const uint16 offset_money1poke = 0x0432; static const uint16 offset_openchangesize = 0x039c; -static const uint16 offset_keys = 0x03da; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -373,15 +372,15 @@ static const uint16 kCurrentsample = 452; static const uint16 kRoomssample = 453; static const uint16 kReelroutines = 454; static const uint16 kBasicsample = 911; -static const uint16 kCurrentfile = 1120; -static const uint16 kRoomscango = 1244; -static const uint16 kRoompics = 1260; -static const uint16 kOplist = 1275; -static const uint16 kInputline = 1278; -static const uint16 kPresslist = 1406; -static const uint16 kQuitrequested = 1412; -static const uint16 kSubtitles = 1413; -static const uint16 kForeignrelease = 1414; +static const uint16 kCurrentfile = 1060; +static const uint16 kRoomscango = 1184; +static const uint16 kRoompics = 1200; +static const uint16 kOplist = 1215; +static const uint16 kInputline = 1218; +static const uint16 kPresslist = 1346; +static const uint16 kQuitrequested = 1352; +static const uint16 kSubtitles = 1353; +static const uint16 kForeignrelease = 1354; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -569,7 +568,6 @@ public: void searchForFiles(); void getExAd(); void initialMonCols(); - void execCommand(); void findPuzText(); void swapWithInv(); void adjustRight(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index f01664632a..dba0d56c31 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -70,6 +70,7 @@ void DreamGenContext::useMon() { scrollMonitor(); data.word(kBufferin) = 0; data.word(kBufferout) = 0; + bool stop = false; do { di = data.word(kMonadx); bx = data.word(kMonady); @@ -80,10 +81,10 @@ void DreamGenContext::useMon() { di = pop(); data.word(kMonadx) = di; data.word(kMonady) = bx; - execCommand(); + stop = execCommand(); if (quitRequested()) //TODO : Check why it crashes when put before the execcommand break; - } while (al == 0); + } while (!stop); getRidOfTemp(); getRidOfTempCharset(); deallocateMem(data.word(kTextfile1)); @@ -97,6 +98,73 @@ void DreamGenContext::useMon() { workToScreenM(); } +bool DreamGenContext::execCommand() { + static const char *comlist[] = { + "EXIT", + "HELP", + "LIST", + "READ", + "LOGON", + "KEYS" + }; + + const char *inputLine = (const char *)data.ptr(kInputline, 64); + if (*inputLine == 0) { + // No input + scrollMonitor(); + return false; + } + + int cmd; + bool done = false; + // Loop over all commands in the list and see if we get a match + for (cmd = 0; cmd < ARRAYSIZE(comlist); ++cmd) { + const char *cmdStr = comlist[cmd]; + const char *inputStr = inputLine; + // Compare the command, char by char, to see if we get a match. + // We only care about the prefix matching, though. + char inputChar, cmdChar; + do { + inputChar = *inputStr; inputStr += 2; + cmdChar = *cmdStr++; + if (cmdChar == 0) { + done = true; + break; + } + } while (inputChar == cmdChar); + + if (done) + break; + } + + // Execute the selected command + switch (cmd) { + case 0: + return true; + case 1: + monMessage(6); + break; + case 2: + dirCom(); + break; + case 3: + read(); + break; + case 4: + signOn(); + break; + case 5: + showKeys(); + break; + default: + netError(); + break; + } + return false; +} + + + void DreamGenContext::monitorLogo() { if (data.byte(kLogonum) != data.byte(kOldlogonum)) { data.byte(kOldlogonum) = data.byte(kLogonum); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a287d57bad..b3b974a43d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -594,5 +594,6 @@ void dumpDiaryKeys(); void runEndSeq(); void lookAtCard(); + bool execCommand(); #endif |