Hello, i was trying to create this app, which should increment +1 to a value untill its 24, if not then increment again.
But its not really working, so i was wondering what i'm doing wrong.
Here's the code i have:

.model small
StoreVar dd 0


main proc
mov eax, 20 ;put the value 20 in eax

inc eax ;increase eax
cmp eax, 24 ;check if eax is equal to 24
jne Loop ;if not, then loop

mov StoreVar, eax ;store eax in a memory location

main endp
end main

This is the error that i get:

error A2008: syntax error : in instruction
error A2008: syntax error : Loop

btw, is this 16bit or 32bit...??
Posted on 2006-09-24 10:09:39 by w00
loop is part of the x86 instruction set and is reserved by the assembler, you cannot use it as a label.
Posted on 2006-09-24 10:27:53 by donkey
Yeah, thanks. It works when i change the name. Didnt know that :)

But im still stuck with the stupid question, am i doing 16bit or 32bit ASM....????
Posted on 2006-09-24 10:40:00 by w00
.model small = 16 bit

Posted on 2006-09-24 11:47:21 by donkey
i see, but how would the code look like if it were a 32bit ASM code..???
Posted on 2006-09-24 12:03:10 by w00
It would look the same when you just looked at the source. The difference is with instruction encoding (size-prefixes) and code size (it's bigger because almost every instruction must be prefixed to 32-bit). It's kinda hard to explain if you never looked at the binary code and/or never studied Intel's manuals.
Posted on 2006-09-24 14:16:11 by ti_mo_n
It looks like this using Masm with the 32 bit linker.

.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

  StoreVar dd 0

  mov eax, 20          ;put the value 20 in eax

  inc eax              ;increase eax
  cmp eax, 24          ;check if eax is equal to 24
  jne Again            ;if not, then again

  mov StoreVar, eax    ;store eax in a memory location

  invoke ExitProcess, 0
end start
Posted on 2006-09-24 18:04:39 by dsouza123
Thanks, its indeed about the code. But it still shows errors when compiling.
Posted on 2006-09-25 00:38:33 by w00
It would help if you posted which lines are associated with those errors when you attempt to assemble your source file.
Posted on 2006-09-25 02:50:48 by SpooK