-
Notifications
You must be signed in to change notification settings - Fork 5
/
FILE_DTA.ASM
62 lines (53 loc) · 1.3 KB
/
FILE_DTA.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;******************************************************************************
; file search test
;******************************************************************************
;
;[TAB=8]
;------------------------------------------------------------------------------
%macro PRINT 1
mov edx,%1
mov ah,09h
int 21h
%endmacro
;------------------------------------------------------------------------------
segment text align=4 class=CODE use32
;------------------------------------------------------------------------------
..start:
; set FF to buffer
mov eax, -1
mov edi, buffer
mov ecx, 256/4
rep stosd
; set DTA
mov ah, 1ah
mov edx, buffer ;ds:edx
int 21h
; search file
mov ah, 4eh
xor ecx, ecx ;attribute = 0
mov edx, file ;file name
int 21h
jc end
.loop:
mov edi, buffer + 1eh
mov ecx, 20h
xor al, al
repne scasb
mov dword [edi-1], 24_0A_0Dh ; 13 10 '$'
mov ah, 09h
mov edx, buffer + 1eh
int 21h ;print file name
; search next file
mov ah, 4fh
int 21h
jnc .loop
end:
mov ah, 4ch
int 21h
;------------------------------------------------------------------------------
align 16
;------------------------------------------------------------------------------
file db '*.asm',0
align 16
buffer resb 64
db '$$',0 ;safety