Hi @ll,
i'm writing a tiny utility in masm to generate updates (Old-File=>New-File). I'm gonna use it to provide little updates for my delphi-programs so i don't have to send the whole 400kb. The first problem is that the files have to be the same size but THE problem is getting the Old & New Value. Of course I can use SetFilePointer and set to the offset and read with ReadFile the values. But then I could also use delphi :grin:. See my comment in the code for where the problem is...

thx for every hint & help,
DaEagle99

P.S.: If you find some speed improvements, let me know ;)



ReadBlock:
inc counter
invoke ReadFile, hOldFile, ADDR filebuf1, FILE_BUFFER, ADDR bRead, 0
invoke ReadFile, hNewFile, ADDR filebuf2, FILE_BUFFER, ADDR bRead, 0
.if bRead==0
jmp Ende
.endif


lea edi, filebuf1
lea esi, filebuf2
mov ecx, FILE_BUFFER

cld
repe cmpsb
je ReadBlock
push edi
push esi
push ecx

dec edi ;EDI-1
inc ecx ;ECX+1

;OldVal := filebuf1[ecx] ;Well, this would be the
;NewVal := filebuf2[ecx] ;Delphi-Version :grin:
;And i don't know how
;to do this in asm :-(
mov eax, counter
mov ebx, FILE_BUFFER
mul ebx ;EAX = counter * FILE_BUFFER

sub eax,ecx ;compute Offset
mov CalcOffset, eax
pop edi
pop esi
pop ecx
jmp ReadBlock
Posted on 2001-12-15 05:04:26 by DaEagle99
Why not just stick to delphi for this until you have a better grasp
of assembler? :). It's not like there's any improvement in writing this
in assembler. Also, you might want to use memory-mapped files for
the operation (look up CreateFileMapping, MapViewOfFile,
UnmapViewOfFile).

Since you can't do memory->memory transfers with MOV, you need
to get the old/new values into a register before you can store
them
in old/new variables...
Posted on 2001-12-15 08:40:37 by f0dder
Hi f0dder,
Wow, I'm glad that you don't find anything to optimize :)

Why not just stick to delphi for this until you have a better grasp

Well, I already did this in delphi... :tongue:
But I want a compact version of it :grin:

Thanks for giving me this abstract solution but I need something concrete. Maybe you're able to give me something I can cut&paste and I understand ;)

cya,
DaEagle99
Posted on 2001-12-15 10:19:34 by DaEagle99