What value DS need to display message ?
Posted: Sun Nov 07, 2010 2:33 am
Hi all,sorry for this trivial question.
I have a MBR (sector #1) loads sector #2
sector #2 :
What value DS need to display msg ?
I have a MBR (sector #1) loads sector #2
Code: Select all
;MBR
;boot sector,clear the screen
mov ax,0x07c0
mov ds,ax
; Clear the screen
mov cx,0x7D0
claer:
mov ah,0xe
mov al,0
int 0x10
loop claer
;Print message 1
mov ah,0x2
mov dx,0
int 0x10
mov si,stage1_msg
print1:
lodsb
or al,al
jz message2
mov ah,0xe
int 0x10
jmp print1
; Print message 2
message2:
mov ah,0x2
mov dx,0x0100
int 0x10
mov si,stage2_msg
print2:
lodsb
or al,al
jz reset_floppya
mov ah,0xe
int 0x10
jmp print2
;Loading another sector
reset_floppya:
mov ah,0x0
mov dl,0x0
int 0x13
jmp check_driver
print_check_success:
mov ah,0x2
mov dx,0x0200
int 0x10
mov si,check_success_msg
print3:
lodsb
or al,al
jz read_sector2
mov ah,0xe
int 0x10
jmp print3
;
check_driver:
mov ah,0x1
int 0x13
or al,al
jz print_check_success
print_check_failed:
mov ah,0x2
mov dx,0x0200
int 0x10
mov si,check_failed_msg
print4:
lodsb
or al,al
jz hang
mov ah,0xe
int 0x10
jmp print4
;
read_f_error:
mov ah,0x2
mov dx,0x0300
int 0x10
mov si,read_fr_msg
print5:
lodsb
or al,al
jz hang
mov ah,0xe
int 0x10
jmp print5
read_f_success:
push es
push bx
retf
read_sector2:
mov ax,0
mov es,ax
mov bx,0x500
mov ah,0x2
mov al,0x1
mov dl,0x0
mov dh,0
mov ch,0
mov cl,2
int 0x13
jc read_f_error
jmp read_f_success
;
hang:
jmp hang
stage1_msg db "Loading sector1...",0x0
stage2_msg db "Loading sector2...",0x0
check_success_msg db "Check floppy drive successfully!",0x0
check_failed_msg db "Check floppy drive failed!",0x0
read_fr_msg db "Reading failed!",0x0
times 510-($-$$) db 0
dw 0xaa55
Code: Select all
;clear the screen
xor ax,ax
mov ds,ax ;Ds is wrong?
mov cx,0x7d0
clear_s:
mov ah,0xe
mov al,0
int 0x10
loop clear_s
;messaging
mov ah,0x2
mov dx,0
xor bh,bh
int 0x10
mov si,msg
messages:
lodsb
or al,al
jz hang
mov ah,0xe
int 0x10
; jmp messages
hang:
jmp hang
;
msg db "Sector2...",0x0
times 512-($-$$) db 0