I think to many programmers assembly is the "GOTO" of programming languanges: From the day you start learning to program, you are told that all this fancy high-level-language stuff is there so you do not have to deal with assembly. So most people never go there. I did go there, briefly, about ten years ago. It was wicked fun. But all in all, I may have written maybe 20 or 30 instructions of assembly in total. I did t…
X86 assembly doesn’t have to be scary
21–30 of 129 posts
Re: X86 assembly doesn’t have to be scary
#22I wonder if the history of x86 is holding us back in a big way. It started out being close to the metal but now it's an abstraction that can mislead you if you think processors are literally working the way x86 assembly describes. And surely the whole spectre issue could be lessened if we could be less reliant on CPUs having to guess what to keep in cache, which code paths are most likely, etc?
Fire up anything electron based, and you are looking at scripts being JITed inside a "VM", sitting on top of an OS that abstract away the hardware, sitting on top of hardware that is pretending to be something from the 80s/90s.
Re: X86 assembly doesn’t have to be scary
#23Loved the article. Then one can follow up with some MS-DOS classics. https://www.amazon.com/Peter-Nortons-Assembly-Language-Book/... https://www.amazon.com/Advanced-S-DOS-Programming-Microsoft-... https://www.amazon.com/Peter-Norton-Programmers-Bible-progra... https://www.amazon.de/PC-Intern-Programming-Encyclopedia-Dev...
I see your Norton and raise you an Abrash: https://www.amazon.com/Zen-Assembly-Language-Knowledge-Progr... https://www.amazon.com/Zen-Graphics-Programming-2nd-Applicat... https://www.amazon.com/Zen-Code-Optimization-Ultimate-Softwa... Zen of Asm is also online, I think a few of the other works, too. http://www.jagregory.com/abrash-zen-of-asm/
Re: X86 assembly doesn’t have to be scary
#24When I was about 14 I was enthralled with programming my new Commodore 64, first in BASIC, then 6510 assembly. I had the opportunity to accompany my mother to a one-day class on programming. Being just an intro on the subject, I was well ahead of what they would be discussing, but thought it would interesting to talk to some adults that were also into programming. I was talking to a couple of guys about what I had be…
AFAIK you can even go down to 1 register, which is how stack machines work. You might even say it’s 0 registers because it’s not something you can directly access.
Re: X86 assembly doesn’t have to be scary
#25Earlier quoted context omitted.
Why not? If they're determined enough, they'll get it. I learned a lot back in the day by spending many hours with the book PC Intern and some other book on x86 Assembler. Granted, I had a little experience with assembler on a C=64, but, I learned _that_ in a similar way.
> If they're determined enough, they'll get it. That's the exact opposite mindset of someone trying to "not scare newbies away."
Re: X86 assembly doesn’t have to be scary
#26I wonder if the history of x86 is holding us back in a big way. It started out being close to the metal but now it's an abstraction that can mislead you if you think processors are literally working the way x86 assembly describes. And surely the whole spectre issue could be lessened if we could be less reliant on CPUs having to guess what to keep in cache, which code paths are most likely, etc?
Re: X86 assembly doesn’t have to be scary
#27If your intention is to avoid scaring newbies off, I'm not sure if 16bit real mode, PC boot process, BIOS services and all that arcana that follows is the best place to begin.
Newbies like me are more frustrated by thinking there's no path from introductory material to something useful or realistic. Something that's more immediately friendly would be a simplified virtual machine with no or trivial peripheral hardware, like Redcode in Core War:
http://vyznev.net/corewar/guide.html
The death of education is "So What?": "OK, I've learned to play Core War and I know enough to write a warrior that can occasionally beat other warriors written by beginners. So far, so good... so what? I want to program computers in assembly, not play games using assembly programs, so where's the path from where I am now to where I want to be?"
In this case, the pathway from VM opcodes to native opcodes is hardware interface and, while the IBM PC has some funky hardware, it's heartening to know that your code could, in principle and barring emulation errors, run unmodified on real hardware and do something. Not something useful, but you can get to useful. You can ramp up to it, now that you have the pathway in front of you. It might be a long pathway, but it's there.
Re: X86 assembly doesn’t have to be scary
#28I wonder if the history of x86 is holding us back in a big way. It started out being close to the metal but now it's an abstraction that can mislead you if you think processors are literally working the way x86 assembly describes. And surely the whole spectre issue could be lessened if we could be less reliant on CPUs having to guess what to keep in cache, which code paths are most likely, etc?
As someone who hasn’t written assembly in 20+ yrs (some 68k back then, and bits of z80), I’m curious about some examples of how the assembly abstraction diverges from the underlying processor.
Re: X86 assembly doesn’t have to be scary
#29Loved the article. Then one can follow up with some MS-DOS classics. https://www.amazon.com/Peter-Nortons-Assembly-Language-Book/... https://www.amazon.com/Advanced-S-DOS-Programming-Microsoft-... https://www.amazon.com/Peter-Norton-Programmers-Bible-progra... https://www.amazon.de/PC-Intern-Programming-Encyclopedia-Dev...
I see your Norton and raise you an Abrash: https://www.amazon.com/Zen-Assembly-Language-Knowledge-Progr... https://www.amazon.com/Zen-Graphics-Programming-2nd-Applicat... https://www.amazon.com/Zen-Code-Optimization-Ultimate-Softwa... Zen of Asm is also online, I think a few of the other works, too. http://www.jagregory.com/abrash-zen-of-asm/
It's safe to say Abrash's book had a big impact on me.
Norton's books also make me nostalgic, so thank you for that, GP.
Re: X86 assembly doesn’t have to be scary
#30It’s not scary just nasty.