![]() |
| ||
| C++ Multiplication in Assembly I'm trying to translate the following code from C++ into Asembly language but am having trouble. I know that I have to make a cmp and one or more jmp. If any1 has sugguestions or tips thats great. Here's the C++ coding: int x = 1 * 2; |
| ||
| Re: C++ Multiplication in Assembly Is there anything wrong with the output of g++ -S prog.cpp Use it as a guide for your own attempt. |
| ||
| Re: C++ Multiplication in Assembly probably not what u expected ;-) but using a HL Macro Assembler, the difference to other languages ( c) is not so big as one would assume .... |
| ||
| Re: C++ Multiplication in Assembly Ummm, yeah that isn't really what I expected lol since I'm using the Kip Irvine files. Btw sorry I think I forgot to mention we can't use .IF statements lol. |
| ||
| Re: C++ Multiplication in Assembly > I'm using the Kip Irvine files. And now you're only telling us this? > I forgot to mention we can't use .IF statements lol. More restrictions on the solution, is there anything else you should be telling us? Post YOUR attempt. |
| ||
| Re: C++ Multiplication in Assembly Wow i'm really sorry about all that. I was looking at a different program that I wasn't allowed to use .IF statements. So thanks for the help I'll check out what u gave me now. |
| ||
| Re: C++ Multiplication in Assembly Ok now the only problems i'm getting is that cmpmem is an undefined symbol and print is undefined as well. Finally i have this error unmatched block nesting : main |
| ||
| Re: C++ Multiplication in Assembly my code is for the original masm32 package, u can find some download links here http://www.masm32.com/masmdl.htm make sure to install in top level of ur drive, otherwise the standard include paths won't work. there are two files: build.bat and buildc.bat in the /bin directory, the later is the correct one for console apps. the print macro is a very useful macro, located in include file: /macros/macros.asm, see description in help file: /help/hlhelp.hlp - Console Mode Macros - print the cmpmem is a routine located in /include/masm32.inc and the corresponding library is /lib/masm32.lib , see description in /help/masmlib.hlp - Memory Functions - cmpmem ( both functions/macros are available through the Quote:
it might be a good idea to check some step by step assembly tutorials first, before getting too deep into some programming tasks to early. though i don't think that assembler is much more difficult than other programming languages, it sure is different and the learning curve in the beginning takes more time than with other languages. its better to spend more time with the basics in the beginning, than wasting too much time with error fixing when u take the second step before the first... |
| ||
| Re: C++ Multiplication in Assembly Is there some other way to output information other than using the "Print" command? |
| ||
| Re: C++ Multiplication in Assembly u can try: invoke crt_printf,addr msg or with the irvine libs: ;lea edx,msg ;call Writestring |
| All times are GMT -4. The time now is 5:43 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC