Hacker News new | ask | show | jobs
by pizza234 2275 days ago
I've always been skeptical of using retro machines to learn low-level programming.

While the processors are simple, making non-trivial programs is hard, because the machines as a whole have lot of limitations, making programming very intricate, compared to more modern systems (say, 16-bit 80x86, but I guess even Amiga and so on).

If the target it challenge for the sake of challenge, then nothing makes those machines special, I mean, one can code directly in machine code if that's the intention :-)

5 comments

I had to teach an class recently that required introducing students to assembler. I designed an extremely RISC architecture (we’re talking mov into pc for control flow, r31 is “suggested” for use as a stack pointer) but gave it just enough that they could write more advanced instructions in assembler macros, which they designed themselves. I think it worked out well!
One homework problem I had in a computer architecture class circa the late 90s was, here's a hypothetical computer, now implement this instruction using the given microcode definition. I really enjoyed it because I was able to do it in much fewer micro-ops than the instructor expected.
In the early 80's my Computer Organization class the entire semester was dedicated to building a simulated 4 bit computer, with I/O channels (disk, screen, keyboard, printer) and a stripped down basic interpreter, and stripped down language compiler (it was a made up language).

We had to simulate everything, and the final project was to take the professor's Basic program and execute it correctly, and compile his other program and then execute that correctly.

That class was the absolute best thing I ever did, I learned so much in that class. It was the only class that I went to every day and took seriously, I got the only A in the class.

I had started programing back in the mid-70's by the time I got to college in 82 I had a bunch of side jobs writing code. I didn't focus too much on my college career, I was working my side programming gigs, and I was tutoring other students. That class got my attention and I loved it.

Finally an application for MIX!
Well, kinda. The architecture is minimal but I had a strong focus on orthogonality, a linear address space, and clean instruction decoding; so much so that I named it REGULAR ;) The ISA (https://github.com/regular-vm/specification) was specifically selected so that traditional control flow could be created with the use of only one temporary register (some take a bit of work; conditional branches decompose to branch islands for example).
Yeah I was being tongue in cheek. Your approach sounds great for encouraging people to think about and find solutions to specific issues.

MIX was, in theory, supposed really to be the opposite: so universal/generic that you'd ignore the language and focus on the lesson. Similar to the motivation for using Scheme in SICP. Obviously times have changed :-).

Sort of the difference between putting on eyeglasses to see the world better (MIX) or putting on eyeglasses to learn about how lenses work.

Have you seen MMIX? It's my favorite RISC architecture (unlike MIX, which isn't RISC)!
If you end up doing anything embedded you’ll likely be working with machines that also have very limited capabilities (you may be debugging by toggling a few pins and looking at the results on an oscilloscope) so I’d argue that these old machines can provide a lot of infrastructure to get comfortable with thinking this way.
I think the opposite is true because those machines were built around assembly programming. The hardware was essentially the software development framework.

Check out this assembly programming series, it's less assembly code on the Amiga to get something on screen or getting mouse/keyboard input than with highlevel languages and APIs/frameworks today:

https://www.youtube.com/watch?v=p83QUZ1-P10&list=PLc3ltHgmii...

A couple of decades ago there was a demo tutorial called "Asphyxia demo trainer"; it explained many effects and even basic 3D, both in assembler and, in a revised version, in C.

> I think the opposite is true because those machines were built around assembly programming.

This isn't true. It was extremely simple to get something work based on that tutorial, and to move to something more complex.

Doing that on an 80s 65xx-based machine would have been significantly more difficult, because that generations had significant limits in the coprocessors (AFAIK, the C64 could play music in games, but it was a workaround; it wasn't designed to do so).

Surely Amiga is easier, as the coprocessors were significantly more capable, but the parent based the discussion on C64 development.

> I've always been skeptical of using retro machines to learn low-level programming.

> While the processors are simple, making non-trivial programs is hard, because the machines as a whole have lot of limitations, making programming very intricate, compared to more modern systems (say, 16-bit 80x86, but I guess even Amiga and so on).

Programming in those time was an art. Now some people have 32 GB of RAM and they are not able to use it efficiently.

> If the target it challenge for the sake of challenge, then nothing makes those machines special, I mean, one can code directly in machine code if that's the intention :-)

I've seen OS's that at 20 MHz and 4MB RAM did things that Windows, Linux or MacOSX cannot do today with 1000 times more resources. It is really a shame.

In the late 90s, I worked with a small team, about four of us, and ported a DSL soft modem from Windows NT running on a Pentium II running at 450Mhz to VxWorks running on an ARM SA110 running at 120 Mhz. The original software and hardware team that developed the Windows drivers claimed that it would be impossible to meet the processing requirements on that platform. In the end, under worst case line conditions (R-S correction thrashing like mad) we could still get it to run with the clock turned down to 60Mhz.

Because that was all the processor was doing. No virtual memory, no disk, no IO, no graphics. Just feeding the DSP data on one side and NAT routing on the other.

Under the same line conditions, the PII running windows was useless running at 450Mhz. Mouse would barely respond, keyboard was lagging, screen wouldn't update.

Like you said, depending on what you are trying to achieve, you can perform near miracles on confined hardware if you have confined demands.

Which is why game developers love consoles so much.
Smaller world, smaller expectations. I know people who started with Amigas and they went straight to C, no assembly. I started on 6502, skipped 16bit and went to ARM2. Doubt I would have learned assembly if not for the 6502, and the need to use it. The simpler the machine, the better. Sure it might be faster to get some quick wins if the computer has a blitter, but if the goal is to learn low level programming, then writing the blitter yourself is probably the way to start. The more extra bits there are on the system, the harder and less interesting it is to program for at a low level. Modern OSs are abstracted for a reason.
Smaller expectations, smaller programs, so you don't learn how to structure larger programs.

It's the same as learning on GW-BASIC or equivalent: You learn some bad habits due to the environment which you must unlearn the moment you move on to a real system.

Yes. That is how people learn. Or is teaching children arithmetic pointless because they won't learn how to simplify algebraic expressions? Learn the basics, then add more complexity.

The 6502 was a real system. Conversely, I'd say Visual Basic is a terrible environment and I have a few friends that made millions using it, so, not sure who gets to be the judge.