Assembly.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Benjamin100
ES Beta Backer
ES Beta Backer
Posts: 250
Joined: Tue Jul 19, 2011 9:37 pm

Assembly.

Post by Benjamin100 »

I've been playing and learning with C++ on and off for a while now, through books, experimentation, and a little bit with graphics.
What are the chances I would learn anything valuable by studying assembly? Have any of you learned assembly and found it helpful in any way?
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Assembly.

Post by dandymcgee »

Yes. Yes, yes yes. Learning even just the basics of x86 assembly give you an invaluable insight into what's really going on behind the scenes. I don't think there's a programmer in the world who can effectively program in C/++ without having a basic understanding of how the hardware works.

I just recommended this to another guy, but it suits your case as well. There's a guy named Casey who has been writing his own game from scratch in C and documenting the entire process on YouTube. In his intro videos, he explains in moderate detail what's going on behind the scenes and how to properly use a debugger for view memory and disassembled instruction. I highly recommend it:

https://www.youtube.com/user/handmadehe ... =0&sort=da

After that, you can refer to "Art of Assembly" which may as well be the bible on x86 assembly. It's probably a lacking newer instructions as CPU artchitecture is constantly evolving, so for a more up-to-date reference you can always look up Intel's reference manual for your CPU (or AMD if you're that guy).

http://www.plantation-productions.com/Webster/

Also, one of the greatest ASM tutorials I have ever found is the Ketman Interpreter. This thing is absolutely ancient though, and only runs in 16-bit mode. I'm pretty sure if you download and install DOSBox, it should run just fine in the emulator.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Benjamin100
ES Beta Backer
ES Beta Backer
Posts: 250
Joined: Tue Jul 19, 2011 9:37 pm

Re: Assembly.

Post by Benjamin100 »

I have no clue what the man in the tutorial is talking about.
He seems to assume I already understand the basics of assembly, which I do not.
Perhaps I should read about it extensively first.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Assembly.

Post by dandymcgee »

Benjamin100 wrote:I have no clue what the man in the tutorial is talking about.
He seems to assume I already understand the basics of assembly, which I do not.
Perhaps I should read about it extensively first.
It's not an assembly tutorial, sorry if I implied that. It's a C tutorial, with heavy focus on underlying memory and instruction discussion in the first few videos.

You should definitely go through the Ketman tutorial first if you can get it working.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Benjamin100
ES Beta Backer
ES Beta Backer
Posts: 250
Joined: Tue Jul 19, 2011 9:37 pm

Re: Assembly.

Post by Benjamin100 »

Oh, that's the one I was talking about.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Assembly.

Post by dandymcgee »

Benjamin100 wrote:Oh, that's the one I was talking about.
How far did you get? He starts off just spewing a bunch of shit at you in the beginning to show you the controls and how the interpreter works. You're not *supposed* to understand the assembly code being presented, you're just learning the tools.
Ketman Page 26 wrote:"At this point, I calculate that I've dropped the dolphins. I mean those delightful aquatic clowns that latch onto any passing ship and race alongside, thumbing their noses at human technology. [...] But I digress. Like all authors, I get my share of compulsive ship-chasers, that mysterious group of insomniacs who are hell-bent on trying out everything, and who inflate the download counts [...]. But your app was just one of ten apps they downloaded that night merely because they saw them displayed enticingly on someone's site, like selections on a cake-trolley. [...] Don't quote me, but I think they're gone. My feeling is that I lost them several pages back with a ferocious burst of speed. And if you're still with me, it means you could be serious.
In other words, you're a dolphin. The author of the tutorial has presumed you don't really give a shit about assembly and are just trying to skim a few paragraphs and pretend you're cool. This tutorial is fucking awesome in my opinion (I've read it start-to-finish more than once, and it enjoyed the hell out of it), but you need to actually *want* to learn assembly. Like anything, it's going to take time. Read the tutorial, patiently and comprehensively, and I assure you'll have a good time and learn a lot of valuable things.

Essentially, everything before page 36 is to get the lazy people to "drop the class". That said *DO NOT* skip those pages, because they teach you to use the tool.

If you comprehensively read pages 1-50, and are still lost or confused, post back here with any questions you have and I'll do my best to help you through.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Benjamin100
ES Beta Backer
ES Beta Backer
Posts: 250
Joined: Tue Jul 19, 2011 9:37 pm

Re: Assembly.

Post by Benjamin100 »

So am I supposed to understand him?
There is no point in sticking it out if I should simply be reading a book about it instead.
I'm not trying to impress anyone, I simply stop using a source if it isn't comprehensible to me.
Endurance by itself doesn't produce understanding if I'm not starting where I belong.

Is the tutorial for people just beginning to look at assembly, or is it for someone with a basic understanding already?
Benjamin100
ES Beta Backer
ES Beta Backer
Posts: 250
Joined: Tue Jul 19, 2011 9:37 pm

Re: Assembly.

Post by Benjamin100 »

I'm using masm32 now.
Been reading one lesson online about it.
I keep having issues installing masm32 because every time it gets to installing, it can't find kernel32.lib. I finally searched the computer for it and found it in "Windows Kits."
and "Microsoft SDKs." Where is it EXPECTING it?
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Assembly.

Post by dandymcgee »

Benjamin100 wrote:So am I supposed to understand him?
What page did you get to? I said page 50 for a *very good reason*. (See below)
Benjamin100 wrote:Is the tutorial for people just beginning to look at assembly, or is it for someone with a basic understanding already?
Yes. The tutorial it written for bare-bones, never-programmed-before-in-my-life people. It starts teaching basic binary arithmetic and moves slowly toward populating registers and the basic instructions. But you need to have a good sense of humor and, you *need* to read the first 50 pages before you start judging it. If you don't understand something, skip it and keep reading. Trust me, the first ~10 pages are basically a joke to get rid of people the author wouldn't like if he met in person (super serious people, lazy people, stupid people, etc.) You may not find that very professional, but it is what it is.

If you're not quick-witted and easily amused by Ketman's stabby jokes, then I recommend finding another learning resource. That said, I think you will be hard-pressed to find one better than Ketman. If you don't have the patience to read 50 DOS-sized pages, then you should probably give up trying to learn assembly and go do something you'll enjoy. Regardless of the tutorial you choose, this is not going to be a walk in the park.
Benjamin100 wrote: I keep having issues installing masm32 because every time it gets to installing, it can't find kernel32.lib. I finally searched the computer for it and found it in "Windows Kits."
and "Microsoft SDKs." Where is it EXPECTING it?
I've never used masm32, but I would expect to find it somewhere in the SYSTEM dir. Are you running a 64-bit OS? 64-bit Windows virtualizes and redirects a bunch of system paths, so masm32 might not be expecting that. I used to use NASM back when I was screwing around with assembly.

Just be aware that you've skipped ahead to 32-bit protected mode and involved yourself in a bunch of more complex things than the tutorial I recommended. If you're having more fun, that's all that really matters, but I have a hard time believing you'll find it any easier.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Post Reply