Permalink
Browse files

Make file adjustment, fixed iCycles counting.

  • Loading branch information...
totallymike committed Apr 11, 2012
1 parent f0580bf commit 6d2b5e236665d770803686f40ad5a72e94d24b73
Showing with 9 additions and 1 deletion.
  1. +3 −0 Makefile
  2. +6 −1 vm.c
View
@@ -1,5 +1,8 @@
all: vm
+test: vm test_bin
+ ./vm test.0x
+
vm: vm.c
gcc vm.c -o vm
View
7 vm.c
@@ -4,7 +4,7 @@
/* A and B equate to how far to shift
* to get that section of the current word.*/
-#define MAX_CYCLES 100000
+#define MAX_CYCLES 1000
#define A 4
#define B 10
@@ -169,7 +169,12 @@ int main(int argc, char *argv[]) {
while(1) {
cycles++;
+ if (--iCycles > 0)
+ continue;
+
current = ram[PC++];
+
+ // Simulate the consumption of cycles.
switch(get_op(current)) {
case 0x0:

0 comments on commit 6d2b5e2

Please sign in to comment.