BITS 16
ORG 0x7C00

JMP 0x0000:main

main: 
    MOV AX, 0x1000
    MOV DS, AX
    XOR AX, AX
    MOV ES, AX
    MOV SS, AX

    MOV SP, 0x7C00
 
    MOV [boot_drive], DL

    MOV AH, 02h
    MOV CX, 0x1000
    MOV ES, CX
    MOV BX, 0x0000
    MOV AL, 0x04
    MOV CH, 00h
    MOV CL, 02h
    MOV DH, 00h
    MOV DL, [boot_drive]

    INT 13h

    JNC success

    MOV CH, AH
    MOV AH, 0Eh
    MOV AL, CH
    MOV BH, 00h
    INT 10h

    success:
        MOV AH, 0Eh
        MOV AL, 58h
        MOV BH, 00h
        INT 10h

        JMP 0x1000:0x0000

    boot_drive db 0

    times 510-($-$$) db 0

    dw 0xAA55