Jump to content

  • Log In with Google      Sign In   
  • Create Account


Where to start learn x86 assembly


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 DemonRad   Members   -  Reputation: 290

Like
0Likes
Like

Posted 01 July 2012 - 08:04 AM

Is there any good starting guide for x86 assembly and C++?

is a x86 program still able to run on a 64 bit machine?

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!


Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 11861

Like
1Likes
Like

Posted 01 July 2012 - 08:14 AM

On this recent thread several people posted links to useful guides to learn assembly language.

Yes, x86 can run on some 64-bit machines.

#3 DemonRad   Members   -  Reputation: 290

Like
0Likes
Like

Posted 01 July 2012 - 08:26 AM

thx :)

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!


#4 slayemin   Members   -  Reputation: 2043

Like
1Likes
Like

Posted 01 July 2012 - 09:50 AM

The Art of Assembly Language:
http://maven.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html

The Author (Randal Hyde) has been nice enough to make his book freely available online. It's probably the best way to learn x86 ASM.

I learned ASM by using the Easy68k emulator for the 6800 processor. It's a bit easier for beginners to pick up than the x86 processor.

Eric Nevala

Currently a self-employed indie game dev


#5 Narishma   Members   -  Reputation: 117

Like
1Likes
Like

Posted 01 July 2012 - 01:03 PM

There's also this free book that doesn't assume any prior programming knowledge: http://savannah.nongnu.org/projects/pgubook/

#6 ApochPiQ   Moderators   -  Reputation: 14273

Like
0Likes
Like

Posted 01 July 2012 - 02:05 PM

What are you intending to learn to do with assembly language? Depending on your goals, there might be different resources that are more relevant to what you want to accomplish.

#7 Matt-D   Crossbones+   -  Reputation: 1410

Like
0Likes
Like

Posted 01 July 2012 - 07:55 PM

There aren't that many resources for x86-64 assembly yet (there are plenty for x86-32, though).
A decent tutorial I'd recommend is "Practical x64 Assembly and C++":
http://www.youtube.c...8D&feature=plcp
http://www.whatsacreel.net76.net/

See also:
http://www.x86-64.org/documentation/assembly.html
http://stackoverflow.com/questions/254963/best-resources-for-learning-x86-64-assembly
http://software.intel.com/en-us/articles/introduction-to-x64-assembly/

Edited by Matt-D, 01 July 2012 - 07:57 PM.


#8 DemonRad   Members   -  Reputation: 290

Like
0Likes
Like

Posted 03 July 2012 - 01:18 PM

What are you intending to learn to do with assembly language? Depending on your goals, there might be different resources that are more relevant to what you want to accomplish.


Well, I think SIMD will be very usefull for me for matrix and vectors calculation (Should I expect compilers to support automatically SIMD in near future?)
And also stack usage, where to get parameters if I'm writing a function that need some assembly.

And if there are differences between compilers I want to do that with Mingw. I'm interested in how much that code is portable and how to detect automatically if code is not portable (for example i know that SDL can detect with instruction sets are supported by the machine it is running on).

I 've done some simple function call with MIPS, nothing more for now. And I started reading x86 material.

P.S. If I write some wrong code should I expect blue screen or just segmentation fault/other errors?

Edited by DemonRad, 03 July 2012 - 01:26 PM.

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!


#9 ApochPiQ   Moderators   -  Reputation: 14273

Like
2Likes
Like

Posted 03 July 2012 - 01:32 PM

SIMD you can generally do with intrinsics in modern compilers; there's no need to mess with raw assembly. As a bonus this will get you code that works on 32-bit and 64-bit compilers, generally speaking.

Stack and parameter usage will vary based on calling conventions so you can read up on that to find out what you want to know.

Compilers will vary in terms of what inline assembly they support and how well they support it; GCC's assembly syntax is different from MSVC++'s, for instance, although they generally expose the same amount of capability.

Detecting the capabilities of your hardware can be done using instructions like CPUID and other functionality; have a google for CPUID and you should find some resources on handling that.



Screwing up your assembly language in a modern OS will probably just net you a process crash; it's pretty hard to drop a system that way these days.

#10 e‍dd   Members   -  Reputation: 2105

Like
1Likes
Like

Posted 03 July 2012 - 04:31 PM

Well, I think SIMD will be very usefull for me for matrix and vectors calculation (Should I expect compilers to support automatically SIMD in near future?)

Intrinsics, as have already been mentioned are the easiest way to use SIMD. GCC, Clang, MSVC and Intel's compiler all support the same API.

It's more and more the case that compiler's will be able to automatically vectorize code. Recent versions of the same 4 compilers I mentioned can do this to an extent. I say to an extent, because there are constraints on e.g. alignment, which might inhibit potential vectorization opportunites in some cases. GCC has a command line switch that will tell you when it would have auto-vectorized some code but something stopped it (unknown alignment, potential aliasing, ...). EDIT: can't find it in the manual now, perhaps it has been removed.

And if there are differences between compilers I want to do that with Mingw.

It's usually the case that compilers for a given platform tend agree on an ABI for C (though the object file formats might differ so linking them may be problematic in practice).

I like the netwide assembler ("nasm") as it allows you to produce object files in a number of formats. So I could assemble the same source in to two object files, one compatible with MinGW and the other compatible with Visual C++.

For C++, things are less clear. Particularly on Windows each C++ compiler tends to do its own thing w.r.t things like name mangling, virtual table ordering, exception propagation, etc. So if you're interfacing with C++ objects, you'd potentially have to write one assembler file per compiler in this case. OTOH, if you're using assembly you're unlikely to be writing code to throw exceptions, or use vtables, or whatever, and will instead be able to restrict yourself to writing code using the C calling convention.

Edited by e‍dd, 03 July 2012 - 04:37 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS