Switched FASM to NASM

If I'm gonna port a C compiler I might as well use and port NASM as it 
is more widely used anyway
This commit is contained in:
Jarkko Toivanen 2023-06-23 23:10:06 +03:00
parent 5badddbada
commit e21e42d318
Signed by: jt
GPG Key ID: 9151B109B73ECAD5
3 changed files with 17 additions and 19 deletions

View File

@ -3,7 +3,7 @@ clean:
-@rm build/*.o build/*.elf 2> /dev/null || true
build/start32.o: build/ src/start32.asm
fasm src/start32.asm build/start32.o
nasm -felf32 src/start32.asm -o build/start32.o
build/kernel-i386.elf: build/start32.o
tcc -m32 -nostdlib -Wl,-Ttext,0x100000 -o build/kernel-i386.elf src/*.c build/start32.o
image: build/kernel-i386.elf mount

View File

@ -3,7 +3,7 @@ Multiboot compatible stupid useless OS-like project.
## Compatibility
32bit x86 legacy BIOS system
## Building
FASM and TinyCCompiler are used.
NASM and TinyCCompiler are used.
TCC might need manual compilation for 32bit crosscompilation
on 64bit systems.
Just download the source and `make cross` or something.

View File

@ -1,15 +1,13 @@
format elf
use32
MULTIBOOT_PAGE_ALIGN equ (1 shl 0)
MULTIBOOT_MEMORY_INFO equ (1 shl 1)
MULTIBOOT_VIDEO_REQUEST equ (1 shl 2)
MULTIBOOT_AOUT_KLUDGE equ (1 shl 16)
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO or MULTIBOOT_VIDEO_REQUEST
MULTIBOOT_PAGE_ALIGN equ 1 << 0
MULTIBOOT_MEMORY_INFO equ 1 << 1
MULTIBOOT_VIDEO_REQUEST equ 0 << 2
MULTIBOOT_AOUT_KLUDGE equ 0 << 16
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_REQUEST
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
section '.multiboot' align 4
section .multiboot
align 4
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
@ -23,14 +21,15 @@ section '.multiboot' align 4
dd 768 ; video height
dd 32 ; video depth
section '.bss' writable align 16
section .bss
align 16
stack_bottom:
rb 16384
resb 16384
stack_top:
section '.text' executable
public _start
extrn kmain
section .text
global _start
extern kmain
_start:
; Setup stack
@ -41,8 +40,7 @@ _start:
push eax
call kmain
@@:
.hang:
cli
hlt
jmp @b
jmp .hang