%include "../common/multiboot_header.asm"
%include "../common/x86_vram.asm"

%define stack_size 0x1000

section .bss

stack resb stack_size ;define stack_size worth of uninitialized space

section .data

print_word db 'Hahaha',0

section .text

; Defined in include.c
extern get_vram_offset
extern c_entry

; Defined in common/x86_vram_functions.asm
global write_to_coord

global boot
    mov esp, stack + stack_size ;stack is stack-size bytes higher than highest uninitialized memory
    xor ebp, ebp ; zero ebp
    jmp main

main:
    push word BG.CYAN | ' ' ; repeatdly set cell to be black space
    call clear
    add esp, 2
    push dword BG.BLACK | FG.RED | 'A'
    push dword 0
    push dword 0
    call write_to_coord
    add esp, 12

    mov ecx, 0
    .loop:
        add ecx, 1
        cmp ecx, 5
        jne .loop

    push dword BG.BLACK | FG.YELLOW | FG.BRIGHT | 'Z'
    push dword 0
    push dword 24
    call write_to_coord
    add esp, 12

    call c_entry

    jmp halt

halt:
    hlt
    jmp halt

%include "../common/x86_vram_functions.asm"
