Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ASSEMBLY_FINAL.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <stdio.h>
- #include <stdlib.h>
- int function()
- {
- // Print the return address of the function.
- __asm
- {
- mov eax, [ebp + 4]
- }
- }
- int assmbly_power()
- {
- __asm
- {
- mov cl, 10
- mov eax, 1
- L1:
- mov ebx, 1
- shl ebx, cl
- add eax, ebx
- DEC cl
- jnz L1
- }
- }
- int get_val(int x, char *format)
- {
- // pass a value to a function and print it with assembly.
- __asm
- {
- mov eax, x
- push eax
- mov eax, format
- push eax
- call printf
- pop ebx
- pop ebx
- }
- }
- void main()
- {
- char format[] = "%d is the number you entered";
- int return_address = 0, i = 0, j = 0;
- return_address = function();
- i = assmbly_power();
- printf("%d\n", i);
- /*
- __asm
- {}
- */
- get_val(3, format);
- printf("%d", j);
- scanf("%d", &i);
- }
Advertisement
Add Comment
Please, Sign In to add comment