{"id":3084,"date":"2025-02-06T09:30:00","date_gmt":"2025-02-06T09:30:00","guid":{"rendered":"https:\/\/andyjohnson.uk\/blog\/?p=3084"},"modified":"2025-02-13T18:26:01","modified_gmt":"2025-02-13T18:26:01","slug":"cpu-journey","status":"publish","type":"post","link":"https:\/\/andyjohnson.uk\/blog\/2025\/02\/06\/cpu-journey\/","title":{"rendered":"CPU Journey"},"content":{"rendered":"\n<p>The <a href=\"https:\/\/en.wikipedia.org\/wiki\/MOS_Technology_6502\">6502<\/a> was the first CPU that I programmed<sup data-fn=\"1104f630-e685-4baa-82c9-eb68c4c1260a\" class=\"fn\"><a href=\"#1104f630-e685-4baa-82c9-eb68c4c1260a\" id=\"1104f630-e685-4baa-82c9-eb68c4c1260a-link\">1<\/a><\/sup> in machine code \u2014 on my Vic-20<sup data-fn=\"18fe43e9-b9f0-4791-82cc-f1083a32b064\" class=\"fn\"><a href=\"#18fe43e9-b9f0-4791-82cc-f1083a32b064\" id=\"18fe43e9-b9f0-4791-82cc-f1083a32b064-link\">2<\/a><\/sup> and on BBC Micros<sup data-fn=\"2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8\" class=\"fn\"><a href=\"#2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8\" id=\"2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8-link\">3<\/a><\/sup> at school, back in the 80s. I wrote a few simple games for the Vic-20, mostly because its limited 3.5Kb memory made it hard to do anything in BASIC. On the BBC Micro I got a bit more ambitious and wrote something that I imagined was like a simple round-robin, cooperative multitasking scheduler. The cassette tapes containing that code will all be somewhere in a landfill site near Hull, whiling-away the time until entropy reduces the bits to noise.<\/p>\n\n\n\n<p>Later I wrote some code for the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Motorola_6809\">Motorola 6809<\/a>. And later still I used <a href=\"https:\/\/en.wikipedia.org\/wiki\/Motorola_68000\">68000<\/a> dev boards as an undergraduate. We had to upload assembly language to an honest-to-god minicomputer to be assembled to machine code before we could find out if the seven-segment LED display would do the right thing, or whatever it was.<\/p>\n\n\n\n<p>(During an intern year at IBM I remember talking to an employee who was writing <a href=\"https:\/\/en.wikipedia.org\/wiki\/IBM_System\/36\">System\/36<\/a> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Microcode\">microcode<\/a> to interface a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Transputer\">transputer<\/a> development board to a <a href=\"https:\/\/en.wikipedia.org\/wiki\/IBM_3090\">3090<\/a> mainframe. Godlike stuff, and way beyond me.)<\/p>\n\n\n\n<p>It&#8217;s been a while now, but I remember feeling that the 68000 was clearly powerful and elegant and a &#8220;proper CPU&#8221;, but also that I had little hope of understanding all the details of its operation. The 6502 was my first, and with hindsight was far less elegant with plenty of warts, but I felt at the time that I understood it pretty well. The 6809 was somewhere in-between, I guess, and a very nice CPU to work with.<\/p>\n\n\n\n<p>As a professional developer I haven&#8217;t had to write a single line of machine code or assembly language these thirty-odd years. Maybe I should be glad. Even now, though, I try to think of computers as physical machines with physical characteristics and limits \u2014 even if the tools and developer experience try to convince me otherwise.<\/p>\n\n\n\n<p>I&#8217;ve never thought about it before today, but I suppose I benefited from that early progression from 6502 to 6809 to 68000<sup data-fn=\"8472e598-f5b7-4e39-8cc5-ccbb2993ebde\" class=\"fn\"><a href=\"#8472e598-f5b7-4e39-8cc5-ccbb2993ebde\" id=\"8472e598-f5b7-4e39-8cc5-ccbb2993ebde-link\">4<\/a><\/sup>. Whether or not it makes sense as a journey nowadays, I couldn&#8217;t say.<\/p>\n\n\n\n<p><\/p>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"1104f630-e685-4baa-82c9-eb68c4c1260a\">It occurs to me that we seldom talk about <em>programming<\/em> <em>computers<\/em> any more. We write code or apps, separated from the hardware. <a href=\"#1104f630-e685-4baa-82c9-eb68c4c1260a-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><li id=\"18fe43e9-b9f0-4791-82cc-f1083a32b064\">Yes, machine code. The Vic-20 didn&#8217;t have a built-in assembler and, while I think I was aware that such as thing could theoretically be obtained somehow, I had no idea how to go about doing that. All I had was a monthly subscription to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Commodore_User\" data-type=\"link\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Commodore_User\">Commodore User magazine<\/a> and my falling-apart copy of the <a href=\"https:\/\/archive.org\/details\/VIC-20ProgrammersReferenceGuide1stEdition6thPrinti\" data-type=\"link\" data-id=\"https:\/\/archive.org\/details\/VIC-20ProgrammersReferenceGuide1stEdition6thPrinti\">Vic 20 Programmers Reference Guide<\/a>. So I wrote-out the assembly language on paper and hand-converted it to machine code. Debugging was even more fun.  <a href=\"#18fe43e9-b9f0-4791-82cc-f1083a32b064-link\" aria-label=\"Jump to footnote reference 2\">\u21a9\ufe0e<\/a><\/li><li id=\"2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8\">BBC Basic had a good, built-in, two-stage assembler. <a href=\"#2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8-link\" aria-label=\"Jump to footnote reference 3\">\u21a9\ufe0e<\/a><\/li><li id=\"8472e598-f5b7-4e39-8cc5-ccbb2993ebde\">I never got on with the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Zilog_Z80\">Z80<\/a>: that brash upstart \/s <a href=\"#8472e598-f5b7-4e39-8cc5-ccbb2993ebde-link\" aria-label=\"Jump to footnote reference 4\">\u21a9\ufe0e<\/a><\/li><\/ol>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The 6502 was the first CPU that I programmed in machine code \u2014 on my Vic-20 and on BBC Micros at school, back in the 80s. I wrote a few simple games for the Vic-20, mostly because its limited 3.5Kb memory made it hard to do anything in BASIC. On the BBC Micro I got &hellip; <a href=\"https:\/\/andyjohnson.uk\/blog\/2025\/02\/06\/cpu-journey\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;CPU Journey&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"[{\"content\":\"It occurs to me that we seldom talk about <em>programming<\/em> <em>computers<\/em> any more. We write code or apps, separated from the hardware.\",\"id\":\"1104f630-e685-4baa-82c9-eb68c4c1260a\"},{\"content\":\"Yes, machine code. The Vic-20 didn't have a built-in assembler and, while I think I was aware that such as thing could theoretically be obtained somehow, I had no idea how to go about doing that. All I had was a monthly subscription to <a href=\\\"https:\/\/en.wikipedia.org\/wiki\/Commodore_User\\\" data-type=\\\"link\\\" data-id=\\\"https:\/\/en.wikipedia.org\/wiki\/Commodore_User\\\">Commodore User magazine<\/a> and my falling-apart copy of the <a href=\\\"https:\/\/archive.org\/details\/VIC-20ProgrammersReferenceGuide1stEdition6thPrinti\\\" data-type=\\\"link\\\" data-id=\\\"https:\/\/archive.org\/details\/VIC-20ProgrammersReferenceGuide1stEdition6thPrinti\\\">Vic 20 Programmers Reference Guide<\/a>. So I wrote-out the assembly language on paper and hand-converted it to machine code. Debugging was even more fun. \",\"id\":\"18fe43e9-b9f0-4791-82cc-f1083a32b064\"},{\"content\":\"BBC Basic had a good, built-in, two-stage assembler.\",\"id\":\"2a4fc2ba-cab2-4c5b-ba77-cb6c2b4cddf8\"},{\"content\":\"I never got on with the <a href=\\\"https:\/\/en.wikipedia.org\/wiki\/Zilog_Z80\\\">Z80<\/a>: that brash upstart \/s\",\"id\":\"8472e598-f5b7-4e39-8cc5-ccbb2993ebde\"}]"},"categories":[6,62,16],"tags":[71,73,70,72],"class_list":["post-3084","post","type-post","status-publish","format-standard","hentry","category-development","category-programming","category-technology","tag-assembly-language","tag-bbc-micro","tag-machine-code","tag-vic-20"],"_links":{"self":[{"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/posts\/3084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/comments?post=3084"}],"version-history":[{"count":9,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/posts\/3084\/revisions"}],"predecessor-version":[{"id":3093,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/posts\/3084\/revisions\/3093"}],"wp:attachment":[{"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/media?parent=3084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/categories?post=3084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andyjohnson.uk\/blog\/wp-json\/wp\/v2\/tags?post=3084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}