Jump to content


Check out our Community Blogs

Guest45316

Member Since 20 Apr 2012
Offline Last Active Aug 30 2015 08:42 PM
-----

Topics I've Started

Bootloader Is Not Working. Help?

23 April 2012 - 04:03 PM

Hello! I have made a bootloader on x86. The rest of it works, its just that the program hangs after jumping to the (supposedly) loaded sector. Could someone please tell me what I am doing wrong?

	    [BITS 16]
	    org 0x0
	    mov ax, cs
	    mov ds, ax
	    cli
	    mov ss, ax
	    mov sp, 0xFFF0
	    sti
	    jmp 0x07C0:start
print:
	    lodsb
	    or al, al
	    jz done
	    mov ah, 0x0E
	    int 0x10
	    jmp print
done:
	    ret
resetmsg db "Resetting floppy...", 10, 13, 0
loadmsg db "Loading sectors...", 10, 13, 0
jumpmsg db "Jumping to loaded sectors...", 10, 13, 0
start:
	    nop
reset:								   ; Resets floppy
	    mov si, resetmsg
	    call print
	    xor ax, ax
	    xor dx, dx
	    int 13h
	    jc reset
load:
	    mov si, loadmsg
	    call print
	    mov bx, 0x1000
	    mov es, bx
	    xor bx, bx
	    mov al, 10				   ; Load 10 sectors
	    mov ah, 2			   
	    mov cl, 2					 ; Load 10 sectors
	    mov ch, 0				    ; Track 0
	    mov dx, 0x0000		  ; Head 0, Drive 0
	    int 13h
	    jc load
jumpto:
	    mov si, jumpmsg
	    call print
	    jmp 0x1000:0000
times 510 - ($-$$) db 0
; end of sector 1
	    mov ax, cs
	    mov ds, ax
	    cli
	    mov ss, ax
	    mov sp, 0xFFFF0
	    sti
	    jmp sec2start
message db "It works!", 0
sec2start:
	    mov si, message
print2:
	    lodsb
	    or al, al
	    jz done2
	    mov ah, 0x0E
	    int 0x10
	    jmp print2
done2:
	    nop
	    cli
	    hlt
times 512 * 2880 - ($-$$) db 0	  ; Pad out 0's to make floppy disk image.


Here's the output:

Resetting disk...
Loading sectors...
Jumping to loaded sectors...


And then nothing...It just hangs!
So can someone help me with this?


P.S. The last line of code was to make a bootable floppy image! I know its not the best way but it works!

Hello!

20 April 2012 - 12:01 PM

Hello! I am new to this site. I program in VB.NET, C#, and ASM. I know a tad of scripting languages, like Javascript.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download