2015-11-26 53 views
1

幫我修復我的程序。程序必須在目錄中顯示隱藏文件,但它不起作用。當CX = 2計劃也表明,沒有隱藏文件:在目錄彙編程序中顯示隱藏的文件

.model  tiny 
.code 
org 100h   ; СОМ-file 
start: 
push cs   ;cs=ds 
pop ds   

mov ah, 9  ;show message on screen 
lea dx, msgpathrequest 
int 21h 

mov ah, 0Ah  ;write directory by keyboard 
lea dx, path  
int 21h   

lea dx, pathstring 
push dx   
add dl, byte ptr[pathactual]  
xor al, al  
adc dh,al  
mov di, dx  
mov byte ptr[di], al 

mov ah, 3Bh  ;change directory 
pop dx   
int 21h 
jc no_such_directory 

mov ah,1ah 
mov dx,offset dta 
int 21h 

;find first file 
mov ah,4Eh   
mov cx,2h   ; hidden files 
lea dx,searchPath 
int 21h 
jc no_more_files ; if CF = 1 - files end 

print: 
mov ah,9h  
mov dx,offset dta + 1eh 
int 21h 

; new string 
mov ah,9h 
mov dx,offset crlf 
int 21h 

mov ah,4Fh    ; find next file 
mov dx,offset dta 
int 21h 
jc no_more_files 
mp print 

no_such_directory: 
mov ah, 9  ;print message 
lea dx, msgnosuchdir 
int 21h 
jmp no_more_files 

no_more_files:       
mov ah,9h 
mov dx,offset message 
int 21h 

xor ax,ax 
int 16h 
mov ah,4ch 
int 21h 

msgpathrequest db 0Ah, 0Dh, "Enter the full directory name: $" 
msgnomorefiles db 0Ah, 0Dh, "No files found in current directory$" 
msgnosuchdir db 0Ah, 0Dh, "No such directory$" 
crlf db 0Dh,0Ah,'$' 
searchPath db "*.*",0 
dta  db 2ch dup (?) 
      db "$" 
message db 'Press any key...','$' 
path  label byte 
pathlen  db 66 
pathactual db ? 
pathstring db 66 dup (?) 
end start 

Result

附:對不起,我的英語

回答

5

除了爲int 21h的服務4e(使用FindFirst)和4f(FindNext中)指定的file attributes flag,正規文件總是包含在結果中。唯一的例外是請求的類型是「卷標」。

有過濾是否通過查看文件的屬性返回的文件感興趣,你(看在Disk Transfer Area (DTA)偏移15字節,你可以用int 21h服務2f得到DTA的地址)

+0

謝謝,我會試試 –