mirror of
https://github.com/Fennix-Project/Lynx.git
synced 2025-07-11 15:19:14 +00:00
Code stub
This commit is contained in:
22
BIOS/Makefile
Normal file
22
BIOS/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
include ../../Makefile.conf
|
||||
|
||||
NAME=loader.bin
|
||||
NASM = /usr/bin/nasm
|
||||
|
||||
ASM_SOURCES = $(shell find ./ -type f -name '*.asm')
|
||||
OBJ = $(ASM_SOURCES:.asm=.o)
|
||||
|
||||
prepare:
|
||||
$(info Nothing to prepare)
|
||||
|
||||
$(NAME): $(OBJ)
|
||||
cat boot.o second.o > $@
|
||||
|
||||
build: $(NAME)
|
||||
|
||||
%.o: %.asm
|
||||
$(info Compiling $<)
|
||||
$(NASM) $< -f bin -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(NAME)
|
65
BIOS/boot.asm
Normal file
65
BIOS/boot.asm
Normal file
@ -0,0 +1,65 @@
|
||||
[ORG 0x7C00]
|
||||
[BITS 16]
|
||||
|
||||
start:
|
||||
jmp 0x0000:Boot
|
||||
nop
|
||||
|
||||
times 8-($-$$) db 0
|
||||
PrimaryVolumeDescriptor dd 0
|
||||
BootFileLocation dd 0
|
||||
BootFileLength dd 0
|
||||
Checksum dd 0
|
||||
Reserved times 40 db 0
|
||||
times 90-($-$$) db 0
|
||||
|
||||
%include "print.inc"
|
||||
|
||||
Boot:
|
||||
cli
|
||||
mov [BOOT_DISK], dl
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov ss, ax
|
||||
mov sp, 0x9C00
|
||||
|
||||
mov si, ErrorText
|
||||
call Print
|
||||
hlt
|
||||
jmp $
|
||||
|
||||
mov si, BootloaderText
|
||||
call Print
|
||||
call ReadDisk
|
||||
jmp EX_ADDRESS
|
||||
jmp $
|
||||
|
||||
ReadDisk:
|
||||
sti
|
||||
mov ah, 0x02
|
||||
mov bx, EX_ADDRESS
|
||||
mov al, 20 ; max 65
|
||||
mov dl, [BOOT_DISK]
|
||||
mov ch, 0x00
|
||||
mov dh, 0x00
|
||||
mov cl, 0x02
|
||||
int 0x13
|
||||
jc DiskError
|
||||
cli
|
||||
ret
|
||||
|
||||
DiskError:
|
||||
cli
|
||||
mov si, DiskReadingErrorMessage
|
||||
call Print
|
||||
jmp $
|
||||
|
||||
ErrorText db 'BIOS boot not implemented', 0
|
||||
BootloaderText db 'Lynx Bootloader', 0
|
||||
DiskReadingErrorMessage: db ' Disk Error', 0
|
||||
EX_ADDRESS equ 0x8000
|
||||
BOOT_DISK: db 0
|
||||
|
||||
times 510-($-$$) db 0
|
||||
db 0x55
|
||||
db 0xAA
|
9
BIOS/print.inc
Normal file
9
BIOS/print.inc
Normal file
@ -0,0 +1,9 @@
|
||||
Print:
|
||||
lodsb
|
||||
or al, al
|
||||
jz PrintDone
|
||||
mov ah, 0eh
|
||||
int 10h
|
||||
jmp Print
|
||||
PrintDone:
|
||||
ret
|
9
BIOS/second.asm
Normal file
9
BIOS/second.asm
Normal file
@ -0,0 +1,9 @@
|
||||
; TODO
|
||||
init:
|
||||
mov si, LoadingText
|
||||
call Print
|
||||
jmp $
|
||||
|
||||
%include "print.inc"
|
||||
|
||||
LoadingText db ' Loading...', 0
|
Reference in New Issue
Block a user