; -----------------------------------------------------------------------------
;    ~     RetroForth for Linux
;   . .    http://www.retroforth.org
;   /V\    
;  // \\
; /(   )\
;  ^'~'^
; -----------------------------------------------------------------------------

%include "../../macros.nasm"

extern vga_init
extern vga_setmode
extern vga_setlinearaddressing
extern vga_getgraphmem
global main

SECTION .text
main:
	mov eax, 07dh              ;sys mprotect (pinched from IsForth :-)
	mov ebx, 08048000h
	mov ecx, 00100000h
	mov edx, 7
	int 080h                   ;make the entire program space rwx
        mov esi, sp0

        call vga_init
        push word 5
        call vga_setmode
        add esp, 4*2
        call vga_setlinearaddressing
        call vga_getgraphmem
        mov dword [frame], eax

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
