Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Created June 18, 2011 15:58
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 nathanpc/1033222 to your computer and use it in GitHub Desktop.
Save nathanpc/1033222 to your computer and use it in GitHub Desktop.
Booting a Kernel In The Middle Of a Floppy
org 7C00h
mov ax, 1000h
mov ss, ax
mov sp, 0 ; Points to the top of the stack
mov ax, cs
mov ds, ax
mov ah, 02h ; Read sub function
mov al, 1 ; Number of sectors to read
mov ch, 0 ; Cylinder
mov cl, 2 ; Sector
mov dh, 0 ; Head
mov dl, 0 ; Drive (00h = A:)
mov bx, 0800h ; ES:BX Points to the memory location
mov es, bx ; Where the data will be written
mov bx, 0 ; 0800:0000h (ES = 0800h, BX = 0000h)
int 13h ; Floppy interrupt
; Turn off the floppy drive
mov dx,3F2h
mov al,0
out dx,al
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment