Hello,
I'm learning Assembly and i'm trying to develop my own boot loader for my OS that is only a test to build something big, but my boot loader that i'm developing isn't booting, i know the boot loader that don't boot is very funny, but it's not a joke. Let's go to the problem, i insert the floppy of my boot loader(Beginning of an OS, because my OS only shows a message and then reboot the computer, because it's only a test to start the develop of my own OS) and select the floppy as primary boot drive, then when is at the time of the boot, the computer searches in the floppy, because i see the light of the floppy drive on, then like it don't have any OS there it goes and boot in the hard drive and initialize Windows(In my laptop, Ubuntu), but it haves an OS there in the floppy(i suppose that is), but here is my code for Nasm:
Code:
[BITS 16] ; 16 bit code generation
[ORG 0x7C00] ; ORGin location is 7C00
;Main program
main: ; Main program label
mov ah,0x0E ; This number is the number of the function in the BIOS to run.
; This function is put character on screen function
mov bh,0x00 ; Page number (I'm not 100% sure of this myself but it is best
; to leave it as zero for most of the work we will be doing)
mov bl,0x07 ; Text attribute (Controls the background and foreground colour
; and possibly some other options)
; 07 = White text, black background.
; (Feel free to play with this value as it shouldn't harm
; anything)
mov al,65 ; This should (in theory) put a ASCII value into al to be
; displayed. (This is not the normal way to do this)
int 0x10 ; Call the BIOS video interrupt.
jmp $ ; Put it into a coninuous loop to stop it running off into
; the memory running any junk it may find there.
; End matter
times 510-($-$$) db 0 ; Fill the rest of the sector with zeros
dw 0xAA55 ; Boot signature
Here is my code developed in emu8086(That is the default):
Code:
; directive to create BOOT file:
#make_boot#
; Boot record is loaded at 0000:7C00,
; so inform compiler to make required
; corrections:
ORG 7C00h
PUSH CS ; make sure DS=CS
POP DS
; load message address into SI register:
LEA SI, msg
; teletype function id:
MOV AH, 0Eh
print: MOV AL, [SI]
CMP AL, 0
JZ done
INT 10h ; print using teletype.
INC SI
JMP print
; wait for 'any key':
done: MOV AH, 0
INT 16h
; store magic value at 0040h:0072h:
; 0000h - cold boot.
; 1234h - warm boot.
MOV AX, 0040h
MOV DS, AX
MOV w.[0072h], 0000h ; cold boot.
JMP 0FFFFh:0000h ; reboot!
new_line EQU 13, 10
msg DB 'Hello This is My First Boot Program!'
DB new_line, 'Press any key to reboot', 0
DW 0xAA55 ; Add the boot loader signature to the end
And here is the process to that i use to write in the floppy:
Code:
> DEBUG os-test.asm
-w 100 0 0 1
-q
What i'm doing wrong?Thanks,
Nathan Paulino Campos