There are still groups of programmers who support old microprocessors, e.g., Z80, 6510, 68000, etc. What can we learn from old assembly languages at a time when functional programming is becoming fashionable?


I imagine that there would be more to learn for embedded systems. However, assembler styles apply to a more limited extent for web programming where caching is used and the size of routines does not really matter. The guideline for best practice for embedded and web styles differs massively (server and client styles being different). For example, the optimising a sprite multiplexer to run in say, under 30 bytes, is different to types of optimising we would make for code we intend to run on a web server. The types of optimisation are very different. The sprite multiplexer is written with memory usage as the main priority but regarding our web server routine, we want maximum performance which has little to do with efficient use of memory unless we are talking about shared resources.

  • I wish we'd learned more from Macro32... – SK-logic Apr 9 '11 at 13:07
  • 2
    I think there is a lot to learn from Lisp, for example. – quant_dev Apr 9 '11 at 15:58
  • 1
    @quant: How delightfully ironic... OP talks about assembly languages for obsolete architectures in the advent of functional programming and you go and name the first functional programming language ;) Also, be careful you're not getting lynched by the Lisp fans... – user7043 Apr 9 '11 at 16:18
  • 5
    Irritating Lisp groupies is the whole point. – quant_dev Apr 9 '11 at 17:44
  • 1
    I don't get what's the point of adding the part about functional languages in the question – vartec Apr 11 '11 at 16:55

It's a very long time since I did any assembler... I remember learning on a 68k at college, the reason given was that the assembler was simpler on the older chips so easier to learn the fundamentals without any clever optimization getting in the way. So maybe they are still useful as teaching platforms?

I don't get the reference to functional programming - are you saying FP somehow replaces assembly programming?

| improve this answer | |

The primary thing for these older platforms is essentially:

How to code efficiently when memory is tight and cpu cycles are few.

In an age where the typical response is "just upgrade the hardware" it is very interesting to see how to squeeze maximum performance out of what you have.

The Z80 and 6502/6510's are good starting points as they were very wide spread (CP/M-80 and C64 respectively) with a lot of code written.

See for instance the chess programs listed here - http://chessprogramming.wikispaces.com/Z80 - Sargon played a respectable game, and the ZX81 ran in 1 KB of RAM.

| improve this answer | |
  • I like this answer I suppose you are talking about embedded system but does it apply to web programming where caching is used and the size of routines does not really matter. The guideline for best practice across these two styles differs massively. – CarneyCode Jan 1 '12 at 12:04
  • No, both CP/M-80 and C64 machines were what we today would consider desktop systems. – user1249 Jan 1 '12 at 12:08
  • I was talking about about server and client styles being different – CarneyCode Jan 1 '12 at 12:12
  • If you have a non-distributable system that needs to scale, you essentially have the same problem, just on a very different scale. – user1249 Jan 1 '12 at 12:20
  • I still fail to see how optimising a sprite multiplexer to run in say, under 30 bytes, has anything to do with optimisations that we make when we are writing code to run on web server. The types of optimisation are very different. The sprite multiplexer is written with memory usage as the main priority but regarding our web server routine, we want maximum performance which has little to do with efficient use of memory unless we are talking about shared resources. – CarneyCode Jan 1 '12 at 12:35

It's a good way to get introduced to assembly language programming. x86 has become a real mess over the decades, and it's used almost everywhere the average programmer would program that way. Starting with something more coherent (like M68K, for example) has real advantages.

| improve this answer | |

If you have an interest in computer history, how did we get to where we are now. if you examine a lot of assembly today, much of the time most people are looking at compiler generated code, not hand written assembly. The 6502 is a prime example if a processor to learn. For one thing there are many roms from the classic standup arcade games like Asteroids. You can learn the instruction set by writing a disassembler. Writing a disassembler for a variable length instruction set is a educational programming challenge in and of itself, well worth the effort, or at least like a maze solving program, worth at least getting to the point where you figure out what you have to do to solve it. Because these were hand coded assembler, they didnt have to, and didnt follow programming conventions like a compiler would. Some of these roms either intentionally or on purpose have some traps in them that trip up a disassembler. Back to the disassembler learning experience. Then you can examine the programming style, how it might be similar to general programming in any language and the kinds of tricks and habits used by the programmer for that instruction set. The 6502 holds an important position in computing history, despite the sales pitch leading many to think that Apple had anything to do with anything (they were an also ran behind commodore and tandy/radio shack in the personal computer movement) the 6502 was the common factor in the move from time share computers to ones you could afford to own. As well as the video game world both atari vcs (a.k.a atari 2600) and stand up arcades. Later the z80, and a number of others took over and carried us to where we are now. the 6502 in particular has an addressing mode, which the msp430 can also take advantage of in its own way. YOu may think of the 6502 being starved for registers, but consider the actual registers just temporary registers and the page zero memory being 256 registers.

