From b626864293a5cb4717303245095c6d6f39c52f7d Mon Sep 17 00:00:00 2001 From: Savely Skresanov Date: Sat, 15 Sep 2012 18:29:23 +0700 Subject: [PATCH] Some work on adding new hooks. --- src/virtualmachine/Operations.cpp | 2 +- src/virtualmachine/Syscalls.cpp | 11 ++++++++++- src/virtualmachine/Syscalls.inl | 21 +++++++++++---------- src/virtualmachine/VirtualMachine.h | 2 +- tptlibrary/tpt_syscalls.asm | 21 +++++++++++---------- tptlibrary/tpt_syscalls.h | 1 + 6 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/virtualmachine/Operations.cpp b/src/virtualmachine/Operations.cpp index dcd2cb2e6..0c998a87a 100644 --- a/src/virtualmachine/Operations.cpp +++ b/src/virtualmachine/Operations.cpp @@ -353,4 +353,4 @@ namespace vm Push(Pop()); return 0; } -} \ No newline at end of file +} diff --git a/src/virtualmachine/Syscalls.cpp b/src/virtualmachine/Syscalls.cpp index bc88fb24e..692d4d010 100644 --- a/src/virtualmachine/Syscalls.cpp +++ b/src/virtualmachine/Syscalls.cpp @@ -68,4 +68,13 @@ namespace vm { sim->part_change_type(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4); } -} \ No newline at end of file + + TRAPDEF(pmapData) + { + int xarg, yarg; + yarg = ARG(0).int4; + xarg = ARG(1).int4; + + Push(sim->pmap[yarg][xarg]); + } +} diff --git a/src/virtualmachine/Syscalls.inl b/src/virtualmachine/Syscalls.inl index 6338d119b..5281fb3a1 100644 --- a/src/virtualmachine/Syscalls.inl +++ b/src/virtualmachine/Syscalls.inl @@ -1,11 +1,12 @@ -TRAPDEF(-104, sin) -TRAPDEF(-105, cos) -TRAPDEF(-106, atan2) -TRAPDEF(-107, sqrt) -TRAPDEF(-108, floor) -TRAPDEF(-109, ceil) +TRAPDEF(-1, sin) +TRAPDEF(-2, cos) +TRAPDEF(-3, atan2) +TRAPDEF(-4, sqrt) +TRAPDEF(-5, floor) +TRAPDEF(-6, ceil) -TRAPDEF(-110, error) -TRAPDEF(-111, print) -TRAPDEF(-112, partCreate) -TRAPDEF(-113, partChangeType) \ No newline at end of file +TRAPDEF(-7, error) +TRAPDEF(-8, print) +TRAPDEF(-9, partCreate) +TRAPDEF(-10, partChangeType) +TRAPDEF(-11, pmapData) diff --git a/src/virtualmachine/VirtualMachine.h b/src/virtualmachine/VirtualMachine.h index 04dd4000a..b295d0206 100644 --- a/src/virtualmachine/VirtualMachine.h +++ b/src/virtualmachine/VirtualMachine.h @@ -279,4 +279,4 @@ public: }; }; -} \ No newline at end of file +} diff --git a/tptlibrary/tpt_syscalls.asm b/tptlibrary/tpt_syscalls.asm index 39d1f1799..2da262704 100644 --- a/tptlibrary/tpt_syscalls.asm +++ b/tptlibrary/tpt_syscalls.asm @@ -1,13 +1,14 @@ code -equ sin -104 -equ cos -105 -equ atan2 -106 -equ sqrt -107 -equ floor -108 -equ ceil -109 +equ sin -1 +equ cos -2 +equ atan2 -3 +equ sqrt -4 +equ floor -5 +equ ceil -6 -equ error -110 -equ print -111 -equ partCreate -112 -equ partChangeType -113 \ No newline at end of file +equ error -7 +equ print -8 +equ partCreate -9 +equ partChangeType -10 +equ pmapData -11 diff --git a/tptlibrary/tpt_syscalls.h b/tptlibrary/tpt_syscalls.h index 611230666..a3adf418a 100644 --- a/tptlibrary/tpt_syscalls.h +++ b/tptlibrary/tpt_syscalls.h @@ -13,5 +13,6 @@ void error(char * message); int partCreate(int i, int x, int y, int type); void partChangeType(int i, int x, int y, int type); +int pmapData(int x, int y); #endif