diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-21 14:39:00 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-21 14:39:00 -0800 |
commit | d672cdfc6c89b1306af9a967d551dbc016948965 (patch) | |
tree | 9ea2aca23ce4456846bc7f794290d3654ee9e694 /cpp/018address | |
parent | 986eebffcfbc896449a0d61c395b714bab59c5f0 (diff) | |
download | mu-d672cdfc6c89b1306af9a967d551dbc016948965.tar.gz |
808
Diffstat (limited to 'cpp/018address')
-rw-r--r-- | cpp/018address | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/018address b/cpp/018address index 4a5bcd51..33f62fc9 100644 --- a/cpp/018address +++ b/cpp/018address @@ -28,8 +28,19 @@ vector<int> read_memory(reagent x) { return result; } +:(scenario "store_indirect") +# similarly, write to addresses pointing at other locations using the 'deref' property +recipe main [ + 1:address:integer <- copy 2:literal + 1:address:integer/deref <- copy 34:literal +] ++run: instruction 1 ++mem: location 1 is 2 ++mem: storing in location 2 + :(replace{} "void write_memory(reagent x, vector<int> data)") void write_memory(reagent x, vector<int> data) { + x = canonize(x); int base = to_int(x.name); size_t size = size_of(x.types[0]); if (size != data.size()) raise << "size mismatch in storing to " << x.to_string(); |