Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Assembly creating functions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
MaximuS
I post too much
Reputation: 3

Joined: 05 Apr 2007
Posts: 3212
Location: ......

PostPosted: Thu Mar 26, 2015 1:12 am    Post subject: Assembly creating functions Reply with quote

I need to make functions for these problems. I'm a little lost on this section. Please can you help me writing the code and understanding it as well?

a) Write a function, labelHash(), that will verify if a given string is a valid label, and if it is, create a hash from the label name. The hash is created by adding each of the ASCII values for the characters (thus treating the characters as a series of byte integers). For this question, a valid label must start with a letter (upper or lower case), followed by letters (upper or lower case) or numbers (no special symbols), and ending with with a “:” (and no characters after the “:”). The total length (including the “:”) must be ≤ to 255 characters. The function should return the label status (TRUE for valid, and FALSE for invalid). You may assume TRUE and FALSE are already declared as constants. In addition, the function should return (via arguments) the hash value, label length (including the “:”), letter count ('a'-'z', 'A'-'Z') and digit count ('0'-'9'). The hash value is calculated by adding each of the ASCII characters. An example call of the function as follows:

status = labelHash(lblStr, hashValue, lblLen, ltrCnt, digitCnt);

Where lblStr is the address of a NULL terminated string, and hashValue, lblLen, ltrCnt, and digitCnt are addresses for the double-word sized counts. Do not assume the count variables have been initialized to zero. Your procedure must use the standard calling convention. Note, points will be deducted for poor or inefficient solutions.




b) Write a function, printLabel(), that will read a string from a file and determine if the string is a valid label. If the string is not valid, NOSUCCESS should be return to the calling routine. If the string is valid, the string should be displayed to the console, the string (NULL terminated) and string length should be returned via call-by-reference, and SUCCESS returned to the calling routine. The function must open the file, determine if the string is valid by calling the function from the previous question, return the appropriate results, and close the file. If the file can’t be opened or read, or the string is not valid, display an “label error” to the console and return NOSUCCESS. You may assume the standard constants are already defined. An example call for the function as follows:

status = printLabel(fileName, lblStr, lblLen);

Where fileName is the address of the NULL terminated file name string, lblStr is the address of where to store the NULL terminated label string, and lblLen is the address of where to store the string length (double-word). Your function must use the standard calling convention. Show additional data declarations (if any). You may use the printString() function without writting it. Note, points will be deducted for poor or inefficient solutions.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites