flat assembler
Message board for the users of flat assembler.

Index > Windows > Looping Program Doesn't Loop Correct Amount Of Times

Author
Thread Post new topic Reply to topic
bybb



Joined: 17 Jan 2016
Posts: 1
Location: UK
bybb
I have made a simple program by using the examples that come with fasm, but I cannot get this to work. The program should come up with a message box 32 times, but only runs once. It compiles fine, but I cannot seem to make it work.

Here is code:
Code:
include 'win32ax.inc'

.code

  start:
        invoke  MessageBox,HWND_DESKTOP,"Welcome to hell >:D",invoke GetCommandLine,MB_OK
        inc [loopcount]
        cmp [loopcount], 20h
        jne start
        invoke  ExitProcess,0

  loopcount db 01h

.end start
                       
    
[/code]
Post 17 Jan 2016, 20:33
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
Code:
include 'win32ax.inc'

.code

  start:
        invoke  MessageBox,HWND_DESKTOP,"Welcome to hell >Very Happy",invoke GetCommandLine,MB_OK
        inc [loopcount]
        cmp [loopcount], 20h
        jne start
        invoke  ExitProcess,0

.end start

section '' data readable writable
  loopcount db 01h

    
Post 17 Jan 2016, 20:45
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
You might want to explain to him why you added the data section instead of just completing his code.
Post 20 Jan 2016, 20:37
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
win32ax.inc
Code:
...
macro .data { section '.data' data readable writeable }

macro .code { section '.text' code readable executable } ;writes prohibited
...
    
Post 21 Jan 2016, 07:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.