-2

Is there a point to learn x86 assembly (protected mode, virtual x86 mode, segmentation, DOS calls etc.) at the end of 2021 by reading the old assembly books about 286/386/486 processors?

Or it will be better to start with a 64-bit version? As far as I know modern 64-bit CPUs use long mode and x86 is there for backward compatibility only and, as I understand, after some time will be removed.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    @CodyGray: What this question is actually asking is different from the title. By "x86", they apparently meant all pre-amd64 stuff, apparently mostly focusing on totally obsolete 16-bit mode. They meant "instead of just jumping in to x86-64", not whether or not to learn asm at all. I retitled this to match the actual question. I'll leave it closed for a bit in case I find a duplicate for it. ([Drawing a character in VGA memory with GNU C inline assembly](https://stackoverflow.com/a/34918617) has a section about not starting with DOS, but isn't a dup.) – Peter Cordes Nov 24 '21 at 08:47
  • 1
    @PeterCordes Yeah, understood, but if not closing as a duplicate, I would be closing this as "primarily opinion-based". As you're the resident expert in the tag, I'm happy to change to that reason, if you think it is a better fit, but I don't think it's reasonable to re-open this and risk attracting the type of opinion-based answers that we try to avoid here. – Cody Gray - on strike Nov 24 '21 at 09:17
  • 3
    @CodyGray: Ok that's fair. Although I think most of the SO community agrees that starting with 16-bit segmentation and DOS isn't the best way to get started if your goal is to understand modern x86-64 asm. Even ARM might be a better starting point as a first ISA to learn. x86 quirks are easy to learn later, once you have the basics, if you want to mess around with osdev stuff or whatever. I think Alex's answer is sufficient; these opinions have already been expressed various times in comment at least, by many folks. "How to learn" questions aren't a great fit for SO, as you say. – Peter Cordes Nov 24 '21 at 09:25

1 Answers1

2

These thing

Is there a point to learn x86 assembly (protected mode, virtual x86 mode, segmentation, DOS calls etc.)

Mostly no. These things are in the past (DOS isn't used nowadays often), and are specific to x86 ISA and are not likely to repeat in any new ISA.

This:

Or it will be better to start with a 64-bit version?

Maybe.

Programming directly in assembler isn't often used, but understanding assembly is helpful in profiling (especially making micro-optimizations and interpreting their results), and debugging (especially post-mortem dump analysis or debugging that involves running some code without source).

Note that what you call 64-bit version is called x86-64, and together with 32-bit version (which has not very big difference from 64-bit version) it is referred to as "x86".

That's why here we have which often covers issues related to the interpretation and performance of machine code for modern CPUs running in modern OSs.

Alex Guteniev
  • 12,039
  • 2
  • 34
  • 79