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. Pascal Monett Silver badge
    Thumb Up

    Because why not indeed

    I salute the dedication and sheer obsessiveness that went into this project. It's harmless, it's useless, it might not even run BASIC.

    In a word : it's art. Geek art.

    Well done, chaps.

    1. Michael Strorm

      Re: Because why not indeed

      Pffffffft.... newfangled surface-mount components. Lightweights. (*)

      Let me know when they implement it using valves.

      Actually, no, don't bother. Let me know when they implement a two billion transistor Core i7 processor using valves. I'd like to see that :-)

      FWIW, I did try to work out how much space would be required for that many valves, and the ballpark figure was ludicrous. Having thought it out again, I realised that if each valve took up 4 x 4 x 5 cm (including spacing), and there were just 1 billion (10^9) of them, that'd take a total volume of 40 x 40 x 50 *metres*, something like 3 tightly-packed 50m high office blocks. Double that for two billion.

      (*) No, not really, actually it's quite impressive (even if it's not the first time I've seen something like this done).

      1. Named coward

        Re: Because why not indeed

        40x40x50 is almost 32 olympic-sized swimming pools. I bet you'd need even more space to cool things down (unless you submerge it in said swimming pools)

      2. Arthur the cat Silver badge

        Re: Because why not indeed

        I did try to work out how much space would be required for that many valves ... that'd take a total volume of 40 x 40 x 50 *metres*, something like 3 tightly-packed 50m high office blocks

        That's Asimov's Multivac, or at least an early prototype.

      3. khjohansen

        Re: Michael Strorm & herman (thermionic valves)

        "The Manchester Mk.1 ... contained 4,050 valves and had a power consumption of 25 kilowatts." (!!11!)

        If this is not troubling enough, ask nearest greybeard about MTBF for valves.

        1. Anonymous Coward
          Anonymous Coward

          Re: Michael Strorm & herman (thermionic valves)

          The MTBF for valves can be pretty good if the heater current can be ramped up and down rather than 6.3 volts hitting a cold, low resistance filament. This is one reason why recent cars have a single headlamp bulb filament and a little motor to switch between main and dip; the avoidance of on and off switching increases bulb life and reduces warranty costs.

          The discovery that lots of valves could be reliable if the heaters were treated gently was made by Tommy Flowers, and helped make Colossus possible. the Americans made the same discovery more or less independently.

        2. Trevor Gale

          Re: Michael Strorm & herman (thermionic valves)

          25kW seems a bit much - if it was this then it equates to around 6.172W per valves, and typically that'll be 1.89W for the heaters (filaments) and 4.282W for the logic per valve. So it'd be 7.654kW total for heaters, and 17.346kW for logic. Assuming +170V as +ve rail for valve anodes, that'd make around 25mA anode current for a triode (and I'm assuming heaters/filaments at 6.3V, 0.3A for the rest) all as averages.

          You could do logic switching using triode valves with a lot less than 25mA anode current - 2.5mA would be more typical. Remember, a power output valve might handle 6 - 9W in a typical valved radio of the time, and for the logic levels we don't need that power. So we'd be looking at, say, 0.43W for logic and 1.89W for heaters giving a total of 2.32W per valve total, requiring 9.4kW for all the valves...

          Admittedly I'm looking at more recent technology here, like double-triodes on a B9A base such as the ECC83 and its data from around 1953, but even the earlier (double-)triodes in octal bases (physically larger devices) would fall in a similar ball-park.

          1. Loud Speaker

            Re: Michael Strorm & herman (thermionic valves)

            While you are mostly correct, there are several losses you forget: the power supplies were all linear, and were probably less than 50% efficient after you consider the use of rectifier diodes (probably also thermionic) the smoothing done with RC networks, and the fact that there would need to be numerous RC decoupling networks in the HT lines. Bias chains can't be totally neglected. AC into RC circuits swinging >60V for fast logic signals eats a fair bit of power.

            Also, many early valves were not 300mA heater current, and some were not 6.3V either. Quite a lot of the logic was done with pentodes, and there would have been significant screen current in some of them.

            Don't forget the peripherals: I suspect the mercury delay line drivers needed significant power, and there would have been other power circuits too - how much power does a high speed paper tape punch draw?

            Presumably "das blinken lights" were all neons, and probably only 1 mA each, but if they were incandescent, thats another story.

            Incidentally, the EDSAC circuit shown on Youtube has wired-or logic - this may be the first example of it.

            I doubt that efficiency was the highest priority.

      4. Dr Patrick J R Harkin

        Re: Because why not indeed

        Valves? I spit on valves.

        I want to see it done using dominoes.

      5. PNGuinn

        Re: Because why not indeed @ Michael Strorm

        I presume you specced that using 6SN7s not those nasty all glass B9A based thingies?

        OK, I'm a bit rusty with all this new technology. 6SN7 = ECC32?? And I've no idea off hand what the Septic is for B9A. Bit before my time .....

      6. JulieM Silver badge

        Re: Because why not indeed

        That number of valves is in the region of the total lifetime output of the Mullard works in Blackburn ..... Remember, there were just 5 (or maybe 8*) valves in most MW / LW radios.

        * The frequency changer actually has two electrode structures -- a triode and a hexode -- in the same envelope; and the detector / preamp has two diodes and a triode. Adding FM introduces another double triode, and replaces the double-diode triode with a triple-diode triode.

  2. Tchou

    Might be enough to run Pong however or a simple PacMan.

    1. Steve Crook

      There's probably someone already porting


    2. Charles 9 Silver badge

      I don't think Pong needed a CPU to run. As for Pac-Man, I think it's just a touch out of reach unless someone perhaps made a tigher-coded version that ran on a B&W monitor. A better target I think would be Space Invaders.

      1. elaar

        Wozniak designed Pong to run on just 30 TTL chips, so it's "easily" possible. Pacman uses a Z80@2mhz, but needs quite a bit of RAM.

        Space Invaders would still be incredibly hard (unless it was dumbed down a lot). The game needed more juice than a 8080 could deliver, so required further bitshifter ICs on the daughterboard.

        Breakout runs just on TTLs, infact I'm sure someone has already replicated that game with transistors.

  3. A Non e-mouse Silver badge

    It's not that big...

    This guy's going even bigger: The CPU takes up his entire living room!

    1. Mike 125

      Re: It's not that big...

      >>takes up his entire living room!

      ...not to mention life.

      >>just over 11 transistors per RAM bit

      Discrete - that is seriously impressive.

      Good Luck to all obsessive hobbyists - that's how the ball gets rolling.

      1. energystar

        Re: It's not that big...

        People like James Newman are the real McCoy.

        We are just f_(*!ng pretenders...

  4. Haku

    Stupid masochists.

    *goes back to cutting his 1/2 acre lawn with the nail clippers in his coat pocket*

    1. Dave 126 Silver badge

      Re: Stupid masochists.

      Oooh, you don't want to have a good idea. My grandfather had a good idea once and his toes fell off.


      Yeah, he thought it would be a good idea to trim his toenails with a scythe.

      - Mr Ploppy, Blackadder II

      1. Roo

        Re: Stupid masochists.

        "Oooh, you don't want to have a good idea. My grandfather had a good idea once and his toes fell off."

        Love the quote...

        However, my inner pedant can't help but observe that you are more likely to cut off your fingers while sharpening the scythe or someone else's feet when you are using it. The shape & balance of a usable scythe makes it pretty tricky to get anywhere near your toenails. :)

        1. Anonymous Coward
          Anonymous Coward

          Re: Stupid masochists.

          "that you are more likely to cut off your fingers while sharpening the scythe"

          Too true. After moving to the country my grandfather observed some men in the adjacent field using scythes. They didn't seem to be getting on too well so he asked them if he could have a look and told them the blades needed sharpening. Which he proceeded to do with a grinder and whetsone. One of them promptly cut his finger on the blade and I noticed they were proceeding with somewhat more care than before.

          1. Roo

            Re: Stupid masochists.

            "After moving to the country my grandfather observed some men in the adjacent field using scythes. They didn't seem to be getting on too well so he asked them if he could have a look and told them the blades needed sharpening"

            Soldiering on with a blunt scythe is pointless. I found that stopping every 3-4 metres (or more when doing something like brambles), giving the (rusty) blade a wipe down with a drop of oil and a whetstone worked a treat - nothing intensive, just four or so careful swipes with the stone and move on making sure to count your fingers each time. ;)

            If you are selecting a scythe you should be looking to have the thing feel pretty much balanced (ie: NOT twisting in your grip) with the blade level with the ground along it's whole length, a bit of momentum and good balance goes a long way with a scythe, so don't be tempted to choose a lightweight poorly balanced scythe if you want to do real work with it. Quality scythes will have adjustable handles, once you've got them set correctly the scythe will feel like a natural extension of your arms.

            In terms of the action most of the power should come from your arms & shoulders, so it should be a fairly smooth dragging motion keeping the blade level over the ground through the whole stroke, with just enough momentum to keep the scythe moving but not enough to cause you to strain to slow it down and bring it back for the next stroke. Take care not to "swing" the scythe because you won't cut evenly (if at all) and the chances are you'll do yourself an injury in the process.

            Everything I know about scything stuff I discovered from trial, error and talking to an old geezer who used to mow hayfields with them - if folks know better I'd be interested to hear. :)

            1. allthecoolshortnamesweretaken

              Re: Stupid masochists / @Roo

              Yep, that's the way to do it. My granddad used to do it that way, but despite all his efforts I never got the hang of it.

              And you really have to be very, very carefull with a scythe, especially when sharpening it, I've seen some nasty scars on several guys. Slices through tendons like butter.

              Heck, why do you think DEATH carries a scythe?

      2. EddieD

        Re: Stupid masochists.

        Double pedant alert: It was Nursy, talking to the queen. Series 2, episode 5 "Beer"

        1. Dave 126 Silver badge

          Re: Stupid masochists.

          I think you may be right, EddieD. My confusion may stem from Mr Ploppy featuring in the episode 'Head', in which other body parts were lopped off.

        2. Wilseus

          Re: Stupid masochists.

          Triple pedant alert: It was his foot that fell off, not just his toes :)

          1. EddieD

            Re: Stupid masochists.

            Pendants rule OK: Or, to be more precise, exhibit certain characteristics normally observed in those in authority.

            1. Anonymous Coward
              Anonymous Coward

              Re: Stupid masochists.

              pe(n)dants also spot extra N's .....

  5. Anonymous Coward

    [Runs to get 6502 machine code book from shelf and start compiling programs]

    yes, I do still own the book

    yes, I am that old.

    1. maffski

      To keep to scale you'll need to finder a printer that can produce your listing at 10CPM (Characters Per Mile).

    2. Sorry that handle is already taken. Silver badge

      I'm not old enough to have programmed for the 650x family but I do still have my Atari 2600 (6507).

    3. Anonymous Coward
      Anonymous Coward

      Hah, I still have a device with a 6302 and it still works, although I would have to refresh my memory to program it in machine language (usually snippets to access my own electronics in the interface slot, because I was in the habit of cooking up all sorts of stuff).

      You may have guessed it: it's a PSION Organiser II - the last one I still have. I used to have a bunch of them, but I gave them away to musea. Due to some ill advised packing during a move I lost the comms link, but I no longer own anything with a serial port so I'd be hard pressed to use it (leaving aside that I'd have to install DOS on a VM that is hardened enough to withstand the way PSION wrote DOS code - it's the only code I recall busting out of protected mode and hang multitaskers).

      Anyway, the silly thing still works quite happily. And I may even have the 6302 data book. When I started coding on it I had no idea what machine language was, but I worked it out myself, that was part of the fun of it all. An update in those days meant physically cutting the ROMs off the board and soldering ones with new firmware in place, something I have done many, many times :).

      Those were the days (etc etc).

      1. MacroRodent Silver badge


        but I no longer own anything with a serial port so I'd be hard pressed to use it

        There are USB to serial adapters, they don't cost too much.

      2. Esme

        @AC - I'm very jealous - easily my favourite piece of portable computing tech ever, the Psion II. I've never been so organised as when I had one o'them. Hmm.. might see if I can find a working one next payday...

      3. energystar

        "...An update in those days meant physically cutting the ROMs off the board and soldering ones with new firmware in place, something I have done many, many times :).

        Those were the days (etc etc)."

        Miserable state of the [ACTUAL] firmware.

        1. Anonymous Coward
          Anonymous Coward

          Miserable state of the [ACTUAL] firmware.

          Ah, but you're used to current tech - you'd lob a flash chip on the board and be done with it. In the 1980's (can't believe that's already some good 30 years ago), updating of especially portable firmware based devices was actually not something you did very often - a patch was a rare and momentous event because it meant the company in question had something wrong. It was not the occasionally rather shameful routine it now is for some companies.

          On the PSION Organiser II, the extra issue was that EPROMS (at the time the only persistent reprogrammable chip) were typically a lot bigger and needed extra support circuitry to program so that wouldn't fit in the case.

          Basically, the whole PDA idea (which is now part of what you carry around in your smartphone) started with that silly device, and it was (and is) fantastically functional for its simplicity. I actually came across a Palm pilot too a few days ago as well when I was digging for some electronics, but to me that was better done by Sony with the Sony Clie NX70, also because that was pretty much the first time a PDA and WiFi were combined.

    4. DrBobK

      Me too - I can still probably write the stuff (6502 ASM) without a manual.

      1. Anonymous Coward
        Anonymous Coward

        I can still probably write the stuff (6502 ASM) without a manual

        Assembler? Luxury! (thanks for setting that one up :) ).

        I only learned later about assembler - I was hand-assembling opcodes and getting them to work which is hard work if you start from a position of not knowing much about how CPUs actually work.

        But, as I said, that was the fun of it - it's the kind of puzzle that the analytical part of my brain seems to live for. That, and shredding marketing guff with facts (I don't get invited to product launches much anymore :) ).

        1. jeffdyer

          I wrote quite a few little programs for my C64 and VIC20 using DATA statements, you converted all your OP codes into decimal and put them in a data array, then had a mini BASIC program that called SYS something which ran your data as machine code. The speed difference between a character bouncing around the screen in assembler compared with C= BASIC was amazing.

          1. Charles 9 Silver badge

            I was actually dabbling in 6510 assembler using the C-128's ML Monitor. It was perhaps my first real trip into machine language and assembler and I actually did some pretty decent things with it. It was something I didn't think I would use again when I then went to Intel 80486 assembler in the mid 90's and actually got the hang of it pretty quickly after skimming an x86 assembler guide.

        2. Trevor Gale

          Hand-assembled Code

          Some 35 years ago I had two (yes, 2!) PDP-8/e computers with a tape drive, disk drive (cabinet one, all of 10 MEGAwords!), printer (line), and a couple serial lines - one a VDU terminal and the other an ASR33 teletype - as a home system!

          I already knew assembler, for the 6502 and the 6800-series processors, but I had no OS or anything for the PDP's. So I set about writing one, so that I could end up using these machines for processing radio propagation data from regular observations. No development tools, just the PDP-8/e manuals and codes.

          Fisrt I had to write a bit of code that would take serial characters as octal input (it is a 12-bit machine) and write this word into successive memory locations - this was done using the front-panel switches, word by word.

          Then it was time to write some code that would allow me to write whole segments of octal from the keyboard of the serial device I chose, usually the VDU terminal. The next bit of octal 'code' was a routing that would take that segment and write it to the magtape as a record, skipping till after a 'long gap' on the tape so I could eventually load back these segments one at a time how I wanted.

          Once that was done the 'semi-serious' work began - first of this was actually to *write an assembler*, which for this machines' instruction set and layout was not too complicated. This assembler, a 'program', was written to a new magtape and also to two copies (play safe here!) of punched-paper-tape.

          After that, the assembler was the main tool to write I/O routines for the magtape (proper, better), the disk (elementary), and the printer. Once that was completed the 'really serious' work began, I wrote an executive, then a filing system of my own, then an operating system on top of those.

          Finally I had a running system with storage volumes (floppy disk never got added but all principles were in place and it didn't make any difference anyway), and with interfaces to assignable peripherals (e.g. equivalents of mount and unmount and different peripheral classes and parameters) - and I did go on to write some of the programs I ran to do the original work I wanted to do.

          Eventually the "common" P.C. came along and was easy to interface with the radio hardware I used, plus it used a LOT less A.C. power than the roomfull of computer gear that was the PDP's, so eventually I got rid of most all of that equipment as there's a limit to how much one can keep, at least in the 'sane' world.

          Still, even as I look back all those years, I'm sure that I learned quite a lot and gained a valuable insight into what certain colleagues of mine have to do in their work and where the 'trip-up-points' can be lying around; in any event it was definitely a memorable experience at the raw end!!!

      2. Steve Graham

        I can still write the stuff without an assembler.

    5. Haku

      I dabbled in programming on my BBC Micro back in the 80s, mostly BASIC but did get into some of assembly for its speed, and the best book I ever owned for it was I think 'Advanced Programming For The BBC Micro' (going by memory but I do still have it in a drawer with the BBC Master Compact), which I bought for £2.49 from Toys'R'Us.

    6. Anonymous Coward
      Anonymous Coward

      I can remember the pain of 6502 machine code programming whilst doing my BTEC Engineering back in 1988

      1. Mark York 3 Silver badge

        BTEC Engineering

        That takes me back to Swindon College 1988 & the tutor we dubbed "Chernobyl" with his two fixations 6800 processors & wibbly wobbly timey wimey flashback............

        About 1 hour doing labwork on a Wednesday morning & 1pm - 4pm with him lecturing (us trying to stay awake with various degrees of success, we quickly learned that the afternoons (invariably pissing down outside & lulling our senses further toward 40 winks) were a write off) & then somehow he would be triggered by a question\scenario (heaven help us if it was before mid afternoon break) & fixate for the rest of the afternoon on partial address decoding moving us further towards the land of nod or wishing for death.

        I have no idea what I really learned or how I managed to pass that subject (Along with "Dangermouse" & his version of teaching analogue electronics IV by throwing extremely advanced mathematics at us from 9am - 12pm for 3 hours Friday mornings).

      2. John 48

        I remember writing the processor!

        Finishing my engineering course at university in '88, we had to team up and produce a "project" that represented a chunk of the final grade. The girl who would one day become SWMBO and I, decided that a software emulation of a 6502 might be fun. Managed to do that, plus a small machine language monitor program with inline assembly and disassembly, and a small set of emulated system calls for IO etc. It was quite fun keying in some 6502 assembler, and having it run on a Prime multi user mini computer or on an early PC. ISTR even running it on an emulated DOS machine on my Amiga once just to see how many layers of emulation one could run (at an effective clock speed of some 10kHz probably!)

        1. David Nash

          Re: I remember writing the processor!

          Hey we did that too, for a final year project, would have been 1990. Ran on a Macintosh and had simulated IO and interrupts. In the real world I was a Z80 man though.

          Those were the days. The closest I get to assembler now is watching OpenSSL build in a cmd window.

    7. BongoJoe

      [Runs to get 6502 machine code book from shelf and start compiling programs]

      yes, I do still own the book

      yes, I am that old.

      The 6502 cookbook was one of my best thumbed tomes when at polytechnic (before the days when it became a CostaMacDonaldPseudoUniversity) as I my thesis was written entirely in 6502 machine code (no assembler available, let alone BASIC).

    8. VeganVegan

      Yup, check,

      All 5 of my 6502 assembly language books are still up there on my top shelf.


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

Biting the hand that feeds IT © 1998–2020