A
A
Alexander Knyazev2016-04-14 14:40:25
assembler
Alexander Knyazev, 2016-04-14 14:40:25

How to print the numeric value of a variable to the screen in Assembler using the Invoke command?

I want to display the value of a variable in a window.

.386
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

.data
num db 1
result db 0
.code
start:
mov ah,num
inc ah
mov [result],ah
invoke MessageBox, NULL, addr result, addr result, 0
invoke ExitProcess, NULL
end start

Result is not displayed.
Nothing is displayed, an empty window. If you do not display result, but declare and display a line, then it works. The number is not

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Martyanov, 2016-04-14
@vilgeforce

You forgot to convert a number to a string.

D
D', 2016-04-14
@Denormalization

You can use the str$ macro
i.e.:
Just to start, include a file with macros:
include c:\masm32\macros\macros.asm # путь свой

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question