Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BITS 16
- ; Load a program off the disk and jump to it
- ; Tell the compiler that this is offset 0.
- ; It isn't offset 0, but it will be after the jump.
- ;to run
- ;nasm floppyboatloader.asm -o floppyboatloader.bin
- ;dd status=noxfer conv=notrunc if=floppyboatloader.bin of=floppyboatloader.flp
- ;qemu-system-i386 -fda floppyboatloader.flp
- [ORG 0]
- jmp start ; Goto segment 07C0
- start:
- ; Update the segment registers
- mov ax, cs
- mov ds, ax
- mov es, ax
- reset: ; Reset the floppy drive
- mov ax, 0 ;
- mov dl, 0 ; Drive=0 (=A)
- int 13h ;
- jc reset ; ERROR => reset again
- read:
- mov ax, 1000h ; ES:BX = 1000h:0000
- mov es, ax ;
- mov bx, 0h ;
- mov ah, 2 ; Load disk data to ES:BX
- mov al, 5 ; Load 5 sectors
- mov ch, 0 ; Cylinder=0
- mov cl, 9 ; Sector=2
- mov dh, 0 ; Head=0
- mov dl, 0 ; Drive=0
- int 13h ; Read!
- jc read ; ERROR => Try again
- jmp 1000h:0h ; Jump to the program
- times 510-($-$$) db 0
- dw 0AA55h
- mov ah, 0Eh
- mov al, '='
- int 10h
- mov ah, 0Eh
- mov al, '1'
- int 10h
- mov ah, 0Eh
- mov al, '2'
- int 10h
- mov ah, 0Eh
- mov al, '3'
- int 10h
- mov ah, 0Eh
- mov al, '4'
- int 10h
- jmp $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement