thank for your comment?
You tell BIOS to read into 7c00, the BIOS will happily overwrite your code
i reallocate my boot loader
this is complete sorce code
To be slightly less cryptic, the INT 13's need to be INT 0x13's.
i use INT 0x13 and result have been changed.now it is read diffrent content but it is false
Code: Select all
bits 16
org 0x7c00
start: jmp main
;print something
Print:
lodsb
or al, al
jz PrintDone
mov ah, 0eh
int 10h
jmp Print
PrintDone:
ret
;this is program entry
main:
;adjust our segments
cli
xor ax,ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
sti
;display message
mov AH,06H
mov AL,00H
mov BH,1FH
mov CX,0000
mov DX,184FH
INT 10H
mov si,msgLoading
call Print
;move our programe to new entry
mov si,0x7c00
xor ax,ax
push ax
pop es
mov di,0x0600
MOV CX,0100h
REPNZ
MOVSW
;far jmp to new location
JMP 0000:0x0642
nop
nop
;adjust our segment
cli
xor ax,ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
;set our stack
mov ax, 0x0000
mov ss, ax
mov sp, 0xFFFF
;try to load active partiotion
READACTIVE:
MOV DI,0x9
RETRY:
XOR AX,AX
INT 13
XOR AX,AX
MOV ES,AX
MOV SI,07BEh
LODSB
MOV DL,AL
LODSB
MOV DH,AL
LODSB
MOV CL,AL
LODSB
MOV CH,AL
MOV BX,0x7c00
MOV AH,02h
MOV AL,01h
INT 13
DEC DI
JNZ RETRY
MOV DI,0x200
MOV SI,0x7c00
CALL PRIM
jmp done
;for test our memory content
PRIM:
PUSHA
MOV CX,DI
MOV AX,SI
.LOOPM:
lodsb
mov dl,al
mov BX,table
SHR AL, 4
XLAT
MOV AH, 0Eh
INT 10h
MOV AL, DL
AND AL, 0Fh
XLAT
MOV AH, 0Eh
INT 10h
dec cx
jnz .LOOPM
POPA
RET
;for test our register content
PRIR:
PUSHA
MOV DL,AL
mov BX,table
SHR AL, 4
XLAT
MOV AH, 0Eh
INT 10h
MOV AL,DL
AND AL, 0Fh
XLAT
MOV AH, 0Eh
INT 10h
POPA
RET
done:
hlt
jmp done
;************************************
table DB '0123456789ABCDEF'
msgLoadin db 0x0D, 0x0A, "ok thats right!", 0x0D, 0x0A, 0x00
msgLoading db 0x0D, 0x0A, "Boot Loader Start Please Choose One Active Parttiotion", 0x0D,0x0A,0x00
TIMES 446-($-$$) DB 0