add ALIGNED

master
Ondřej Hruška 3 years ago
parent 26c65655e1
commit 0f5eda0def
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 11
      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; 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 */ /** Add pointers to built-in word handlers to a runtime struct */
enum fh_error register_builtin_words(struct fh_thread_s *fh) 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}, {"!", w_store, 0, 0},
{"2!", w_two_store, 0, 0}, {"2!", w_two_store, 0, 0},
{"2@", w_two_fetch, 0, 0}, {"2@", w_two_fetch, 0, 0},
{"aligned", w_aligned, 0, 0},
// TODO +! // TODO +!
// TODO pictured numbers (#) // TODO pictured numbers (#)
// TODO tick // TODO tick

Loading…
Cancel
Save