[Solved] CS 3844-Homework #2

$25

File Name: CS_3844_Homework__2.zip
File Size: 178.98 KB

SKU: [Solved] CS 3844-Homework #2 Category: Tag:
5/5 - (1 vote)

Homework #2 Convert C to Assembly

CS 3844 Section 0B1,

Given this C program:

#include <stdio.h>

int main(int argc, char *argv[]) {

int i;

printf(Hex Dec Oct Ch
);

for (i=32; i<256; i++) {

printf( %2x %3d %3o %c
, i, i, i, i);

}

}

Output should look like this (from both the C program above and your Assembly version):

Convert it to Assembly (inside C). You must use Visual Studio in the VDI. If you run it on Linux, characters 128 to 255 wont show up.

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char *argv[]) {

char *hdr = Hex Dec Oct Ch
;

char *msg = %3x %3d %3o %c
;

__asm {

TBD

}

system(pause);

}

Replace the TBD with two parts: a loop on EAX from 32 to 255, and a function. You must do a CALL to your function and RET to return. And you must pass in the loop variable to the function using the EAX register.

Hint: Use the command call printf to do the two prints. It expects all the parameters on the Stack. What order do the parameters need to be to printf?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS 3844-Homework #2[Solved] CS 3844-Homework #2
$25