Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
690B

  1. Stack management
  2. The Parameter stack (PS) is maintained by SP and the Return
  3. stack (RS) is maintained by IX. This allows us to generally use
  4. push and pop freely because PS is the most frequently used.
  5. However, this causes a problem with routine calls: because in
  6. Forth, the stack isn't balanced within each call, our return
  7. offset, when placed by a CALL, messes everything up. This is
  8. one of the reasons why we need stack management routines below.
  9. IX always points to RS' Top Of Stack (TOS)
  10. This return stack contain "Interpreter pointers", that is a
  11. pointer to the address of a word, as seen in a compiled list of
  12. words.
  13. (cont.)