help help me!!!!!!!!!!!!!!!!!!!!!!!!!!!
问题1:
请解释CHECKDOS的执行原理!!
StringComp proc uses es ds si di,
source: WORD,
dest : WORD,
number: WORD
mov ax, cs
mov ds, ax
mov es, ax
mov si, source
mov di, dest
mov cx, number
cld
repe cmpsb
mov ax, cx
ret
StringComp endp
CheckDos proc uses si di es ds
mov si, offset MSDOS1 ; io.sys
mov di, offset buff
INVOKE StringComp, si, di , 11
.if ax != 0 ;how read??
jmp NoDos
.endif
add di, 32 ;11 32 what?????
add si, 11 ; msdos.sys
INVOKE StringComp, si, di , 11
.if ax != 0
jmp NoDos
.endif
mov cx, 14
add si, 11 ; command.com
@@:
add di, 32
INVOKE StringComp, si, di , 11
.if ax != 0
loop @B ;@B what's mean??
jmp NoDos
.endif
.if di != offset buff+64
mov si, di
mov di, offset buff+64
mov cx, 32
mov ax, cs
mov ds, ax
mov es, ax
cld
rep movsb
.endif
mov havewrited, 0
INVOKE ReadWriteLogSector,3, 0,0 ,hidecyln, 0
inc havewrited
xor ax, ax
jmp the_ret
NoDos:
push cs
pop ds
mov ah,09h
mov dx,offset string_NoDos
int 21h
the_ret:
ret
CheckDos endp
问题2:
那么WRITEDOS怎样编写??
ReadDos proc
mov bx, offset buff
invoke ReadFile, word ptr [bx+1ah], dword ptr [bx+1ch]
invoke ReadFile, word ptr [bx+1ah+32], dword ptr [bx+1ch+32]
invoke ReadFile, word ptr [bx+1ah+64], dword ptr [bx+1ch+64]
ret
ReadDos endp
WriteDos proc uses eax ebx ecx edx ax bx cx,
?????????????????????????
ret
WriteDos endp
问题3:
GetDiskType proc near uses ax bx cx dx es
LOCAL currentdisk : BYTE
LOCAL detectedhdnumber: BYTE
LOCAL tableindex : WORD
mov currentdisk, 80h
xor ax, ax
mov detectedhdnumber, al
mov tableindex, ax
@@: mov dl, currentdisk
mov ah,8
int 13h ; Disk dl=drive 0 ah=func 08h
; get drive parameters, bl=type
; cx=cylinders, dh=max heads
jc @F
mov cs:HDnumber, dl
mov dl,cl /*具体在干什么????
and dl,3Fh ; '?'
xchg cl,ch
shr ch,6 ; Shift w/zeros fill
clc ; Clear carry flag
*/
mov bx, tableindex
mov cs:diskinfo[bx].track, cx
mov cs:diskinfo[bx].sector, dl
mov cs:diskinfo[bx].head, dh
inc detectedhdnumber
mov al, cs:HDnumber
.IF (detectedhdnumber < al) && ( al < 5)
add bx, type DISK
mov tableindex, bx
inc currentdisk
jmp @B
.ENDIF
@@:
ret
GetDiskType endp
YES_NT EQU 0
NO_NT EQU 1