 We will continue. I'm Ben Dewkes. I work for a company called Cove Paint but that's not really important for this presentation. I'm going to go through a little bit about some old computer system that I used to have... Yn ymwneud, yw'n gwneud yw'n gweithio'i gwaith ar CC bys A4. Mae'r ysgolwch ac mae'r hyn yn ei ddod yn gweithio'n gweithio'r cyfrifau gyda'r ymddangos yn ei ddod yn ymddangos. Yn ymwneud, yw'n gweithio'r ysgolwch. Rwy'n gweithio'n gweithio'n gweithio, ac mae'n gweithio'n gweithio'n gweithio'n gweithio'n gweithio'n gweithio. Prun fyddwyd... Ika bryd effeithio'n trash unemployed i'r mwyaf mewn llwi ffawr ar cwrwpm dressingol, byddwn i ddilidion a wahanol i'ch cabb ran chi oherwydd yn weithio... Fe foresee'r ysgrif hon... sefydli'n amser hwg gyda chi. Fe wnaeth unig ar y gweithio'n rhaid mewn iawn, i'n s знаком na siwr ein resistance Verse 64. Roedd hyn hyn hefyd ddim yn anggorerrydd ar적io ac ar gyfer mynd i chi. terminellwch. Ychydig wych chi haeth 20 springwch o Ron. 5,5 kg o ram. I've missed out a half on this. That was about $299 when it was released. I think it's about €700-800 nowadays. So it wasn't exactly cheap for selling that thing. In any case one of the first computers I had, obviously I didn't get it new, I've got mine second hand, because I really... Iwn gwaith i'r un o rhai hwn ffordd. Dw i dweud, yn ceisio'n credu weithio gweithiinfod Jeu, oeddwn eich digud yn teithio, a dwi wedi weithio eich sefyll â'r gwrdd. Cywb ceisio'n gwasanaeth Rham 16. Dwi gweithio'r siwr yn ddiwg ddechuno'n gweithio'r ddweud. Rhaid i'r ffordd o hynny o un ffordd i'r rhaid i'r gweithio'r sefyll. I think a free killer bike ram expansion, I really love that because whilst it says five and a half K of ram about three K by three kilobytes that is available to the user for programming by default, the rest is used by the screen and the operating system so there wasn't really much much chance for writing your own code and because of the limitations lot of the games would come on cartridges which would fit in to the slot which was like this edge connector that I'm assuming most people are familiar with. So why does this talk exist? Well I said earlier this was my second ever computer and I was browsing around this board and I came across this upgrade and I was thinking do I have enough information from this to work out how it worked? Because I was actually slightly interested in what was going on. I thought this was actually simple and I'm going to go through some of the technology involved in the next few slides which might explain to people who don't know about the details of the hardware what was going on. There's two types of ram from this sort of era. There's the static and dynamic ram so nowadays there's pretty much now dynamic because that's the stuff that's one but in this space most of the expansions use the static ram and this one from looking at the picture was using dynamic ram. Nice thinking. That circuit looks a bit too simple and I'll go through. So I'll say two types of the ram. So a dynamic ram was a bit faster but it comes with a couple of downsides. The address bus is multiplex so you have to give it address in two parts whereas SRAM just had a standard address bus so you just gave it the address. And I read and write. Dynamic ram requires a refresh so every in this case it's 128 rows requires every single row to be accessed within a 60, sorry, a four millisecond window otherwise the contents of the ram will start decaying. Now the bit here that I think made the DRAM more interesting to manufacturers is it was actually cheaper. Now I haven't got exact prices from this point in time but it's about four or five times cheaper to go with the DRAM and when you're talking about what was about 50 or $60 worth of memory spending that money on making it simpler. But adding extra components around it was worth it. I say this is sort of a state machine of how you go about a DRAM access. I'll explain a bit more about that. But this is obviously this is a bit more complicated than simple logic decode that was used on static ram. So the VIC-20 has a rear expansion port which is where this cartridge plugs in. It's a really simple extension of the 6502 CPU main bus. It brings out the eight data lines and 13 of the 16 address. You get the read and write, there's some pre-decoded chip selects because they'd already done some of the work for you of working out which areas were being accessed. A CPU clock which is running at about one megahertz. It varied slightly depending whether you had a Palo NTSC version because they used the video reference to divide down for the CPU reference clock because they were trying to make a very cheap machine. And there's a few other things like the soft and hard interrupt. Now, unlike the Z80, the 6502 doesn't have an inbuilt refresh. At least with the Z80, there was actually some help for building DRAM based systems where they had a CPU refresh in there. But it's a basic parallel bus in this diagram. This is a simplified timing diagram. You get an address set up during the low cycle of the clock. You get some data roughly in the high cycle and by the time it's ended this, it's expected the data to be valid for read or it's been written for the right. Now, as I say, it's about one megahertz in this. So we're about talking about 1000 nanoseconds for a cycle and going with how the DRAM would work is that you start with the row address of the row you want and that's sampled roughly on the active edge of the RAZ signal. Column address is again on the active edge of the column address. And then at some point pretty soon after you either read or write the data. And again, just below this is a refresh cycle where all you need to do is just give the DRAM the row address. So that's a little bit of an introduction about how DRAM works. Let's go back to what I was thinking when I saw the picture. So I'm thinking actually there's probably enough information from just looking at the picture to tell me roughly what's going on. I say it's all pretty much standard logic gates. We're not talking any sort of FPGA type stuff that wasn't available back then. The best you'd find is programmable logic arrays that were fairly simple. You're talking and or gates probably 14 cells. And we're talking and we thought there's definitely no PLL in this because if you're doing a state machine you often for modern FPGA would require PLL to get your 8 or 16 times clock and there's definitely no room for that. That's just a quick list of what there is there. I'm not going to go through it too much. There is a counter. So I'm thinking that the first point the counter is probably the refresh counter. So I've already got some clues what's going on. And there's some MUX chips that select one of two inputs. So I'm thinking wonderfully drawn diagram. The probably the dress is coming in. The first MUX would probably select whether I'm taking the row or the column. And there's probably another select for what I'm doing for the refresh and that gets presented to the DRAM. Now I'm still not sure how on earth they're actually working out when they can refresh because usually you would hold off and access do your refresh and then let the processor back. So I was reading through the data sheets and I came to realisation. The refresh cycle is only 400 nanoseconds. I have a 500 nanosecond inactive window on the bus cycle because it's not faster. It's not the fastest 602 you could get. You could just refresh when it's not doing access. This would simplify the state machine. The problem with that is that you're going to use a bit more power. But when each of the two DRAM chips that are on the board are drawing 26 milliamps in refresh and a normal VIC-20 is drawing about 16 watts of power anyway, the size is not really caring too much about the power. So I've driven the new state machine so I know I'm now working out that there's a probably clock high for an access, clock low to a refresh. That will simplify my thing. Now I'm just going to skip. I did a drop some schematics thinking this is now a thought experiment for me. So what would I do next? I could just leave this alone. No, I go on eBay. So the first start of this madness is that I actually buy one. I find one on eBay. I spend about 30 euros. Take it out of its cartridge and I'll show you later. I've got it here. And I take photo and this is the first stage or actually a full reverse engineering of this sort of thing. I got a photo of this and I've got a photo of the underside of the board now. So pretty much, unfortunately, you can't really see on this projector, but you've got two DRAM chips, the counter, there's got this state, the two to one muxes for the address and some logic. So I can photo. I can use that to look at the board. I can use a multimeter to check whether a pin is connected to another pin or not. I'm fairly obviously the power pins are all connected. But what do I also see? There's actually, but hidden behind the capacitor that was in the picture here, there's another capacitor. There's actually more capacitors than I thought. Now coming back to the fact of state machines, actually resistors and capacitors make a fairly good delay. If you've done electronics, you can use them to make delays. So I can actually do a state machine by a series delays. So I'm fairly sure that actually this is going to work quite nicely and I've got a really good idea now how this works. I can actually draw a schematic and I can use the tools I have to actually trace out and verify what I've done. So this is the underside of the board. And this is the next part of the technical reverse engineering is that I can draw so I can flip it over. I can draw with Marker on it saying what everything is, the edge connector. I actually work out definitely how it is all connected. So I've actually gone a step further now. So I actually used Eagle for this. I'm very sorry. It's not an open source product. I had a few problems getting my Eagle to key card conversion working that I've been working on. I will actually be moving to this. So I drew it out. I had five boards made and it actually works. I was quite impressed with that. You can very much, if you can just see down there, there is a piece of bodge wire. Somehow I missed the CPU reading right line, which is just fairly blooming obviously. Now I would have brought my VIC-20 along with me, but unfortunately I don't have a power supply for European plugs and I wasn't sure how easy it was to get through customs. So anyway, so I've actually built this and it does work as standard. So I'm quite amazed that something that simple can actually make a very good implementation of a state machine. Now it works very well because the VIC-20 is slower. If it had been faster, you couldn't have got the refresh into the inactive part of the cycle. So I was almost right on my first go. I mean, if I'd had that extra component, I'd have probably got the initial circuit right, but as I say, I've got the refresh. Thank you. I say I'm probably going to actually get through my time slot a little bit faster than I intended because I forgot that my original presentation actually had a demo in it. So, as I might have said, I, going back to a little earlier statement, I know that this board works. Now I ended up actually buying two VIC-20s to go with this. So this little adventure in reverse engineering, which started out as a thought experiment, has ended up actually costing me about 100 euros of money in buying comparts because of course the first one turned up and didn't work. So I got another one to get the other one working. So I've gone through some of the techniques I did use now. I had an actual thought of, which would have actually saved me some time and money in the long term. I could have actually just simulated this. I was actually so intent on actually building a physical implementation that I forgot that simulators exist. Now, back when I started, you'd pay good money for something which would do this, but this is actually a open source directly, but this is circuit.js and you just put your circuit in here and you can put stuff in and it will just show you a waveform. And it's like, yep, that worked. So that was the thought which would save me some time. So going forwards, I might try and optimize the design, but I think it's actually with the amount of components there, it's fairly optimal already. Now, I was thinking that I said earlier that PLLs weren't really around. Now, there were some chips that you could use for a PLL and you could probably actually build a very simple logic-based state machine. Whether that's worth doing or not is another point of, am I wasting my time on this? So, to wrap up this presentation, I'm putting the project files for the PCB, the presentation, the simulation, and the other little things I've used to produce the presentation. I'm going to put those up on a GitHub, which I've put URL I put there. I say there's some very nice stuff like the waveforms I've all been done in Wavedron, which is another way of just taking some text and producing a nice diagram out of it. And at that point, thank you very much all for attending. Now, I think I've got plenty of time for questions for about 10 minutes. The question is about putting a USB logic analyzer on the machine and using that to work out what's going on. Now, I did think about that, but that would have required me to have upfront bought the machine, which I wasn't intending on doing in the first place. This was basically, I found this one evening and I thought, well, that looks simple. How is this working? So, yes, nowadays a simple logic analyzer would have probably given me the same thing. I could have probably got a lot of information out of attaching a logic analyzer to the real thing and actually looking at it. But as soon as you've got that, it's fairly easy with these sort of systems to actually just trace it because it's two layer PCBs. You don't have anything really hidden within the board with a lot of complex modern systems. You might have six, eight, 10 layers and once a signal vanishes into the board, you've lost it. The fixing board is a switchable 16K RAM module. I saw you replace the original switches for the 3K or 8K or 16K RAM with jumpers. Could you please, maybe if we have time enough, elaborate a bit more how is this scheme working and why is the 3K? Okay, so there's a couple of questions here. Firstly about how the module that I've chosen has a certain amount of selection for the memory and where it says it's 16K, there's a 3K module mode. So the first easy bit is I couldn't get the switches, so I just used jump headers to replace them. Now, the memory map of the VIC-20 already has five kilobytes of memory in it. There's two 8K selectable areas and the jumpers just change which of the chip select lines are fed into the logic of the Vixen. So depending on which one you select, you may just end up overlapping an original 8K section. However, some of the original programs you get would assume you'd extend that extra three kilobytes because that's part of what you could get. And some of the really small expansions were simply three 1K SRAMs that would sit there, so that's why there's an option. So basically the 16 kilobytes is two 8K blocks and some of that, depending on which way the switches are selected, could overlap an existing RAM area. So at the back there. No, so the question was, there's a technology between the simple RC and a PLL using a delay line. Now, I didn't actually think about using delay lines because I haven't actually come across those very much in any of the standard computing stuff. So I think delay lines are technology I've not seen used, so I don't know about. But it's a very interesting idea. It's like how there are a number of ways of doing this and which one would have been possible or cost effective. So, OK, so yes. So the comment is that these have been used on a certain PC expansion and motherboards between like the 8595. Now that is about the timeframe we are talking about. I can't remember exactly when this cartridge was first put in. I think the copyright on mine was 82. And I have actually bought something to show people. So here is the original. That's its boxed. And this is what we're looking at. Now, I was trying to get some of the values of the components on here and I've actually destroyed one of the capacitors in doing it. So it's actually got a replacement on there. It turns out that. So it's. So I think that it was that was a two to three hundred three point three nano farad, I think. So. But yeah, these boards are not exactly easy to deal with. Because they're they're not actually very desperately well made. And they certainly don't have any nice features like solder masks. Anyway, that was. I can show people that close up if they want to look at the later. I say this has got a slightly different switch on it. And I say, and this is the one I actually built. I say, I don't know why not find it up with five of them. So. Yes. So I mean the question is why only 16 kilobytes? So I mean I was just recreating this pretty much chip for chip. These are for 16 K by four DRAM chips. So I'd need more chips to get more memory. If I put 32 kilobytes on the expansion, I'd fill the pretty much the entire spare memory map of the victory. Anything more. And I'm looking into having to do memory paging. And that is getting to the point of there's probably even weirder ways that I could build memory expansions at this point. And this this way is getting to the point that is probably not worth my time. Yeah, I'm just curious. You said the victory was your second computer. What was your first? So the question is the victory was my second. So I had a ZX81 as my first. And if anybody remembers the ZX81, that had even worse RAM expansions because those would actually fall off the back of the computer. So the victory at least had a proper case. So, yeah, this, I mean, this is probably spent, I suppose it's been about 10, 12 days of my time from last year on this. I don't know whether this is really a good use of my time. It certainly made an interesting talk, I hope. You've got two VIC-20s out of it. Well, yeah, I've actually repaired. So the comment was I've got two VIC-20s out of this. Now, one VIC-20 was probably one VIC-20 more than I needed. I've actually repaired the second one as well, because I could probably settle that back on. It turned out the VIC chip on it had died, so that's why I wasn't getting anything out of it. But that was another evening of why on earth is this not working? And there was a sidetrack of probing through finding out what was wrong. And the fact that China still sells VIC-20 chips. So, a question is, did I have any problems getting any of the old chips now? It turns out that eBay is a fount of all knowledge or surprise on this. And there are people still selling these DRAM chips. I think it was cost me about three euros for a pack of three euros each for a pack of four. I say there's still people with stocks of these things sitting around. I don't know if they have the same date code. This is an AT4, 45. Do both of them have the same date code? So the question was, do both the DRAM chips have the same date code? And yes, actually they do. They are fake. Probably fake, yeah. Who knows? I mean, who cares if it works? They rub ink out of it and make the same date code. Because those are not making for 20 or 30 years. So there is no way that it is all stock anymore. Well, it could because it is actually, the date code is 84. So that's 19, that's 19. But yeah, the comment was that it could be, the stock could well be fake. Who knows? I think there was a lot in Russia that had big stock money. And they are selling them out. Yeah. So I think the question, I don't know if it's going to be reliable or not, but I think, as I say, AliExpress on China is still selling the video interface chip that's used in the centre of the Vic as a new old stock. And I was quite surprised. It's like you just go online, order it and a month later a chip turns up. Anyway, well I hope that this was interesting to people. Thank you for attending.