Advertisement
Guest User

Intel bootloader

a guest
Jun 12th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; COMPILE: nasm bootloader.asm -f bin -o bootloader.bin
  2. ; RUN: qemu-system-i386 bootloader.bin
  3.  
  4. [BITS 16]
  5. [ORG 0x7C00]
  6.  
  7. Bootloader_Entry_Point:
  8.     mov     si, info_text
  9.     call    Print_String
  10.     jmp     $                   ; Loop forever
  11.  
  12. Print_Character:
  13.     mov     ah, 0x0e
  14.     mov     bh, 0x00
  15.     mov     bl, 0x07
  16.     int     0x10
  17.     ret
  18.  
  19. Print_String:
  20.     mov     al, [si]
  21.     inc     si
  22.     cmp     al, 0
  23.     je      exit_function
  24.     call    Print_Character
  25.     jmp     Print_String
  26. exit_function:
  27.     ret
  28.  
  29.  
  30. info_text   db  'My very own bootloader', 13, 10, 0
  31. TIMES 510 - ($ - $$) db 0       ; Fill unused part of the 512 byte boot block with zeroes
  32. magic_id    dw 0xAA55           ; This ID has to be the last two bytes of the 512 byte boot block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement