-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.fth
50 lines (36 loc) · 805 Bytes
/
test.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
; program: test
; Used to test words as they are developed
%include "forth.h"
[BITS 32]
section .text
GLOBAL _start
_start:
mov [var_S0], esp ; Save the initial data stack pointer in FORTH variable S0.
mov ebp, return_stack_top ; init the return stack
mov esi, cold_start ; fist foth word to exec
next
; Forth Entry point
section .rodata
cold_start:
dd main
: test_add, test_add, 0
2 2 + drop
;
%define _invoke_addr invoke_addr
: test_invoke, test_invoke, 0
_invoke_addr execute
;
GLOBAL main
: main, main, 0
test_invoke
;
; stacks
section .bss
align 4096
RETURN_STACK_SIZE equ 8192
return_stack:
resb RETURN_STACK_SIZE
return_stack_top:
; data
section .rodata
_invoke_addr: dd test_add