Live data from Hacker News

I believe 6502 instruction set is a good first assembly language

nemanjatrifunovic.substack.com

1–10 of 297 posts

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

#2
Biased here (it was my first language period), but I agree. Simple addressing modes. Getting started with x86 seems like it would warp the thinking a little bit, you can always pick its peculiarities up later.

Having worked with the 6809 series as well, it wouldn't be a bad choice either. The Freescale 68HC12 is still in production. Little systems with limited-yet-real I/O give the programmer very useful feedback.

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

#4
I got into 6502 assembly when trying to do bit manipulations on an Apple IIc back in the day.

The problem was that Applesoft basic set the high bit on data going out a serial or parallel port which was a problem for printing and sending data out through a modem. So if you wanted to keep the high bit one had to use 6502 assembly.

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

#5
I’ve only ever learned two assembly languages: 6502 (when I was in elementary school in the early 80s) and 370 (my senior year of high school when I had access to the UIC mainframe thanks to taking night classes there). I can roughly follow the output of godbolt on those rare occasions that I’m curious enough to bother, but the complexity of modern CPUs and computer architectures are such that I don’t know that I really need to deal with assembly language now. That said, my mental model of how a computer works at a low level is very much based on how the Apple II was set up.

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

#6

6502 and 680x0 were just a delight. I learned C (and later C++) solely because I couldn’t escape x86 anymore and hated assembly on those chips. Still do, really, though I’m decades beyond wanting to write anything in assembly now.

I love 68K. So nice to read with the separated data/address registers, and between the instruction set and addressing modes you can easily translate idiomatic C into reasonable 68K assembly.

Main downside is that with 68K you're more likely to be loading your program into an OS rather than bare metal hardware, and have to deal with things like relocation.

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

#7
I really don't see how. When students are first exposed to computer programming, it might make sense to start with toy / compact languages that don't have any real-world use. But assembly is not the first language you're supposed to learn!

It's very utilitarian and most commonly just used for debugging and reverse engineering. So why would you waste time on the assembly language of a long-obsolete platform?

Plus, the best way to learn assembly is to experiment. Write some code in your favorite language and look at the intermediate assembler output, or peek under the hood with objdump or gdb. Try to make changes and see what happens. Yes, you can do that with an emulator of a vintage computer, but it's going to be harder. You need to learn the architecture of that computer, including all the hardware and ROM facilities the assembly is interacting with to do something as simple as putting text on the screen... and none of this is going to be even remotely applicable to Linux (or Windows) on x86-64.

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

#8
In addition to be a good starting point for programming, the 8-bit micros are also a good way to begin learning about the hardware side of microprocessor systems, since the external stuff (memory chips, etc.) was correspondingly simpler as well. And without pipelining, you can form a more straightforward mental model of what the system is actually doing.

For me, it was Z80, just because Radio Shack had a book on it. I never actually built or programmed a Z80 system, but I still fall back on that knowledge when working with microcontrollers.

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

#10
It's also a fun one to write an emulator for. There are plenty of example programs out there to test, and they draw graphics by writing bytes to a frame buffer at some offset in memory. You can read from that region in memory, interpret each byte as a color from a preset palette, and use it to display visual output / graphics.

I wrote one in Swift a few years back, and then ended up developing it further into an NES emulator capable of playing Donkey Kong. It was a great learning experience.

Post reply on HN