I want to do this
Code
point DD ?
LBL:
cmp point,40;
add point,4;|
Assembly
how can I compare a dword to an int |
|
Why do you have semicolons after each instruction?
x86 asm - ISO & ANSI C
what have you tried?
Move them into registers and use atodw
Code .386(Oct 18, 2012 09:08 PM)DaRkReD Wrote: Move them into registers and use atodwOoh Darkred, where'd you learn to do MASM? I've only found books on FASM and ROSM and some other ones. (Oct 19, 2012 07:33 AM)Amokov Wrote: What is this DWORD being used for? If it's something numerical, like an address, you can just cmp, you don't need to call any function. It depends on the IDE you are using (if any) and compiler. Real assembly cannot do cmp value, 1 It has to use value as a pointer i.e. mov eax, dword ptr [value] o cmp dword ptr [value], 40
Oct 19, 2012 06:14 PM
(This post was last modified: Oct 19, 2012 06:22 PM by K4Fr.)
(Oct 19, 2012 05:48 PM)c0mputer-fr0d Wrote:A dword is an int. Secondly cmp only sets flags you still need a branch instruction. e.g for MASM: Code cmp dword ptr [point], 40just use what ever labels are valid in in your assembler
cmp dword ptr[ variable ], value is a perfectly valid instruction. That will work.
An int does not differ in size from a dword (on a 32bit machine), the only difference between the two is that an int is signed and a dword is unsigned. On a 64 bit machine an integer type might be 64 bits long, while a dword is always 32 bits long. To test if both hold the same number (despite their signs) do this: Code point dd -40h |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [Help] by SIM-2362662Mar 2, 2021 07:53 AM | 7 | 271 |
Mar 2, 2021 07:53 AM Last Post: sangita123 |
| [Assembly] by gigajewJul 25, 2020 08:41 AM | 5 | 278 |
Jul 25, 2020 08:41 AM Last Post: gigajew |
| [DBMS] by VirtualFrostFeb 15, 2019 08:36 PM | 4 | 294 |
Feb 15, 2019 08:36 PM Last Post: VirtualFrost |