freesci-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesci-develop] r1572 - in freesci/branches/glutton: . src/engine


From: freesci
Subject: [freesci-develop] r1572 - in freesci/branches/glutton: . src/engine
Date: Mon, 22 May 2006 17:29:30 +0200

Author: skovmanden
Date: 2006-05-22 17:29:21 +0200 (Mon, 22 May 2006)
New Revision: 1572

Modified:
   freesci/branches/glutton/ChangeLog
   freesci/branches/glutton/src/engine/kernel.c
   freesci/branches/glutton/src/engine/vm.c
Log:
Fix the conversation system in CotL by providing special pointer arithmetic 
semantics.
Also take care of Memory(). It's odd, this seemed to take much more code the 
last time around.
Oh well.

Lars



Modified: freesci/branches/glutton/ChangeLog
===================================================================
--- freesci/branches/glutton/ChangeLog  2006-05-20 13:35:32 UTC (rev 1571)
+++ freesci/branches/glutton/ChangeLog  2006-05-22 15:29:21 UTC (rev 1572)
@@ -1,3 +1,8 @@
+2006-05-22  Lars Skovlund  <address@hidden>
+
+       * src/engine/kernel.c, src/engine/vm.c: Added special pointer
+       handling for LOCALS blocks in arithmetic opcodes and in Memory().
+
 2006-05-19  Walter van Niftrik <address@hidden>
 
        * src/engine/kpathing.c, src/scicore/script.c, src/include/vm.h:

Modified: freesci/branches/glutton/src/engine/kernel.c
===================================================================
--- freesci/branches/glutton/src/engine/kernel.c        2006-05-20 13:35:32 UTC 
(rev 1571)
+++ freesci/branches/glutton/src/engine/kernel.c        2006-05-22 15:29:21 UTC 
(rev 1572)
@@ -650,37 +650,43 @@
 
        case K_MEMORY_PEEK : {
                byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2);
-               if (ref)
-                       return make_reg(0, getInt16(ref));
-               else {
+
+               if (!ref) {
                        SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at 
"PREG"!\n",
                                  PRINT_REG(argv[1]));
                        return s->r_acc;
                }
+               if (s->seg_manager.heap[argv[1].segment]->type == 
MEM_OBJ_LOCALS)
+                       return *((reg_t *) ref); else
+                       return make_reg(0, getInt16(ref));
        }
                break;
 
        case K_MEMORY_POKE : {
                byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2);
 
-               if (argv[2].segment) {
-                       SCIkdebug(SCIkERROR, "Attempt to poke memory reference 
"PREG" to "PREG"!\n",
-                                 PRINT_REG(argv[2]), PRINT_REG(argv[1]));
-                       return s->r_acc;
-               }
-
                if (!ref) {
                        SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at 
"PREG"!\n",
                                  PRINT_REG(argv[1]));
                        return s->r_acc;
                }
 
-               putInt16(ref, argv[2].offset);
+               if (s->seg_manager.heap[argv[1].segment]->type == 
MEM_OBJ_LOCALS)
+                       *((reg_t *) ref) = argv[2]; else
+                       {
+                               if (argv[2].segment) {
+                                       SCIkdebug(SCIkERROR, "Attempt to poke 
memory reference "PREG" to "PREG"!\n",
+                                                 PRINT_REG(argv[2]), 
PRINT_REG(argv[1]));
+                                       return s->r_acc;
+                                       putInt16(ref, argv[2].offset);
+                               }
+                               
+                       }
                return s->r_acc;
-       }
                break;
 
        }
+       }
 
        return s->r_acc;
 }

Modified: freesci/branches/glutton/src/engine/vm.c
===================================================================
--- freesci/branches/glutton/src/engine/vm.c    2006-05-20 13:35:32 UTC (rev 
1571)
+++ freesci/branches/glutton/src/engine/vm.c    2006-05-22 15:29:21 UTC (rev 
1572)
@@ -613,6 +613,9 @@
        switch (mobj->type) {
 
        case MEM_OBJ_LOCALS:
+               base.offset += 2*offset;
+               return base;
+
        case MEM_OBJ_SCRIPT:
        case MEM_OBJ_STACK:
        case MEM_OBJ_DYNMEM:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]