back to article Chaps make working 6502 CPU by hand. Because why not?

The 6502 CPU is a fondly-remembered CPU* for good reason: along with chips from Motorola, Intel and Zilog, it helped create the personal computer business in the 1980s. However, this project is affection on a grand scale: some US enthusiasts are creating a transistor-for-transistor replica of the chip's design using discrete …

  1. glen waverley
    Mushroom

    Vacuum tube (aka valve)

    "one of the designers, Eric Schlaepfer, a vacuum tube enthusiast".

    I know what I want to see. A combined valve 6502 and bbq!

    1. Anonymous Coward
      Anonymous Coward

      Re: Vacuum tube (aka valve)

      > I know what I want to see. A combined valve 6502 and bbq!

      I want to see a complete Commodore PET built out of discrete transistors!

      The CRT and cassette deck can remain as-is.

      If I remember rightly, the base model had 4K RAM and 8K ROM, so it should be doable. I used to type in about 3KB of BASIC interpreter in hex to a Hewart Microelectronics 6800. Hand-positioning jumper links would be a bit more tedious (but perhaps could be automated with a pick-and-place robot?)

      1. Lee D Silver badge

        Re: Vacuum tube (aka valve)

        The problem is speed.

        Links and PCB's this big will have enormous capacitance issues when running at higher frequencies. You'd be lucky to get more than a couple of hundred KHz out of it before things started going weird.

        1. This post has been deleted by its author

        2. Wommit

          Re: Vacuum tube (aka valve)

          My first experience with a microprocessor was in the mid 80s. The motherboard was about 2ft square, and covered with components. As for the "couple of hundred KHz" I can't remember it topping 100kHz.

          We used to program it in machine code, when we ran our first BASIC program it took so long we thought the ROM was broke.

        3. Anonymous Coward
          Anonymous Coward

          Re: Vacuum tube (aka valve)

          Given that the original 'thing' only ran at 1MHz I'd consider a couple of hundred KHz an impressive achievement but I have a sneaky suspicion it could be possible to persuade it to run full pelt, if they've given the layout some thought it may well work.

      2. Rich 11

        Re: Vacuum tube (aka valve)

        Hand-positioning jumper links would be a bit more tedious (but perhaps could be automated with a pick-and-place robot?)

        That would be cheating (unless you programmed the robot with Jacquard-loom cards).

      3. MacroRodent

        Re: Vacuum tube (aka valve)

        If I remember rightly, the base model had 4K RAM and 8K ROM, so it should be doable.

        Wouldn't the RAM alone require 8192 transitors? (each bit in a bistable transitor circuit).

        The whole device would fill a warehouse.

        1. Anonymous Coward
          Anonymous Coward

          Re: Vacuum tube (aka valve)

          > Wouldn't the RAM alone require 8192 transitors? (each bit in a bistable transitor circuit).

          4KiB is 32,768 bits, so it will be that times the number of transistors per SRAM cell ( a small number)

          Given that the single PCB in the photograph has 3,218 transistors, that's hardly going to "fill a warehouse". Maybe a 4U rack box.

    2. Steve 114
      Happy

      Re: Vacuum tube (aka valve)

      Our mechanical 'Comptometers' (and a few 'Marchants' for the really expert girls who were qualified to multiply) were noisy on steel desks, so they sat on thick hairy felt pads. When the first big 'electronic' calculators came in, same size, the felt pads were retained by habit, and blocked the ventilation. If you put pies on top at coffee time, they'd be piping hot by lunch. Met a few nice girls that way, who warmed my pies. Down in the PCB shop they had Paxolin ovens which were much better, but only run by blokes.

  2. Neil Barnes Silver badge
    Pint

    Hat off. Beer raised.

    It turns out I can still remember 6502 assembly op-codes...

    1. Warm Braw

      Re: Hat off. Beer raised.

      Yep. A9 01 is burned into my brain through frequent use.

      He now needs to start work on a 6522!

    2. Frumious Bandersnatch

      Re: Hat off. Beer raised.

      It turns out I can still remember 6502 assembly op-codes...

      I think I can only remember A9 (LDA, immediate mode?) and EA (NOP).

      For shits and giggles, I tried to write a Hello World program without looking stuff up. Can't remember exact instructions and addressing modes, but I think it might go something like ...

      SCREENBASE EQU XXX

      TEXT DB "Qbrf vg jbex?"

      DB 0

      CLX ; (clear X?)

      loop: LDA (TEXT,X) ; (do loads set flags? does this need Y-index addressing?)

      JZ done

      TAY ; (Y <- A?)

      AND 0x20

      PUSHA ; (remember case)

      TYA

      OR 0x20 ; (make lower-case)

      CMPA 'a'

      JLT fix_case ; (A < 'a'?)

      CMPA 'z'

      JLE rot

      fix_case: POPY ; get back case bit

      ORY ; (A <- A or Y?)

      STA (SCREENBASE,X)

      INX

      JMP loop

      rot: ADDA 13 ; (or just ADD 13?)

      CMP A, 'z'

      JLE fix_case

      SUBA 26

      JMP fix_case

      1. anonymous boring coward Silver badge

        Re: Hat off. Beer raised.

        I find this sort of stuff relatively easy to remember.

        The hard things to remember are things like where I put my pants yesterday.

  3. The Vociferous Time Waster

    Oh bravo

    Bravo

    That is all.

  4. Herby

    I'll really be impressed when..

    They do a 6809 that runs at full speed. That was a proper 8 bit micro.

    My first micro was a 6800 when you got the kit of parts in a $300 (1975) and a nice big applications book. Did LOTS of things with it!

    1. Anonymous Coward
      Anonymous Coward

      Re: I'll really be impressed when..

      In the UK that 6800 evaluation kit cost over £160 in 1976 - with its full complement of 1KB of static RAM. That's the equivalent of a couple of thousand pounds now. Dwarfed by my Apple II from New Bear three years later at £1780 (circa £6K now).

      The 6800 kit was a DIY soldering job. It came with the circuit board and the Motorola large chips like CPU, RAM, UART with pre-production "XC" markings. You then had to go and buy the discrete components.

      Having had bad experiences with early MOS transistors and static - I built it in the office one evening stripped down to my cotton underpants. It was only later I realised that tantalum capacitors were polarised. Fortunately I had soldered them in aesthetically - so getting the first one the right way round was fortuitous. Even the couple at right-angles were the right way round.

      Lackingt a 'scope to set it up - the two clock pots were adjusted until it ran. Not having the necessary Teletype handy at that instant - the voltages on the bus were measured to show the expected idle loop activity. A check with a 'scope later showed it was over-clocking - which explained why one instruction was always giving a one bit error.

      As Herby says the applications manual was enormous with simple circuits for bar code readers, keyboards etc - all driven at low level to do things like key de-bounce. Our first application was to hook it up to one of the mainframe terminal room Teletypes. Watching an unsuspecting colleague being refused a login was not only puerile amusement - but also impressed us to microprocessors' capabilities - if only they had a lot more RAM.

      The 6800, 68000, and 6502 were logical orthogonal instruction sets like the IBM 360. The Intel instruction sets always seemed far more arbitrary - so I never learned to program the 8080 etc at assembler level.

      I still have a brand new "wide-bodied" Motorola UART chip in my boxes of 74' TTL etc components.

      1. I Am Spartacus

        Re: I'll really be impressed when..

        " if only they had a lot more RAM"

        How many times did I say that????

      2. Wilseus

        Re: I'll really be impressed when..

        "The 6800, 68000, and 6502 were logical orthogonal instruction sets like the IBM 360. The Intel instruction sets always seemed far more arbitrary - so I never learned to program the 8080 etc at assembler level."

        The 6502 wasn't that orthogonal, certainly not when compared to the 68000 or the ARM for example (IIRC you had to use different registers, either X or Y, for different addressing modes etc)

        1. Nick Ryan Silver badge

          Re: I'll really be impressed when..

          From memory, yes: the X and Y registers had different capabilities when it came to the indirect/offset addressing modes.

          I remember when I first figured out what one of the more obscure ones actually did, and then wondered if there was ever a useful use for it. Like you do I searched the entirety of both of the C64 ROM chips and couldn't find the instruction in use. Not a definitive use case, but it was what I had available at the time...

          1. Solmyr ibn Wali Barad

            Re: I'll really be impressed when..

            "From memory, yes: the X and Y registers had different capabilities when it came to the indirect/offset addressing modes."

            Wasn't only Y usable for offset addressing? Load base address in Y, and then use one-byte offset as an argument for a command. Much faster than using two-byte addresses. Also, there were some register ops available to work with contents of Y - that had no counterparts for X.

            1. Simon Harris

              Re: I'll really be impressed when..

              If I remember correctly, X and Y were used differently for indirect addressing thus

              LDA (aa,X) added X to the operand aa, and the contents of memory at (aa+X) and (aa+1+x) were used as the address from which A was loaded.

              LDA (aa),Y took the data from (aa) and (aa+1) as an address and then added Y to that. A was then loaded from that total address.

              The first was useful if you had a list of pointers to objects, the second was useful if you had one pointer to an object, but wanted to access data from a particular offset into that object.

              1. Nick Ryan Silver badge

                Re: I'll really be impressed when..

                @Simon Harris

                That sounds right. I suppose we could lookup the 6502 instruction set but it's quite interesting how well the instruction set comes back to memory despite so many years of not using it. I remember reading through it all in detail when teaching myself 6502 (6510) assembler as the C64 came with great manuals, particularly the Programmers Reference Guide(?).

    2. Anonymous Coward
      Anonymous Coward

      Re: I'll really be impressed when..

      now for the fun .. build an Intersil 6100 .. and then try to get Java running on a 12 bit CPU ...

      1. Simon Harris

        Re: I'll really be impressed when.. Intersil 6100

        Well, the 6100 was based on the PDP8, so you could copy the PDP8s design (that one used discrete transistors).

        The next step would be to recreate your discrete version of the 6100 as a FPGA. Then you'd have an integrated version of a discrete version of an integrated version of a discrete transistor CPU.

    3. Down not across

      Re: I'll really be impressed when..

      They do a 6809 that runs at full speed. That was a proper 8 bit micro.

      And it ran OS-9. Had much fun with that.

    4. PhilBack

      Re: I'll really be impressed when..

      6809, what a nice processor. Too bad the 6847 VDU in my CoCo was such a piece of crap and didn't do justice to it.

  5. Admiral Grace Hopper

    A happy thought

    I've still got the listing for a B-Tree database that I wrote in 6502 assembler at college somewhere. And the screenscraper that I used to capture the passwords to the course tutors' accounts.

  6. Anonymous Coward
    Coat

    Yes, but can it...

    ...and I'll stop there.

    1. jake Silver badge

      Re: Yes, but can it...

      No. It can't. And that joke (or, rather, variations of it) was old before the IBM PC was an itch in Don Estridge's pants.

    2. Tony Haines

      Re: Yes, but can it...

      ...

      just imagine a beowolf cluster of 'em.

    3. Anon

      Re: Yes, but can it...

      ...play Elite?

      Yes, it can.

      Well, it might need a few extra transistors to turn it into a BBC Micro first.

  7. John Savard

    Why So Slow?

    While capacitance and distance issues are certainly real, computers made from discrete transistors achieved speeds high enough to allow them to do useful work back when computers were made from discrete transistors.

    Thus, the original PDP-8 ran at 666.67 Kilohertz, the SDS 9300 ran at 571.43 Kilohertz, the KA-10 chassis version of the PDP-10 ran at 1 Megahertz, and the CDC 6600 ran at 10 Megahertz.

    1. Tromos

      Re: Why So Slow?

      The high capacitance is probably due to the packing density putting relatively large chunks of conductors in close proximity to each other. I don't think distance (within reason) is too much of an issue for 1 MHz operation, spreading things out with a single layer board and classical discrete components might have been a better option. Open up a CDC6600 and you would find 4 large bays loosely packed with modules interconnected with wiring (usually twisted pairs) up to a couple of metres long. Use of emitter coupled logic and finely crafted tuning were critical to achieving the speed.

      1. Anonymous Coward
        Anonymous Coward

        Re: Why So Slow?

        "[...] packed with modules interconnected with wiring (usually twisted pairs) up to a couple of metres long"

        On the prototype English Electric 4-70 it was not unusual to see a long twisted pair wire that had been added during testing to give an extra signal delay. A calculated so many nanoseconds per length.

    2. Simon Harris

      Re: Why So Slow?

      I was wondering this first when I realised that the original AT motherboard ran at 5MHz and was not much smaller (13.8" x 12").

      I think the PCB size itself does not necessary limit the speed so much. However, if the CPU is simply a transistor for transistor substitution from the die to the PCB without any redesign, simply scaling things up might well scale up parasitic capacitances and time constants. Also, the 6502 used some dynamic registers (essentially single byte DRAMs) to reduce transistor count - scaling up the storage capacitor might also limit the clock speed by increasing the charge/discharge time constant.

      I presume the 1960s transistor based computers running in the MHz range were designed on the macro-scale to control these capacitances in the first place.

      1. Roo
        Windows

        Re: Why So Slow?

        "I presume the 1960s transistor based computers running in the MHz range were designed on the macro-scale to control these capacitances in the first place."

        That and bigger power supplies pushing a lot more current. :)

  8. Aristotles slow and dimwitted horse

    Because retro is the new future...

    Well done those lads.

  9. Andy00ff00

    WHERE do you find the time?

    Can you download free time from an ftp site or something?

    1. Stoneshop
      Go

      Download from an ftp site?

      ITYM 'ntp server'.

  10. I Am Spartacus
    Flame

    1980's?? EXCUSE ME

    I was using a 6502 on a KIM-1 in 1977.

    Do keep up, El Reg.

  11. James Dore
    Meh

    808?

    How about an 808 chip? Maybe they could then go for a Proper 80's icon, and make the world's biggest operational Ibanez TubeScreamer.

  12. Anonymous Coward
    Anonymous Coward

    But... it's using that newfangled electricity thing

    I'd rather like to have a Babbage version of it, if that's all the same to you.

    1. Anonymous Coward
      Anonymous Coward

      Re: But... it's using that newfangled electricity thing

      In Babbage's day there were probably those who thought his machine should be driven by a plodding donkey chasing a carrot on a stick.

  13. Dabooka
    Go

    Largely useless it may be

    but it is a thing of beauty. It has LEDs FFS!

    1. Anonymous Coward
      Anonymous Coward

      Re: Largely useless it may be

      LEDs?

      Luxury!

      Incandescent mini-light bulbs is what we had to use in my youth!

  14. jake Silver badge

    Does anyone have a link to ...

    ... the MCS-4 collection discrete components schematic?

    I built one once, with my daughter, about 25 years ago ... A couple of my nieces & nephews are showing signs of interest in this field.

  15. MJI Silver badge

    Giant Vic 20 next

    Please make the rest of the computer

  16. herman

    Trannies vs Valves

    I'll only be impressed once someone builds a 6502 processor from thermionic valves.

    1. DropBear
      Joke

      Re: Trannies vs Valves

      ...and then you'll demand the electromagnetic relay version, huh?!? We're onto you, you know...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon