Want to learn assembly, confused about where to start [closed] - windows

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Just for the hell of it, i've taken an interest in learning assembly. The problem is I can't find a good starting point...
There seems to be a lot of assemblers available (FASM, NASM, YASM, MASM) but each has their own separate syntax, commands, and features. FASM seems to be the most convenient since it can compile executables without a linker but I haven't been able to find any tutorials to start me off. All the "Hello World" examples i've seen are 16 or 32-bit, but i'm running on 64-bit Windows so none of them work. The Windows examples included with FASM work but I'm not looking to get into Windows programming right from the start, I want to grasp the basics first.
Can anyone point me in the right direction?

If you want to learn to read assembly, I recommend learning to use WInDbg or IDA Pro as your primary debugger - learning not only what the instructions do, but how a C++ compiler idiomatically translates your source code into assembly will help you to learn far better than if you're doing contrived 100% assembly examples

I am no expert on assembly but it is an essential thing, to at least be familiar with, in computing. In a computer engineering class we used SPIM by James Laurus, a MIPS architecture simulator for windows. I think it is a good starting point. You can find a MIPS cheat-sheet via Google search, as well as some tutorials.
Assembly is cool because it is essentially machine language. Happy hacking!

32-bit examples should work even though your host OS is 64-bit.
On top of that is the difference between a 32- and a 64-bit Hello World just 2 characters:
include 'win64ax.inc'
vs
include 'win32ax.inc'

This is the best x86 ASM introduction I have found:
http://www.drpaulcarter.com/pcasm/
There is a pdf version of his book on that page. It starts at the very basics and works its way up. I got all of the fundamental ASM knowledge that I needed just with this book (stack frame creation, calling conventions, c interop, just to name a couple).

It's just boring to learn assembler without any goal.
Could I recommend you to buy any robot kit? As I know RoboSavvy robots are managed by assmeblers / C .. Others may have only DSL.
http://robosavvy.com/site/
P.S. I've learned assembler when I was in need to cheat in games. But today I would choose robot kits.

If you are a bigner and wants to learn the assembly better to get ASM knowledge 1st.
secondly try to learn the basic logic behind each code.
3.enjoy the language when try to learn if u r intrested otherwise leave it.

Related

