Skip to content

Instantly share code, notes, and snippets.

Created October 17, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d29a80b0b05840f8f34fd88bd7a1fa4e to your computer and use it in GitHub Desktop.
Save anonymous/d29a80b0b05840f8f34fd88bd7a1fa4e to your computer and use it in GitHub Desktop.
Read_Sectors:
push ds
pop es
mov cx, 1 ; 1 Sector to read
mov ax, 0
mov bx, bufor
call ReadSectors
ret
Second_Stage:
mov [boot_device], dl ; Boot device number is passed in from first stage in DL. Save it to pass to kernel later.
mov si, second_stage_msg ; Output our greeting message
call Console_WriteLine_16
call Read_Sectors
mov cx, 16
call ReadLoop
hlt
ReadLoop:
mov bx, [bufor+1]
call Console_Write_Hex
loop ReadLoop
ret
second_stage_msg db 'Second stage of boot loader running', 0
boot_device db 0
ask_sector_num_msg db 'Enter the sector number to read:', 0
bufor resb 512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment