Live data from Hacker News

I believe 6502 instruction set is a good first assembly language

nemanjatrifunovic.substack.com

201–210 of 297 posts

Re: I believe 6502 instruction set is a good first assembly language

#201

Earlier quoted context omitted.

Sounds nice, but the 6502 is certainly real, available hardware that you can buy and set up on a breadboard. There are tutorials on youtube for it as well, such as Ben Eater's tutorial.

Yes I'm well aware. I have a 65C02 on a breadboard. I have a 6809 on a breadboard. I've seen all Ben's videos. The *only* advantage the 6502 has is the exposed and non-multiplexed address and data busses, which you can single-step and examine with an Arduino or something. The whole setup is going to cost you the thick end of $100. But you can do that just as easily in an emulator. And meanwhile with RISC-V you can ge…

Having a large body of old software and games, written for various random platforms across 20+ years is also a killer feature.

Re: I believe 6502 instruction set is a good first assembly language

#202

The topic of the 6502 ISA simplicity is a pet peeve of mine, because to me it's clear that anybody thinking that such simplicity is a good thing, never progressed past a hello world. Programming anything of moderate complexity on the 6502 is hard. 8 bits are way too restrictive (e.g. screen addressing on the Commodore 64). Multiplications/divisions need to be hand-rolled. And even 16 bit sums/subtractions are simple…

The restictiveness is part of the fun. 8086 assembly isn't as much fun. If you're already going for something irrelevant (not x86-64 or RISC-V or ARM) then I don't see the advantage of 8086.

Re: I believe 6502 instruction set is a good first assembly language

#203

Why not learn a language intended for didactic use? https://en.wikipedia.org/wiki/MMIX has a quite deep corpus and what looks to be a good introduction: https://www.mmix.cs.hm.edu/getstarted.html (and I say that as a person who owns a much battered copy of Inman & Inman's _Apple Machine Language_)

Because there aren't any real-world implementations. Why bother with MMIX when you already know it'll never go beyond a toy "hello world" equivalent in an emulator?

MMIX might be good for educational use in an academic setting, but literally anything else would be better if you want to have fun working with it. Nothing beats the magic of seeing your first program run on a real computer.

Re: I believe 6502 instruction set is a good first assembly language

#204
What is a "good" assembly language? The best I've ever seen was the VAX instruction set. The second best, probably m68k. These were big, CISC CPUs that were as nice as possible to program in assembly language.

The 6502 wasn't. Everything about the 6502 was "do more with less" and you had to be really clever to eke out performance on it. But that's a good thing! A clean, big CISC architecture like the former ones is also a good compiler target. The 6502 was deeply weird, but programming it in assembly was necessary to get it to fly. That's an era. If you want to relive that era, then go for it. It's much more quirkily fun that, say, the 8080 (the Z80 is another beast, though backwards compatible) and much more mainstream than the otherwise better 6809, all of which are also from the "assembly language required for performance" era.

Re: I believe 6502 instruction set is a good first assembly language

#206

What is a "good" assembly language? The best I've ever seen was the VAX instruction set. The second best, probably m68k. These were big, CISC CPUs that were as nice as possible to program in assembly language. The 6502 wasn't. Everything about the 6502 was "do more with less" and you had to be really clever to eke out performance on it. But that's a good thing! A clean, big CISC architecture like the former ones is a…

Arguably PDP11 is probably the best. Dates back to the assembly language programming era, but nice clean instruction set. But what are you going to run your PDP11 code on? A simulator? Sure. But no real, consumer facing machines with graphics chips.

Re: I believe 6502 instruction set is a good first assembly language

#207
6502 assembly was fairly easy to learn, but it didn't translate to being a productive assembly programmer on the Apple //e I had. In particular, I wanted to do fast 2D and 3D graphics (basically what Ultima III did) to write my own games. My goal was simply to implement SetPixel(x, y, c) which turns out to be tricky because the Apple screen was 280 x 192 so you had to deal with 16-bit math. See https://nicole.express/2024/phasing-in-and-out-of-existence.... for the weird nature of the Apple HIRES graphics mode, and https://github.com/fadden/fdraw/blob/master/docs/manual.md#n... for a project that implements fast drawing on the Apple today.

Re: I believe 6502 instruction set is a good first assembly language

#208
post #118

I would argue that 6502 is a bad first ISA to learn if you want learn assembly. You‘ll spend most of your time fighting the quirks of this clever, but deeply flawed architecture. The idioms you learn to work around them don‘t translate to any better designed architecture that wasn‘t constrained by the tools and budget available to MOS at the time. If you want to learn a small, yet powerful instruction set with a few…

ARM does have a few pain points for new comers related to how immediates are embedded within instructions. It can be non obvious why a certain immediate or offset can be used but not another.

Granted, this extends across a wide range of assembly languages, but it'd be nice to start with a instruction set without this issue.

Re: I believe 6502 instruction set is a good first assembly language

#209

Earlier quoted context omitted.

I've forgotten so much of that, but I'll go to my grave remembering that LDA #97 JSR $FFD2 writes "A" to the screen.

Funny. I still remember it $FDED on the Apple // series. But printing text out like that was really slow. For fast text printing you had to write to memory locations between $400-$7FF and deal with the non continuous memory block -> screen location mapping. It was even more of a pain with 80 columns when half of the text was in the main memory and the other half was the bank switched memory.

Ouch. That sounds painful. Yeah, I usually ended up writing to screen RAM at $400. It was convenient to let the kernal manage cursor position and all that, though.

Re: I believe 6502 instruction set is a good first assembly language

#210

What is a "good" assembly language? The best I've ever seen was the VAX instruction set. The second best, probably m68k. These were big, CISC CPUs that were as nice as possible to program in assembly language. The 6502 wasn't. Everything about the 6502 was "do more with less" and you had to be really clever to eke out performance on it. But that's a good thing! A clean, big CISC architecture like the former ones is a…

Arguably PDP11 is probably the best. Dates back to the assembly language programming era, but nice clean instruction set. But what are you going to run your PDP11 code on? A simulator? Sure. But no real, consumer facing machines with graphics chips.

This is what I learned in university in the late 90s. (It was already totally no longer relevant by then, and we did run it on a simulator.)
Post reply on HN