[Scummvm-cvs-logs] scummvm master -> 6a7e798f465afb0f188b85664dee5ae2cda93a4a

digitall digitall at scummvm.org
Mon Dec 26 22:25:11 CET 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:
6a7e798f46 DREAMWEB: Ported 'dirfile' to C++


Commit: 6a7e798f465afb0f188b85664dee5ae2cda93a4a
    https://github.com/scummvm/scummvm/commit/6a7e798f465afb0f188b85664dee5ae2cda93a4a
Author: D G Turner (digitall at scummvm.org)
Date: 2011-12-26T13:23:38-08:00

Commit Message:
DREAMWEB: Ported 'dirfile' to C++

Needs some checking of es:di usage and work to remove _operand1 to
dreambase.h

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/monitor.cpp



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index f82b6a0..822896a 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -1027,6 +1027,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'zoomonoff',
 	], skip_output = [
 	# These functions are processed but not output
+	'dirfile',
 	'dreamweb',
 	], skip_dispatch_call = True, skip_addr_constants = True,
 	header_omit_blacklisted = True,
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 4a0611d..13cb425 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -26,83 +26,6 @@
 
 namespace DreamGen {
 
-void DreamGenContext::dirFile() {
-	STACK_CHECK;
-	al = 34;
-	es.byte(di) = al;
-	push(es);
-	push(di);
-	ds = data.word(kTextfile1);
-	si = (66*2);
-	searchForString();
-	_cmp(al, 0);
-	if (flags.z())
-		goto foundfile;
-	di = pop();
-	es = pop();
-	push(es);
-	push(di);
-	ds = data.word(kTextfile2);
-	si = (66*2);
-	searchForString();
-	_cmp(al, 0);
-	if (flags.z())
-		goto foundfile;
-	di = pop();
-	es = pop();
-	push(es);
-	push(di);
-	ds = data.word(kTextfile3);
-	si = (66*2);
-	searchForString();
-	_cmp(al, 0);
-	if (flags.z())
-		goto foundfile;
-	di = pop();
-	es = pop();
-	al = 7;
-	monMessage();
-	return;
-foundfile:
-	ax = pop();
-	ax = pop();
-	getKeyAndLogo();
-	_cmp(al, 0);
-	if (flags.z())
-		goto keyok2;
-	return;
-keyok2:
-	push(es);
-	push(bx);
-	ds = cs;
-	si = offset_operand1+1;
-	es = cs;
-	di = 408+1;
-	cx = 12;
-	_movsb(cx, true);
-	monitorLogo();
-	scrollMonitor();
-	al = 10;
-	monMessage();
-	bx = pop();
-	es = pop();
-directloop2:
-	al = es.byte(bx);
-	_inc(bx);
-	_cmp(al, 34);
-	if (flags.z())
-		goto endofdir2;
-	_cmp(al, '*');
-	if (flags.z())
-		goto endofdir2;
-	_cmp(al, '=');
-	if (!flags.z())
-		goto directloop2;
-	monPrint();
-	goto directloop2;
-endofdir2:
-	scrollMonitor();
-}
 
 void DreamGenContext::__start() { 
 	static const uint8 src[] = {
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index f1b870d..7e88838 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -453,6 +453,61 @@ void DreamGenContext::getKeyAndLogo() {
 	}
 }
 
+void DreamGenContext::dirFile() {
+	bool foundFile = false;
+
+	es.byte(di) = 34;
+
+	ds = data.word(kTextfile1);
+	si = kTextstart;
+	searchForString();
+	if (al == 0) {
+		foundFile = true;
+	} else {
+		ds = data.word(kTextfile2);
+		si = kTextstart;
+		searchForString();
+		if (al == 0) {
+			foundFile = true;
+		} else {
+			ds = data.word(kTextfile3);
+			si = kTextstart;
+			searchForString();
+			if (al == 0)
+				foundFile = true;
+		}
+	}
+
+	if (!foundFile) {
+		monMessage(7);
+		return;
+	}
+
+	// "foundfile"
+	getKeyAndLogo();
+	if (al != 0)
+		return;
+
+	// "keyok2"
+	memcpy(data.ptr(kCurrentfile+1, 0), data.ptr(offset_operand1+1, 0), 12);
+	monitorLogo();
+	scrollMonitor();
+	monMessage(10);
+
+	while (true) {
+		al = es.byte(bx);
+		bx++;
+		if (al == 34 || al == '*') {
+			// "endofdir2"
+			scrollMonitor();
+			return;
+		}
+
+		if (al == '=')
+			monPrint();
+	}
+}
+
 void DreamGenContext::dirCom() {
 	randomAccess(30);
 






More information about the Scummvm-git-logs mailing list