![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Dec 2004
Posts: 7
Rep Power: 0
![]() |
I'm calling the FREAD function in assembly, but I have an issue. This is what I'm trying to accomplish:
unsigned short int * *value1; unsigned short int * *value2; unsigned short int * *value3; unsigned short int * *value4; FILE * **GSShandle // ~~ cut out some code to show you what I'm looking at ~~ // fread(&value1, sizeof(short int), 1, GSShandle); fread(&value2, sizeof(short int), 1, GSShandle); fread(&value3, sizeof(short int), 1, GSShandle); fread(&value4, sizeof(short int), 1, GSShandle); As you can see, the valueX variables are defined one after another. In theory, I would believe that I could use a single FREAD and write to all 4. This is what I put into ASM: push * *ebx * * * * * *;I had put GSShandle here prior to this code push * *4 * * * * * * *;4 values push * *2 * * * * * * *;Define each value as 'WORD' size push * *offset value1 *;Set the offset to 'VALUE1' call * *fseek * * * * *;Do it's thing add * * esp, 10h * * *;Fix our stack When I try it, the results are not what I thought they would be. I am having a pretty difficult time debugging this and seeing what it's 'actually' doing. I was wondering if anyone had any clue as to why my ASM code doesn't work. I realize I could do each of the 4 FREAD's, but I thought it'd be neat to do all 4 in 1 shot. EDIT: Perhaps this belongs in the C forum instead of this one. I guess I put it here since I was experimenting with the function in assembly... would it be too much trouble if this was moved to C? I think my chances of getting a reply would increase! |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jan 2005
Posts: 4
Rep Power: 0
![]() |
Hey,
The first thing I would like to point out is....instead of using offset use lea...offset is a compile time directive....while lea is a runtime directive...try that and let me know.... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|