Live data from Hacker News

I believe 6502 instruction set is a good first assembly language

nemanjatrifunovic.substack.com

21–30 of 297 posts

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

#21
post #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 think the Z-80 is sadly out of production at this point, but the eZ80 SoC is still available, so hopefully you can still build a hardware CP/M system!

Of course there are also synthesizable FPGA implementations, cycle-accurate software implementations, etc.

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

#22
It really isn't.

Biggest issue is that register width is half of pointer width, so for arbitrary pointers you at least need to make a trip through the zero page.

That fact alone really obfuscates a lot of what you're trying to teach as a first stab in assembly.

I say this as someone who has a whole lesson plan in 6502 asm.

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

#23
At my institution we teach MIPS, or rather, we teach MIPSY, which is our own version of MIPS which includes a bunch of helper pseudo-instructions.

It's taught to all computer science and software engineering students. Most students would take it in their first year, second semester.

We cover everything from the basics to hand-compiling code with functions, stacks, arrays, pointers etc.

We have our own emulator and even web platform for students to step forward (and backward!) their code: https://cgi.cse.unsw.edu.au/~cs1521/mipsy/

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

#25
Can anyone speak on how it is to move from an older assembly, to a modern CPU? I asked to take an assembly class in local/public college, and was told they wouldn't hold the class because not enough students were interested. This was in 1998, and I truly couldn't believe my ears.

I feel like learning modern assembly would be more useful, but maybe 6502 assembly is far easier to pick up? The first language I learned was Atari BASIC around 1991, and it was enough to get me to keep on moving to better languages and more powerful CPUs, but I wonder where I would have ended up if I learned assembly either before or after Atari BASIC. I try to keep up with technology, and have read quite a bit on different assembly dialects. I still haven't learned an assembly that I can program in, and I suppose it's because there are so many other high-level languages now and I feel like I need to keep up to what is used in "industry" rather than what is more obscure (but might help in debugging).

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

#27

I prefer RISCV as an starting assembly language because: it has good design, it's more intuitive, it has modern language and tool support (GCC, LLVM, Rust, etc.), and it runs on QEMU and real available hardware.

> real available hardware Last I checked the 65C02 was still being manufactured and sold. It can also at a blazing 14 MHz.

It's $8 and can't run without external ROM and RAM and a clock circuit and some glue logic.

A RISC-V CH32V003 32 bit processor with 2k RAM and 16k of flash running at 48 MHz costs $0.10 for an 8 pin package (6 available I/O pins) or $0.20 for the 20 pin package. Once programmed, it needs only electricity between 2.8V and 5.5V to be applied to start running.

https://www.aliexpress.com/item/1005005036714708.html

You can get it on a ready-made board or kit for as little as $1.

https://www.youtube.com/watch?v=dfXWs4CJuY0

https://www.olimex.com/Products/Retro-Computers/RVPC/open-so...

The recommended dev board, with a USB programmer/debugger interface for your PC, plus 5 of the 20 pin chips, costs $8.35 about the same as a bare 65C02 chip.

https://www.aliexpress.com/item/1005004895791296.html

You can make your own cool shit like this, which uses the $0.10 8 pin chip.

https://www.youtube.com/watch?v=1W7Z0BodhWk

It's as easy to learn the instructions of as a 6502 -- there are fewer of them! -- and far easier to write useful code for.

MUCH easier to learn than a 68000, and no more difficult to use. TBH the A and D register split always annoyed the hell out of me in early Mac days.

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

#28

I cannot agree that the simplicity of the 6502 wins over the 68000. The 68000 has more registers and wider data types: but the registers are all uniformly the same. It's really just two registers A and D, copied a bunch of times in to D0 to D7, and A0 to A7. Whatever you can do with D0 can be done with D3 and so on. Some A's are dedicated, like for a stack pointer. Simplicity of structure has to be balanced with simp…

> The best way to learn how to hack around the limitations of a tiny machine is to completely ignore them and become a seasoned software engineer

Learning to hack around the limitations of a tiny machine is a good step toward becoming a seasoned software (and possibly hardware) engineer!

The advantage of tiny systems is that you can understand them completely, from silicon to OS to software.

The 6809 is simpler than the 68K, and more powerful and orthogonal than the 6502, but there isn't the same software base for it. I think Motorola was onto something with the 6809 and 68K instruction sets and programmer-facing architecture. IIRC PDP-11/VAX and NS32K are similarly orthogonal.

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

#30

Can anyone speak on how it is to move from an older assembly, to a modern CPU? I asked to take an assembly class in local/public college, and was told they wouldn't hold the class because not enough students were interested. This was in 1998, and I truly couldn't believe my ears. I feel like learning modern assembly would be more useful, but maybe 6502 assembly is far easier to pick up? The first language I learned w…

Check out Assembly Language for x86 Processors by Kip Irvine. It’s probably one of the best books on x86. The older editions are way cheaper.
Post reply on HN