FOR Loop: don't display text (nasm)

This is a discussion on FOR Loop: don't display text (nasm) within the ASM x86 ASM 370 forums in Programming Languages category; Lnum_1: dw 1 Lnum_2: dw 1 Lstr_0: db "counter line: ",10,0 Lstr_1: db "O ",0 fm3: db "->%s",0 only "->" will be output on the console. mov dword [Lnum_1], 1 mov dword [Lnum_2], 1 @L2: cmp dword [Lnum_1], 4 je @L0 push Lstr_0 push fm3 call _printf add esp, 8 @L3: cmp dword [Lnum_2], 5 je @L1 push Lstr_1 push fm3 call _printf add esp, 8 inc dword [Lnum_2] jmp @L3 @L1: inc dword [Lnum_1] jmp @L2 @L0: ret ;------ What can I do? Thanks for help Jens...

Go Back   Application Development Forum > Programming Languages > ASM x86 ASM 370

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-06-2008, 01:00 PM
Jens Kallup
Guest
 
Default FOR Loop: don't display text (nasm)

Lnum_1: dw 1
Lnum_2: dw 1
Lstr_0: db "counter line: ",10,0
Lstr_1: db "O ",0
fm3: db "->%s",0

only "->" will be output on the console.

mov dword [Lnum_1], 1
mov dword [Lnum_2], 1
@L2:
cmp dword [Lnum_1], 4
je @L0
push Lstr_0
push fm3
call _printf
add esp, 8
@L3:
cmp dword [Lnum_2], 5
je @L1
push Lstr_1
push fm3
call _printf
add esp, 8
inc dword [Lnum_2]
jmp @L3
@L1:
inc dword [Lnum_1]
jmp @L2
@L0:
ret
;------

What can I do?
Thanks for help
Jens

Reply With Quote
  #2  
Old 09-06-2008, 06:05 PM
Frank Kotler
Guest
 
Default Re: FOR Loop: don't display text (nasm)

Jens Kallup wrote:
> Lnum_1: dw 1
> Lnum_2: dw 1


These are "word" (16-bit) variables. You probably want "dd", since
you're using them as "dword" (and thus "zero-initialising" your string)...

"dw" kind of "sounds like" it should mean "dword", but nooo... "data
word". "dd" is "data dword". (ask me how I know about this source of
confusion...

Best,
Frank

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:07 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.