Page 1 of 1
question about MBR of DOS
Posted: Thu Feb 14, 2008 11:46 pm
by david
In the MBR of DOS, there is a few code that moving MBR from 0:7c00 to 0:600.
Code: Select all
xor ax, ax
....
mov sp, 7c00
mov si, sp
push ax
pop es
push ax
pop ds
....
mov di, 0600
mov cx, 0100
repnz
movsw
i have a question , why use 'repnz' ? why not use 'rep' ?
Posted: Fri Feb 15, 2008 4:16 pm
by mathematician
According to AMD's manual, repnz can't be used with movsw. So either the programmer has made a mistake, or your disassembler has.
Posted: Fri Feb 15, 2008 5:00 pm
by XCHG
REPNZ will repeat the instruction while the Zero Flag is Not Zero (NZ). A Move instruction can not possibly set or clear the Zero Flag so that doesn't make sense. REP MOVSW is correct and I also use it in the BootStrap code that I have written for the MBR of the HDD:
Code: Select all
MOV SI , ORIGINAL_MBR_SEGMENT_OFFSET
MOV DI , RELOCATED_MBR_SEGMENT_OFFSET
CLD
MOV CX , BYTESPERSECTOR / SIZEOF_CX
REP MOVSW
JMP LOADED_BOOT_SECTOR_STAGE1_SEGMENT_ADDRESS:\
RELOCATED_MBR_SEGMENT_OFFSET + LABEL_EIP(.RestofTheCode)
Posted: Sun Feb 17, 2008 10:14 pm
by david
the reason maybe is that Microsoft don't want DOS run on AMD CPU, only run on Intel CPU.
Perhaps because Wintel...
i guess
My compter is Intel CPU .
Posted: Mon Feb 18, 2008 11:07 am
by JAAman
david wrote:the reason maybe is that Microsoft don't want DOS run on AMD CPU, only run on Intel CPU.
Perhaps because Wintel...
i guess
My compter is Intel CPU .
no, AMD and Intel CPUs are almost 100% identical...
and MS definately (and quite specifically) does want it to run on AMD
your assembler must be mistaken... i cant seem to find my copy to check at the moment
Posted: Mon Feb 18, 2008 11:03 pm
by david
method of get MBR in DOS(Virtual PC) :
1 debug
2 read MBR to memory buffer from Hard Disk use int 13h
3 use 'U' command disassemble the memory buffer(MBR)
then, the result is that i show you .
so, i don't think the method have problem .
i also think 'U' command is correct !
i don't know why the programmer who write MBR of DOS use 'repnz' .
because i always use 'rep' in this case .
so i want to know the reason!
maybe it doesn't make any sense.
Posted: Tue Feb 19, 2008 6:40 am
by Tyler
It doesn't. Here's the closet thing on the Web, already correctly disassembled and well documented.
http://mirror.href.com/thestarman/asm/mbr/STDMBR.htm
EDIT: There is a note at the bottom of the page that explains the reason it appears as REPNZ. So the page also includes your answer.
Posted: Wed Feb 20, 2008 12:48 am
by david
Tyler wrote:It doesn't. Here's the closet thing on the Web, already correctly disassembled and well documented.
http://mirror.href.com/thestarman/asm/mbr/STDMBR.htm
EDIT: There is a note at the bottom of the page that explains the reason it appears as REPNZ. So the page also includes your answer.
thank you very much!
Posted: Thu Feb 21, 2008 5:24 pm
by 1234
[post deleted]
Posted: Tue Feb 26, 2008 12:26 am
by david
XCHG wrote:
REP MOVSW is correct and I also use it in the BootStrap code that I have written for the MBR of the HDD:
i know.
i am programming a routine , it is in NIC's option ROM, it will use PXE to downland a bootstrap from PXE server .
i think i must load the Onboard NIC driver , ready for UNDI. DHCP and PXE.
do you know how to load the Onboard NIC driver ?
thanks !