forked from august0815/forthos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkernel.fth
66 lines (55 loc) · 1.12 KB
/
kernel.fth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; program: kernel
; by José Dinuncio <[email protected]
; 12/2009
%include "forth.h"
global main
extern main_test
[BITS 32]
section .text
; function: main
; Initialize the forth machinery.
;
global main
main:
mov [var_S0], esp ; Save the initial data stack pointer in FORTH variable S0.
mov ebp, return_stack_top ; init the return stack
mov eax,point_DP ; init DP
mov dword [var_DP],eax ;
mov esi, cold_start ; fist foth word to exec
next
section .rodata
; Bridge to the forth's word main
cold_start:
dd main_kernel
; function: main
; Firts foth word to be executed by the kernel
extern pit_init
extern irq_init
extern idt_init
: main_kernel
idt_init
100 pit_init
irq_init
main_test
stop
;
; stacks
section .bss
align 4096
RETURN_STACK_SIZE equ 8192
return_stack:
resb RETURN_STACK_SIZE
global return_stack_top
return_stack_top:
align 4096
BUFFER_SIZE equ 4096
buffer:
resb BUFFER_SIZE
align 4096
pad:
resb 1024
align 1024
point_DP: resb 2048
point: resb 363748
global top
top: resb 0