flat assembler
Message board for the users of flat assembler.

Index > Windows > program does nothing :(

Author
Thread Post new topic Reply to topic
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 07 Dec 2003, 17:40
ok here's the code--
I;m running this within winxp
the prog does wait for keypress,as expected ,but
doesnt print anything on screen!
???
Thanks for help Wink
Code:

 ;print string 3 times,silly thing


           lea  esi,[str1]
          ;could use loop but this gives more control,I think
           mov ecx,3
           begin:
                 dec ecx
                 js exit
                 call print
                 jmp begin




            exit:
                 ;wait for key press then exit
                  mov ah,01h
                  int 021h
                  int 020h



 print:

 @1:     mov byte dl,[esi] ; load byte at esi
         cmp dl,0          ;check for NULL
         je endp           ;if so return
         mov ah,02h        ;call DOS
         int 021h
         inc esi           ;point to next char
         jmp @1            ;load next char
         endp:  ret        ;end of string

         str1  db 'hello world!',13,10,0


    

_________________
Plez xcuce mi spelng
Post 07 Dec 2003, 17:40
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 07 Dec 2003, 18:08
Use 16-bit registers (ax instead of eax etc.). Wink You can't use 32-bit registers!
Post 07 Dec 2003, 18:08
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 07 Dec 2003, 18:13
Hi.
You missed "org $100" as first row.
And Tommy, you are wrong here. There is no problem with 32bit registers - the programm will work, but using 32bit registers here is meaningless.

Regards.
Post 07 Dec 2003, 18:13
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 07 Dec 2003, 18:54
Embarassed Opps... My fault... Sorry, was too quick there.. Very Happy Thanks for correcting me John! Wink
Post 07 Dec 2003, 18:54
View user's profile Send private message Visit poster's website Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 07 Dec 2003, 18:55
I did the org 100h thing and complied this as a com file.
Mine printed out one line.

To fix this, I put the lea esi,[str1] after the begin statement.

Worked in windows 2000 for me.
Post 07 Dec 2003, 18:55
View user's profile Send private message Reply with quote
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 07 Dec 2003, 19:09
yeah forgot that org100 bit!
also as Gomer73 pointed out ,have to put the lea inside begin label cuz
the print loop modifes esi! So on the next loop god only know whats at
esi...lol
thanks again

_________________
Plez xcuce mi spelng
Post 07 Dec 2003, 19:09
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.