I also highly recommend going backwards to the 8088/86 to get the history of where the current x86 family was born, compare it to the z80, 8080, and others that sprang from a common source/concept and evolved on their own. x86, even the modern one can be considered a dead instruction set it is so painful and archaic, it just wont die. Why bother translating to some other instruction set inside, why not do what DEC did with the Alpha running windows and dynamically recompile converting the program to another instruction set, allowing legacy programs to run, the reason why microsoft and intel are still in business, but moving away from a poor intermediate interface between the source code and the execution unit(s).

Perhaps the most important lesson is that processors are as similar as they are different, load, store, the basic set of alu operations, xor, add, etc. At the same time even with C, the programming languages never really clinched the features of the hardware, you still have to dive down into assembly to hand tune for performance. core language libraries like memcpy for C are hand tuned asm per platform because the language just doesnt cut it.

You will also find out that many of the processors you claim to be obsolete are still available for sale, sure a small vendor or two with a small market share, but some markets or companies rely on the 8051 for example (have you used a network card lately, sent any TCP/IP packets to anyone? how did you get this web page, there were a number of 8051 driven macs and phys that your packet flowed through, even reading the datasheets and programming those parts you dont realize they are 8051 based unless you have had the history or asked the right question to the vendor when programming those parts). zilog still lives (z80) (and rabbit semiconductor is a modified z80), forms of the the 6502 are still for sale, the hc11, etc, etc.

| improve this answer | |
  • could help but notice... are you on some kind of assembly language crusade. Nothing wrong with it, I guess. Just curious :) – DXM Jan 13 '12 at 4:45
  • 1
    I spend my day staring at compiler outputs or machine code in a processor simulator, etc. or teasing the compilers optimizer to create the code I want, etc. So there is that, I have an interest in computer history and processor architectures and how they evolved. And have a real concern about what will happen if we dont keep a certain percentage of the up and coming programmers educated both in history and more important what happens under the hood. compilers are not getting better for the same languages, some are getting worse. – old_timer Jan 13 '12 at 5:45
  • I guess I was affected by the question as well, first the word "obsolete", and the kind of implied, "what use is this knowledge". – old_timer Jan 13 '12 at 5:54
  • I completely agree with you. I'm a C++ developer and 20% C# and at least once a week I still stare at assembly when someone asks for help with a crash dump from QA or a production site. I'm baffled that so many people say assembly is not necessary when it's knowledge been so useful for me to find the most obscure and random bugs (even with C# crashes). I was going to reply myself but then noticed the question was resurrected from 8 months ago. Then I noticed you pulled out a bunch of them. Hence my comment :) – DXM Jan 13 '12 at 6:03
  • The words assembly language to programmers make most of them cringe or make noises or run out of the room. Just like the word math has the same affect on elementary school children. Not saying programmers are elementary school children. We were all elementary school children once and know how we felt about that word math or remember what other kids reactions were. Also as adults we now recognize with paying bills and buying food, etc that our parents/teachers were right, we did need to know math, we do use it, some more than others. – old_timer Jan 13 '12 at 6:14

You can learn what computing is all about: moving 0s and 1s from one location to the other, sometimes making them collide in an ALU.

| improve this answer | |

I think you can learn a lot about a specific machine you need to do work on. For example if you want to emulate an old system such as the NES. You would need to learn about 6502.

| improve this answer | |

I don't think the "assembly language" is obsolete, so much as the hardware is obsolete. There's no significant difference between old and new assembly languages, if you are able to ignore the vast changes in machine architecture they target, the syntax is nearly the same.

So uh, I'd say not much of anything.

| improve this answer | |
  • 1
    Syntax is the least relevant thing of all time. – DeadMG Jan 1 '12 at 12:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.