Put baremetal_gamarjoba into subdir

This commit is contained in:
Greg Shuflin
2022-01-29 22:08:03 -08:00
parent 2851629a8a
commit 01c36c6178
9 changed files with 24 additions and 3 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.o *.o
gamarjoba_munde/gamarjoba gamarjoba_munde/gamarjoba
baremetal_gamarjoba/baremetal_gamarjoba

View File

@@ -6,6 +6,7 @@ low-level programming concerns.
This repo contains the following executables: This repo contains the following executables:
* `gamarjoba_munde` - x86-64 linux binary that prints the text "Gamarjoba, Munde" * `gamarjoba_munde` - x86-64 linux binary that prints the text "Gamarjoba, Munde"
* `baremetal_gamarjoba` - bare-metal x86 program run with QEMU
# Useful links # Useful links

View File

@@ -1,5 +1,5 @@
%include "multiboot_header.asm" %include "../common/multiboot_header.asm"
%include "x86_vram.asm" %include "../common/x86_vram.asm"
%define stack_size 0x1000 %define stack_size 0x1000
@@ -13,8 +13,11 @@ print_word db 'Hahaha',0
section .text section .text
; Defined in include.c
extern get_vram_offset extern get_vram_offset
extern c_entry extern c_entry
; Defined in common/x86_vram_functions.asm
global write_to_coord global write_to_coord
global boot global boot
@@ -52,4 +55,4 @@ halt:
hlt hlt
jmp halt jmp halt
%include "x86_vram_functions.asm" %include "../common/x86_vram_functions.asm"

View File

@@ -1,3 +1,5 @@
%ifndef X86_VRAM_ASM
%define X86_VRAM_ASM
; x86 video stuff ; x86 video stuff
; each character cell is a 16 bit word ; each character cell is a 16 bit word
@@ -31,3 +33,4 @@
%define BG.GRAY 7 << 12 %define BG.GRAY 7 << 12
%define BG.BRIGHT 8 << 12 %define BG.BRIGHT 8 << 12
%endif

View File

@@ -7,3 +7,16 @@ run_gamarjoba: build_gamarjoba
build_gamarjoba: build_gamarjoba:
nasm -f elf64 -o gamarjoba_munde/gamarjoba.o gamarjoba_munde/gamarjoba.asm nasm -f elf64 -o gamarjoba_munde/gamarjoba.o gamarjoba_munde/gamarjoba.asm
ld -o gamarjoba_munde/gamarjoba gamarjoba_munde/gamarjoba.o ld -o gamarjoba_munde/gamarjoba gamarjoba_munde/gamarjoba.o
build_baremetal_gamarjoba:
#!/usr/bin/env bash
cd baremetal_gamarjoba
gcc -m32 -ffreestanding -o include.o -c include.c
nasm -f elf32 -i ../common baremetal_gamarjoba.asm
ld -m elf_i386 -nostdlib -T ../common/linker.ld baremetal_gamarjoba.o include.o -o baremetal_gamarjoba
run_baremetal_gamarjoba: build_baremetal_gamarjoba
#!/usr/bin/env bash
cd baremetal_gamarjoba
qemu-system-i386 -kernel baremetal_gamarjoba