PageRenderTime 25ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/kernel.fth

https://github.com/august0815/forthos
Forth | 66 lines | 55 code | 11 blank | 0 comment | 0 complexity | ab13ff3c89cadfc664c700c83cecf893 MD5 | raw file
  1. ; program: kernel
  2. ; by José Dinuncio <jdinunci@uc.edu.veZ
  3. ; 12/2009
  4. %include "forth.h"
  5. global main
  6. extern main_test
  7. [BITS 32]
  8. section .text
  9. ; function: main
  10. ; Initialize the forth machinery.
  11. ;
  12. global main
  13. main:
  14. mov [var_S0], esp ; Save the initial data stack pointer in FORTH variable S0.
  15. mov ebp, return_stack_top ; init the return stack
  16. mov eax,point_DP ; init DP
  17. mov dword [var_DP],eax ;
  18. mov esi, cold_start ; fist foth word to exec
  19. next
  20. section .rodata
  21. ; Bridge to the forth's word main
  22. cold_start:
  23. dd main_kernel
  24. ; function: main
  25. ; Firts foth word to be executed by the kernel
  26. extern pit_init
  27. extern irq_init
  28. extern idt_init
  29. : main_kernel
  30. idt_init
  31. 100 pit_init
  32. irq_init
  33. main_test
  34. stop
  35. ;
  36. ; stacks
  37. section .bss
  38. align 4096
  39. RETURN_STACK_SIZE equ 8192
  40. return_stack:
  41. resb RETURN_STACK_SIZE
  42. global return_stack_top
  43. return_stack_top:
  44. align 4096
  45. BUFFER_SIZE equ 4096
  46. buffer:
  47. resb BUFFER_SIZE
  48. align 4096
  49. pad:
  50. resb 1024
  51. align 1024
  52. point_DP: resb 2048
  53. point: resb 363748
  54. global top
  55. top: resb 0