From c01cbbc45875bc0fbe3bb36dab7b3839afe17ab6 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 29 Jan 2022 22:39:59 -0800 Subject: [PATCH] Put keyboard into subdir --- .gitignore | 1 + README.md | 1 + justfile | 15 +++++++++++++++ c_keyboard.c => keyboard/c_keyboard.c | 0 keyboard.asm => keyboard/keyboard.asm | 6 +++--- keyboard.rs => keyboard/keyboard.rs | 0 6 files changed, 20 insertions(+), 3 deletions(-) rename c_keyboard.c => keyboard/c_keyboard.c (100%) rename keyboard.asm => keyboard/keyboard.asm (84%) rename keyboard.rs => keyboard/keyboard.rs (100%) diff --git a/.gitignore b/.gitignore index 2cf5651..565d246 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.o gamarjoba_munde/gamarjoba baremetal_gamarjoba/baremetal_gamarjoba +keyboard/keyboard_kernel diff --git a/README.md b/README.md index af4ea34..3733ada 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This repo contains the following executables: * `gamarjoba_munde` - x86-64 linux binary that prints the text "Gamarjoba, Munde" * `baremetal_gamarjoba` - bare-metal x86 program run with QEMU +* `keyboard` - reads keycode information from keyboard. Also uses both Rust and C includes. # Useful links diff --git a/justfile b/justfile index 5826821..6b2615b 100644 --- a/justfile +++ b/justfile @@ -20,3 +20,18 @@ run_baremetal_gamarjoba: build_baremetal_gamarjoba #!/usr/bin/env bash cd baremetal_gamarjoba qemu-system-i386 -kernel baremetal_gamarjoba + + +build_keyboard: + #!/usr/bin/env bash + cd keyboard + gcc -m32 -ffreestanding -o c_keyboard.o -c c_keyboard.c + rustc --emit obj -o rust_keyboard.o --target i686-unknown-linux-gnu keyboard.rs + nasm -f elf32 -i ../common keyboard.asm + ld -m elf_i386 -nostdlib -T ../common/linker.ld keyboard.o c_keyboard.o rust_keyboard.o -o keyboard_kernel + +run_keyboard: build_keyboard + qemu-system-i386 -kernel keyboard/keyboard_kernel + +run_terminal_keyboard: build_keyboard + qemu-system-i386 -display curses -kernel keyboard/keyboard_kernel diff --git a/c_keyboard.c b/keyboard/c_keyboard.c similarity index 100% rename from c_keyboard.c rename to keyboard/c_keyboard.c diff --git a/keyboard.asm b/keyboard/keyboard.asm similarity index 84% rename from keyboard.asm rename to keyboard/keyboard.asm index 3951ad8..a3410dc 100644 --- a/keyboard.asm +++ b/keyboard/keyboard.asm @@ -1,5 +1,5 @@ -%include "multiboot_header.asm" -%include "x86_vram.asm" +%include "../common/multiboot_header.asm" +%include "../common/x86_vram.asm" extern c_entry extern print_int @@ -56,4 +56,4 @@ scan: xor al, al ret -%include "x86_vram_functions.asm" +%include "../common/x86_vram_functions.asm" diff --git a/keyboard.rs b/keyboard/keyboard.rs similarity index 100% rename from keyboard.rs rename to keyboard/keyboard.rs