Places to learn Assembly?

Programming, for all ages and all languages.
CrossJava
Posts: 1
Joined: Sun Sep 06, 2020 9:01 am
Libera.chat IRC: CrossJava

Places to learn Assembly?

Post by CrossJava »

I'm 13 and already mastered most of the other languages, now it's time for a challenge. I finished Tutorialspoint's walkthrough on it, but now I need another place to learn from that's free and high quality. Thanks! :D -Honest
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: Places to learn Assembly?

Post by Octocontrabass »

I learned assembly through reverse-engineering and modifying existing software. It may not be the easiest way to do it, but it's a lot more fun prodding an existing program to change what it does, and I personally found it a lot easier to follow the logic in an existing program instead of trying to write one from scratch.

I also started with 6502 assembly in a NES emulator with a debugger. It's a bit simpler than x86, and the bright colors are more engaging than most distractions. :P
User avatar
iansjack
Member
Member
Posts: 4688
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Places to learn Assembly?

Post by iansjack »

Not wishing to detract from your desire to learn assembler, but have you really "mastered most other languages"? What about Swift, Rust or Go? Or, to widen your horizons a little more, have you looked at any non-Algol type languages. What about Prolog, Forth, Lisp, or (my favourite) Smalltalk? You can learn a lot from these more esoteric languages. Or, getting back to the Algol family, have you tried Eiffel, Oberon, or Ada?

There's a lot more interesting stuff out there than just C, C++, C#, or Java. Not to mention BASIC ( I said DON"T MENTION BASIC!).
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Places to learn Assembly?

Post by Octacone »

I learned Assembly as I was writing my dual stage FAT 32 bootloader.
It is really not that hard, just make sure to choose Intel’s syntax (it is easier and looks cleaner). Also I prefer NASM over other assemblers.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
nullplan
Member
Member
Posts: 1769
Joined: Wed Aug 30, 2017 8:24 am

Re: Places to learn Assembly?

Post by nullplan »

CrossJava wrote:I'm 13 and already mastered most of the other languages, now it's time for a challenge.
When I was 13, I learned Pascal and didn't really get it. I'm 30 now, and have been working in C almost exclusively for half my life and I still find new and interesting ways to shaft yourself in it. There is quite an astounding complexity to it, and C is a very simple language. C++ is way more complicated (the only known document more complicated than the C++ standard is the US tax code), and has even more and interesting ways to shaft yourself.

You want a challenge, you can look at functional languages. Personally I like Haskell, but I'm terrible at it. It's the exact opposite of the problem I have with C++. Looking at functional or declarative languages (like Prolog) would also widen your perceptions, instead of remaining in the strictly imperative world. But if you want to learn assembler, take any C program, rewrite all control flow in terms of goto and also remove all logical composition (logical AND and OR operators), and then imagine that with five times the line count, and that is basically assembler.

I learned assembler for Win32, back when I still used Windows on my development machine, and I quickly learned how pointless it all is. Win32 API is defined mostly in terms of functions, so your code will, at least initially, be something like 90% function calls. Those functions are external, there is almost nothing you can do to speed things up. Writing these long lists of function calls in assembler merely introduces human error into the mix. After debugging a program for hours and finding that the problem was one a compiler would have found (mixed up arguments, and one was missing), I dropped the venture. Today I use assembler only for that which is absolutely necessary.

If you are more of a theoretical type, I cannot recommend PowerPC assembler highly enough. It is way better than x86 assembler. But since I suspect you will want to try out your creations, and you are unlikely to have an old PowerMac lying around, that is not really an option. I suppose qemu could help out.
Carpe diem!
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Places to learn Assembly?

Post by PeterX »

CrossJava wrote:...now I need another place to learn from that's free and high quality. Thanks! :D -Honest
I don't know the whole internet, but I have never seen a free AND high quality Assembler material. You might use a search engine for "Assembler Linux" or "Assembler Windows". But a good book on Assembler beats all internet texts about Asm I saw so far.

Maybe this thread is helpful:
viewtopic.php?f=13&t=37131

Greetings
Peter
User avatar
iansjack
Member
Member
Posts: 4688
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Places to learn Assembly?

Post by iansjack »

Well, The Art of Assembly Language is fairly comprehensive - https://www.plantation-productions.com/ ... oATOC.html

It won't give you a full overview of system programming, which you need for OS development, but once you've completed it you should be in a good position to understand the Intel and AMD Programmer's Manuals.

If you want to learn assembler, forget about OS stuff and concentrate on user programs. You need to master these thoroughly before tackling system stuff.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Places to learn Assembly?

Post by PeterX »

