{"id":86,"date":"2015-05-12T16:17:44","date_gmt":"2015-05-12T15:17:44","guid":{"rendered":"http:\/\/blog.nothinguntoward.eu\/?p=86"},"modified":"2015-05-12T16:28:37","modified_gmt":"2015-05-12T15:28:37","slug":"reading-bbc-roms-with-an-mbed","status":"publish","type":"post","link":"https:\/\/nothinguntoward.eu\/?p=86","title":{"rendered":"Reading BBC ROMs with an mbed"},"content":{"rendered":"<p>A quick post this time. I&#8217;ve had an mbed (LPC1768) lying around for ages which I&#8217;d never gotten around to doing anything more than blinking an LED with, and I also &#8212; for reasons too boring to go in to here &#8212; have some BBC computer ROMs which I don&#8217;t know much about. I was interested to know what was on them though, so I&#8217;m just going to say a little bit about how I used the mbed to read them.<\/p>\n<p><a href=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90031.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90031-300x200.jpg\" alt=\"IMG_9003\" width=\"300\" height=\"200\" class=\"aligncenter size-medium wp-image-103\" srcset=\"https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90031-300x200.jpg 300w, https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90031-1024x683.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The ACORNOS and ACORNBASIC ROMs look legit, but as for the others&#8230; they appear to be <a href=\"https:\/\/en.wikipedia.org\/wiki\/EPROM\" target=\"_blank\">EPROMs<\/a>. These are chips which could be electrically written, and erased using UV light. To prevent accidental erasure you had to put a sticker over the window on the chip! I wonder if this could be an early case of <a href=\"https:\/\/www.youtube.com\/watch?v=up863eQKGUI\" target=\"_blank\">pirated software<\/a>? Or maybe it was common for software to be distributed on EPROMs? Since this is from over a decade before I was even born, I&#8217;m not really sure!<\/p>\n<p>The ROMs were all of different part numbers but the first one I picked out was a <a href=\"http:\/\/www.jaapsch.net\/psion\/pdffiles\/Eprom016k_datasheet_27C128.pdf\" target=\"_blank\">27C128<\/a> so I put together a reader on breadboard built around this. I figured the other chips must be all pin compatible anyway and a quick google for datasheets confirmed this. The circuit is super-simple: just connecting the chip to the 5v supply rails, pulling WE high (it&#8217;s an active low line), and connecting the data, address, CE and OE lines to the mbed&#8217;s GPIOs. I used all but one of the GPIOs. Cutting and stripping all of the wires was very tedious! The ROM chips need a 5v supply but have an input logic high level according to the datasheet of 2v. The mbed uses 3.3v logic but its inputs are 5v tolerant so it looks like we&#8217;re on to a winner.<\/p>\n<p>I don&#8217;t use breadboard much so I only had one reel of solid core wire to hand. I hope you like green!<\/p>\n<p><a href=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90051.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90051-300x200.jpg\" alt=\"IMG_9005\" width=\"300\" height=\"200\" class=\"aligncenter size-medium wp-image-104\" srcset=\"https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90051-300x200.jpg 300w, https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/IMG_90051-1024x683.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Next step was writing software. The way to read the chip is summarised by the read waveforms from the datasheet:<br \/>\n<a href=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/readwaveforms.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-88\" src=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/readwaveforms.png\" alt=\"readwaveforms\" width=\"630\" height=\"405\" srcset=\"https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/readwaveforms.png 630w, https:\/\/nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/readwaveforms-300x193.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Essentially, you set the data address on the address bus, clock OE and CE low (they&#8217;re active-low lines), wait at least some minimum delay then read the data off the output bus. Afterwards, you clock OE and CE back high (in fact, I think you can leave one low all the time but I didn&#8217;t bother) and wait for the output to go back to tristate mode before repeating for the next word. The datasheet allowed ~250ns delays but just to be safe I used 1\u00b5s. Probably a good idea to allow for chips with different minimum timings anyway. Plus it would turn out later that the serial transfer is the bottleneck, rather than reading the chip.<\/p>\n<p>Aside from that, the only thing to say about <a href=\"https:\/\/developer.mbed.org\/users\/alecjw\/code\/chip_reader\/\" target=\"_blank\">the code<\/a> is that transferring the data to the computer over serial behaved a bit strangely. If I used Serial.putc() or Serial.printf(&#8220;%c&#8221;) on the data, I&#8217;d end up short of the expected 16KiB at the PC end. But if I used Serial.printf(&#8220;%d\\n&#8221;), I got exactly the 16384 lines I expected. So instead of spending ages trying to debug this, I opted to use the decimal ASCII transfer and convert at the PC end.<\/p>\n<p>The chip contents were just grabbed using a pipe:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"> $ pv -s 56000 &gt; romcontents-decimal<\/pre>\n<p>This gave a fairly useless decimal output (example from the ACORNOS ROM):<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">76\r\n31\r\n128\r\n76\r\n233\r\n188\r\n64\r\n14\r\n0\r\n66<\/pre>\n<p>&#8230;etc etc.<\/p>\n<p>So I threw together a quick bit of python to convert from the decimal ASCII to the raw binary:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#!\/usr\/bin\/env python3\r\nimport fileinput,struct,sys\r\nfor line in fileinput.input():\r\n\tthisnum=int(line)\r\n\tthisbyte=struct.pack('B',thisnum)\r\n\tsys.stdout.buffer.write(thisbyte)<\/pre>\n<p>Piping the decimal through this gave the raw ROM contents &#8211; exactly 16KiB! This could be viewed with hexdump. Here&#8217;s a couple of examples:<br \/>\n<small><\/small><\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">alex@Apollo:~\/bbcroms$ hd graphics-bin |head\r\n00000000  00 00 00 4c 49 80 82 21  a0 47 52 41 50 48 49 43  |...LI..!.GRAPHIC|\r\n00000010  53 20 45 58 54 45 4e 53  49 4f 4e 20 00 31 2e 30  |S EXTENSION .1.0|\r\n00000020  32 00 28 43 29 31 39 38  33 20 43 4f 4d 50 55 54  |2.(C)1983 COMPUT|\r\n00000030  45 52 20 43 4f 4e 43 45  50 54 53 2d 50 61 75 6c  |ER CONCEPTS-Paul|\r\n00000040  20 48 69 73 63 6f 63 6b  a1 08 2c 80 02 30 13 c9  | Hiscock..,..0..|\r\n00000050  02 d0 11 2c cb 0c 10 08  98 9d f0 0d 8d f0 0c c8  |...,............|\r\n00000060  a9 02 28 60 48 8e df 0c  8a 48 98 48 ba bd 03 01  |..(`H....H.H....|<\/pre>\n<p>&nbsp;<\/p>\n<p><small><\/small><br \/>\nMost of the ROMs had some plaintext descriptor telling you the software and its version.<\/p>\n<p>This segment from AcornOS is quite interesting &#8211; a few familiar names here!<br \/>\n<small><\/small><\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">00003bf0  91 4c f4 ff 20 3a 53 45  54 53 44 46 20 4c 44 41  |.L.. :SETSDF LDA|\r\n00003c00  bb c0 28 43 29 20 31 39  38 31 20 41 63 6f 72 6e  |..(C) 1981 Acorn|\r\n00003c10  20 43 6f 6d 70 75 74 65  72 73 20 4c 69 6d 69 74  | Computers Limit|\r\n00003c20  65 64 2e 54 68 61 6e 6b  73 20 61 72 65 20 65 78  |ed.Thanks are ex|\r\n00003c30  74 65 6e 64 65 64 20 74  6f 20 74 68 65 20 66 6f  |tended to the fo|\r\n00003c40  6c 6c 6f 77 69 6e 67 20  70 65 6f 70 6c 65 2c 20  |llowing people, |\r\n00003c50  63 6f 6d 70 61 6e 69 65  73 20 61 6e 64 20 6c 6f  |companies and lo|\r\n00003c60  63 61 74 69 6f 6e 73 2c  20 63 6f 6e 74 72 69 62  |cations, contrib|\r\n00003c70  75 74 6f 72 73 20 28 61  6d 6f 6e 67 20 6f 74 68  |utors (among oth|\r\n00003c80  65 72 73 20 74 6f 6f 20  6e 75 6d 65 72 6f 75 73  |ers too numerous|\r\n00003c90  20 74 6f 20 6d 65 6e 74  69 6f 6e 29 20 74 6f 20  | to mention) to |\r\n00003ca0  74 68 65 20 64 65 76 65  6c 6f 70 6d 65 6e 74 20  |the development |\r\n00003cb0  6f 66 20 74 68 65 20 42  42 43 20 43 6f 6d 70 75  |of the BBC Compu|\r\n00003cc0  74 65 72 3a 44 61 76 69  64 20 41 6c 6c 65 6e 2c  |ter:David Allen,|\r\n00003cd0  42 6f 62 20 41 75 73 74  69 6e 2c 52 61 6d 20 42  |Bob Austin,Ram B|\r\n00003ce0  61 6e 6e 65 72 6a 65 65  2c 50 61 75 6c 20 42 6f  |annerjee,Paul Bo|\r\n00003cf0  6e 64 2c 41 6c 6c 65 6e  20 42 6f 6f 74 68 72 6f  |nd,Allen Boothro|\r\n00003d00  79 64 2c 43 61 6d 62 72  69 64 67 65 2c 43 6c 65  |yd,Cambridge,Cle|\r\n00003d10  61 72 74 6f 6e 65 2c 4a  6f 68 6e 20 43 6f 6c 6c  |artone,John Coll|\r\n00003d20  2c 43 6f 6d 70 75 74 65  72 20 4c 61 62 6f 72 61  |,Computer Labora|\r\n00003d30  74 6f 72 79 2c 43 68 72  69 73 20 43 75 72 72 79  |tory,Chris Curry|\r\n00003d40  2c 44 65 73 69 67 6e 65  72 73 20 6f 66 20 74 68  |,Designers of th|\r\n00003d50  65 20 36 35 30 32 2c 4a  65 72 65 6d 79 20 44 69  |e 6502,Jeremy Di|\r\n00003d60  6f 6e 2c 54 69 6d 20 44  6f 62 73 6f 6e 2c 4a 6f  |on,Tim Dobson,Jo|\r\n00003d70  65 20 44 75 6e 6e 2c 50  61 75 6c 20 46 61 72 72  |e Dunn,Paul Farr|\r\n00003d80  65 6c 6c 2c 46 65 72 72  61 6e 74 69 2c 53 74 65  |ell,Ferranti,Ste|\r\n00003d90  76 65 20 46 75 72 62 65  72 2c 4a 6f 6e 20 47 69  |ve Furber,Jon Gi|\r\n00003da0  62 62 6f 6e 73 2c 4c 61  77 72 65 6e 63 65 20 48  |bbons,Lawrence H|\r\n00003db0  61 72 64 77 69 63 6b 2c  44 79 6c 61 6e 20 48 61  |ardwick,Dylan Ha|\r\n00003dc0  72 72 69 73 2c 48 65 72  6d 61 6e 6e 20 48 61 75  |rris,Hermann Hau|\r\n00003dd0  73 65 72 2c 48 69 74 61  63 68 69 2c 41 6e 64 79  |ser,Hitachi,Andy|\r\n00003de0  20 48 6f 70 70 65 72 2c  49 43 4c 2c 4d 61 72 74  | Hopper,ICL,Mart|\r\n00003df0  69 6e 20 4a 61 63 6b 73  6f 6e 2c 42 72 69 61 6e  |in Jackson,Brian|\r\n00003e00  20 4a 6f 6e 65 73 2c 43  68 72 69 73 20 4a 6f 72  | Jones,Chris Jor|\r\n00003e10  64 61 6e 2c 44 61 76 69  64 20 4b 69 6e 67 2c 44  |dan,David King,D|\r\n00003e20  61 76 69 64 20 4b 69 74  73 6f 6e 2c 50 61 75 6c  |avid Kitson,Paul|\r\n00003e30  20 4b 72 69 77 61 63 7a  65 6b 2c 50 65 74 65 72  | Kriwaczek,Peter|\r\n00003e40  20 4d 69 6c 6c 65 72 2c  41 72 74 68 75 72 20 4e  | Miller,Arthur N|\r\n00003e50  6f 72 6d 61 6e 2c 47 6c  79 6e 20 50 68 69 6c 6c  |orman,Glyn Phill|\r\n00003e60  69 70 73 2c 4d 69 6b 65  20 50 72 65 65 73 2c 4a  |ips,Mike Prees,J|\r\n00003e70  6f 68 6e 20 52 61 64 63  6c 69 66 66 65 2c 50 65  |ohn Radcliffe,Pe|\r\n00003e80  74 65 72 20 52 6f 62 69  6e 73 6f 6e 2c 52 69 63  |ter Robinson,Ric|\r\n00003e90  68 61 72 64 20 52 75 73  73 65 6c 6c 2c 4b 69 6d  |hard Russell,Kim|\r\n00003ea0  20 53 70 65 6e 63 65 2d  4a 6f 6e 65 73 2c 47 72  | Spence-Jones,Gr|\r\n00003eb0  61 68 61 6d 20 54 65 62  62 79 2c 43 68 72 69 73  |aham Tebby,Chris|\r\n00003ec0  20 54 75 72 6e 65 72 2c  41 64 72 69 61 6e 20 57  | Turner,Adrian W|\r\n00003ed0  61 72 6e 65 72 2c 57 69  6c 62 65 72 66 6f 72 63  |arner,Wilberforc|\r\n00003ee0  65 20 52 6f 61 64 2c 52  6f 67 65 72 20 57 69 6c  |e Road,Roger Wil|\r\n00003ef0  73 6f 6e 2c 41 6c 61 6e  20 57 72 69 67 68 74 2e  |son,Alan Wright.|<\/pre>\n<p>In case the contents of these ROMs are useful to anyone, here&#8217;s a <a href=\"http:\/\/blog.nothinguntoward.eu\/wp-content\/uploads\/2015\/05\/bbcroms.tar.gz\">tarball<\/a> of all of them. It contains:<\/p>\n<ul>\n<li>ACORNBASIC, unknown version, 1981<\/li>\n<li>ACORNOS 032 (?) 12-Aug-1981<\/li>\n<li>MOS+ 1.15, 3-May-1988<\/li>\n<li>DFS 2.26, 1985<\/li>\n<li>Computer Concepts Graphics Extension 1.02, 1983<\/li>\n<\/ul>\n<p>Since I have no use for these chips, I&#8217;m probably going to donate them to the <a href=\"http:\/\/www.computinghistory.org.uk\/\" target=\"_blank\">Centre for Computing History<\/a>. Check them out if you&#8217;re in Cambridge!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A quick post this time. I&#8217;ve had an mbed (LPC1768) lying around for ages which I&#8217;d never gotten around to doing anything more than blinking an LED with, and I also &#8212; for reasons too boring to go in to here &#8212; have some BBC computer ROMs which I don&#8217;t know much about. I was [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=86"}],"version-history":[{"count":13,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":105,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions\/105"}],"wp:attachment":[{"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nothinguntoward.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}