HI all!!

As usually i'm here to ask, more than to help each others... :( :(

This is the issue: a friend of mine ask me a little asm prog.. he need a way under win95/98 or, if easier under real-mode dos, to get first cluster of a file, and after this, to mark as bad all the clusters of the file.

I don't know where to start... in the meantime i'm studying the FAT...

If some help... always thanks !!

Posted on 2002-05-24 01:26:48 by Bit7
Hi Bit7,

for DOS :

- set DTA addr ---> new DTA ( int 21 - 1a)
- find_first_file and set wildcard your filename ( int 21 - 4eh)
- DTA+0f = starting cluster number of current directory
- DTA+13 = starting cluster number of current directory

For example: (*.com file )


newdta db 32 dup (?) ; new DTA
wildcard db 'yourfile.ext',0 ; Your filename here


;org 100h for COM file

push cs ; cs=ds=es for DOS segments
push cs
pop ds
pop es

mov ax,01a00h ; set DTA new adress
lea dx, newdta
int 21h

mov ah,04eh
lea dx, wildcard
mov cx,0ffh ; Attr ff= all files and DIR's
int 21h

lea dx,newdta+13h ; current dir

for int 21- 04eh : http://www.iro.umontreal.ca/~feeley/cours/ift2240/doc/assembly/int21-4e.html

for int 21 -01ah : http://www.iro.umontreal.ca/~feeley/cours/ift2240/doc/assembly/int21-1a.html

for DTA ( disk transfer adress) : http://www.iro.umontreal.ca/~feeley/cours/ift2240/doc/assembly/dta.html

look this adress for more help:

Windows FindFirstFile API not included like DOS DTA+0f and DTA+13. Sorry I dont know how to make for Windows. May be DeviceIOControl but i dont try.

have nice days!
Posted on 2002-05-24 02:54:14 by CYDONIA
CYDONIA ! Thanks for excellent help!!!!!
Posted on 2002-05-24 09:49:14 by Bit7