Skip to content

Instantly share code, notes, and snippets.

Created October 16, 2017 21:12
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/40eb8a70cbf6acd310bc61f9fc170a47 to your computer and use it in GitHub Desktop.
Save anonymous/40eb8a70cbf6acd310bc61f9fc170a47 to your computer and use it in GitHub Desktop.
; Start of the second stage of the boot loader
Read_Sectors:
push cx
push ax
mov cx, 1 ; 1 Sector to read
mov ax, 0
mov bx, 0D000h ; Set starting point for sector data
call ReadSectors
pop ax
pop cx
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
call Read
hlt
Read:
call Console_Write_Hex
mov bx, [0D000h+1]
call Console_Write_Hex
mov bx, [0D000h+2]
call Console_Write_Hex
mov bx, [0D000h+3]
call Console_Write_Hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment