Support stuff for keyboard

This commit is contained in:
greg
2015-09-18 02:56:07 -07:00
parent f4de677406
commit b6851ab0b5
4 changed files with 18 additions and 2 deletions

View File

@@ -15,9 +15,10 @@ baremetal_gamarjoba: baremetal_gamarjoba.asm include.c
run_baremetal_gamarjoba: baremetal_gamarjoba
qemu-system-i386 -kernel baremetal_gamarjoba
keyboard: keyboard.asm
keyboard: keyboard.asm c_keyboard.c
gcc -m32 -ffreestanding -o c_keyboard.o -c c_keyboard.c
nasm -f elf32 keyboard.asm
ld -m elf_i386 -nostdlib -T linker.ld keyboard.o -o keyboard
ld -m elf_i386 -nostdlib -T linker.ld keyboard.o c_keyboard.o -o keyboard
run_keyboard: keyboard
qemu-system-i386 -kernel keyboard

9
c_keyboard.c Normal file
View File

@@ -0,0 +1,9 @@
extern int write_to_coord(int x, int y, int x86_specifier);
extern int clear(int x86_specifier);
void c_entry() {
write_to_coord(1,1, (0xf0 << 8) | 'm');
write_to_coord(1,5, (0xf0 << 8) | 'j');
write_to_coord(2,5, (0xf0 << 8) | 'j');
}

View File

@@ -1,14 +1,17 @@
%include "multiboot_header.asm"
%include "x86_vram.asm"
extern c_entry
section .bss
stack resb 0x1000
section .data
[bits 32]
section .text
global boot:
mov esp, stack + 0x1000
xor ebp, ebp
@@ -18,6 +21,7 @@ main:
push word BG.BLACK | ' '
call clear
add esp, 2
call c_entry
halt:
hlt

View File

@@ -3,6 +3,7 @@
; first argument is row, 1 byte
; second argument is column, 1 byte
; third argument is cell, 2 bytes
global write_to_coord
write_to_coord:
push ebp
mov ebp, esp
@@ -30,6 +31,7 @@ write_to_coord:
; takes character/attribute in edi
; writes it to all cells on screen
global clear
clear:
push ebp
mov ebp, esp