Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 16th, 2004, 12:50 PM   #1
saxman
Newbie
 
Join Date: Dec 2004
Posts: 7
Rep Power: 0 saxman is on a distinguished road
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!
saxman is offline   Reply With Quote
Old Jan 4th, 2005, 3:44 AM   #2
SubhadeepGhosh
Newbie
 
Join Date: Jan 2005
Posts: 4
Rep Power: 0 SubhadeepGhosh is on a distinguished road
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....
SubhadeepGhosh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC