|
|
@ -2,6 +2,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
// TODO stacks should grow down, not up!
|
|
|
|
// TODO stacks should grow down, not up!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void show_rs(struct fh_thread_s *fh) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LOG("\x1b[32;1mRS:\x1b[m"); |
|
|
|
|
|
|
|
for (int i = 0; i < fh->return_stack_top; i++) { |
|
|
|
|
|
|
|
LOG(" %d ", fh->return_stack[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum fh_error ds_roll(struct fh_thread_s *fh, int n) |
|
|
|
enum fh_error ds_roll(struct fh_thread_s *fh, int n) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fh->data_stack_top <= n) { |
|
|
|
if (fh->data_stack_top <= n) { |
|
|
@ -72,6 +80,7 @@ enum fh_error rs_pop(struct fh_thread_s *fh, uint32_t *out) |
|
|
|
} |
|
|
|
} |
|
|
|
*out = fh->return_stack[--fh->return_stack_top]; |
|
|
|
*out = fh->return_stack[--fh->return_stack_top]; |
|
|
|
LOG("RS pop %d (0x%08x)", *out, *out); |
|
|
|
LOG("RS pop %d (0x%08x)", *out, *out); |
|
|
|
|
|
|
|
show_rs(fh); |
|
|
|
return FH_OK; |
|
|
|
return FH_OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -121,5 +130,6 @@ enum fh_error rs_push(struct fh_thread_s *fh, uint32_t in) |
|
|
|
} |
|
|
|
} |
|
|
|
fh->return_stack[fh->return_stack_top++] = in; |
|
|
|
fh->return_stack[fh->return_stack_top++] = in; |
|
|
|
UPDATE_HWM(fh->return_stack_hwm, fh->return_stack_top); |
|
|
|
UPDATE_HWM(fh->return_stack_hwm, fh->return_stack_top); |
|
|
|
|
|
|
|
show_rs(fh); |
|
|
|
return FH_OK; |
|
|
|
return FH_OK; |
|
|
|
} |
|
|
|
} |
|
|
|