I have recently written my assembly program in visual studio 2017 on a windows 10 laptop. I now wish to alter this code to place values obtained from the user into the registries eax, ebx, ecx and edx
\I have gotten the program to work with defualt hardcorded values but am struggling to find anything on the web to help me get user input. The task specifies that i must use assembly to ask the user
.586 ;Enables assembly on non Priiliged intructions for the prntium processor
.model flat ,c ;model=Initialises the program memory mode, flat=Identifies the size of code and data pointers and
;c= identifies the naming and calling coventions
.stack 100h
.data ; This section will contain all of the static variables for our program
foo dd 0 ;Variable to be used to store into meory
.code ; Assembly code will be placed here
multi proc ; Start of the doit process. Like a method in C#. Method is called
;in the visual studio form Source
mov eax, 8 ; Moves the value 8 into the eax Registry
mov ebx, 4 ; Moves the value 4 into the ebx Registry
mov ecx, 6 ; Moves the value 6 into the ecx Registry
mov edx, 12 ; Moves the value 12 into the edx Registry
add eax, ebx ; Adds the value stored in registry ebx to the vale in eax and stores the answer in eax
add eax, edx ; Adds the value stored in registry edx to the vale in eax and stores the answer in eax
sub eax, ecx ; subtracts the value stored in registry ecx from the vale in eax and stores the answer in eax
mul ebx ; Multiply the value in registry eax with the value in eax and stores the answer in eax
mov [foo], eax ; stores the value in registry in eax into the computer memory
ret ; returns the valie of the accumulator
multi endp ; End of the doit method
end
and this is the code i use to call it from visual studio
#include <iostream>
extern "C" int multi();
void main()
{
printf("%d%",multi());
std:getchar();
}
I just now please need assistance to alter my code to allow input from the user, I have a feeling to i may have to do a system cll but am not sure which one. This is litterally my first day doing assembly so any help would be appreciated