Places to learn Assembly?

Programming, for all ages and all languages.
sj95126
Member
Member
Posts: 151
Joined: Tue Aug 11, 2020 12:14 pm

Re: Places to learn Assembly?

Post by sj95126 »

I'm going to make a suggestion everyone is going to hate, but bear with me.

I first learned x86 assembly using "debug" under DOS. You could do worse than boot up FreeDOS and try that.

I'll take a break while you stop laughing.

Think back to the days when you wrote your first line of code in the first language you learned. You wrote "x = 4" and then "print X" so you could see with your own eyes that it did exactly what it was supposed to. You'll probably want to do the same with assembly. You want to run a single MOV instruction and then inspect the registers to see that they changed. You want to do a CMP and see "whoa, it really did set the OF flag".

This is the closest you're going to get to an interactive "interpreted" assembly experience. If you've tool-savvy enough already, you could assemble some code, run gdb and step through the assembly instructions to see what each one does, but that's a lot to set up before you see any results.

You can resume laughing.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Places to learn Assembly?

Post by Schol-R-LEA »

The OP seems to have left the forum, but WTH, I might as well add my two cents, too.
CrossJava wrote:I'm 13 and already mastered most of the other languages, now it's time for a challenge.
As has already been mentioned, there are a lot of programming languages out there, and some of them are very different from the run-of-the-mill Algol derivative. However, since I am mainly mentioning this to suggest you watch at least a few of the Abelson-Sussman lectures (which cover Scheme, a language in the Lisp family) as an alternative view of programming. I'd also check out Smalltalk and Forth as ones which work quite differently from conventional languages, but I will leave it to others to offer good resources on those.
CrossJava wrote:I finished Tutorialspoint's walkthrough on it, but now I need another place to learn from that's free and high quality.
'Free' and 'high quality' tend to be antagonistic goals, but I probably don't need to tell you that. This isn't to say that there aren't any such resources, but a lot of the better ones (and many of the worse ones) will cost money.

That having been said, if you have access to a public library, there are some excellent books such as Duntemann's Assembly Language Step by Step, which has the advantage of covering NASM under Linux the same as the tutorial you've gone through already. I know that libraries aren't the easiest things to access right now due to COVID, but if you can get a copy of this from one it would be worth the effort. Otherwise, the Kindle may not be free but it isn't too expensive if you can scrape the money together or convince a family member to get it for you.

I would also suggest considering a different assembly language, either emulated or on a real single-board computer such as a Raspberry Pi. The x86 instruction set is frankly a mess, compared to something such as ARM or MIPS, and if nothing else looking at other machine types will give you some idea of what is general to most assembly languages, and what is specific to x86 PCs.

For MIPS, there aren't that many real machines which you could use, but there are a few such as the Onion Omega2, and there are many emulators such as SPIM which are usually free. Alternatively, setting up a cross-assembler and a QEMU virtual MIPS Linux image shouldn't prove too difficult. I'd have to look around for suitable tutorials and videos, but I know that ones like this one are around.

While not free, an ARM SBC such as the Raspberry Pi isn't overly expensive (under $80 US for usable system), so it might prove to be a good investment, and not just for programming. I don't know if this is something you could ask family to help with, but I trust that you could convince them that it would be educational (which probably is the case anyway). There are tons of assembly programming tutorials and videos covering the Pi, and while it is far from the best SBC around, it is far and away the most accessible for most people.

Alternatively, a neo-retro platform such as the Commander X16 is another choice, which is convenient in that there is a free emulator and multiple assemblers such as cc65 ready to be used with it. There are several free videos on Youtube covering 6502 assembly for the Commander X16, such as this one.

And there are always the OpenCourseware classes on the theory of instruction sets and such, but that may be jumping the gun a teensy bit. :-)
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
moonchild
Member
Member
Posts: 73
Joined: Wed Apr 01, 2020 4:59 pm
Libera.chat IRC: moon-child

Re: Places to learn Assembly?

Post by moonchild »

The single best resource I know of for learning assembly is Understanding Assembly Language (aka Reverse Engineering For Beginners). You'll learn about a bunch of other cool stuff from that book, too. (You don't have to give your email to read the book; it's available right here.)
frn2000
Posts: 3
Joined: Sat Nov 21, 2020 11:43 pm
Location: United States
Contact:

Re: Places to learn Assembly?

Post by frn2000 »

