From 0f5eda0def3809930138ad6a3b3236f6b53ee524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 15 Nov 2021 00:03:10 +0100 Subject: [PATCH] add ALIGNED --- src/fh_builtins.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fh_builtins.c b/src/fh_builtins.c index 1fe3e03..f967f3e 100644 --- a/src/fh_builtins.c +++ b/src/fh_builtins.c @@ -970,6 +970,16 @@ static enum fh_error w_two_fetch(struct fh_thread_s *fh, const struct fh_word_s return FH_OK; } +static enum fh_error w_aligned(struct fh_thread_s *fh, const struct fh_word_s *w) +{ + (void) w; + enum fh_error rv; + uint32_t addr = 0; + TRY(ds_pop(fh, &addr)); + TRY(ds_push(fh, WORDALIGNED(addr))); + return FH_OK; +} + /** Add pointers to built-in word handlers to a runtime struct */ enum fh_error register_builtin_words(struct fh_thread_s *fh) { @@ -991,6 +1001,7 @@ enum fh_error register_builtin_words(struct fh_thread_s *fh) {"!", w_store, 0, 0}, {"2!", w_two_store, 0, 0}, {"2@", w_two_fetch, 0, 0}, + {"aligned", w_aligned, 0, 0}, // TODO +! // TODO pictured numbers (#) // TODO tick