read assembly file in C [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a project that I have to make a parser in C (first milestone) that it read an assembly file, e.g
goto:
goto:
L.D F0,0(R1) #### comments
ADD.D F4,F0,F2 #### more comments
S.D 0(R1),F4 ###
DSUBUI R1,R1,8 ####
BNEZ R1,goto
L.D F0 0X00A0100
MAYBE 10000 instructions (after that...)
I am thinking of doing this by using arrays....is there a better way of doing this? Also I have to simulate Tomasulo's algorithm using the commands I read from the file.

You're unlikely to get much help here with such a general question.
There are existing MIPS assemblers that do parsing which might provide you with some ideas, or at least some better questions:
http://code.google.com/p/mips-assembler-unb/source/browse/trunk/src/MIPS+Assembler/
...but clearly you'll be setting yourself up for a world of pain if you try using anything like that directly for a class project!
The best source for guidance if you're going to be graded will come from the person who's going to end up giving out the grade. Admit your confusion and ask for help directly. But go with a very clear map of what you did understand, and the point where your understanding stopped.
(This question doesn't demonstrate that kind of clarity, and your teacher will probably be unenthusiastic—much like the community here—if you put it to them in the same way.)

Related

Searching for opcode bytes in PE file [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a task of searching for opcode bytes in a PE file and checking whether a specified opcode byte sequence (constant and predefined) is present in the PE file. I have come across numerous examples online, but the solutions are mostly in C# or Python; however, my requirements are based in C language.
Please tell me how can I check and compare opcode byte values in a PE file by writing a simple program in C. Any help will be greatly appreciated.
Thanks.
You may take a look at ROPGadget or at rp, both software contain code that do what you want (and more).

sending variables to procedures in c and pascal [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
for sending variables to procedures what we should do in c and(or) pascal?
as i searched this work has to be done by BP( base pointer)
or rather i should say that BP do it,and one more thing is that C and Pascal are opposite of each other.
You question is entirely unclear. It would appear that you might be asking about C and Pascal calling conventions on the x86 architecture (at least your mention of BP hints at this).
If that's the case, I'd recommend you study the Wikipedia page on x86 calling conventions, and come back when you have specific questions.
edit You might also want to check out X86 Assembly/High-Level Languages along with the "Further Reading" links therein.

how to generate obfuscated-code [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
For example, consider the following code:
call far ptr 90b6h:79c35c2eh
shl dword ptr [ebp+0fh],1
db 67h
daa
push eax
push cs
How this code block generated in C programming? How can I deobfuscate that code?
It's not obfuscated C code. If this comes from a C program it is a few lines of assembler from a line or so of C code.
Once broken down to assembler it is very difficult to go the other way, especially on an automated basis. While you can get some tools that will do something along those lines the results will not be the original C code but something different that does the same thing. The results will still look obfuscated.
Compiling: converting high-level language to object code, with perhaps intermediate assembler left over.
Disassemble: Object code to assembler source. This can be done by some programs or debuggers.
Decompile: Converting compiled object code back to the original source language.
What you have is the assembler output of either 1 or 2. You seem to be asking for 3.

Execute a program using a C program [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
is it possible to write a C program that reads another program line by line and make it(2nd program) execute? please help
Yes.
But the details are complicated and depend on many things that you don't specify in your question.
What language is the second program written in?
Why you want to do this will affect how it should be done
Are you looking to control the 2nd program in some advanced way?
etc.
yes, with exec on unix and ShellExecute on windows
It's called an interpreter. Google for "C interpreter".
Read in the program, put it into a file, compile, link and execute it?
C isn't Perl if that is what you are looking for.
Frank
Yes. It is not only possible, but done all the time. UNIBASIC & UNIBASIC DL4 are two of the languages that I've used that are written in C.

how to build a calculator in GTK+? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
what's the logic behind the calculator widget. i want to build it in gtk+.
First, don't listen to anyone who says that this is trivial.
Second, I'm going to assume that you really mean something like "How do I convert the user input to an internal expression structure which I can use to calculate the answer?". Well, Wikipedia has a good article (here) on converting infix (human readable) notation, which is what most modern calculators use (e.g you can write 1 + 2 instead of + 1 2), to the more computer appropriate polish (prefix) notation.
Third, if you don't know GTK+ yet, start here.
Hope this helps.

Resources