As a total noob when it comes to assembler, what's the best and easiest distro to learn -- FASM, NSAM, YASM, JWASM or some other ASM? Thank you.
https://vintageos.org/frn2000.html
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: Places to learn Assembly?

Post by pvc »

I've learn't my asm skills from PASS32 assembler bundled with some old gaming magazine. It was an assembler written by some german guy. It had awesome tutorials included,ranging from basic move instruction, to implementing dynamic linker. I think the author was Dieter Pawelczak (I think, he is a doctor or something now).
frn2000
Posts: 3
Joined: Sat Nov 21, 2020 11:43 pm
Location: United States
Contact:

Re: Places to learn Assembly?

Post by frn2000 »

pvc wrote:I've learn't my asm skills from PASS32 assembler bundled with some old gaming magazine. It was an assembler written by some german guy. It had awesome tutorials included,ranging from basic move instruction, to implementing dynamic linker. I think the author was Dieter Pawelczak (I think, he is a doctor or something now).
I found some information on PASS32 at http://www.manmrk.net/tutorials/assembly/a.htm#P.
The Pass32 Assembler is a free x86 Assembler to easily create protected mode and DOS applications. The Assembler directly links a dos extender to the application - there's no complicated linking needed. The Assembler comes together with the Pro32 Dos Extender, but is also compatible to other Dos Extenders like WDOSX, etc. The Assembler provides a large run time library with std. I/O, heap management, file handling & VESA graphic functions. Pass32 comes with a complete documentation and many example programs. The Assembler and Dos Extender are compatible with plain DOS, Win31, Win9X and WinNT platforms.
Pawelczak's website was http://www.geocities.com/SiliconValley/Bay/9159/ (ERROR 404). That's how old PASS32 is! I'm going to check it out. Hopefully it runs on DOSBox. Thank you.
https://vintageos.org/frn2000.html
Seasoft
Posts: 20
Joined: Wed Sep 02, 2020 3:09 am

Re: Places to learn Assembly?

Post by Seasoft »

Schol-R-LEA wrote:The OP seems to have left the forum, but WTH, I might as well add my two cents, too.
CrossJava wrote:I'm 13 and already mastered most of the other languages, now it's time for a challenge.
As has already been mentioned, there are a lot of programming languages out there, and some of them are very different from the run-of-the-mill Algol derivative. However, since I am mainly mentioning this to suggest you watch at least a few of the Abelson-Sussman lectures (which cover Scheme, a language in the Lisp family) as an alternative view of programming. I'd also check out Smalltalk and Forth as ones which work quite differently from conventional languages, but I will leave it to others to offer good resources on those.
CrossJava wrote:I finished Tutorialspoint's walkthrough on it, but now I need another place to learn from that's free and high quality.
'Free' and 'high quality' tend to be antagonistic goals, but I probably don't need to tell you that. This isn't to say that there aren't any such resources, but a lot of the better ones (and many of the worse ones) will cost money.

That having been said, if you have access to a public library, there are some excellent books such as Duntemann's Assembly Language Step by Step, which has the advantage of covering NASM under Linux the same as the tutorial you've gone through already. I know that libraries aren't the easiest things to access right now due to COVID, but if you can get a copy of this from one it would be worth the effort. Otherwise, the Kindle may not be free but it isn't too expensive if you can scrape the money together or convince a family member to get it for you.

I would also suggest considering a different assembly language, either emulated or on a real single-board computer such as a Raspberry Pi. The x86 instruction set is frankly a mess, compared to something such as ARM or MIPS, and if nothing else looking at other machine types will give you some idea of what is general to most assembly languages, and what is specific to x86 PCs.

For MIPS, there aren't that many real machines which you could use, but there are a few such as the Onion Omega2, and there are many emulators such as SPIM which are usually free. Alternatively, setting up a cross-assembler and a QEMU virtual MIPS Linux image shouldn't prove too difficult. I'd have to look around for suitable tutorials and videos, but I know that ones like this one are around.

While not free, an ARM SBC such as the Raspberry Pi isn't overly expensive (under $80 US for usable system), so it might prove to be a good investment, and not just for programming. I don't know if this is something you could ask family to help with, but I trust that you could convince them that it would be educational (which probably is the case anyway). There are tons of assembly programming tutorials and videos covering the Pi, and while it is far from the best SBC around, it is far and away the most accessible for most people.

Alternatively, a neo-retro platform such as the Commander X16 is another choice, which is convenient in that there is a free emulator and multiple assemblers such as cc65 ready to be used with it. There are several free videos on Youtube covering 6502 assembly for the Commander X16, such as this one.

