+1 (315) 557-6473 

How Can Our Assembly Language Homework Help You Convert C

Assembly language is often used in conjunction with C code as it is closer to the metal than Java or other byte code languages. Parameters are passed using the stack (and possibly registers depending on the platform and calling convention). This makes it possible to mix C and assembly language in the same program without too many complications, with some implementations you can even mix assembly and C in the same function.

If you write some conditional code in C, you might write if (a < 0) { a = -a; } but in assembly, all you can do after a condition is to branch (EXCEPT on Arm where you can make any instruction operate based on the condition flags), so you need to invert the condition to if ( a >= 0) goto skip; a = -a; skip: (this is using pseudo assembly code since the actual instructions vary depending on the processor).

When you write a for loop and you don’t care about using the value of the variable, so for example for (j = 0; j < n; j++) *dst++ = *src++; since you are not using the value of j during the loop it makes sense to convert the code to the equivalent of for (j = n; j >= 0; j–) *dst++ = *src++; because there is either a loop instruction LOOP on x86, DBcc on 68000 or decrementing the register for j will set the condition flags ready for the conditional branch.

You need to be familiar with pointers before embarking on assembly code as you normally only have basic types of integers, and pointers (and possibly floats depending on the processor). Normally pointers in assembly allow you to do references based on the pointer and index value as well and often support pre and post decrement (which is one of the reasons C was designed, as it was close to the assembly used on the PDP-11 which is where C was developed).

Assembly language is probably the hardest programming you will have to do at university, although the commands are simple and the syntax is also simple, you have to break down everything into the component parts, even printing value for debugging is complex. I spent 15 years programming in assembly language and we have other experts as well, so we can definitely provide the help you are looking for. One additional problem with assembly language is that you need to consider not only the processor you are targeting (there are huge differences between the different processor families) but the environment is very different. For example in C to open a file, you use open but the way you do this in assembly depends on the operating system, under Linux you use an int 80h instruction, and under Windows, you link to dll and call the function using an invoke macro.

You can rely on Programming Homework Help to provide any Assembly language homework help you may need.


Comments
No comments yet be the first one to post a comment!
Post a comment