【问题标题】:Show hidden files in directory assembler在目录汇编器中显示隐藏文件
【发布时间】:2016-02-29 18:04:12
【问题描述】:

帮助我修复我的程序。程序必须显示目录中的隐藏文件,但它不起作用。当 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

附:对不起我的英语

【问题讨论】:

    标签: assembly dos tasm 16-bit


    【解决方案1】:

    除了为int 21h 的服务4e (FindFirst) 和4f (FindNext) 指定的file attributes flag 之外,常规文件始终包含在结果中。唯一的例外是请求的类型是“卷标”。

    必须通过查看文件的属性来过滤返回的文件是否您感兴趣(查看Disk Transfer Area (DTA)的偏移量15处的字节,您可以获得DTA 与服务 2fint 21h)

    【讨论】:

      猜你喜欢
      • 2020-01-16
      • 2016-10-22
      • 2020-02-12
      • 2021-06-07
      • 1970-01-01
      • 2011-05-24
      • 2012-10-24
      • 1970-01-01
      • 2023-04-02
      相关资源
      最近更新 更多