 Good afternoon ladies and gentlemen. Welcome to the next talk of the afternoon. This is Hacking the ZX Spectrum with Ben Heck. Can I ask that when we get to the Q&A session at the end, if you do have a question would you be able to come forward to the mic at the front as we're running a bit short on radio mic batteries and I'm about to go and try and find some. Thank you. Okay you ready? All right. All right well hello everyone. Thank you for coming to my talk about the ZX Spectrum. Yes. So clearly I'm an American and it's I'm trying really hard to say that correctly so that y'all will accept it. Anyway some history. I'll give you the brief history of myself if you don't know who I am because I don't assume that everyone does. I'm not that egotistical. I'm a hacker and I also do engineering and prototype work usually for video game companies and systems and industry but I also do other things such as a disability controllers for persons that don't have the full facility to play video games and I also have done prototypes for point-of-sale systems and whatnot as well. But what I kind of got started with years ago back in the year 2000 was, oh my laptop made a noise, oh a tablet, was video game consoles and at that time I was a graphic artist you know working nine to five or seven to three or whatever it was and I was always interested in the old video game systems because when I was a kid I had an Atari 800 computer that was actually my first save a computer not the specky so I know strike one but you know I always really like that stuff so when I was older in my 20s I thought okay so now I've got my full-time job blah blah blah working for the man I need a hobby so I didn't get into motorcycles or boats I'm a geek so I was in the computers so I thought okay I think I'll try to take this old Atari 2600 game console and try to shrink it down to make it portable and this was you know 14 years ago there wasn't a whole lot of hacker space movement or any I mean it was it existed obviously but not like it does today so there wasn't as much information on the internet so I kind of had to shotgun a lot of it and you know throw Hail Miri's oh I just used two American analogies sorry but it still worked out pretty well and as the years went by I started doing other things like working with the newer consoles like Xbox 360 making accessibility controllers as I mentioned and various other things so in 2010 we started doing the Ben Heck show named after myself I thought circuit breakers would have been a cooler title but I was overruled ironically it's like no you have to name and have yourself like okay anyway so on element 14's the Ben Heck show if you're not familiar with it it's a well it's now a weekly show and you can get an element 14 in YouTube where we take requests from viewers such as you or future viewers such as those you are like oh this guy is not a complete jerk I think I'll watch the show in the future anyway project ideas like oh you should build this you should build this and this would be a cool project you try to build this and as long as it's reasonable and interesting you know we'll have a go at it because we love new ideas that are fun and challenging and you know look good on camera so I've done projects using most of the old 8-bit computers in the past I'd done you know things of the Atari 800, Commodore 64, Apple II GS and I think that's about it for those computers and one that I was always interested in working with was the ZX Spectrum okay we had this I don't know where it came from like I think someone just gave it to me because it was fairly worthless at least in the states but we had a Timex and Claire which is kind of like the rebadged GIMP import version of it and I was like what is this thing it was I kind of liked how small was I didn't even think it was a real computer to be quite honest sacrilege right and I don't I had that laying around I it probably still like in my parents basement someplace back home but so then once you know I got more into hacking and started like reading more about the computers I'm like oh there's a much better version of the like the fully formed version was the ZX Spectrum with 48k starting at 16 but it basically looked like the same thing and it was a Z80 based system that was pretty interesting I really thought it was cool how small it was so one of our fans in I believe Ireland he I don't know Twittered me is that a verb earlier this year he's like hey I will send you one if you do something cool that which is usually what people say and as long as people want to send me small items that don't take up a lot of room I'm all for it so I'm not quite like Dave Jones when it comes to that I like minimal things yeah then I love getting rid of it like going around the shop yeah goodbye goodbye goodbye goodbye goodbye goodbye goodbye it's really I just like take getting rid of stuff like that anyway so he sent us one and I'm like okay this is really cool the thing is already really small I think it'd be cool to make a really small portable unit of it which I have with me afterwards I know I don't really have any flashy slides because I was too lazy to repair them but afterwards we do a short question answer you want to come up and take a closer look at the specky portable that's that's super cool we can come up here and I have a fireside chat even though there's no fire yeah so I was okay I'm going to start working with us so as far as hacking it I obviously had to learn about the system and you know I obviously knew how the APIC computer architectures typically work the spectrum as I'm sure a lot of you know it was a little different where it had two different I don't want to say two different buses of RAM but kind of two different buses of RAM are how many of you are super familiar with the spectrum or this guy is okay yeah so do you guys actually care about this kind of geeky stuff like this is this is a geeky conference haha I'm gonna bore you with it so the spectrum was supposed obviously it was meant to be cheap and it was spectacularly cheap if you ask me but that's awesome and then I don't just mean the keyboard everything about it was stripped down it had I don't want to know I'm gonna say how much like normally let's say you had like your Apple 2 or your Atari 800 and have like all this RAM expansion you put in in order to address it it would have 74 series logic where it would say okay well if this address line and this address line but not this address line then we'll activate this bank of RAM and so on and so forth and the spectrum had that too it was the old school where you'd have you know nowadays we have one well nowadays it's RAM would be not anywhere near that but it would have something like eight yes eight one-bit RAM chips and that would give you well there was two banks there was a 16k bank and a 32k bank and you had those numbers up and you get your 48k specky and that was kind of interesting how it uses separate banks it kind of reminded me of the Nintendo Entertainment System which had something similar it had a separate bus for its video then for its CPU so what I had to do and this is what is so great about the internet now which I always say in my talks is like you know the greatest things in the slice bread USB is also pretty cool I was able to go online of course there's a world spectrum org and I don't know if this is where I found the schematics from but I definitely I was able to you know obtain the schematics and they had like I think I had like I actually when I built this I used two different sets of schematics in order to compile it so inside of the spectrum to see if I can know this from memory there's a Z80 there's a ULA which is a video chip there's eight RAM chips for the video eight RAM chips for the for the CPU as it were then there's a complex logic chip which is a bunch of 74 series logic pulled into one dip 40 there's a TI chip I don't know if it's TI that does the YUV to over to be pal and then there's a ROM did I get everything anyway I wanted to I didn't want to use that specialized dip 40 what they basically did there is I think if you look at the older schematics like the version 2 schematics in order to do the RAM addressing for the CPU and the ULA I'm just gonna consider them separate things that I believe six different is either six gates or six 74 series logic chips I can't remember but I was like okay it's easier for me to wire in you know six common logic gates that I can get then try to scarf this custom dip 40 chip that they had made for the later revisions like if you look at an older spectrum motherboard where that big dip 40 chip is they'll be actually like for 74 series logic chips instead you like dip 16 chips so I'm like okay I'm going to take this part of these schematics and wire up that and I'm going to take this part of these schematics so basically I kind of combined two different types of schematics and it did work so yay one thing that kind of sucked was the they had like what do they use like five bit address lines so the ULA is actually what makes a spectrum the spectrum most old systems were like that with the Atari 2600 it was the TIA adapter that's what they spent all their money on developing the silicon for that's why they had to sell I'm talking about Atari here that's why they sell their company to Time Warner so they could afford to finish it the other two chips were just off the shelf chips same excuse me same thing with this is a pizza out there it was good same thing with the spectrum basically all off the shelf except for the ULA which I actually don't know what it stands for but it's basically the video chip and thank you that makes sense and I when I as soon as it cracked it open I noticed that was the only socketed chip and they got warm so immediately I'm like oh this thing must have failed a lot but luckily this one didn't fail and we were actually thanks to Chris from Premier Farnell actually sent me an extra one so the original spectrum has been reconstituted so it lives yeah anyway so the big trick was just going through the schematics very carefully and for some reason I just had this death wish to hand wire an 8-bit computer which I'd never actually done before I've always wanted to and then so I don't know if you can see it can you come up with a closer view I put a window in the back of this for two reasons a to show the insane wiring and b to prove that it wasn't like an FPGA emulation of what emulation not with a white word but you know to show that it was real and again we can show this in more detail later but how I did it as far as wiring up this computer so I basically copied the spectrum over but I use the original one as a blueprint and a test bed so to speak I would wire up for instance the Z80 and its RAM and the ROM which is really that's a Z80 computer right there I wired that up here I don't think you can see there's actually two separate circuit boards with space consuming headers although headers are awesome so the top portion is basically just a single board Z80 computer I'm getting good at that yeah and I wired that up I mean okay so to test this I'm going to put it back into its original state as well as I can so I took this and where the header is actually hooked it up to a dip 40 so I took the CPU out of the specie and then I wired that top board into the CPU slot then I removed its RAM and its ROM to see if it would still boot up so I only built one part at a time to mitigate the risk of failure because if you wire up everything I mean I always bring this up to you if you wire up everything then flip the switch and nothing happens where's the problem you never know because you've done all that work and it's like digging for the city of El Dorado to try to find the solution so my hacking advice is build one thing test it build the next thing test it build the next thing test it because then you almost have like an undo button you know it's not like Microsoft Word it's go undo undo undo undo or when you're sitting there trying to compose a tweet and you're spending an hour and you can always just change it you can't do that when you build things in reality obviously so by taking it one step at a time it gives you a better chance of success so I had the ROM which is where the program comes from like you know the basic and whatnot 16k ROM CPU and RAM and then I believe I had an inverter which was needed to do the ROM addressing because if it's read right you have to set the lines once I had that working I had his own board then I came back that into the spectrum okay this part works then the tricky part well more time consuming part was to make the video half of the of the ZX Spectrum project and like I mentioned before the video is really what makes it a ZX Spectrum I mean you could put in a Texas Instrument video chip and it would basically be a Colecovision or an MSX computer as I believe they had on this side of the palm so for that I had to take the precious precious ULA which I've already forgotten the name of that you told me something logic array okay that makes sense and that was having a very clever coloring scheme but I won't bore you with that I'm sure most of you know how that work anyway so on the bottom half of it I made the video portion and it has the ULA and then its RAM and I didn't use the single bit 8 parallel RAM chips I got a modern 32k RAM from on the States Newark slash element 14 and it was pretty simple to hook up but you had to do the oh gosh how does it work the ULA addresses its own RAM using two stages of an address so you have like the first five bits of the address it will load that then it will strobe it then you'll load the next five stages and you can't that doesn't that's not how modern RAM works or at least you know remotely modern RAM oh I think the original RAM wasn't it wasn't static either it was dynamic that's okay because the Z80 sorry Z80 takes care of that hey I'm batting pretty good here so what is it a zebra like if there's a spotted horse or striped horse that's really whatever anyway the Z80 part of it the CPU you can attach RAM to that perfectly normally you know a 16 line I actually was in 16 bits of address it was like 15 is only sees 32k and then you know your eight lines of data oh excuse me pizza was spicy and then you actually combine the data lines with resistors so they could be separated but what's interesting as I went through the schematics and I had to find like the right speed transistors because you can't just take like some I can't remember the number off of a head like you know the bog standard NPN transistor doesn't work I had to find a modern equivalent that was a still a through-hole resistor that I could solder I mean there's some service mode on here but not a whole lot actually there is although well I guess I just contradicted myself you'll see it in person to come up but anyway we had to find a transistor that had the right switching speed because the ULA which I I've heard stands for universal logic array nice it actually drives the CPU which is kind of interesting so this isn't too geeky you know I have I have friends most of my friends are like IT I mean I have a few engineer friends but I even start talking about this and their eyes glaze over and they're like walking dead or something oh yeah we're doing we're doing okay on time excuse me I just completely forgot my train of thought while making up those analogies oh yeah how the clock works yeah so there's a 14 megahertz crystal on there that's divided by two to create the PAL color burst then that's divided by two again to drive the clock of the CPU which is 3.5 megahertz which is actually I believe faster than the Super Nintendo which was didn't have blast processing so what happens is when the ULA is accessing the memory in order to draw the screen which of course it does I would assume 50 times a second it actually prevents the Z80 from accessing the same RAM or even operating so you know you don't have collisions so it was really fun doing all that and then I also I really wanted I thought about does people that have FPGA in implementations of the ULA so get access a drop-in replacement since the ULA is unobtainium as I use that word correctly not like the movie avatar did and so but then I like if I'm gonna put an FPGA in there why don't just the whole system on FPGA that I'm like no I must stand firm I'm gonna plop that ULA in there but I added a heat sink because that sucker got warm actually all told it's only about 400 milliamps which isn't too horrible for an old system and so I did actually rewire the entire analog video circuit so it this is a cheap little backup camera for your car that you can get from Amazon.com it's like 15 US dollars probably like 22 dollars here pounds I'm sorry 22 pound dollars it's the new new year versus currency the dollar pound Euro quid Euro quid sounds like some sort of sea beast that would attack ships it's the Euro quid soon coming to soon to a theater near you anyway so it basically outputs a PAL signal just like it always did in drives this so if you get like a LC nowadays no matter where you get it they usually can take at least pound and TSC if not C cam as well so it actually has a PAL signal on it RGB would be nice but this camera was cheap and it fit and the idea was to make it as small as possible so I did that and yes I guess oh I'm managing to talk quite a bit so I will I will move along that org so in the back here we have two 3.7 volt lithium ion cells and the charger so they get these just fairly generic ones you can get you charge it here there's a power switch which you know that's an improvement on the original is that expector well let's see 10 cents times 6 million is prove bugger that remove everything until it stops working engineering 101 cassette it still uses the cassette we do we did this as a as a as a project on our show and we did it in three our shows every week and we did it in three episodes over the course of this summer so we had June July and August so you know there's only a certain amount of time I had to work on although it was usually more time we had had I had more time I probably would have tried to build my own implementation of what was it called the Ram loader star path multi-face is that it okay so you basically do a RAM dump and you know you could basically dump RAM to SD card and load it back in whatever you have to save state but the tapes kind of quaint too and actually yeah as my talk draws to a close I'll load up something on it for your amusement then down at the bottom I just have a slide switch I don't think you can even get a 16k e prom anymore I always like to say e prom and a prom so I said that wrong I would say a prom so erasable programmable read-only memory not electrically erasable programmable read-only memory it's nice to be so geeky not have to ungeek myself yeah that computer uses the electrical bits that go into the data and that's how it works oh okay I get that now yeah we'll write the article about that so did you ever ever come have conversations with that and you had to be like Sherlock Holmes like you meet someone and you're like well madam I can tell that you know nothing about eight computers but you do know of everything about molecular biology therefore I'm going to say this to you you know you have to kind of edit yourself on the fly what you could talk about but here I can say any sort of geeky crap I want it doesn't matter anyway I'm gonna start a load here la da da da so this is basically just a app you can get off the app store redundant or Android player whatever they call it and it takes the zip files and basically it basically turns this into the world's most complex cassette deck so so I actually have two ROMs on this I put in a 32k app rom which is the ones you use with EVO though it's UVO so it's a one-shot at now so it has on the lower 16k it has the original spectrum ROM and on the upper 16k it has a custom ROM that was on the world spectrum cycle gosh wonderful where you can actually type in keywords you don't have to like do all the you know J for load which makes no sense oh because L is for let it's like on the basic on this you actually have to type let I was like mind blown so I'm gonna do the load command and then it yes it will make the noise manic minor I believe works okay and you can write all the you're ready for this all right this is what you all want to hear right okay the title screen is is titling or whatever so so see see how I'm tapping my finger here I'm not just trying to keep the beat the tablet any excuse to shut off and not run out of batteries because it's an Android device it'll take so if I don't keep tapping it'll like reduce its volume and then yes tape loading error so when it went into a BBC interview and I'm like yes yes yes he probably thought I was a nervous tick but no because last night I was like okay I got to make sure this thing loads in one shot and Clifstein Claire's like never work boy don't do it I kind of picture he's like in this castle like Mrs. Havisham or our citizen Kane who I should know the first name of Charles Foster Kane you know that with like a snow globe the snow globe has a spectrum inside of it of course and then he's like oh I know he's still alive and he'd say something as he dropped it to the floor and black and white anyway it's still loading and then I kind of pictured it like this some this young lad would go there's like you're going to work at that not have a some castle the spectrum castle and he's like yes I will and then he's like what are you doing and there's a fireplace we're still working on the script anyway yeah so it loads just like the original one did I actually had to do a few I couldn't copy the analog audio loading circuit exactly because it didn't quite work with modern I don't want tape deck but modern equipment so I actually had to make a few adjustments the thing I find so amazing about this is the same circuit that makes the beeps and boops the same circuit takes in the audio from your tape deck I mean I guess anything to save a block but I I had to say I know I've said it's kind of cheap but I don't mean that in a derogatory way it's very impressive like so you have like a on your CPU you can access a port which is not necessarily the same thing as a RAM location and usually on those there would be like 255 ports like you know zero zero to ff and you know a lot of computers at all sorts of ports you know parallel ports and like no not the spectrum it had one port FE and it did everything so if you wanted to read the keyboard you would actually you know FE would be the two lower I'm sorry the lower byte and then you'd have the top eight bytes would tell you which keyboard you want row you wanted to scan so you'd actually pulse the address lines to scan the keyboard and then you also use that same bite one of the bits did the beeps and boops all on one bite and if you read it or wrote it it did different things so right now it's reading that location through the ULA to load the tape program which should be done you're gonna hear this really loud music here yeah so yeah look mom I got it to load oh man this is really loud okay so I think we about 15 minutes left so I guess I will answer some questions I'm gonna push this button okay hold on be quiet game okay now I'm gonna pause the game okay there we go okay yeah so I guess some questions the microphone or whatever and then anyone that wants to come up and take a look at it closely is really do so okay so oh oh oh yeah so if you want that's kind of embarrassing isn't it it's like I guess it's me how about this yell really loudly if you have a question about how I did this or why I did this how many hours oh no it's it's fine I'm sorry how many hours did I spend on it oh good okay yeah oh gosh hours it's it wasn't too dear maybe 40 to 50 it's I I don't I don't have a much trouble doing this it's time consuming if anything it it's actually kind of relaxing like if I was 30 years older this would have been a ship and a bottle or something like that but for me it's it's wiring and I always use the it you don't see it anymore but the ultra ATA solid ribbon cable that computers use round about 2002 because it's very thin it's single strand you can do differential signaling with it now like this needs it and so I always go to computer shops and just hoard all the garbage and I call it recycling but it's only way to get that stuff anymore and then I love to use it for this and I also use it when I do timing latency controllers for the video game companies such as a rockstar and whatnot yeah so yeah we have like 15 minutes yeah so any more questions and then we can take a look yes sir I'm sorry I didn't quite get that well I guess we could find one in the field and do a scientific test I'll tell you what though I actually was a little superstitious about this you know I thought maybe we could get some shielding about it I definitely try to keep it away from my legs or whatnot it kind of depends I think some of these images are botched but you have to have the volume like like that's why I brought my tablet I have an Android phone as well but it's even more inconsistent so like if you take one of the tablets you turn it all the way up you have the cable it doesn't actually use the stereo it just uses the left which was you know you know mono originally so I did I've actually even after I finished this on the show I continue to tweak it it's like usually when we get done with the project on the show I'm like goodbye but with this one I really wanted to make sure it was perfect and even like last Sunday I found a loose wire on the RAM I'm like oh my gosh I almost brought this to England like that but so yeah if you can you know what ironically you can keep the 2 gigahertz quad core this awake and not power down it actually loads pretty reliably but again what I have more time I put in an SD loader mouse parts huh so were there were there like super superstitious rituals that you know you all would use where it's like you know you rub sage over it and have a chicken bone and then yeah don't breathe yeah we still have a 14 minute so yeah game for more questions I know you probably all want to see it closer up but no I didn't try to someone has done that actually was that you oh so yeah okay this I'm I don't want to turn off manic minor I'll just let it sit there you know it's completely off-subject but I got that TRS 80 model 100 recently that that white box thing I don't know if you've ever seen that and that thing is awesome like you can turn it off and it has a nice head that'll store the RAM I love that thing that's that's my new toy anyway wait I can remember your question oh yes so I had a couple thoughts someone had written emulation for the ULA using the parallax propeller which I have a lot of those laying around I thought about using that because I was in a bind I thought oh is the ULA toast because you don't know I mean I know the ULA was notoriously you know notoriously bad for breaking probably because it was so warm so it goes back to okay what did I do wrong did I just wire something wrong did I do the video analog circuit wrong because it's digital analog as far as doing it with them discrete logic yes I know I saw someone had this big breadboard they'd done it I mean why would you do that and you could do an FPGA or CPLD yeah but there was a slight moment of panic well not really panic but I'm like oh crap you know I hope I didn't spend a less time wiring then it'll be you know botched but luckily it was alright but if I were to do it again yeah I'd still do it all the original logic but maybe use a surface mount Z80 processor use more surface mount 74 series logic actually make a PCB I know it's weird like well there's like this I don't know I need a term for it maybe you could help me with this it's like the point where like I'll just wire this one prototype by hand how much time that takes or I could have just designed it and had a PCB made because sometimes you think you're gonna save time by wearing it by hand nope you can wait two weeks from China to get the boards and it'd be faster ah yeah so most parts as well and most like oh dear I'm sorry about that yeah we've got about 10 minutes of any more questions or if you want to head up oh yes sir the spectrum had a higher clocks being well it was cheaper this is see I'm giving you a very political answer here because well yeah he added Atari 800 and that thing was a dog compared to either of them so but it was awesome yeah oh yes sir yes that's your other national computer right and it led to the what is but that led to arm so you know it was no small it was no small part of history I mean it was from the great small acorn I like it you're a great oak yeah I don't know if I think I'm trying to get through all the APIC computers I might actually do something with the ST or the Amiga next but I might swing around to the because I mean the spectrum is already pretty obscure outside of London or England so yeah someday maybe again kind of a political answer yes sir so it can load oh yeah yeah okay you're I'm just trying to remember I had to remove a few inline passives I believe there's again this has been about a month or half ago since I did this I'd remove a few inline passes change some pull-ups to be a lower value and that's about it but I was pretty worried but if you just if you just of course it's all surface mount when you all come up and take a look if you just take the schematic at face value yeah it wouldn't load through this but it was basically one of those things where I just move parts until it works go back to that old old dodge yeah because I'm not really that good at analog and more of a digital guy but I was able to power through it yeah any more questions I know you should probably all should come up and take a look that's better than the questions probably but oh yes sir again I didn't really I didn't really have one back in the day so at the moment I like Galaxian because it loads quickly for demonstrations every answer I give you I sound like a politician don't I yeah any more quick questions before we can wrap it up and yes sir it was in my check bag but I had a piece of tape over it so wouldn't actually turn itself on I've actually designed portable 3d printers I did one for printer bot and I've actually taken that and stuck it in the luggage rack and they what did they ask well it was in America it was it was like they're like oh what's that it's a 3d printer oh okay I even had I taped a 3d print to it in case that is okay this is what it does blah blah blah blah and then I got this great photo yeah cuz just randomly taking photos of people on the airplane yeah that's not creepy or anything so I you know I was like I put it in the bin and I even had it measured even it was like the little three-seat across puddle jumper it would still fit which is like 13 inches or 12 no I didn't make it 13 because it's superstition so I made it like 12 and that was a few sets of seats back and then this other guy comes in and he's put he's like giving it like what the heck is that and I'm like oh the surprises yeah okay so no okay well I think you should maybe all come up and take a closer look and if you had any more questions I'll be here obviously holding this thing so thank you for coming