LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-07-2010, 10:22 AM   #181
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723

Still, I am a

N E W B I E

I hardly understand a lot of the stuff you are saying. Why not keep it simple first?
 
Old 04-07-2010, 10:25 AM   #182
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Still, I am a

N E W B I E

I hardly understand a lot of the stuff you are saying. Why not keep it simple first?
Just do it. Install a 32 bit OS using QEMU or similar and just do it.
 
Old 04-07-2010, 10:28 AM   #183
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by johnsfine View Post
Even if you will never write a useful line of asm code, learning to code in asm with an OS, is a valuable skill that will improve the quality of your programming in languages like C++ as well as your skill at debugging.

Learning to code in asm without an OS would mostly be useful if you intend someday to write or significantly modify an OS. (I myself have done so, but don't expect to do so again).

Coding and debugging C++ is a more commonly useful skill than modifying an OS. So asm with an OS is more relevant knowledge than asm without an OS.
What johnsfine says is all true, but ignores that there are other architectures than X86 Linux. There are many architectures for which assembly is either the best or only choice, as well as other architectures which are easier to learn and experiment with. Many of these are supported with emulators such as Qemu, which further simplifies the process (overlooking a small amount of initial setup pain, maybe).
It think it bears emphasizing that there is a difference between learning a CPU instruction set, and learning assembly language programming. Much of the idiom of assembly language programming is transportable across CPUs. Even though the instruction sets may vary, the concepts are fairly consistent, and simply understanding how low level language constructs compare to relatively higher level languages is a valuable piece of knowledge.
I would tend to put more emphasis on interfacing assembly language to a high level language compiler, than to an OS. I say this as a matter of pragmatism, as well as a matter of academics. Being able to code a function/subroutine in assembler, and understanding the use of the interface to a high level language is not significantly unlike the interface to an OS. On many architectures, there is no OS, but there may well be a C compiler, or other compiler. It may also be useful to code in assembler for such things as optimization of code (I know GNU C is hard to beat, but not all compilers are GNU C), or to access hardware in ways not supported by a high level language.
I say all of this to suggest that MTK358 examine the real reason(s) for wanting to learn assembler coding, and base his choice of training architecture on his needs/wants, more than on what future there is in assembly language for Linux X86.

--- rod.
 
Old 04-07-2010, 11:05 AM   #184
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
For example, the original PC keyboard had a microcontroller (I think I8039, don't remember already) and all the firmware was written in assembly. Probably still is - the keyboard remains remarkably the same - a few added keys don't count, key matrix is simply scanned.
 
Old 04-07-2010, 11:28 AM   #185
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Also, compilers are still either terrible or don't even try to use SSE. Even though there's a huge win *just by treating the SSE or MMX registers like really fast memory*.
 
Old 04-07-2010, 11:41 AM   #186
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
WTF is SSE and MMX?
 
Old 04-07-2010, 12:25 PM   #187
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by MTK358 View Post
WTF is SSE and MMX?
They are two (actually more than two) versions of "Single Instruction Multiple Data" instruction sets included in modern X86 chips.

http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions
http://en.wikipedia.org/wiki/MMX_%28instruction_set%29

I believe MMX can be ignored as an obsolete predecessor of SSE. But I never used MMX much even when it wasn't obsolete, so I'm not certain there aren't a few useful features one might still want despite having SSE to use instead.

In addition to being SIMD, SSE is also the better way to do ordinary floating point operations.

X86 (modern CPUs) and X86_64 (all CPUs) have two entirely separate floating point instruction sets, a legacy floating point instruction set and an SSE floating point instruction set.

GCC in X86 defaults to using Legacy. GCC in X86_64 defaults to using SSE. SSE is usually better. That is often the reason a 64 bit application runs faster than a 32 bit application.

I believe an asm programmer can use either or both floating point instruction sets (but I switched to SSE long ago and haven't used Legacy floating point in asm since).

Last edited by johnsfine; 04-07-2010 at 12:38 PM.
 
Old 04-07-2010, 12:35 PM   #188
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by tuxdev View Post
Also, compilers are still either terrible or don't even try to use SSE. Even though there's a huge win *just by treating the SSE or MMX registers like really fast memory*.
They are not that terrible; there are vendor supplied performance libraries using SIMD; I am using certain SIM-based routines coded in pure "C", and they do perform better than equivalent generic ones.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ASM or C++? Hb_Kai Programming 16 01-20-2010 09:12 AM
Is ASM dangerous? MrCode Programming 37 11-18-2009 08:29 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 02:26 PM
I/O in ASM Mercurius Programming 10 11-16-2006 07:02 PM
ASM question zWaR Programming 2 06-26-2004 11:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration