x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4556
Number of posts: 16011

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Assembly vs. C++ Posted by daviddaly on 18 Oct 2007 at 11:25 AM
I have just posted on my blog the reasons why I think C++ is the one true programming language (I am being slightly tongue in cheek here). I used 10 questions to compare it to other languages. Unfortunately I have not been able to compare it to assembly as I don’t have any significant experience of assembly development. Would anyone be willing to score assembly for me?

Report
Re: Assembly vs. C++ Posted by zibadian on 18 Oct 2007 at 12:14 PM
: I have just posted on my blog the reasons why I think
: [link=http://outofthetriangle.wordpress.com/2007/10/18/is-c-the-only-
: real-language/]C++ is the one true programming language[/link] (I am
: being slightly tongue in cheek here). I used 10 questions to compare
: it to other languages. Unfortunately I have not been able to compare
: it to assembly as I don’t have any significant experience of
: assembly development. Would anyone be willing to score assembly for
: me?
:
:
Assembly would get an 10, because assembly is one of the oldest programming languages around and the only low-level programming language until C came around.
Question 8 is also a yes, because the ASCII character-set is invented by the ANSI and therefor makes it an ANSI standard.
The only thing assembly doesn't support is object orientation.
Report
Re: Assembly vs. C++ Posted by BitByBit_Thor on 18 Oct 2007 at 1:26 PM
: : I have just posted on my blog the reasons why I think
: : [link=http://outofthetriangle.wordpress.com/2007/10/18/is-c-the-only-
: : real-language/]C++ is the one true programming language[/link] (I am
: : being slightly tongue in cheek here). I used 10 questions to compare
: : it to other languages. Unfortunately I have not been able to compare
: : it to assembly as I don’t have any significant experience of
: : assembly development. Would anyone be willing to score assembly for
: : me?
: :
: :
: Assembly would get an 10, because assembly is one of the oldest
: programming languages around and the only low-level programming
: language until C came around.
: Question 8 is also a yes, because the ASCII character-set is
: invented by the ANSI and therefor makes it an ANSI standard.
: The only thing assembly doesn't support is object orientation.

I agree with the 10, if Question 8 is a yes (basically, the question doesn't fully apply).
Question 3 should be for assembly: does it work cross-platform, which answers to No. When using a different processor architecture, the entire assembly code must be re-written. But, since OS is no problem it scores points here too (one can always include a ASM STDLIB to implement OS-specific code).
Ofcourse, the real "No"-score is for Question 5, since it's VERY low-level, objects don't apply.

Basically, assembly is the language of the processor - only then it's translated 1-1 to human-readable commands. But it's entirely 1-1: meaning that you can Assemble, Disassemble, Assemble, Disassemble as many times as you want and no matter what assemblers/disassemblers you use you'll always get the same code (that's what I mean by the 1 on 1 / 1-1).
Ofcourse, at the processor level, even the machine code (which is equivalent to the assembly instructions) are considered 'macro-instructions' and are seperated into many smaller, more basic instructions. This means that, when I said "the language of the processor" this is *almost* true :)

PS: One would begin to suspect the list of questions being as such that C++ gains the full rating; in other words, the questions are made with everything about C++ that's wonderful in mind :P
This in contrast to having general conditions, and C++ obeying (most) of them

Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
Report
Re: Assembly vs. C++ Posted by AsmGuru62 on 19 Oct 2007 at 4:29 AM
"The only thing assembly doesn't support is object orientation."

I am creating OO Assembler right now.
Report
Re: Assembly vs. C++ Posted by BitByBit_Thor on 19 Oct 2007 at 6:33 AM
: "The only thing assembly doesn't support is object
: orientation."

:
: I am creating OO Assembler right now.
:


Haha... Brilliant :)

Let me know when you've got a working beta (or alpha) version :P I want to try
Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
Report
Re: Assembly vs. C++ Posted by atcl on 19 Oct 2007 at 8:05 AM
OO ASM?
Kinda exists already.

http://cs-netlab-01.lynchburg.edu/courses/Assemb/OOPAssem.html

I have some more stuff saved, i couldn't find online right away. But there is/was.


Report
Re: Assembly vs. C++ Posted by MT2002 on 19 Oct 2007 at 4:44 PM
OOP is a paradigm for use when designing software; it is independent of the language.

Granted, some languages have built in mechanics to better support this paradigm, any software can still be object orianted, even in C and assembly if it is designed around the concept.

[.:EvolutionEngine][.:MicroOS Operating System][Website :: OS Development Series]
Report
Re: Assembly vs. C++ Posted by AsmGuru62 on 20 Oct 2007 at 4:18 AM
: OO ASM?
: Kinda exists already.
:
: http://cs-netlab-01.lynchburg.edu/courses/Assemb/OOPAssem.html
:
: I have some more stuff saved, i couldn't find online right away. But
: there is/was.
:

I researched a lot of OO Assembly attempts before embarking on this project. I looked at TASM (horrid syntax, impossible to maintain or understand after some time), Objects Package in MASM32 (slow, virtual tables initialized at run-time!), HLA from Randal Hyde (too much - this is assembler, not C++ and syntax is the worst) and a few more.

Main point: using macros it is impossible to get an OO principle working. I use different approach. More of HLA approach, but not that complex (no protection levels, please - this is a low-level language). I have a script (it looks like C#, but some internal pieces are in assembly), which will be pre-processed and turned into a 'real' ASM code. And then on the next step - it compiles with a 'normal' assembler.

Here is an example:

class TWindow : TObject
{
	data
	{
		HANDLE Win32Heap;		# simple variable
		WCHAR Text [MAX_CHARS];	# array
		TCell Object;		# instance of another class
	}

	method ctor
	{
		# todo: implement constructor code
	}

	method dtor
	{
		# todo: implement destructor code
	}

	virtual OnCmd
	{
		mov	eax, me.Win32Heap
		mov	edx, me.Object.member
		cmp	eax, edx
		je	...

		...
		ret
	}

	override ProvideData
	{
		call	base.ProvideData
		call	me.Object.virt.ProvideData
		add	eax, 8
		ret
	}

	callback MsgMap (hWnd, uiMsg, wParam, lParam)
	{
		mov	eax, prm.uiMsg
		cmp	eax, e.WinMsg.WM_CREATE
		je	...


	Quit:
		call	api.PostQuitMessage (0)
		...
		ret
	}
}

This is ^^^ a class in its completeness - no separation of definition and declaration, just one file per class, which is a good thing. Also, there are some syntax constructs describing the Win32 API, like these:

enum WinMsg
{
	WM_CREATE = 1
	WM_DESTROY = 2
	...
}

alias
{
	HANDLE : dword
	WCHAR : word
	...
}

api KERNEL32
{
	PostQuitMessage
	HeapCreate
	...
}


And, of course IDE is in the package too with auto-complete and syntax highlighting and a few more things... like a class library, where one can re-use classes into different projects.
Report
Re: Assembly vs. C++ Posted by shaolin007 on 26 Oct 2007 at 11:12 PM
: I have just posted on my blog the reasons why I think
: [link=http://outofthetriangle.wordpress.com/2007/10/18/is-c-the-only-
: real-language/]C++ is the one true programming language[/link] (I am
: being slightly tongue in cheek here). I used 10 questions to compare
: it to other languages. Unfortunately I have not been able to compare
: it to assembly as I don’t have any significant experience of
: assembly development. Would anyone be willing to score assembly for
: me?
:
:

Every programming language has its pluses and minuses. When I started programming in C, before I learned assembler, I didn't have a deep understanding of the language. The reasons for this was the fact that I didn't understand what was happening under the "hood". I would use a function like "printf" and not know that the variables are pushed on the stack in reverse and used _cdecl calling convention. Looking at an header file was even more cryptic to me. But when I started to learn x86 assembler, everything started to fall in place and I went from a "blackbox" approach to programming to a "hands-on".

I think everyone should start learning how to program in some kind of assembler first and then move on to a higher language. It will make a better programmer out of you for sure.
Report
Re: Assembly vs. C++ Posted by BitByBit_Thor on 27 Oct 2007 at 2:04 AM
: I think everyone should start learning how to program in some kind
: of assembler first and then move on to a higher language. It will
: make a better programmer out of you for sure.

The other way around works too :)

I agree that any programmer should know atleast a couple of languages - and C is definitely one of them. Furthermore, I also think C++ is a must. I would not say every programmer has to know assembly... I'll keep it to should ^^
C and C++ suddenly became a lot more logical to me once I knew a bit of assembly language.


Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
Report
Re: Assembly vs. C++ Posted by MT2002 on 27 Oct 2007 at 6:05 AM
I personally think that alot of languages create too much abstraction; hiding the core basics of machine programming. They get to learn what programming is, and some concepts, and can even produce software focusing on the software's design itself.

This is great, of course. After all, it does indeed increase productivity. However, as they are never taught the core fundamentals of machine programming, it makes it much more harder for them to grasp the concepts involved. (I have seen alot of BASIC programmers give up on learning C and C++ because they deemed it to difficult and confusing.)

One of the reasons why I like C and C++ is because, while attaining abstraction, it is still low enough to control everything you want in it, without the headaches and problems of assembly languages (ie, portability.)

---

Then again, it might just be personal taste. Some people may learn better from the core fundamentals, while others may learn better starting from abstract concepts learned from other higher level languages.


[.:EvolutionEngine][.:MicroOS Operating System][Website :: OS Development Series]
Report
Re: Assembly vs. C++ Posted by BitByBit_Thor on 27 Oct 2007 at 7:51 AM
: I personally think that alot of languages create too much
: abstraction; hiding the core basics of machine programming. They get
: to learn what programming is, and some concepts, and can even
: produce software focusing on the software's design itself.
:
: This is great, of course. After all, it does indeed increase
: productivity. However, as they are never taught the core
: fundamentals of machine programming, it makes it much more harder
: for them to grasp the concepts involved. (I have seen alot of BASIC
: programmers give up on learning C and C++ because they deemed it to
: difficult and confusing.)

For practical purposes, abstraction is your friend. Could you imagine a software suite being written in a low level language like Assembly? It's possible ofcourse, but hardly do-able.

However, every programmer should know the fundamentals - the core - of what programming is. I think it's part of the general education of a programmer.

:
: One of the reasons why I like C and C++ is because, while attaining
: abstraction, it is still low enough to control everything you want
: in it, without the headaches and problems of assembly languages (ie,
: portability.)
:
: ---
:
: Then again, it might just be personal taste. Some people may learn
: better from the core fundamentals, while others may learn better
: starting from abstract concepts learned from other higher level
: languages.
:

I started at a young age learning VB. I didn't understand a thing of the first 10 examples I programmed. But eventually, I understood more and more. It took me a long time to start with C and C++. Nowadays, I love C and C++ for the control you as a programmer have - pointers are my friend :D
Just for practical purposes, I program VB because it's much more productive. It's just way too easy to create a decent interface to deny the language (ofcourse, with the .NET framework, when programming for Windows this is no longer an argument).
But every time I went a step less abstract, I learned só much more and understood better and better what the logic behind the abstraction is.

Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
Report
Re: Assembly vs. C++ Posted by daviddaly on 30 Oct 2007 at 1:28 PM
Thanks to everyone one for their replies and comments. I have posted my response to some of them as a comment on my original blog post.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.