Moved some files around in preparation for completely changing the way that booting works
This commit is contained in:
parent
2c4c76d1e7
commit
d617de6a0c
6
Makefile
6
Makefile
@ -1,7 +1,7 @@
|
||||
CFLAGS = -m32 -mgeneral-regs-only -nostdlib -fno-builtin -fno-exceptions -fno-leading-underscore -fno-pie -fno-stack-protector -Wno-pointer-to-int-cast
|
||||
LDFLAGS =
|
||||
|
||||
DISK_IMG_FILES = kernel.bin hello.bin print.bin boot32.bin kernel32.bin
|
||||
DISK_IMG_FILES = kernel.bin boot32.bin kernel32.bin
|
||||
KERNEL32_OBJS = screenstuff.o io.o idt.o keyboard.o strings.o atapio.o kernel32_strap.o kernel32.o
|
||||
|
||||
run: disk.img
|
||||
@ -28,8 +28,8 @@ boot.sector: boot.asm
|
||||
kernel32.bin: kernel32.ld $(KERNEL32_OBJS)
|
||||
ld $(LDFLAGS) -T $< $(KERNEL32_OBJS)
|
||||
|
||||
%.o: %.asm
|
||||
%.o: src/kernel/%.asm
|
||||
nasm -felf32 $< -o $@
|
||||
|
||||
%.o: %.c
|
||||
%.o: src/kernel/%.c
|
||||
gcc $(CFLAGS) -o $@ -c $<
|
20
hello.asm
20
hello.asm
@ -1,20 +0,0 @@
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
mov ax, [bp + 6]
|
||||
mov ds, ax
|
||||
|
||||
mov si, hello_world_str
|
||||
mov ah, 01h
|
||||
int 22h
|
||||
|
||||
pop bp
|
||||
retf
|
||||
|
||||
hello_world_str db "Hello, World!", 13, 10, 13, 10, 0
|
||||
new_line db 13, 10, 0
|
||||
|
||||
buffer:
|
||||
times 32 db 0
|
||||
|
||||
program_segment dw 0
|
@ -10,5 +10,6 @@ SECTIONS {
|
||||
kernel32_strap.o(.text)
|
||||
kernel32.o(.text)
|
||||
*(.text)
|
||||
heap_section = .;
|
||||
}
|
||||
}
|
46
print.asm
46
print.asm
@ -1,46 +0,0 @@
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
mov ax, [bp+6]
|
||||
mov ds, ax
|
||||
mov word [program_segment], ax
|
||||
|
||||
mov si, filename
|
||||
mov ah, 4
|
||||
int 22h
|
||||
|
||||
cmp ax, 0
|
||||
je error
|
||||
|
||||
mov si, ax
|
||||
mov di, 0
|
||||
mov bx, word [program_segment]
|
||||
add bx, 1000h
|
||||
mov ah, 3
|
||||
int 22h
|
||||
|
||||
push word [program_segment]
|
||||
mov ax, word [program_segment]
|
||||
add ax, 1000h
|
||||
mov ds, ax
|
||||
mov si, 0
|
||||
mov ah, 1
|
||||
int 22h
|
||||
|
||||
pop ax
|
||||
mov ds, ax
|
||||
|
||||
jmp exit
|
||||
|
||||
error:
|
||||
mov si, err_msg
|
||||
mov ah, 1
|
||||
int 22h
|
||||
|
||||
exit:
|
||||
pop bp
|
||||
retf
|
||||
|
||||
filename db "HELLO TXT"
|
||||
err_msg db "HELLO.TXT Missing!"
|
||||
program_segment dw 0
|
Loading…
x
Reference in New Issue
Block a user