From bd70cd9dff5666d7bcca69960ef4271c519d04f3 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 Dec 2011 20:45:39 +0000 Subject: [PATCH] DREAMWEB: Ported 'read' to C++ --- devtools/tasmrecover/tasm-recover | 1 + engines/dreamweb/dreamgen.cpp | 91 ------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/monitor.cpp | 76 ++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 5 files changed, 78 insertions(+), 92 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index d63c17ecd74..01264256251 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -763,6 +763,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'randomnum1', 'randomnum2', 'randomnumber', + 'read', 'readabyte', 'readcitypic', 'readdesticon', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 220304c405b..b44efe9d0ed 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,97 +26,6 @@ namespace DreamGen { -void DreamGenContext::read() { - STACK_CHECK; - cx = 40; - randomAccess(); - parser(); - _cmp(es.byte(di+1), 0); - if (!flags.z()) - goto okcom; - netError(); - return; -okcom: - es = cs; - di = 408; - ax = data.word(kTextfile1); - data.word(kMonsource) = ax; - ds = ax; - si = (66*2); - searchForString(); - _cmp(al, 0); - if (flags.z()) - goto foundfile2; - ax = data.word(kTextfile2); - data.word(kMonsource) = ax; - ds = ax; - si = (66*2); - searchForString(); - _cmp(al, 0); - if (flags.z()) - goto foundfile2; - ax = data.word(kTextfile3); - data.word(kMonsource) = ax; - ds = ax; - si = (66*2); - searchForString(); - _cmp(al, 0); - if (flags.z()) - goto foundfile2; - al = 7; - monMessage(); - return; -foundfile2: - getKeyAndLogo(); - _cmp(al, 0); - if (flags.z()) - goto keyok1; - return; -keyok1: - es = cs; - di = offset_operand1; - ds = data.word(kMonsource); - searchForString(); - _cmp(al, 0); - if (flags.z()) - goto findtopictext; - al = data.byte(kOldlogonum); - data.byte(kLogonum) = al; - al = 11; - monMessage(); - return; -findtopictext: - _inc(bx); - push(es); - push(bx); - monitorLogo(); - scrollMonitor(); - bx = pop(); - es = pop(); -moretopic: - monPrint(); - al = es.byte(bx); - _cmp(al, 34); - if (flags.z()) - goto endoftopic; - _cmp(al, '='); - if (flags.z()) - goto endoftopic; - _cmp(al, '*'); - if (flags.z()) - goto endoftopic; - push(es); - push(bx); - processTrigger(); - cx = 24; - randomAccess(); - bx = pop(); - es = pop(); - goto moretopic; -endoftopic: - scrollMonitor(); -} - void DreamGenContext::dirFile() { STACK_CHECK; al = 34; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 6ee65ada685..6ec194618a7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -418,7 +418,6 @@ public: void dirFile(); void dreamweb(); - void read(); void searchForString(); void parser(); }; diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index a877f17b8a6..953d1cb6a1b 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -475,6 +475,82 @@ void DreamGenContext::dirCom() { scrollMonitor(); } +void DreamGenContext::read() { + bool foundFile = false; + + randomAccess(40); + parser(); + if (es.byte(di+1) == 0) { + netError(); + return; + } + + es = cs; + di = kCurrentfile; + + data.word(kMonsource) = data.word(kTextfile1); + ds = data.word(kMonsource); + si = kTextstart; + searchForString(); + if (al == 0) { + foundFile = true; + } else { + data.word(kMonsource) = data.word(kTextfile2); + ds = data.word(kMonsource); + si = kTextstart; + searchForString(); + if (al == 0) { + foundFile = true; + } else { + data.word(kMonsource) = data.word(kTextfile3); + ds = data.word(kMonsource); + si = kTextstart; + searchForString(); + if (al == 0) + foundFile = true; + } + } + + if (!foundFile) { + monMessage(7); + return; + } + + // "foundfile2" + getKeyAndLogo(); + if (al != 0) + return; + + // "keyok1" + es = cs; + di = offset_operand1; + ds = data.word(kMonsource); + searchForString(); + if (al != 0) { + data.byte(kLogonum) = data.byte(kOldlogonum); + monMessage(11); + return; + } + + // "findtopictext" + bx++; + + monitorLogo(); + scrollMonitor(); + + while (true) { + monPrint(); + if (es.byte(bx) == 34 || es.byte(bx) == '=' || es.byte(bx) == '*') { + // "endoftopic" + scrollMonitor(); + return; + } + + processTrigger(); + randomAccess(24); + } +} + void DreamGenContext::signOn() { parser(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index feedef9aae8..bda2be634ee 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -117,6 +117,7 @@ void getKeyAndLogo(); void signOn(); void searchForFiles(uint16 segment); + void read(); void dirCom(); #endif