From 190031a0162e315d87c7f0b0a9c7c0f2b0e706c2 Mon Sep 17 00:00:00 2001 From: Erick Date: Sun, 6 Feb 2022 22:20:33 +0100 Subject: [PATCH] update assembly test code --- asm/asm_test.asm | 26 ++++++++++++++++++++++++++ asm/helloworld.asm | 32 ++++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 asm/asm_test.asm diff --git a/asm/asm_test.asm b/asm/asm_test.asm new file mode 100644 index 0000000..546e779 --- /dev/null +++ b/asm/asm_test.asm @@ -0,0 +1,26 @@ +.ORIG x3000 + AND R0, R0, #0 + AND R1, R1, #0 + AND R3, R3, #0 + LEA R0, NUM + ADD R1, R1, R0 + LD R2, ASCII + +FOR_LOOP + LDR R4, R1, #0 + BRz END_LOOP + ADD R4, R4, R2 + STR R4, R1, #0 + ADD R1, R1, #1 + BRnzp FOR_LOOP +END_LOOP + + PUTs +HALT + +ASCII .fill x30 +NUM .fill x01 + .fill x02 + .fill x03 + .fill x04 +.END \ No newline at end of file diff --git a/asm/helloworld.asm b/asm/helloworld.asm index fd0bdb1..ae4edc1 100644 --- a/asm/helloworld.asm +++ b/asm/helloworld.asm @@ -1,6 +1,26 @@ - .ORIG x3000 - LEA R0, HS ; - PUTS ; - HALT ; -HS .STRINGZ "Henlo world!" - .END \ No newline at end of file +.ORIG x3000 + AND R0, R0, #0 + AND R1, R1, #0 + AND R3, R3, #0 + LEA R0, NUM + ADD R1, R1, R0 + LD R2, ASCII + +FOR_LOOP + LDR R4, R1, #0 + BRz END_LOOP + ADD R4, R4, R2 + STR R4, R1, #0 + ADD R1, R1, #1 + BRnzp FOR_LOOP +END_LOOP + + PUTs +HALT + +ASCII .fill x30 +NUM .fill x01 + .fill x02 + .fill x03 + .fill x04 +.END