Practical Assembly Language
Configure Visual studio for MASM and implement the following basic programs by following the instructions in the resources provided on Canvas:
Setting up Visual Studio for x86 Assembly language Programming.pdf
Watch the video How to use Visual Studio for x86 Assembly Programming
Copyright By Assignmentchef assignmentchef
Part 1 Arithmetic
Write the following C program in assembly language.
int a = 11;
int b = 3;
a = a + b;
a = a b;
a = a * 2;
b = a % 3;
Here is some code to initialise the variables a and b:
; write your assembly code here
mov dword ptr [ebp-4], 11 ; int a = 11 movdwordptr[ebp-8],3 ;intb=3
Part 2 Nested IF statements
Write the following C program in assembly language.
What is the final value for z?
Experiment with different values for x, y and z so that all paths are covered.
int x = 0;
int y = 1;
int z = 2;
if (x == y){
if(z == 0){
if(z == 0){
When implementing jump statements you need to provide a label.
For example, jmp l1 will result in the program jumping to the line labelled l1 e.g.
See lecture notes for more examples.
l1: # code jumps to here
Part 3 For loops
Implement the following C program in assembly language. What is the final value of j?
for (i = 0; i < 10; i++)Part 4 While LoopsImplement the following C program in assembly language. What is the final value of p?int p = 2;int r = 3;int n = 5;int y = 1;while (y <= n)p = p*(1+r); CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.