
PC Assembly Book (2006) - lrsjng
https://pacman128.github.io/pcasm/
======
pacman128
Author here. Surprised to see this here.

I wrote most of the book for the class I was teaching in the 90's. All the
textbooks I could find were for 16-bit DOS assembly. I wanted to do 32-bit and
use free software. I picked NASM and djgpp because most of my students used
Windows. There was no free express version of MS Visual Studio back then. I
also wanted to cover interfacing with C since that's how one typically uses
assembly, plus it shows how C operates under the hood.

I went into industry in 2000, so never had the time to update it to 64-bit.

~~~
pan69
> I grew frustrated at teaching 16-bit real mode programming and decided to
> change to 32-bit protected mode. However, I soon ran into a problem. I could
> not find a textbook that covered 32-bit protected mode assembly programming!

I skimmed through the book a bit and there is an explanation of what protected
mode is in chapter 1, but the actual teaching assembly part of the book seems
to be all 32 bit real mode. Is that correct?

~~~
pacman128
No, it's all in 32-bit protected mode.

------
DyslexicAtheist
imo it really increases you understanding of security issues, stack, heap,
over- and under-runs, debugging without source-code, low level caches etc.
people often dismiss it because it not being a useful language to implement
applications, but it's kind of essential when optimizing C (you might want to
play with inline assembly called from C - not always to make things faster but
to better understand where your money is spent).

A great place to visit for a break is @x86instructions Twitter[1] feed.
Absolutely hilarious (and you will need some humor to keep your sanity with
Assembly on Intel), e.g.:

MOV - Literally Copy Something Instead Of Moving It

or

VLTAYTMPNL - I’d Like To Add Your Scalar Vector Lane To My Professional
Network On LinkedIn

...

[1] [https://twitter.com/x86instructions](https://twitter.com/x86instructions)

------
ChrisSD
I'd encourage every programmer to learn some basic assembly. Arguably ARM
assembly is slightly easier to learn but either one will give you a better
understanding of the API that your programming languages are abstracting over.

And in my experience it makes teaching about C pointers so much easier.

~~~
djhworld
I'm going through this at the moment.

I've come to the point in my life where I've realised I don't understand
modern computers, so tasking myself with trying to learn about this stuff.

My mental model of computing is stuck at around the Z80, I wrote a gameboy
emulator a few years ago, but that's far away from what modern machines are
doing!

------
icholy
I got a printed copy of this book. It's a great introduction to x86.

------
mesaframe
I'm learning about compilers and operating systems. And I don't know how much
assembly should I learn. Ofc, I can't read whole x86 manual.

~~~
blihp
Enough so that you're comfortable that you have a solid mental model of what
the CPU is actually doing when a given program is running. (i.e. at least get
to the point where the CPU is no longer a black box to you.)

~~~
mesaframe
I did take a computer architecture class but all there was addressing modes
and few basic instruction classes. Things got difficult when I started
studying OS. Then I came to know that sopport for things like page table,
higher privilege level instructions etc are all in Architecture itself (Though
I still have to read about them from manual). I don't know what else am I
missing.

