Hi, i want to set the value from EBX-register into a EQU-vatiable ?
How i can i realize that ?

Greets !
Posted on 2003-03-22 13:21:54 by Forginforcer
EQU is an assemble-time command and the value of EBX will not be known until run-time. You cannot do this.
Posted on 2003-03-22 13:32:02 by kairon
I want do set a timer with a value. But First I have to multiply the input with 1000.

How does it workS ?
Posted on 2003-03-22 13:35:21 by Forginforcer
What does that have to do with constants or the EBX register ?
Posted on 2003-03-22 13:42:13 by donkey
Look at my code:
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, EQU_time, 2
mov eax, EQU_time
mov ebx, 60
mul ebx
;mov EQU_time, ebx
mov eax, EQU_time
mov ebx, 1000
mul ebx
;mov EQU_time, ebx
Posted on 2003-03-22 13:45:05 by Forginforcer

Look at my code:
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, EQU_time, 2
mov eax, EQU_time
mov ebx, 60
mul ebx
;mov EQU_time, ebx
mov eax, EQU_time
mov ebx, 1000
mul ebx
;mov EQU_time, ebx

Your code doesn't make sense. When you use the mul opcode it multiplies whatever is in the EAX register by the number that you supply and places the result in EAX. First just because you named a variable EQU_BLAH, does not make it an equate, that is something that is defined in the .constant section of your program i.e. it never changes. Second you multiply the value of EQU_Time by 60 and place the result in EAX then you just replace that value with the original value of EQU_Time again, so you have done nothing at all for the first 5 lines. remove the second mov eax,EQU_Time and it should work the way you want. And just as a pointer, the EQU_Time is a TEXT BUFFER, you pass the address of the buffer not the actual buffer to GetDlgItemText and when you want to move it into eax you have to first convert it to a DWORD.
Posted on 2003-03-22 14:13:49 by donkey
Sorry donkey, i do not understand.
Can you show me a little code ? - ITs, because my egnlsich is very bad !
Posted on 2003-03-22 14:22:29 by Forginforcer
; Create a string buffer to hold the text from the edit control
EQU_Time BYTE 4 DUP (0) ; you only read 2 bytes so make it 4 long for the null terminator + alignment

; copy the text from the edit control into your string buffer
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, ADDR EQU_time, 2
; convert the string in the buffer to a numeric DWORD value
invoke atodw,ADDR EQU_Time
; perform the math in one operation instead of splitting it in two
mov edx,60000
mul edx
; The result is in EAX you cannot use it in EQU_Time as that is a String buffer

Posted on 2003-03-22 14:29:23 by donkey
it is pissible to convert eax to a number ? - With atoi perhaps ? Ifm where is the result ?

Thanky you !
Posted on 2003-03-22 14:43:30 by Forginforcer

EAX is neither a number nor a String, it is a register which is just a storage location inside the processor 4 bytes wide. The commands that you use are what require numbers or letters.

Though I don't mind answering your questions you have to read the manual, or as we say RTFM. There are some very good tutorials available from Iczelion but they all are based on the premise that you at least have some idea of how the most basic concepts work. Like strings and numbers, handles/addresses/IDs etc..

What langauge do you speak, maybe posting a request for tutorials in your language would help. I'm sure that somebody would help.

You have some rather large misconceptions about programming that have to be worked out before you jump into ASM. At the very least you might try to read the usage for the API calls that you are trying to use before you post a question. I find it difficult to conceive that you have programmed in C++ alot if you don't understand the difference between a string and a number, or are incapable of working properly with ID's and handles. Maybe you should consider a higher level language and come back to ASM when you better grasp the basic concepts of Win32 programming.

I am sorry to be so blunt but the questions that you are asking are simple questions that have concepts in common with all languages and are the first thing that you learn when programming. I would suggest Visual Basic as a good place to start. It is a little more forgiving than ASM for a beginner.
Posted on 2003-03-22 14:47:44 by donkey
Hi donkey you're great !

i do programming 4 years. With 1 yeat interruption. Almost everythink I forgot in Assembler. The basic.

Chinese or german would be nice.

Nice Weekend !

P.S. I have 11 points in english subject. Thats a 2.
Posted on 2003-03-22 14:56:16 by Forginforcer
Where did u make that 94 posts, in Test Area ????
Posted on 2003-03-22 19:05:50 by AceEmbler
Hi Red,

You may want to check this forum out, you may be able to find Iczelion's tutorials translated to German here:

Posted on 2003-03-22 19:46:42 by donkey

it is pissible to convert eax to a number ? - With atoi perhaps ? Ifm where is the result ?

Thanky you !

i didnt know the cpu could urnate!
Posted on 2003-03-22 19:48:32 by Qages
Quit bullying.
Posted on 2003-03-22 22:38:34 by comrade
Red Forginforcer,

When you code in assembly there are 2 things you need to keep in mind on how you treat numeric data conversion.

1. The numbers you see on screen are ASCII values [30h - 39h]

30h = "0"
31h = "1"
39h = "9"

If you have a hex editor, try opening up notepad and type 0123456789 then save it, open it up in a hex editor. You'll see what I mean.

2. The numbers that are used for math operations(add, sub, mul, div) are ASCII values[0h-9h]

mov eax, "1234" == mov eax, 31323334h

mov eax, 1234d == mov eax, 1234d
the "d" implies that the value is in base 10(DECIMAL). As you can see these 2 are different

When you say you want to convert eax to a number, that depends on what kind of data is in EAX. EAX is a register, think of it as a small fast volatile memory storage.

When coding in assembly, every data are numbers. Please don't be confused. It is how the data is treated, makes a big difference.

From what I've seen so far, you're using GetDlgItemText, remember you retrieved it as "text" (ASCII: 30h - 39h) since you are treating it as text, you need to convert it to a "different format" so you can use it for math operations.

Here's some fast algorithms for conversion - http://www.asmcommunity.net/board/index.php?topic=7265&highlight=aTODW

If you don't want to bother with ATODW use GetDlgItemInt instead.

If you want to convert the number to readable text again, use dwtoa and SetDlgItemText combo or simply SetDlgItemInt

p.s. of course it's possible to do math operations even on numeric text data(30h - 39h) but it's not worth the complexity (but fun) - search for vedic maths. ;)
Posted on 2003-03-22 23:35:03 by arkane