And call into c from assembly

This commit is contained in:
greg
2015-09-17 21:57:10 -07:00
parent 2bf23664bf
commit a56cf9f455
2 changed files with 11 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ print_word db 'Hahaha',0
section .text section .text
extern get_vram_offset extern get_vram_offset
extern c_entry
global write_to_coord
global boot global boot
mov esp, stack + stack_size ;stack is stack-size bytes higher than highest uninitialized memory mov esp, stack + stack_size ;stack is stack-size bytes higher than highest uninitialized memory
@@ -51,6 +53,8 @@ main:
call write_to_coord call write_to_coord
add esp, 12 add esp, 12
call c_entry
jmp halt jmp halt
halt: halt:

View File

@@ -1,5 +1,12 @@
extern int write_to_coord(int a, int b, int c);
int get_vram_offset() { int get_vram_offset() {
return 0xb8000; return 0xb8000;
} }
void c_entry() {
int space = 0x26 | (0xf0 << 8); //ascii ampersand white on black
write_to_coord(space,1,2);
}