aboutsummaryrefslogtreecommitdiff
path: root/tclasm.tcl
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-16 14:42:32 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-16 14:42:32 +0200
commit780f056e61323a41abcaf0dd53a44f99bcac197c (patch)
tree29aed814e2809e9ba258d4f8465a964180803c82 /tclasm.tcl
parent196582e9c74cbdc02e66189774ed22f2ca632691 (diff)
downloadAGH-engineering-thesis-780f056e61323a41abcaf0dd53a44f99bcac197c.tar.gz
AGH-engineering-thesis-780f056e61323a41abcaf0dd53a44f99bcac197c.zip
add function calling (call, ret and drop instructions) with a testbench + bugfix in stack machine
Diffstat (limited to 'tclasm.tcl')
-rwxr-xr-xtclasm.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tclasm.tcl b/tclasm.tcl
index f80863d..0dec4b0 100755
--- a/tclasm.tcl
+++ b/tclasm.tcl
@@ -273,6 +273,11 @@ proc tee {} {
}
+proc get_frame {} {
+ puts 0001000000000001
+}
+
+
proc _const {value_part} {
puts 010100000[__to_binary $value_part 7]
}
@@ -282,6 +287,15 @@ proc const {value} {
}
+proc _call {address_part} {
+ puts 010100001[__to_binary $address_part 7]
+}
+
+proc call {address} {
+ _with_im _call $address
+}
+
+
# Instructions, that shrink stack
proc add {} {
@@ -304,6 +318,16 @@ proc mul {} {
}
+proc drop {} {
+ puts 0011000000000100
+}
+
+
+proc ret {} {
+ puts 0011000010000000
+}
+
+
proc _cond_jump {address_part} {
puts 011100001[__to_binary $address_part 7]
}