[Scummvm-cvs-logs] CVS: tools Makefile,1.9,1.10 descumm6.cpp,1.74,1.75

Max Horn fingolfin at users.sourceforge.net
Tue Dec 31 09:30:02 CET 2002


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv3179

Modified Files:
	Makefile descumm6.cpp 
Log Message:
added various opcode and some thoughts on switch/case

Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/tools/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile	23 Dec 2002 12:49:48 -0000	1.9
+++ Makefile	31 Dec 2002 17:29:07 -0000	1.10
@@ -6,7 +6,7 @@
 LDFLAGS :=
 
 # Uncomment this if you are on a big endian system
-# CFLAGS += -DSCUMM_BIG_ENDIAN
+CFLAGS += -DSCUMM_BIG_ENDIAN
 
 TARGETS := descumm3$(EXEEXT) descumm5$(EXEEXT) descumm6$(EXEEXT) extract$(EXEEXT) rescumm$(EXEEXT) simon2mp3$(EXEEXT)
 

Index: descumm6.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm6.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- descumm6.cpp	30 Dec 2002 01:48:18 -0000	1.74
+++ descumm6.cpp	31 Dec 2002 17:29:07 -0000	1.75
@@ -32,6 +32,40 @@
 #include <stdlib.h>
 #include <assert.h>
 
+/*
+switch/case statements have a pattern that look as follows (they were probably
+generated by some Scumm script compiler):
+
+push SOMETHING		- the value we are switching on
+dup					- duplicate it
+push caseA			- push the first case value
+eq					- compare
+jump if false 		- if not equal, jump to next case
+  kill 				- we entered this case - kill the switch value from the stack
+  ...
+  jump AFTER		- leave this switch
+dup
+push caseB
+eq
+jump if false
+  kill
+  ...
+  jump AFTER
+[optional: default case here ?!?]
+AFTER:
+
+
+Unfortunatly, in reality it is somewhat more complicated. E.g. in script 55,
+in some cases the "jump AFTER" instead jumps into the middle of some other case.
+Maybe they did have some sort of code optimized after all?
+
+Anyway, the fixed key pattern here seems to be for each case:
+  dup - push - eq - jumpFalse - kill
+And of course a push before the first of these. Note that there doesn't have
+to be a jump before each case: after all, "fall through" is possible with C(++)
+switch/case statements, too, so it's well possible they used that in Scumm, too.
+  
+*/
 
 typedef unsigned char byte;
 typedef unsigned char uint8;
@@ -463,13 +497,13 @@
 	NULL,
 	NULL,
 	/* 24 */
-	"timedate_year?",
-	"timedate_month?",
-	"timedate_day?",
-	"timedate_hour?",
+	"VAR_TIMEDATE_YEAR",
+	"VAR_TIMEDATE_MONTH",
+	"VAR_TIMEDATE_DAY",
+	"VAR_TIMEDATE_HOUR",
 	/* 28 */
-	"timedate_minute?",
-	"timedate_second?",
+	"VAR_TIMEDATE_MINUTE",
+	"VAR_TIMEDATE_SECOND",
 	"override_hit",
 	"VAR_ROOM",
 	/* 32 */
@@ -672,8 +706,6 @@
 	}
 }
 
-
-
 byte *skipVerbHeader(byte *p)
 {
 	if (scriptVersion == 8) {
@@ -1799,10 +1831,21 @@
 				"\x28|restart,"
 				"\x29|quit");
 		break;
-
+	case 0xB4:
+		ext("x" "saveRestoreVerbs\0"
+				"\xB4ppp|saveVerbs,"
+				"\xB5ppp|restoreVerbs,"
+				"\xB6ppp|deleteVerbs");
+		break;
 	case 0xB5:
 		ext("ps|setObjectName");
 		break;
+	case 0xB6:
+		ext("|getDateTime");
+		break;
+	case 0xB7:
+		ext("ppppp|drawBox");
+		break;
 
 	case 0xB9:
 		ext("s|startVideo");
@@ -2412,7 +2455,9 @@
 		break;
 	case 0xA5:
 		ext("x" "saveRestoreVerbs\0"
-				"\x8Dppp|saveRestoreA," "\x8Eppp|saveRestoreB," "\x8Fppp|saveRestoreC");
+				"\x8Dppp|saveVerbs,"
+				"\x8Eppp|restoreVerbs,"
+				"\x8Fppp|deleteVerbs");
 		break;
 	case 0xA6:
 		ext("ppppp|drawBox");





More information about the Scummvm-git-logs mailing list