title: Starting Parallels Virtual Machine with own bootloader written on an Iso file
body: <p>I'm fiddling around with the creation of an own bootloader (MBR). It's my first step into having a better understanding of operating systems.</p>
  
  <p>My configuration is:</p>
  
  <p><strong>MacBook Air, OsX 10.8.4, Parallels Desktop, Xcode, XCode Command Line tools, Nasm, LD, gcc, ...</strong></p>
  
  <p>I have composed a boot loader:</p>
  
  <pre><code>;
  ;  FpLoader.s
  ;  
  
                  bits    16                  ; 16-bit Real Mode
                  org     0x7c00              ; Set origin to BIOS boot origin
  
  
  ;
  ; Bootloader entry-code
  ;
  Main:           cli                         ; Enable interrupts
                  mov     ax, cs              ; Setup stack segments
                  mov     ds, ax
                  mov     es, ax
                  mov     ss, ax
                  sti                         ; Enable interrupts
  
                  mov     si, Message_1       ; Print string
                  call PrintLn
  
                  mov     si, Message_2       ; Print string
                  call PrintLn
  
                  call PrintCrLf
                  call PrintCrLf
  
                  call Reboot
  
  
  ;
  ; Read keypress
  ;
  ReadKeypress:
                  mov     ah, 0               ; BIOS function - Wait for and read keyboard
                  int     0x16                ; Call BIOS Keyboard Service
  
                  ret                         ; Return from procedure
  
  
  ;
  ; PrintLn string
  ;
  PrintLn:
                  lodsb                       ; Load [Si] in Al and increment Si
  
                  or      al, al              ; Check if end of string reached (Al == 0)
                  jz      .PrintLnEnd
  
                  mov     ah, 0x0e            ; BIOS function - Print character on screen
                  int     0x10                ; Call BIOS Screen Service
  
                  jmp     PrintLn             ; Loop
  .PrintLnEnd     call PrintCrLf
  
  
  ;
  ; Print Cr/Lf
  PrintCrLf:      mov     ah, 0x0E            ; BIOS function - Print character on screen
  
                  mov     al, 0x0D            ; Character to print: Cr
                  int     0x10                ; Call BIOS Screen Service
  
                  mov     al, 0x0A            ; Character to print: Lf
                  int     0x10                ; Call BIOS Screen Service
  
                  ret                         ; Return from procedure
  
  
  ;
  ; Reboot the machine
  ;
  Reboot:         mov     si, AnyKey          ; Print string
                  call PrintLn
                  call ReadKeypress
  
                  db      0x0ea               ; Sends us to the end of the memory causing reboot
                  dw      0x0000
                  dw      0xffff 
  
  
  ;
  ; Data
  ;
                  ; Program data
  Message_1       db "Hello World...", 0x0
  Message_2       db "Painted Black bootloader.", 0x0
  AnyKey          db "Press any key to reboot...", 0x0
  
                  ; Filler bytes
                  times 510 - ($-$$) db 0
  
                  ; Trailer bytes
                  dw 0xAA55                   ;Boot signature
  </code></pre>
  
  <p>I'm assembling this code with:</p>
  
  <pre><code>nasm -f bin FpLoader.s -o FpLoader.img
  sudo dd if=FpLoader.img of=FpLoader.iso bs=2k
  </code></pre>
  
  <p>When I'm trying to start a Parallels Virtual Machine from FpLoader.iso, it refuses to start, telling me that it cannot boot from the iso (configured as a CD in the Parallels configuration).</p>
  
  <p>Since I'm completely new to the topic, and puzzled on how to proceed with the tools I have available, I would appreciate any help you can give me.</p>
  
  <p>I have found a number of partial solutions for Linux, Bochs, ... but nothing really pointed me in the right direction.</p>
  
  <p>I'm not rigid about the Iso file. If someone can show me a way with an img file, a real bootable USB (within Parallels Virtual Machine), or some other solution (compatible with my configuration) for testing my developments, that would be fine as well.</p>
  
  <p>Thanks in advance and kind regards,
  PB</p>