%ifdef LINUX.CONSOLE
%macro PLATFORM_START 0
SECTION .text
	global _start
_start:
	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

	lea esi, [esp-0x200]	;Initialize data stack
%endmacro

%macro PLATFORM_DRIVERS_ASM 0
%include "platform/linux/linux.drivers"
%endmacro

%macro PLATFORM_FORTH 0
  incbin "platform/linux/linux.f"
%endmacro
;---------------------------------------------------------------------
section .bss
tib  resb   200h
d0   resb 10000h
h0   resb 80000h
section .text
;---------------------------------------------------------------------
%endif


%ifdef LINUX.SVGALIB
%macro PLATFORM_START 0
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
	lea esi, [esp-0x200]	;Initialize data stack

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

%macro PLATFORM_DRIVERS_ASM 0
%include "platform/linux/svgalib.drivers"
%endmacro

%macro PLATFORM_FORTH 0
  incbin "platform/linux/svgalib.f"
%endmacro
;---------------------------------------------------------------------
section .bss
tib  resb   200h
d0   resb 10000h
h0   resb 80000h
section .text
;---------------------------------------------------------------------
%endif


%ifdef LINUX.SDL
%include "platform/linux/sdl"

%macro PLATFORTM_INIT 0
section .text
	global main
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	

	; The stack is bigger than in the svgalib version, because
	; SDL needs it. It could probably be a _lot_ smaller than
	; 0x2000 though...
	lea esi, [esp-0x2000]	;Initialize data stack
	
	call sdl_init
 	mov eax,[screen]
	mov eax,[eax+PIXELS_OFS]
 	mov [frame],eax
%endmacro


%macro PLATFORM_DRIVERS_ASM 0
%include "platform/linux/sdllinux.drivers"
%endmacro

%macro PLATFORM_FORTH 0
  incbin "platform/linux/sdllinux.f"
%endmacro
;---------------------------------------------------------------------
section .bss
tib  resb   200h
d0   resb 10000h
h0   resb 80000h
section .text
;---------------------------------------------------------------------
%endif