Types of assembly language [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I´m looking forward to learn an assembly language.
I searched web for the tutorial and found different tutorials with different syntax of assembly.
There is any difference between 8086 assembler, nasm and gcc?
What is the better way to learn code with in assembly language?
thanks.
Basically there are two flavours on the x86 chipset which is AT&T or the Intel snytax. Most people I know prefer the Intel syntax because it is much easier to understand, but of course this is also a matter of getting used to. When I learned assembly on 6510 or M68000 I found the AT&T syntax closer related, it is rather confusing with it's adressing modes IMO.
If you instruct gcc to write the assembly sourcefile it uses AT&T syntax by default, but you can switch that to Intel as well using
gcc -S -masm=intel test.c
nasm is an assembler and gcc is a compiler so they have quite different purposes.
As for learning assembly there are lots of tutorials, for example The Art of Assembly. But if you really want to learn it, IMO the best way is to start debug and enter some instructions and see what they are doing and how they change reigsters and flags, writing small loops first.
This way you can focus on the instructions and not fight with the assembler source syntax as well.
I wouldnt start with x86, not a good first instruction set even if you have the hardware. ARM, msp430, avr, and some others are better and have open source simulators where you can get better visibility. I would start small, simply adding or anding a few numbers, write a memory location, read it back, that kind if thing. The simulators (can) prevent you from needing to make system calls to "see" your results, likewise they can definitely help you work through hangs and crashes, which you will get and which IMO leads to giving up on the whole thing. Once you know more, you can switch to hardware or try another instruction set (each new one gets exponentially easier than the prior) leading to x86 if you by then still feel there is a need...With x86 I recommend going back to the early days, find an 8088/86 simulator, learn the original instruction set, then if you still feel the need, then skip to 80386 and newer. You will also need to be able to switch formats in your head, gnu using AT&T was a cardinal sin (gnu assembler folks commit these sins regularly BTW, it is almost expected), but unfortunately we now have these two competing formats. With practice you should easily be able to tell what format is being used on inspection of code, but mentally switching back and forth may still be a challenge.

Ruby as a standalone language [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been messing around with ruby on rails. But my questions is really simple. Is ruby used language used for desktop applications? I mean without Rails? Can it be combined with GUI packages and Graphics Libraries to create a game for example? I have read that ruby is based on C. So it will be fast right?
Is ruby used language used for desktop applications?
Yes it is.
I mean without Rails?
Yes.
Can it be combined with GUI packages and Graphics Libraries to create a game for example?
Yes it can be.
I have read that ruby is based on C. So it will be fast right?
No, it won't be "fast" in the same way C is fast, because that isn't the point of Ruby. Ruby isn't "based on" C in any sense. The interpreter which runs Ruby code may be written in C (there are many interpreters and not all of them are), but that has nothing to do with the language itself. C and Ruby are not really comparable and occupy completely different niches.
I've no experience in programs where speed is critical; however, from my experience, Ruby is fast enough for user applications with GUI, and differences are almost unnoticeable from other similar dynamical languages (Ruby 1.9 is even faster, sometimes).
There is a reason I don't name the "similar languages": I think languages benchmarks aren't useful at all. While the fact that Ruby is fast enough for general purpose programming will probably make you happy, I think it's more important that if you already know and like Ruby you will be more productive using it.
There are some limit cases Ruby will be even faster than C: your implementations in C for functions that are offered as methods in the Ruby core lang and std lib could be slower than the ones in Ruby VM. This is just to say, speed isn't usually a concern, unless you're actually well aware of a particular reason you should be concerned with speed.
Some nice GUI libraries are FXRuby and Shoes, a very easy library used in the Hackety Hack project to teach children to program.
I usually use Tk when programming with Ruby and Python because it's included in the standard library and there is no need to install anything else.
For Gaming, you can try Gosu and Chingu; Gosu is probably the most actively developed Ruby Gaming Library, and Chingu is a nice collection of classes based on the foundations offered by Gosu. They've not got the nice community of other gaming libraries (e.g. Pygame) but you can easily start making little games with them.
Check out the Shoes GUI, it has different implementations, each one has a colorname, the most popular ared Red and Green Shoes, they are often used to make the kind of games you see also in Flash or regular javascript. They are fast enough for that kind of games. Some implementations even work with JRuby.
Red Shoes
Green Shows
Ruby is a language whose common implementation (e.g. ruby-1.9.3-pl94) is an interpreter coded in C. File main.c contains the main function in C which set up the Ruby VM implemented in C in file vm.c.
You could have several implementations of Ruby. I heard that some people wanted to re-implement Ruby above the Parrot VM (itself implemented in C); but that effort is perhaps still in progress. JRuby is a Ruby above the JVM.
Indeed interpreter vs compiler is not a sharp difference. Many interpreters contain a virtual machine with a translator (which you could view as a compiler) to that VM. Some VM implementations have a Just In Time dynamic translator to machine code. The JIT part produces machine code dynamically.
You could code a graphical application using e.g. Ruby-Gnome, a glue to Gnome and Gtk. You could also use Ruby Qt, a glue to KDE and Qt

Recommendations for a Windows based make tool [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does anyone have any recommendations for a good, fast, make tool? SCons? KJam? Something else?
Cross platform tools would also be acceptable.
GNU make is fast, but the native Windows-port is not very polished; there are a lot of pitfal regarding things like which shell is used to execute your commands. (Search for "MS-DOS" in the GNU make manual.)
SCons works very well on Windows. SCons had (last time I looked) some serious performance issues on large projects (thousands of files and upwards), but that was a couple of years ago.
CMake is an excellent tool if you want to work in Visual Studio but still stay crossplatform and allow other development tools on other platform. Can also generate makefiles for windows, so you're not bound to Visual Studio.
Whatever you may think of Ant, it is not a replacement for Make. That's like saying that a SUV is a replacement for a Formula 1 car. They are entirely different beasts. Ant is good for some things, and make for others.
There is a relatively new tool called premake which you may want to investigate. It looked promisiing when I looked, but I haven't checked it out in any detail.
On a PC is said in your title, so I assume you mean Windows? If so, I would recommend installing the Cygwin environment and if you install all the packages along with it, GNU's make is part of the deal. If you are on a Linux platform or one of the Unix variants, then you can just go with the GNU make directly.
You may be interested in cross-platform tools like Ant, Rake, Gant. These should give you most, if not all the functionality of GNU make, though compiling C code may be harder in some than other.
I've recently started using BJam. It is cross-platform and has a saner syntax than make.
If you're on Windows and you have the .Net Framework, you can use MSBuild. It's very similar to nAnt, and also has a lot of support from the community (some very detailed community toolkits are out there). It has a somewhat steep learning curve, but it's quite powerful once you get the hang of it.
Also another option could be writing PowerShell scripts. It depends what you want to do I guess. In my limited experience with makefiles, they've usually be to compile something, or set environment conditions, which you would use batch files for on a Windows platform.
If you need to build C-language based projects, take a look at rtEasyMake at www.routinetools.com. It is windows based and very easy to setup.

Where can I find tools for learning assembler on OS X? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'd like to learn assembler. However, there are very few resources for doing assembler with OS X.
Is there anyone out there who has programmed in assembly on a Mac? Where did you learn?
And, is there any reason I shouldn't be doing assembly? Do I risk (significantly) crashing my computer irreparably?
If you're using a PowerPC Mac, look into gcc inline assembler. Otherwise, look into nasm. I can't give any decent references to PPC ASM (they're few and far between), but I suggest the following things to learn x86 asm:
The book Reversing by Eldad Eilam
Compile simple C source with gcc -S and read the assembly generated
Use Sandpile
Join #openrce on irc.freenode.net and use OpenRCE
Also, if you're not in kernel mode then there's no chance of screwing anything up, really, and even if you are in kernel mode it's hard to really destroy anything.
Edit: Also, get gcc and such from XCode not Macports or somesuch. You're in for a world of malformed Mach-O files if you don't. Not fun to diagnose file format issues when you're just starting asm hacking.
The assembler language is determined by the hardware platform, not the operating system. Given that OS X runs on Intel platform and is 64-bit, you should look for information on x64 (also called AMD64) assembler. Check the Wikipedia article (http://en.wikipedia.org/wiki/X86-64) for a lot of links to documentation about x64.
Also, the OS X tools documentation might contains a lot of information about x64 assembler. In particular, the Netwide Assembler (NASM - http://developer.apple.com/documentation/DeveloperTools/nasm/nasmdoc0.html) might have documentation on how to build OS X applications using assembler.
To start learning assembly, you might want to start with simple C programs and ask GCC to generate the assembler code for it using the -S option:
gcc -S hello.c -o hello.asm
You will then be able to understand how to call functions, pass arguments, etc.
Nasm/yasm are your best bet; gcc inline syntax is quite crippling and can be very painful to use at times, plus there are literally some things it cannot do. Nasm's macro syntax is also much much more useful, a godsend in a language like assembly that has no built-in templating features.
XCode (ie. GCC) has great support for writing assembler. It's a fun thing to learn (although you're unlikely to need it much), and the worst you can do is crash the program you're writing, same as in C. Just Google for 'gcc inline asm x86 tutorial' and you should find plenty of starting points. Don't worry that some will seem to be Linux specific, they'll generally work just as well in XCode.
(edit) ...assuming you have an Intel Mac of course; if not then replace 'x86' with 'ppc'.
here
I programmed assembly on a Mac. It was Motorola 680x0 assembler using MPW. I've touched on the PowerPC assembler a few times in CodeWarrior and ProjectBuilder. Now ProjectBuilder is called XCode, and there is Intel. The assembler is one of the many tools within XCode.
I originally learned assembler on the Apple II: the 6502 machine language monitor built in ROM, the Sweet16 mini-assembler, and others. Later, I used Intel 80186 assembler to speed up slow bits of C code, and work paid for a one day course on Intel 80186 assembler at a university. Later, I had to maintain some 680x0 assembly for the Mac. That was a long time ago.
I don't think there is any reason not to do assembly. Learning is great. Learn all you can. Drop into a low enough level debugger and look at the disassembled code.
My advice is:
Don't be scared.
There's no reason why you shouldn't; there is nothing you can do in assembly language that you can't do in a higher level language like C.
As far as tools go, you might want to install MacPorts and get the GNU assembler. That may or may not be the easiest way, but it's free and you can probably find tutorial documentation for writing Unix programs in GNU assembler somewhere on the net.
There are two three things you to know need for writing assembly language on a system with an operating system (as opposed to 'bare metal' assembly which is a world of its own):
How the instruction set works - loads of resources for Intel X86 if you have an Intel Mac, still reasonable set for PPC for example Mac OS X Internals.
How to assemble link your programmes - if you have the Developer tools installed you have GCC and associated tools
How to talk to the OS - here is where Mac assembly is a lot less well documented than Windows or Linux. It may be you have to write equivalent C programs and use 'gcc -S' to see what calling/stack restoration conventions are appropriate. It depends what you want to do but at a miniumum you need OS system calls for IO and memory allocation.
A good starting point is here.
If you've got Developer Tools installed, you can simply open Terminal and type as (GNU Assembler - part of Binutils).
For PPC try Lightsoft

Best win32 compiled scripting language? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the network.
There was a small Perl which appeared to be able to do most of this, but it does not seem to have been updated/developed in quite a while. I have wondered about Lua, but I don't know if it has everything I need yet (and don't want to hunt through fifty library sites trying to find out). Any thoughts?
Have you considered using an EXE maker? For example, you can code in Python and use py2exe to create a standalone EXE that runs anywhere (it actually packages Python into the exe, so you don't have to install the runtime).
Ruby is my scripting language of choice.
Try RubyScript2Exe.
A scripting language is, almost by definition, not compiled into a standalone executable. So maybe you need to restate your intentions or give some indication about what kind of program you want to create.
C# is a powerful language that compiles to .EXE and allows you to interface with pretty much anything (through native p/invoke calls, if necessary). A basic but very usable Visual Studio for C# can be downloaded for free from the Microsoft website. The .NET runtime is installed on most systems nowadays.
Did you consider AutoIt ?
It is a scripting language, and you can quickly transform a script into an exe...
At OSCON 2005, I heard Damien Conway say "the only thing better than Perl is something that works well, even if it's not written in Perl."
It's good advice. Instead of looking for the best language that can be compiled to an .EXE, worry a lot more about writing it in a language that can be compiled to an .EXE. Use whatever works. Just remember that the quality of your programming matters infinitely more than what language you use.
That said, I like py2exe. YMMV. Good luck!

Resources