Memory added plus basic memory operations

This commit is contained in:
2019-11-23 14:53:56 +01:00
parent 99f616e1e4
commit 22bb974a05
17 changed files with 232 additions and 68 deletions

View File

@@ -1,3 +1,5 @@
DECLARE MEMORY_SIZE $4096;
addi $10 $-5 %A;
subi %A $2 %B;
muli $2 %B %C;
@@ -7,7 +9,7 @@ divi $2 %C %D;
seti %A $0;
# Loop from 0 to 10
loop:
count_loop:
addi $1 %A %A;
# Print the current value
@@ -18,7 +20,7 @@ int $0;
seti %A %B;
lti %A $10;
jmp loop;
jmp count_loop;
# Hello world
seti %A $72; # H
@@ -31,5 +33,24 @@ int $0;
seti %A $111; # o
int $0;
seti %A $32; # space
int $0;
pushi $68; # D
pushi $76; # L
pushi $82; # R
pushi $79; # O
pushi $87; # W
seti %B $5;
world_loop:
popi %A;
int $0;
subi %B $1 %B;
gti %B $0;
jmp world_loop;
seti %A $10; # newline
int $0;