org 7C00h

jmp 0x0:start


start:
mov [BootDriveNumber],dl

cli
mov ax, 0x0200	;start the stack after the bootloader
mov ss, ax	
mov ax, 0xC00	;make the stack 3k big later this will need to be changed and hardware detection added
mov ax, sp	;but for now this will work.
mov ax, ds
sti

mov ah, 0x0e
mov al, '1'
int 0x10


mov ah, 0x42
mov dl, 0
mov si, DiskAddressPacket
mov dl, [BootDriveNumber]
int 0x13
jc error

jmp	0x0000:0x0200

error:
mov ah, 0x0e
mov al, 'E'	
int 0x10


BootDriveNumber db 0 	;temp


DiskAddressPacket:
db 0x10		;size of packet
db 0x0		;reserved
dw 0x1		;number of blocks to transfer
dw 0x0200	;offset
dw 0x0		;where in memory to write to
dq 0x1		;starting block to read
dd 0x0

times 510-($-$$) db 0 ;Fill rest of sector up with 0s to make this 512B (a sector)
dw 0xAA55             ;Let BIOS know this is an OS


