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.

51 lines
1.0KB

  1. ; RAM disposition
  2. ;
  3. ; Because this glue code also serves stage0 which needs HERE to start right
  4. ; after the code, we have a peculiar RAM setup here: it lives at the very end
  5. ; of the address space, just under RS_ADDR at 0xf000
  6. ; Warning: The offsets of native dict entries must be exactly the same between
  7. ; glue0.asm and glue1.asm
  8. .equ RAMSTART 0xe800
  9. .equ HERE 0xe700 ; override, in sync with stage1.c
  10. .equ CURRENT 0xe702 ; override, in sync with stage1.c
  11. .equ HERE_INITIAL CODE_END ; override
  12. .inc "ascii.h"
  13. .equ STDIO_PORT 0x00
  14. jp init
  15. .equ STDIO_RAMSTART RAMSTART
  16. .equ STDIO_GETC emulGetC
  17. .equ STDIO_PUTC emulPutC
  18. .inc "stdio.asm"
  19. .equ FORTH_RAMSTART STDIO_RAMEND
  20. .inc "main.asm"
  21. .inc "util.asm"
  22. .inc "stack.asm"
  23. .inc "dict.asm"
  24. init:
  25. di
  26. ; setup stack
  27. ld sp, 0xffff
  28. call forthMain
  29. halt
  30. emulGetC:
  31. ; Blocks until a char is returned
  32. in a, (STDIO_PORT)
  33. cp a ; ensure Z
  34. ret
  35. emulPutC:
  36. out (STDIO_PORT), a
  37. ret
  38. .dw 0 ; placeholder used in glue1.
  39. CODE_END:
  40. .out $ ; should be the same as in glue1