Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-2008, 12:11 PM
maple23 maple23 is offline
Newbie
 
Join Date: Apr 2008
Posts: 7
Rep Power: 0
maple23 is on a distinguished road
Default Assembly Problem

I have been working with assembly (TASM32) for a few months now and have ran into a problem which I cannot fix. Here's a working example written in C++ which needs to be converted to assembly.
Code:
#include <windows.h>

int	main(){
	char	*name_list[5] = {"Micheal", "Stefan", "Judy", "William", "Lora"};
	for(int i = 0; i < 5; i++){
		MessageBox(0, name_list[i], name_list[i], 0);
	}
	return 0;
}
Here's the assembly version I've written. It goes through the five names fine, after the names, it brings up a message box with random characters.
Code:
.386
.model flat

EXTRN	MessageBoxA : PROC
EXTRN	ExitProcess : PROC

.DATA
	dd ?			; TASM gayness

.CODE
MAIN:
	pushad
	call	lblNames
		db "Micheal", 0
		db "Stefan", 0
		db "Judy", 0
		db "William", 0
		db "Lora", 0

lblNames:
	pop	esi		; esi = current name
	push	5		; 5 names
	pop	ecx		; ecx = counter

lblNameLoop:
	push	0
	push	esi
	push	esi
	push	0
	call	MessageBoxA

lblNextChar:
	lodsb
	test	al, al
	jnz	lblNextChar

	pop	ecx
	loop	lblNameLoop

	popad

	push	0
	call	ExitProcess
END	MAIN
Does anyone know what the problem is, or have any suggestions for me? This seems much more complicated than it should be...

Sorry for my English.

Thank you,
Stefan Kendrick
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-23-2008, 02:11 PM
R-G's Avatar   
R-G R-G is offline
Programmer
 
Join Date: Apr 2007
Location: Europe
Posts: 144
Rep Power: 0
R-G is an unknown quantity at this point
Default

Well, I personally don't like the computer software assembler Turbo. If you have already developed the software algorithm in the computer programming language C (not C++ as you mentioned) why should you develop another one that should solve the same problem?

Translate the source software code algorithm with a compiler software in a executable digital file and translate it back with a disassembler software. You should however watch for the quality of the translation so you'll not get unuseful source software code written in the computer programming language Assembly.
__________________
Like an angel without a sense of mercy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-24-2008, 09:19 AM
v0id's Avatar   
v0id v0id is offline
Super Mod
 
Join Date: Apr 2007
Location: Denmark
Posts: 1,940
Last Blog:
CherryPy(thon)
Rep Power: 23
v0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to behold
Send a message via MSN to v0id
Default Re: Assembly Problem

I agree with R-G. TASM is not the best assembler to use when you can find many other free alternatives. If you're doing Windows programming, I think you should consider either FASM or NASM(X). Both of them have extensively support for the Windows application programming interfaces.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-24-2008, 09:29 AM
R-G's Avatar   
R-G R-G is offline
Programmer
 
Join Date: Apr 2007
Location: Europe
Posts: 144
Rep Power: 0
R-G is an unknown quantity at this point
Default

Without a doubt. I 100% agree with the computer software assembler Flat.
__________________
Like an angel without a sense of mercy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-25-2008, 09:32 AM
maple23 maple23 is offline
Newbie
 
Join Date: Apr 2008
Posts: 7
Rep Power: 0
maple23 is on a distinguished road
Default Re: Assembly Problem

I do not have a reason for using TASM. I can switch compilers if I need to. How would this be done with a different compiler?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 04-25-2008, 09:41 AM
R-G's Avatar   
R-G R-G is offline
Programmer
 
Join Date: Apr 2007
Location: Europe
Posts: 144
Rep Power: 0
R-G is an unknown quantity at this point
Default

Everyone has a reason for something. What do you mean with switch the compiler software? What does this have to do with it? Maybe, you mean the assembler software?
__________________
Like an angel without a sense of mercy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-25-2008, 10:10 AM
TkTech TkTech is offline
CrazyOne
 
Join Date: Jun 2006
Posts: 742
Last Blog:
Having trouble with yo...
Rep Power: 50
TkTech is on a distinguished road
Send a message via MSN to TkTech
Default Re: Assembly Problem

Fasm is an excellent, highly portable ( I ported to my os in under 3 hours ) assembler that makes me leap with joy. I'd recommend it any day over tasm.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-26-2008, 11:47 PM
maple23 maple23 is offline
Newbie
 
Join Date: Apr 2008
Posts: 7
Rep Power: 0
maple23 is on a distinguished road
Default Re: Assembly Problem

I mean if I change compilers from TASM to <ENTER YOUR FAVORITE COMPILER HERE>, would you be able to help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-27-2008, 04:35 AM
R-G's Avatar   
R-G R-G is offline
Programmer
 
Join Date: Apr 2007
Location: Europe
Posts: 144
Rep Power: 0
R-G is an unknown quantity at this point
Post

Did you read the second part of my first message?
__________________
Like an angel without a sense of mercy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-27-2008, 05:59 AM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,190
Last Blog:
The Windows Registry
Rep Power: 28
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Assembly Problem

I haven't had a lot of experience in Assembly, but Fasm seems to have a higher reputation than Tasm.
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Assembly Tutorials Jordan General Programming 36 07-15-2008 02:06 PM
Peculiar UI Problem Needs Tackling adriyel C# Programming 2 04-06-2008 07:46 AM
Problem read pwd protected Access2K dbase - CR9 & VB6 mrbar Visual Basic Programming 2 03-10-2008 04:50 AM
How to tackle a programming problem? TcM General Programming 10 01-07-2008 11:29 AM
C++ to assembly conversion Kaishain C and C++ 4 12-10-2007 04:07 AM


All times are GMT -5. The time now is 02:15 AM.

Contest Stats

dargueta ........ 128.00000
John ........ 127.00000
Xav ........ 107.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads