PageRenderTime 38ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/test.fth

https://github.com/jdinuncio/forthos
Forth | 50 lines | 36 code | 14 blank | 0 comment | 0 complexity | 3a3afc861d2ed1ad1f4aaa7c8695d0a7 MD5 | raw file
  1. ; program: test
  2. ; Used to test words as they are developed
  3. %include "forth.h"
  4. [BITS 32]
  5. section .text
  6. GLOBAL _start
  7. _start:
  8. mov [var_S0], esp ; Save the initial data stack pointer in FORTH variable S0.
  9. mov ebp, return_stack_top ; init the return stack
  10. mov esi, cold_start ; fist foth word to exec
  11. next
  12. ; Forth Entry point
  13. section .rodata
  14. cold_start:
  15. dd main
  16. : test_add, test_add, 0
  17. 2 2 + drop
  18. ;
  19. %define _invoke_addr invoke_addr
  20. : test_invoke, test_invoke, 0
  21. _invoke_addr execute
  22. ;
  23. GLOBAL main
  24. : main, main, 0
  25. test_invoke
  26. ;
  27. ; stacks
  28. section .bss
  29. align 4096
  30. RETURN_STACK_SIZE equ 8192
  31. return_stack:
  32. resb RETURN_STACK_SIZE
  33. return_stack_top:
  34. ; data
  35. section .rodata
  36. _invoke_addr: dd test_add