summaryrefslogtreecommitdiff
path: root/src/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem.c')
-rw-r--r--src/mem.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mem.c b/src/mem.c
index 3c605a5..798fa1b 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,7 +1,11 @@
#include <stdio.h>
#include "mem.h"
-struct mem_st mem = { .pos = 0};
+struct mem_st mem = { .pos = 0, .arr={0}};
+
+int mem_pos(){
+ return mem.pos;
+}
int mem_inc(){
mem.arr[mem.pos]++;
@@ -45,16 +49,16 @@ int mem_set(char v){
void mem_printDebug(){
if (mem.pos+9 >= MEM_SIZE)
- printf("index: %d [%d .. %d]: ", mem.pos, mem.pos, mem.pos-MEM_SIZE+9);
- printf("index: %d [%d .. %d]: ", mem.pos, mem.pos, mem.pos+9);
+ printf("index: %d mem [%d .. %d]:", mem.pos, mem.pos, mem.pos-MEM_SIZE+9);
+ printf("index: %d mem [%d .. %d]:", mem.pos, mem.pos, mem.pos+9);
for (int i = 0; i < 10; ++i) {
if (mem.pos+i >= MEM_SIZE) {
- printf("%d ", mem.arr[mem.pos-MEM_SIZE+i]);
+ printf("% d", mem.arr[mem.pos-MEM_SIZE+i]);
}
else {
- printf("%d ", mem.arr[mem.pos+i]);
+ printf("% d", mem.arr[mem.pos+i]);
}
}
-
+ printf("\n");
}