4 ms·
After all these years, I think the 6502 instruction set is still the one I know best.
by michael_dorfman 16y ago
After all these years, I think the 6502 instruction set is still the one I know best.
- jacquesm 16y agoI only remember 0x00 and 0xEA these days :) All the rest of them have slid in to the swamp of time. The 6502 was a funny chip with it's zero page access and lack of a 'mul', to some extent not having a mul makes you a better programmer (you'll have to roll your own, and that will lead you to discover look up tables for nibble sized chunks pretty quickly because of a perceived lack of performance), and the 'zero page' was a good preparation for knowing how to deal with memory with different degrees of accessibility (think of caching and demand paging). I worked a lot with the 6809 as well, and that was a much richer instruction set (and more orthogonal too), but I did not learn as much from that as I did from the 6502 because of the more restricted environment on the 6502. I believe my first 6502 based computer had all of 1K of RAM :) Single board job with a hex calculator keypad and 6 7 segment displays and an fsk based tape interface.
- mtkd 16y agoDid any peer chip have a mul in the late 70s/early 80s?
- jacquesm 16y ago6809 did 8x8 mul.
- pietrofmaggi 16y ago6809 was one of the first to have a mul instruction, and was used in the initial development of the macintosh: http://www.folklore.org/StoryView.py?story=Good_Earth.txt http://www.folklore.org/StoryView.py?story=Good_Earth.txt
- unwind 16y agoAwesome! In 11 clock cycle (not counting the set-up, i.e. loading the hardcoded source registers with the desired values).
- mtkd 16y agoThat's interesting, thanks, I remember writing my own on the Z80.
- Someone 16y agoI vaguely remember that at least one version of the 6502 had half a mul instruction, that is, an attempt was made to add one, but it was buggy: it only worked for some multiplicands (ones without any neighboring one bits or something like that). That made for interesting programs, where, depending on the arguments one would compute a times b, b times a, a1 times b plus a2 times b for some a1 a2
- jonsen 16y agoPerhaps the most satisfying hack I ever did was with the 6809. Making it handle high speed communications directly. It was done by decoupling its address bus during instruction fetch and then feeding it instructions from a separate ROM. The effect was to let external logic handle the control flow even if the 6809 did the data processing.
- jacquesm 16y agoThat sounds like a ROM driven bus master to me, how did you manage to get the 6809 to disenage? Using DMA/BREQ ?
- jonsen 16y agoNMI to let the active process save its state. Then the busses were taken over during instruction fetch. Feeding NOPs when nothing to do and appropriate instructions when needed. No jumps nor branches. Just the essential processing. A normal interrupt routine couldn't have a tight loop fast enough, so control flow was handled in parallel externally in programmable logic.
- jacquesm 16y agoVery cool, I highly doubt anybody will ever fully appreciate what a neat hack that is. So you basically divorced the busses from the CPU for a while making it run in a little parallel universe of it's own. A total perspective vortex of a sort ;)
- jonsen 16y agoI realize it would take some more to clearly explain the intricacies, but I see you got it :-)
- jws 16y agoBRK and NOP? Odd choice. 0x20 and 0x60 are still burned in my brain. (I couldn't afford the exotic "floppy disc drive" required to run the assembler, but the ROMs would disassemble what you entered so hand translating to machine code wasn't too bad.)
- jacquesm 16y agoNop to temporarily disable a call (nop, nop, nop that is), and BRK stop so I could have a look at what's going on. The reason I remember them is because those are the ones I would insert most often in binary rather than in code.
- protomyth 16y agoIn high school I learned 6502 (Apple II) which prepared me for the college course that was in 6809. I enjoyed the 6809 more, but I still have a soft spot in my heart for 6502. I also had a course on 8088 in college and really didn't like it at all. Looking back, I had college courses on assemblers for 6809 (EE dept), 8088 (CSci), and IBM 370 (CSci - the banana book rocked). I wonder if that goes on anymore today.
- oiuyhgthj 16y agoYou also have the 6502 to thank for the design of ARM Interview with Sophie Wilson, chief architect of ARM, October, 2001 Primarily the 6502. I learned about pipelines from it (by comparison with the 6800) and its designers were clear believers in the KISS principle. Plus the syntax of its assembler and general accessibility of it from the machine code perspective. I can still write in hex for it - things like A9 (LDA #) are tattoed on the inside of my skull. The assembly language syntax (but obviously not the mnemonics or the way you write code) and general feel of things are inspirations for ARM's assembly language and also for FirePath's. I'd hesitate to say that the actual design of the 6502 inspired anything in particular - both ARM and FirePath come from that mysterious ideas pool which we can't really define (its hard to believe that ARM was designed just from using the 6502, 16032 and reading the original Berkeley RISC I paper - ARM seems to have not much in common with any of them!).