flat assembler
Message board for the users of flat assembler.

Index > Windows > Problem with modified Examplecode of HELLO.ASM

Author
Thread Post new topic Reply to topic
Richter



Joined: 02 Sep 2005
Posts: 5
Richter
Hi,
i have modified the Hello exampel a little bit, now it doesnt work anymore Laughing

I want to change a letter at runtim, but i just get runtime memmory errors of windows

Code:
include 'win32ax.inc'

.code

  start:

        jmp goon
        text db "h",0
        name db "test"
        goon:

        mov ah, "a"
        mov [text], ah

        invoke  MessageBox,HWND_DESKTOP,text,name,MB_OK
        invoke  ExitProcess,0

.end start

    


Why does it not work?

Thx!

And sorry, english is not my nativ luange!
Post 02 Sep 2005, 07:12
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
That's because you're trying to write to your code section, which doesn't have "writeable" flag. If you want to keep both code and data in one section, then replace ".code" (3rd line) with:

Code:
section '.code' code data readable writeable    


And, btw, there's missing 0 after name db "test".

regards
Post 02 Sep 2005, 07:40
View user's profile Send private message Visit poster's website Reply with quote
Richter



Joined: 02 Sep 2005
Posts: 5
Richter
Thx to the big noob helper! Very Happy
Post 02 Sep 2005, 07:45
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.

Powered by rwasa.