The MASM Forum
Projects => Rarely Used Projects => GoAsm => Topic started by: asmNOOB on July 30, 2014, 12:22:12 PM
-
Hi, first english is not my mother toungue so, i will try to explain my problem the more clearly i can XD. I just have start learning GoASM , so i try to do a program that add and subtrcat two number this is my code:
.Data
inicio DD 0
var1 DD 5 ;modificar
var2 DD 4 ;modificar
resultado DD 1
suma DD 43
resta DD 45
igual DD 61
show DD 1
.Code
start:
Push - 11
Invoke GetStdHandle
Push 0, Addr inicio
Push 2, Addr show
Mov Bx, [var1]
Add Bx, 30H
Mov [show], Bx
Push Eax
Call WriteFile
Push - 11
Invoke GetStdHandle
Push 0, Addr inicio
Push 2, Addr resta
Push Eax
Call WriteFile
Push - 11
Invoke GetStdHandle
Push 0, Addr inicio
Push 2, Addr show
Mov Bx, [var2]
Add Bx, 30H
Mov [show], Bx
Push Eax
Call WriteFile
Push - 11
Invoke GetStdHandle
Push 0, Addr inicio
Push 2, Addr igual
Push Eax
Call WriteFile
Push - 11
Invoke GetStdHandle
Push 0, Addr inicio
Push 1D, Addr resultado
Mov Bx, [var2]
Mov Cx, [var1]
Sub Cx, Bx
Add Bx, 30H
Mov [resultado], Bx
Push Eax
Call WriteFile
Ret
I just can add two number, but i cant do it to subtract.
Thanks
-
Sub Cx, Bx
Add Bx, 30H
Mov [resultado], Bx
The result is in CX, not BX.
-
Hi asmNOOB,
Yuri is right. You should write:
Sub Cx, Bx
Add CX, 30H
Mov [resultado], CX
And welcome to the forum.
Gunther