Problem with coding: the search function does not work

Status
Not open for further replies.

ron2004

Newbie level 2
Joined
Oct 27, 2004
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
20
int 021h / ah = 4Eh

i want to create a prog.exe to copy directory that is compiled in turbo assembler.
my problem is the code that i search does not work properly here it is

ideal
dosseg
model small
stack 256

dataseg


dNa2 db '*.txt',00

dNa3 db 0


codeseg

start:
mov ax, @data
mov ds, ax
mov es, ax

xor ax, ax

mov ah, 04Eh ;search file for first text file
mov cx, 00000001b
mov dx, offset dNa2
int 021h

mov [dNa3], al ; get the file handle so ah=3Dh can use it

mov ah, 3Dh ;open file
mov al, 02h
mov dx, offset dNa3 ; mov dx, 9Eh is my other use of it
int 021h



exit:
mov ax, 04C00h
int 021h


the mov ah, 3Dh is cf = 1. it got error, my problem is i cant use the search
function "mov ah, 04Eh" for "mov ah, 3Dh" to open the file.


please help me.
 

After FindFirst/FindNext (int21 , function 4E/4F), the name and other infos about found file resides in DTA.

The name & extension of found file is at offset 0x1E of DTA

So, you should get DTA address (int 21 , function 2F) & put its segmentffset into DSX and add 0x1E to DX and then call OpenFile (int 21 , function 3D)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…