aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_machine_multiinstructions_load_store/instructions.s.tcl
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-05 14:47:13 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-05 14:47:13 +0200
commit6295bacd000e00d7c569fdc64697a29561f1d2b1 (patch)
tree70355a4e0a163bd53d01790704bd5fc40b8adf7e /tests/stack_machine_multiinstructions_load_store/instructions.s.tcl
parent67338780099d1384b36623780a5a63c3be5ade9d (diff)
downloadAGH-engineering-thesis-6295bacd000e00d7c569fdc64697a29561f1d2b1.tar.gz
AGH-engineering-thesis-6295bacd000e00d7c569fdc64697a29561f1d2b1.zip
add tclasm multiinstructions (instructions, that possibly translate to more than one)
Diffstat (limited to 'tests/stack_machine_multiinstructions_load_store/instructions.s.tcl')
-rwxr-xr-xtests/stack_machine_multiinstructions_load_store/instructions.s.tcl54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/stack_machine_multiinstructions_load_store/instructions.s.tcl b/tests/stack_machine_multiinstructions_load_store/instructions.s.tcl
new file mode 100755
index 0000000..bd16f8a
--- /dev/null
+++ b/tests/stack_machine_multiinstructions_load_store/instructions.s.tcl
@@ -0,0 +1,54 @@
+#!/usr/bin/env tclsh
+
+source tclasm.tcl
+
+### set stack to h1FFE00, store 4 numbers (h11223344, h55667788, h8899AABB and
+### hCCDDEEFF) at addresses h00002E, h00003E, h00004E and h00005E and load them
+### back to stack (only 2 will really get written to stack's memory, other 2
+### will remain in r0 and r1). Then, write them to h00F0F0, h08F0F0, h10F0F0 and
+### h18F0F0.
+### At the and use operand-addressing to load back value h55667788 from h00003E
+### (expressed as h000040 in im + (-2) in operand) and store it to h1FFFCD
+### (expressed as h1F0F0D in im + h00F0C0 in operand).
+
+## set up stack
+set_sp 0
+
+## get number h11223344 into r1, and store it - repeat for other 3 numbers;
+const h11223344
+store h00002E
+
+const h55667788
+store h00003E
+
+const h8899AABB
+store h00004E
+
+const hCCDDEEFF
+store h00005E
+
+## get numbers back on stack
+load h00002E
+load h00003E
+load h00004E
+load h00005E
+
+## store copies to new locations
+store h18F0F0
+store h10F0F0
+store h08F0F0
+store h00F0F0
+
+## prepare operand for later store operation
+const h00F0C0
+
+## use operand addressing to load back value from h000018
+const -2
+load+ h000040
+
+## use operand addressing to trove value to h1FFFE2 = h1FFFC0 + h000022
+# immediate value gets sign-extended here!
+store+ h1F0F0D
+
+## finish test
+halt