first commit
This commit is contained in:
commit
eda494ac49
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
ros.img
|
8
Makefile
Normal file
8
Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FLOPPY = ros.img
|
||||
SRC_FILES = $(cd src && shell find -L * -type f -name '*.asm')
|
||||
|
||||
$(FLOPPY): Makefile $(SRC_FILES)
|
||||
nasm stage1.asm -o $(FLOPPY)
|
||||
|
||||
run: $(FLOPPY)
|
||||
qemu-system-i386 -fda $(FLOPPY) -boot a -enable-kvm -cpu host -m 512M
|
71
stage1.asm
Normal file
71
stage1.asm
Normal file
|
@ -0,0 +1,71 @@
|
|||
org 0x7c00
|
||||
jmp main
|
||||
|
||||
%include "hcf.asm"
|
||||
|
||||
main:
|
||||
mov ax, msg_checking
|
||||
call puts
|
||||
|
||||
mov ah, 0 ; reset disk
|
||||
mov dl, 0 ; disk A
|
||||
int 0x13
|
||||
jc .fail
|
||||
jmp .success
|
||||
.fail:
|
||||
mov ax, msg_fail
|
||||
call puts
|
||||
jmp hcf
|
||||
|
||||
.success:
|
||||
mov ax, msg_success
|
||||
call puts
|
||||
|
||||
mov ah, 0x2 ; read sectors
|
||||
mov al, 0x2 ; sector count
|
||||
mov ch, 0x0 ; cylind
|
||||
mov cl, 0x2 ; sector index
|
||||
mov dh, 0x0 ; head
|
||||
mov dl, 0x0 ; disk A
|
||||
|
||||
mov bx, 0
|
||||
mov es, bx
|
||||
mov bx, stage2
|
||||
int 0x13
|
||||
jmp stage2
|
||||
|
||||
puts:
|
||||
push bx
|
||||
push di
|
||||
|
||||
mov bx, ax
|
||||
|
||||
mov ah, 0xE
|
||||
mov di, 0
|
||||
.loop:
|
||||
mov al, [bx + di]
|
||||
|
||||
cmp al, 0
|
||||
je .exit
|
||||
int 0x10
|
||||
|
||||
cmp al, 0xA
|
||||
jne .skip
|
||||
mov al, 0xD
|
||||
int 0x10
|
||||
.skip:
|
||||
inc di
|
||||
jmp .loop
|
||||
.exit:
|
||||
pop di
|
||||
pop bx
|
||||
ret
|
||||
|
||||
msg_checking: db "Checking that Floppy Disk A is mounted... ", 0
|
||||
msg_success: db "success!", 0xA, 0
|
||||
msg_fail: db "fail!", 0xA, 0
|
||||
|
||||
times 510 - ($-$$) db 0
|
||||
db 0x55, 0xaa
|
||||
|
||||
%include "stage2.asm"
|
5
stage2.asm
Normal file
5
stage2.asm
Normal file
|
@ -0,0 +1,5 @@
|
|||
stage2:
|
||||
mov ax, msg_loaded
|
||||
call puts
|
||||
|
||||
msg_loaded: db "Loaded!"
|
Loading…
Reference in a new issue