Differences between version 6 and revision by previous author of AssemblyLanguage.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Wednesday, October 8, 2003 9:47:21 pm | by AristotlePagaltzis | Revert |
Older page: | version 5 | Last edited on Sunday, August 17, 2003 12:58:13 pm | by StuartYeates | Revert |
@@ -20,19 +20,19 @@
* The code is very difficult to read, especially when having to maintain somebody elses code.
* It is usually easier to start from scratch than to debug faulty code.
* Due to the above two reasons, debugging is rarely done. Especially on hand-optimized code.
-A Compiler such as [gcc(1)] will hide it's generation of AssemblyLanguage code from you as it generates it's object files and the executables. It is however possible to tell it to generate the AssemblyLanguage code for you by passing it the -S CommandLineOption
+A Compiler such as [gcc(1)] will hide it's generation of AssemblyLanguage code from you as it generates it's object files and the executables. It is however possible to tell it to generate the AssemblyLanguage code for you by passing it the -S CommandLine option
Here is an example. First, the [C] code:
int main(void) {
-
int i;
+
int i;
-
i=5;
-
i=i*3;
-
printf("%d\n",i);
-
i=0xff;
-
return i;
+
i = 5;
+
i = i * 3;
+
printf("%d\n",i);
+
i = 0xff;
+
return i;
}
Now you can translate this to assembler. If I do this on an [x86] (ie [Intel] machine), I get:
$ gcc -S x.c ; cat x.s