Answer the question
In order to leave comments, you need to log in
How to pass the value of a variable to the stack (Assembler)?
Hello.
I solve the problem in TASM assembler. Subroutine that calculates the hyperbolic sine. This subroutine must be linked to the main program using the C language communication standards.
My problem is that I can't push a real number onto the stack.
I enter a number from the keyboard, this number is on the FPU stack, I put it in the Source variable, and then I have to load it onto the stack and call a subroutine where I unload it and start the calculations
Here is an example code:
-------- -------
Source dq ?
Result dq ?
---------------
sub sp,16
mov bp,sp
fstp Source
mov qword ptr [bp], Source // "need register in expression" error here
mov qword ptr [bp+8], Result //there is an error "need register in expression"
call OutFloat
Add sp,16
---------------
Answer the question
In order to leave comments, you need to log in
The code might look something like this:
sub sp,16
mov bp,sp
fstp qword ptr [bp + 8]
call OutFloat
add sp,16
using the push command
push AX ; передать значение регистра AX в стек
push ВX ; передать значение регистра BX в стек
.... ; ваш код
pop BX ; извлечь значение из стека в регистр AX
pop AX ; извлечь значение из стека в регистр AX
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question