iansjack wrote:Well, The Art of Assembly Language is fairly comprehensive - https://www.plantation-productions.com/ ... oATOC.html
But this is about High Level Assembler, which is not what we normally call Assembler.
iansjack wrote:If you want to learn assembler, forget about OS stuff and concentrate on user programs. You need to master these thoroughly before tackling system stuff.
This seems to me like a good advice. One advantage (among others) of application development is that you get positive results faster.

Greetings
Peter
User avatar
iansjack
Member
Member
Posts: 4688
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Places to learn Assembly?

Post by iansjack »

All assemblers provide instructions and control structures above the level provided by pure machine code. HLA is just another example. But the book teaches all the basic concepts of x86 assembler programming needed to understand the processor.

If you want pure machine code you can certainly type in a bunch of hex numbers, but it's not necessarily the best way to learn.
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: Places to learn Assembly?

Post by Thomas »

Hi CrossJava,
Emu8086 is an easy way to learn 8086 assembly language. The program is a little dated, but it was fun to play around with. Old ROSAsm was a fun way to study win32 assembler and 32bit assembler. You can also play around with SSE and MMX instruction set later, but these are merely details. I must warn that these are *fun* ways to learn. You can do same the same thing in Linux and use gdb as a debugger. The experience is similar.

Some of the assembler programs will get flagged by antivirus as malware. Please do not download them if you are concerned about the warning.

Link:
Emu8086
https://archive.org/details/tucows_3250 ... r_Emulator
RosAsm
https://www.tapatalk.com/groups/rosasm/ ... es-t2.html

Assembly Language Tutorials:
Art of Assembly : Art of Assembly Language Programming and HLA by Randall Hyde
https://www.plantation-productions.com/Webster/
http://pacman128.github.io/pcasm/
Assembly language section at PCGPE
http://bespin.org/~qz/pc-gpe/
Flat Assembler manual has a brief introduction. You may check out Fresh IDE and SASM projects.

This is largely focused on x86, which is what I did as a high schooler. It think it might be advantageous to learn about ARM and RISC-V instead in the present era. The principles remain the same. I do not know if this is too advanced for you at this stage but something like this
https://github.com/d0iasm/book.rvemu
might be of some interest to you.

Hope I am of some help.

--Thomas
Seasoft
Posts: 20
Joined: Wed Sep 02, 2020 3:09 am

Re: Places to learn Assembly?

Post by Seasoft »

iansjack wrote:Not wishing to detract from your desire to learn assembler, but have you really "mastered most other languages"? What about Swift, Rust or Go? Or, to widen your horizons a little more, have you looked at any non-Algol type languages. What about Prolog, Forth, Lisp, or (my favourite) Smalltalk? You can learn a lot from these more esoteric languages. Or, getting back to the Algol family, have you tried Eiffel, Oberon, or Ada?

There's a lot more interesting stuff out there than just C, C++, C#, or Java. Not to mention BASIC ( I said DON"T MENTION BASIC!).
You still recommend a BASIC language in 2020? Cool.
User avatar
iansjack
Member
Member
Posts: 4688
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Places to learn Assembly?

Post by iansjack »

I said "DON'T MENTION BASIC".
nullplan
Member
Member
Posts: 1769
Joined: Wed Aug 30, 2017 8:24 am

Re: Places to learn Assembly?

Post by nullplan »

iansjack wrote:I said "DON'T MENTION BASIC".
10 print "DON'T MENTION BASIC"
20 print "MENTION BASIC ANYWAY"
30 goto 10

That's as far as I understand the language.
Carpe diem!
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Places to learn Assembly?

Post by PeterX »

I don't think Basic is THAT bad. (OK, I must admit it isn't great either.) VisualBasic .NET (and I think Gambas) are OOP now and don't have line numbers anymore. And Goto is used rarely (and it exists in C, too).

One really bad aspect about Basic (and Logo, too) is that it isn't very standarized or compatible. Yes, there are Basic and Logo standards. But many implementations don't follow these standards. So if you write code for one system, you can throw it away when you change the system. There were GW Basic, QBasic, Visual Basic etc...

To say something on-topic:
I think Thomas gave some good links for learning Assembler.

Greetings
Peter
SpaceAcoustics
Posts: 5
Joined: Thu Sep 10, 2020 1:32 pm
Contact:

Re: Places to learn Assembly?

Post by SpaceAcoustics »

I learned assembly a few years ago at a similar age (One bit of advice is you never have fully mastered a language, much less multiple). To he honest I mainly learned assembly through trial and error, through Linux, DOS, and bootloaders. So personally I find the best way to learn is some basic information on assembly and computer architecture, NASM, and time.
Post Reply