Code: Select all
BITS 16
ORG 0x7C00
entry:
; clear screen
mov ax, 0x9100
mov ss, ax
mov sp, 0x9000
mov ah,0
mov al,0x03 ; 0x13 set mode vga 256 color 0x03 80*25 16 color
int 0x10
xor ax,ax ; set ax zero
mov ds,ax ; initilize data segment register
mov es,ax
mov ah,0x02
mov al,0x01
mov ch,0x00
mov cl,0x02
mov dh,0x00
mov dl,0x00
mov bx,0x7e00
read_sector:
int 0x13
jc read_sector
mov si, msg
call print_str
mov si,0x7e00
call print_str
jmp hang
read_error:
mov si,msg_err
call print_str
hang:
jmp hang
print_str:
lodsb ; this will load a byte from DS : SI to al
or al,al ; this will set zero flag if output of or is zero
jz print_str_out ; jump if zero
mov ah,0x0E ; print char
mov bx,0x007 ; color
int 0x10 ; call bios
jmp print_str
print_str_out:
retn
; Memory Data
;--------------------------------------------------------
msg db 'Read Sector',0
msg_err db 'Read Error',0
; Size should not be greater then 510 bytes
;--------------------------------------------------------
size equ $ - entry
%if size+2 > 512
%error "Code is greater then 512"
%endif
times 510-($-$$) db 0 ; Note that this does not handle -ve error condition
dw 0AA55h
Code: Select all
floppya: 1_44=boot.bin, status=inserted
boot:floppy