And there are always the OpenCourseware classes on the theory of instruction sets and such, but that may be jumping the gun a teensy bit. :-)
I'm sure everyone has good tips on here and each have their own pros and cons. I might argue that while learning a non-x86 assembly might be a good idea, it could distract from his purpose to OS Dev for x86 platform, which I assume here.

But good work. :D
clementttttttttt
Member
Member
Posts: 70
Joined: Tue Jul 14, 2020 4:01 am
Libera.chat IRC: clementttttttttt

Re: Places to learn Assembly?

Post by clementttttttttt »

Books are your friends.
frn2000
Posts: 3
Joined: Sat Nov 21, 2020 11:43 pm
Location: United States
Contact:

Re: Places to learn Assembly?

Post by frn2000 »

Seasoft wrote:
Schol-R-LEA wrote:The OP seems to have left the forum, but WTH, I might as well add my two cents, too.
That having been said, if you have access to a public library, there are some excellent books such as Duntemann's Assembly Language Step by Step, which has the advantage of covering NASM under Linux the same as the tutorial you've gone through already. I know that libraries aren't the easiest things to access right now due to COVID, but if you can get a copy of this from one it would be worth the effort. Otherwise, the Kindle may not be free but it isn't too expensive if you can scrape the money together or convince a family member to get it for you.
Someone put the Duntemann's book in Github.
https://vintageos.org/frn2000.html
User avatar
eekee
Member
Member
Posts: 891
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Places to learn Assembly?

Post by eekee »

frn2000 wrote:Someone put the Duntemann's book in Github.
Duntemann wrote:Note well: When somebody asks you, "Why would you want to do that?" what it really means is this: "You've asked me how to do something that is either impossible using tools that I favor or completely outside my experience, but I don't want to lose face by admitting it."
He's dead right there! It took me far too long to realise that.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Places to learn Assembly?

Post by Solar »

eekee wrote:
Duntemann wrote:Note well: When somebody asks you, "Why would you want to do that?" what it really means is this: "You've asked me how to do something that is either impossible using tools that I favor or completely outside my experience, but I don't want to lose face by admitting it."
He's dead right there! It took me far too long to realise that.
It could also mean "I have enough experience with the subject matter to know that this is a really dumb thing to do that will come back to bite us in the arse later". Just as well.

The trick is to have the awareness of your relative experience sets to tell the two apart.
Every good solution is obvious once you've found it.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Places to learn Assembly?

Post by PeterX »

eekee wrote:
Duntemann wrote:Note well: When somebody asks you, "Why would you want to do that?" what it really means is this: "You've asked me how to do something that is either impossible using tools that I favor or completely outside my experience, but I don't want to lose face by admitting it."
He's dead right there! It took me far too long to realise that.
Or it sometimes means: "That is outside of my limited imagination. I will stick to the pathes others have gone before me. And so should you."
(Which is nonsense, of course. Imagine all people were that way! We still would use stone tools, maybe not even those.)

Greetings
Peter
User avatar
eekee
Member
Member
Posts: 891
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Places to learn Assembly?

Post by eekee »

Solar wrote:It could also mean "I have enough experience with the subject matter to know that this is a really dumb thing to do that will come back to bite us in the arse later". Just as well.

The trick is to have the awareness of your relative experience sets to tell the two apart.
Good point, but it can take a lot of awareness. I guess that's what really took me years. The fun part is when something would indeed be dumb in someone else's world, but makes perfect sense for what you're trying to do. Just-about all of Forth is like that. ;)
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Places to learn Assembly?

Post by bzt »

frn2000 wrote:As a total noob when it comes to assembler, what's the best and easiest distro to learn -- FASM, NSAM, YASM, JWASM or some other ASM? Thank you.
I would recommend FASM, because it's easy to set up (on both Win and Unix), has straightforward syntax (mostly Intel with some additions, in contrast to AT&T), very intuitive and powerful macro system, good and very detailed documentation (including x86 instructions), lightning fast compilation times, finally a friendly community and active developer on the forum (aka Message Board) with tons of examples.

NASM is not bad either, you might find more examples with it on the net, but less supportive forum, and its macro system is nowhere near sophisticated as FASM's.

Eventually to get pro you'll have to learn GAS (AT&T syntax and the quirks of inline assembly and C precompiler with Assembly). But don't start there, it's hard.

Cheers,
bzt
Post Reply