Support stuff for keyboard
This commit is contained in:
5
Makefile
5
Makefile
@@ -15,9 +15,10 @@ baremetal_gamarjoba: baremetal_gamarjoba.asm include.c
|
|||||||
run_baremetal_gamarjoba: baremetal_gamarjoba
|
run_baremetal_gamarjoba: baremetal_gamarjoba
|
||||||
qemu-system-i386 -kernel 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
|
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
|
run_keyboard: keyboard
|
||||||
qemu-system-i386 -kernel keyboard
|
qemu-system-i386 -kernel keyboard
|
||||||
|
|||||||
9
c_keyboard.c
Normal file
9
c_keyboard.c
Normal 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');
|
||||||
|
}
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
%include "multiboot_header.asm"
|
%include "multiboot_header.asm"
|
||||||
%include "x86_vram.asm"
|
%include "x86_vram.asm"
|
||||||
|
|
||||||
|
extern c_entry
|
||||||
section .bss
|
section .bss
|
||||||
|
|
||||||
stack resb 0x1000
|
stack resb 0x1000
|
||||||
|
|
||||||
section .data
|
section .data
|
||||||
|
|
||||||
|
[bits 32]
|
||||||
section .text
|
section .text
|
||||||
|
|
||||||
|
|
||||||
global boot:
|
global boot:
|
||||||
mov esp, stack + 0x1000
|
mov esp, stack + 0x1000
|
||||||
xor ebp, ebp
|
xor ebp, ebp
|
||||||
@@ -18,6 +21,7 @@ main:
|
|||||||
push word BG.BLACK | ' '
|
push word BG.BLACK | ' '
|
||||||
call clear
|
call clear
|
||||||
add esp, 2
|
add esp, 2
|
||||||
|
call c_entry
|
||||||
|
|
||||||
halt:
|
halt:
|
||||||
hlt
|
hlt
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
; first argument is row, 1 byte
|
; first argument is row, 1 byte
|
||||||
; second argument is column, 1 byte
|
; second argument is column, 1 byte
|
||||||
; third argument is cell, 2 bytes
|
; third argument is cell, 2 bytes
|
||||||
|
global write_to_coord
|
||||||
write_to_coord:
|
write_to_coord:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
@@ -30,6 +31,7 @@ write_to_coord:
|
|||||||
|
|
||||||
; takes character/attribute in edi
|
; takes character/attribute in edi
|
||||||
; writes it to all cells on screen
|
; writes it to all cells on screen
|
||||||
|
global clear
|
||||||
clear:
|
clear:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
|
|||||||
Reference in New Issue
Block a user