Two quick remarks:

>> 2. how the data from data stack (or from return stack) are passed to
>> assembler

- data stack (all elements EXCEPT top of the stack) are kept close
  to the end of RAM (end of RAM - 128), growing down.

- TOP of the stack is kept in register pair (tosh:tosl)

>> 3. how the data are passed from asm. back to data stack or return
>> stack

- if you just change top of the stack (say remove 1 parameter and
  put 1 cell of results) just change contents of tosh:tosl registers

- "loadtos" macro fetches the second item on stack and loads it
  into the tosh:tosl, while moving stack pointer down -
  - so it effectively the same as DROP.
  Of course, if one needs to preserve top of stack another
  "ld" command can be used to load 2nd, 3rd, etc. elements
  into other registers.

- "storetos" macro stores the TOS on to the stack, therefore
  it is how DUP is implemented. If you want just to push
  something on stack just "storetos" and modify tosh:tosl.

- return stack is the machine stack. it starts at the end of RAM
  and grows downward (toward smaller addresses), the same
  direction as the data stack. It means you have 128 bytes
  (64 16-bit words) for the return stack available by default.

- second item on a data stack is pointed by the YH:YL register
  pair

- push, pop operate on the return stack then (see >r, r>, r@)

- inner interpreter stores current Forth instruction pointer
  in the register pair XH:XL and pushes it/pops off the return
  stack as necessary. 

It's all in amforth.asm - first 87 lines

--Marcin





------------------------------------------------------------------------------
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
_______________________________________________
Amforth-devel mailing list
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to