diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-09-16 14:42:32 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-09-16 14:42:32 +0200 |
commit | 780f056e61323a41abcaf0dd53a44f99bcac197c (patch) | |
tree | 29aed814e2809e9ba258d4f8465a964180803c82 /tclasm.tcl | |
parent | 196582e9c74cbdc02e66189774ed22f2ca632691 (diff) | |
download | AGH-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-x | tclasm.tcl | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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] } |