Programming, for all ages and all languages.
david
Member
Posts: 93 Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:
Post
by david » Thu Feb 14, 2008 11:46 pm
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' ?
mathematician
Member
Posts: 437 Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk
Post
by mathematician » Fri Feb 15, 2008 4:16 pm
According to AMD's manual, repnz can't be used with movsw. So either the programmer has made a mistake, or your disassembler has.
The continuous image of a connected set is connected.
XCHG
Member
Posts: 416 Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:
Post
by XCHG » Fri Feb 15, 2008 5:00 pm
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)
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
david
Member
Posts: 93 Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:
Post
by david » Sun Feb 17, 2008 10:14 pm
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 .
JAAman
Member
Posts: 879 Joined: Wed Oct 27, 2004 11:00 pm
Location: WA
Post
by JAAman » Mon Feb 18, 2008 11:07 am
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
david
Member
Posts: 93 Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:
Post
by david » Mon Feb 18, 2008 11:03 pm
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.
Tyler
Member
Posts: 514 Joined: Tue Nov 07, 2006 7:37 am
Location: York, England
Post
by Tyler » Tue Feb 19, 2008 6:40 am
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.
david
Member
Posts: 93 Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:
Post
by david » Wed Feb 20, 2008 12:48 am
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!
Just For Fun
1234
Posts: 24 Joined: Sat May 26, 2007 7:58 pm
Post
by 1234 » Thu Feb 21, 2008 5:24 pm
[post deleted]
Last edited by
1234 on Tue Jan 27, 2009 3:19 pm, edited 1 time in total.
david
Member
Posts: 93 Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:
Post
by david » Tue Feb 26, 2008 12:26 am
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 !
Just For Fun