; -----------------------------------------------------------------------------
;    ~     RetroForth for Linux
;   . .    http://www.retroforth.org
;   /V\    
;  // \\
; /(   )\
;  ^'~'^
; -----------------------------------------------------------------------------
%include "../../macros.nasm"
%include "../system.inc"

SECTION .text
	global _start
_start:
	                           ; Make the entire program space rwx
	push dword 7               ; PROT_READ | PROT_WRITE | PROT_EXEC
	push dword 00100000h       ; Length
	push dword 08048000h       ; Address
	system sys_mprotect        ; System call mprotect
        add esp, byte 3*4
jph:                
	mov esi, sp0               ; Initialize data stack

MAIN:   upsh startup               ; Load startup code (startup.f)
        upsh startup.1 - startup
        call eval
	call interpret
;---------------------------------------------------------------------
%include "../../forth.asm"
%include "../../forth.dict"
%include "drivers.asm"
;---------------------------------------------------------------------
section .data
startup: incbin "../../forth.f"
         incbin "drivers.f"
.1
END
