summaryrefslogtreecommitdiff
path: root/src/virtualmachine/VirtualMachine.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-09-09 14:22:54 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-09 14:22:54 (GMT)
commitd5ae22115d19a87f61163479b972fb13e5d42caf (patch)
treeb605ceeef9021c40ee9803e038edd30abdcb559a /src/virtualmachine/VirtualMachine.cpp
parent7b05862cfe69ece782493b9f3f78338262e569bd (diff)
downloadpowder-d5ae22115d19a87f61163479b972fb13e5d42caf.zip
powder-d5ae22115d19a87f61163479b972fb13e5d42caf.tar.gz
Preserve stack pointer after VirtualMachine::Call()
Diffstat (limited to 'src/virtualmachine/VirtualMachine.cpp')
-rw-r--r--src/virtualmachine/VirtualMachine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/virtualmachine/VirtualMachine.cpp b/src/virtualmachine/VirtualMachine.cpp
index ce12b87..c97ba72 100644
--- a/src/virtualmachine/VirtualMachine.cpp
+++ b/src/virtualmachine/VirtualMachine.cpp
@@ -198,11 +198,11 @@ namespace vm
int VirtualMachine::Call(int address)
{
word w;
- int i, argCount = 13;
+ int i, argCount = 0;
/* Set up call. */
- opPUSH(w);
- crumb("Starting with PC=%d, DP=%d, RP=%d to %d\n", PC, DP, RP, address);
+ //crumb("Starting with PC=%d, DP=%d, RP=%d to %d\n", PC, DP, RP, address);
+ opPUSH(w); //wtf is the point of this...
w.int4 = (argCount + 2) * sizeof(word);
opENTER(w);
i = 8;
@@ -222,11 +222,14 @@ namespace vm
w.int4 = address;
Push(w);
opCALL(w);
- printf("Upon running PC=%d, DP=%d, RP=%d\n", PC, DP, RP);
+ //printf("Upon running PC=%d, DP=%d, RP=%d\n", PC, DP, RP);
Run();
- printf("At finish PC=%d, DP=%d, RP=%d\n", PC, DP, RP);
+ //printf("At finish PC=%d, DP=%d, RP=%d\n", PC, DP, RP);
w.int4 = (argCount + 2) * sizeof(word);
opLEAVE(w);
+ opPOP(w); //To counter that stupid opPUSH at the start
+ PC = romSize + 1;
+ //crumb("Ending with PC=%d, DP=%d, RP=%d\n", PC, DP, RP);
return 0;
}