From 5d3abd1ac03bbd3943ab6e40c3b8ef482e46466b Mon Sep 17 00:00:00 2001 From: Sven Riwoldt Date: Sun, 26 Mar 2023 08:18:09 +0200 Subject: [PATCH] Pointers Kommentare --- projects/04/tests/pointers01.asm | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/04/tests/pointers01.asm diff --git a/projects/04/tests/pointers01.asm b/projects/04/tests/pointers01.asm new file mode 100644 index 0000000..b1c5176 --- /dev/null +++ b/projects/04/tests/pointers01.asm @@ -0,0 +1,43 @@ +//arr = 100 +@100 // für @100 wird RAM[16] reserviert +D=A // RAM +@arr // +M=D // RAM = D + +// n=10 +@10 +D=A +@n +M=D + + +//initialize i=0 +@i +M=0 + +(LOOP) + // if (i == n) goto END + @i + D=M // + @n + D=D-M + @END + D;JEQ + + // RAM [arr+i] = -1 + @arr + D=M + @i + A=D+M // <-- das soll es sein + M=-1 + + //i++ + @i + M=M+1 + + @LOOP + 0;JMP + +(END) + @END + 0;JMP \ No newline at end of file