Sunday, 26 January 2025

Mini VIC Revisited Part 3

Originally posted to Patreon, October 2024.

The PCBs arrived a while ago, but now is time to assemble a Mini VIC.

I have not made many yellow PCBs before, but this just seemed an appropriate colour match.

I put together the parts required. This is a new kit, so may need further tweaking. Lots of similar resistor values, 220Ω, 240Ω, 470Ω, 510Ω, etc. can these be optimised?

I did consider packing multiple kits, but I think a one off will do for now. (2025 update - still tweaking things - almost there)

That all went together without a problem. The edge connector for the cartridge port went in easily. On the previous board, I had the holes too small, so it was quite a job to finagle all the pins into the socket at the same time.

I don't like the way the sockets look when there is a mix of 14 and 16 pin chips, but when the chips are installed, or they are soldered direct they all align nicely as the 14 and 16 pin IC bodies are the same sice. I definitely need sockets in this case, there are likely to be some bodge wires appearing (2025 update oh yes, so many wires....)

Actually, there was one problem - the power switch.

I had carefully searched the datasheets for the exact type to match the original (top).

The one bottom left is the closest match. The right hand one was more easily available, but the rocker is too big for the case.

However, it appears there is one difference I had missed. The footprint is the same, but the pins at the front that are for support only are different.

The current type have a sort of ledge, which causes the switch to sit a few mm off the board.

The originals just had a pin, so it sat flat, something like this.

I have looked around and it seems those are the only type available now. I should be able to get around this by changing those pads to slots to allow the switch to sit flat as required.

For the moment, I attacked the metalwork with the side cutters.

That fits much better.

You will also notice above the switch there are extra pads around the power connector.

This is to allow a 2.1mm DC jack to be used instead of the 7 pin DIN.

I know the VIC20CR / C64 7 pin DIN power supplies are known to be unreliable, but I am not actually connecting to the 5V which can fail, I am using only the 9V AC, which is just a transformer winding, so should be fine.

Actually, it will probably be better than a modern switch mode 9V or 12V supply, and is a good way to use a power supply you wouldn't normally touch with a barge pole, and also one that goes perfectly with the machine.

I think this is the first time I have put a fuse on one of my designs, just staying true to the original, I guess they thought it was necessary.

Time to install all the ICs.

Well almost all of them. All the ones fitted are modern, still in production, low power, high speed CMOS chips.

The VIC chip is the one part I do not have a suitable replacement for yet, but let's test everything else before committing to trying with a precious VIC chip.

5V power is good, reset is there. It's about 2 seconds, maybe a bit long, I might reduce that a but by changing the resistor value.

The clock is a bit rubbish though.

Not sure what is going on there. I had a few issues with the scope / probes here. Both clock signals look awful, but they are different shapes. The trouble is when I swapped pins or entire scope probes, the top trace still showed the spiky stair version, and the other was showing something more rounded?

They have both been adjusted on the probe compensation pin. Something to look at another day, hopefully it will be good enough.

Time to try it out.

(imagine a picture of a black screen here)

The video output is disappointing though, black screen. Sync but no signal.

So the VIC chip is running, but has not been initialised.

I had set this board up to work with either a W65C02S or a MOS 6502. I wasn't sure if that was the issue, so I fitted the jumper (to get around them not being quite pin compatible) and a 1983 6502.

And that made no difference.

(another black screen picture)

I tried various things with the clocks (more in the next post), but finally gave up for the day.

...... time passes ......

The next morning, I was planning to write some test ROMs to toggle bits on the userport and things like that. But first, I decided to check the board over to make sure I hadn't made any stupid mistakes, like the wrong chip, or a bent pin or ....

.... a missed solder joint.

That would do it.

Let's try again.

Yay! A ready prompt!

10 PRINT tested

OK. So far so good. The video output is not great, and there may be a glitch in the colour RAM, but let's skip over that for the moment.

When I started out with projects like this, I like to set a goal. For the Minstrel 3, this was being able to play 3D Monster Maze. For the Mini VIC, it was loading Cheese and Onion from the Penultimate and it playing properly with the wider screen etc.

Nice, the cartridge port works, as does Cheese and Onion, sound and the joystick.

Rude not to have a go at EMH whilst I am here, make sure it's horizon trick was working.

A bit more testing, and the Penultimate passed a self test,

The Mini VIC passed the dead test. I will need to dig out the Commodore Diag cartridge and test harness and give this a full test later on, but so far so good.

The video output is not perfect, bit of a blue line to the left of the white.

The board is setup for Composite and S Video output, so I will give that a go when I make up the appropriate leads. I suspect the video circuit needs a bit of tweaking with values etc. I think I based it more on the one from the C64C, I might have to reconsider that.

There have been a few glitches in the colour RAM. I think may be related to the clocks. (the first sign of the mods there)

I thought it could have just been a flaky VIC chip, so I fitted a ZIF socket and went through my spares, but they were all basically the same (the working ones at least).

I also tried an NTSC VIC chip to see if that was any different. The video was clearer, no blue line, but still the occasional glitch with the colour RAM.

The plan initially is to go for a VIC20 replacement board.

I would like to also do a version with built in keyboard, but I think I should wait to see what happens regarding alternatives to the VIC chip.

Let's see how it fits in a VIC20 case.

Nice.

All looks good on the side as well.

Looks rather splendid, doesn't it.


Adverts

The Mini VIC kits are not available yet, but there are still Minstrel 2 and Minstrel 3 kits available.

You can now get a Minstrel 2 kit for $200. 1980s pricing.

Or you can get a Minstrel 3 kit for $200

Patreon

You can support me via Patreon, and get access to advance previews of development logs on new projects and behind the scenes updates. These are often in more detail than I can fit in here, and some of these posts contain bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.

Sunday, 19 January 2025

Mini VIC Revisited Part 2

In the last post I finished laying out and routing the PCB for the new version of the Mini VIC. I like to leave things for a couple of days if I can, and then go back and check over.

I wanted to check the board dimensions, and a couple of things on the actual schematic.

In order to check the board dimensions, I dug out on old VIC20-CR board. This was one that came in a lot of broken Commodore stuff from ebay. It had either been used as a spares board, or the previous owner had been trying to track down a fault or maybe even trying to turn it into a board with all sockets.

Lots of chips had been removed (badly), and the board to be damaged in several places, so it was now committed to being a parts board. It was still useful as I was able to steal several of the remaining bits myself to save other boards.

Not sure the technique they had been using to remove parts, but some things like the BASIC ROM socket still has all the solder in the holes. Was it "flood the back with molten solder and lever the chip from the front"? I dread to think.

There was a leg of the 7406 still hanging on before I cleaned it up, but several tracks, pads and through hole plating has been lost.

Anyway, it turned out to be ideal in this situation as I was able to remove most of the parts from the ends of the boards.

It actually cleaned up quite well (I should have taken a photo before I started), so I may go on to remove all of the remaining parts and clean up all the solder to make a blank (if damaged) VIC20 PCB.

The dimensions of the PCB had been worked out using a ruler and a micrometer, and a bit of guesswork.

The plan, now I had the board bared back, was to compare this to the 1:1 scale printouts of the PCB.

Here I could see that most of the things were in the right place, but it needed a tweak here and there.


The next task was going back over the schematic to make sure everything was correct.

I had to double check a few things that didn't seem right, such as the Colour RAM chip select line. It comes from the output of a 138, is then inverted, and inverted again. Seems odd to add two unnecessary steps?

On the actual VIC20 schematics, this is split over 3 pages, so I had to pull all of those together to confirm I had actually redrawn the correct things.

It starts on page 2.

Then jumps to page 1.

And finally page 3.

And that does indeed seem to match what I have drawn.

What is going on here is the two modes of operation. In one mode, the 6502 is driving the bus. Ding ding, fares please.

When VIC_PΦ1 is low, the signals on the left of the LS245 are connected to the ones on the right, which means CPU_A8 drives VIC_A8 etc. (the VIC should have stopped driving the bus itself at that point).

This means the inverted /Colour RAM signal is passed through and inverted again to generate /Colour_RAM_CS.

When VIC_PΦ1 is high. The buffers on the 245 are disabled, and the pullup resistor comes into action, making the /Colour_RAM_CS signal go low.

This means the colour RAM chip is always enabled when the VIC is in charge, and only enabled when block 4 is being accessed when the 6502 is in charge.

It is presumably done that way as a pull up is easier to deal with for 74LS logic, or the extra delay was needed, or maybe the CS line needed to be buffered if the inputs on the 2114 RAM chip would be a heavy load?

Either way, it shouldn't be a problem with 74HC series logic, but I may as well leave it like that for now.


The other things I wanted to check was the Character ROM. It isn't clear from the schematic what is going on. All the ones I could find show pins 20 and 21 being marked as "CS1" and "CS2". This would imply active high chip select inputs, both have to be high to enable the chip.

It says 2532, which is an EPROM, but I have only ever seen mask ROMs installed (901460-03).

The 2532 has those pins as marked as PD/PGM and VPP, so they would need to be low and high respectively to enable read mode.

I had initially taken them at their word, and used a NAND gate to convert the two active high signals to give a single active low enable, which is required for the modern EPROM I am using. It wasn't on the original, but since I was using a spare 3 input NAND gate, I also added an active high read signal so it would only be enabled for reads.

But which is it? High + High or Low + High?

Well, I worked through the memory maps to see what it should be. The VIC chip has a 14 bit address bus (and a 12 bit databus), and has several of windows into the full 6502 address bus.

Looking at that table, it makes more sense of the values you enter when setting the locations of RAM, colour RAM and character RAM when configuring the VIC chip at $9005.

You can even see why when you set the character memory to $1C00 (on the 6502 side), you get 128 UDGs in RAM and then the first 128 characters of the font ROM as it loops back around on the VIC side from $3C00-$3FFF to $0000-$03FF.

What is block 0 ($0000-1FFF) to the 6502, is actually $2000-3FFF to the VIC, and block 4 is $8000-9FFF to the 6502 and $0000-$1FFF to the VIC. This means that the character ROM should only be enabled when the VIC_A13 and VIC_A12 are both low. (which is neither of the cases implied by the schematic above).

OK, so I need an OR gate.

There aren't any of those in the design so far, but there are 4 NOR gates. 3 of those are employed to do things with the clocks and read/write signals.

The forth does like it could possibly be stolen.

This is the select lines for the block 0 8K of RAM from $0000-1FFF, including the external 3K on the cartridge port and the internal 5K, which those AND gates now combine to provide on a single RAM chip.

Two of the three enable inputs of the 138 are used. E3 needs to be high to enable any of the outputs. In CPU mode, this is connected to /BLK4 (see above), so will be high when block 0 is to be accessed. In VIC mode, this is VIC_A13. It will be high when the VIC is reading $2000-3FFF in it's address space, which is this block of RAM.

The second input /E1 needs to be low to enable the RAM. For that to be low, SΦ1 needs to be high (the VIC is active) or /BLK0 needs to be low (CPU is accessing block 0).

I wonder......

Here I have used the spare element of the 245 to in theory do the same job. When the VIC is in operation, the 245 is disabled, so the pulldown resistor pulls /E1 low, enabling the chip as required. In CPU mode, that pin is connected to /BLK0, so will be low when that is being accessed and high other times, again as required.

That frees up a NOR gate and an inverter, and as if by magic, that makes an OR gate.

Great, that's all sorted.

But wait, let's just have a look at all of the NOR gates again.

Now every single NOR gate is being followed by an inverter. So I could just replace all of those with OR gates?

I can then get rid of the NOR gates altogether, and swap the 74HC02 for a 74HC32 (which annoyingly has a different pinout). That will leave 4 spare inverters.

But wait!

The other two inverters were sort of pointlessly inverting the colour RAM signal twice, if I got rid of those, I could get rid of the whole 74HC04 chip.

With the HC logic, a pulldown resistor should be fine. So that saves me a whole chip. Nice.


OK, hold on a moment, lots of changes going on here. Maybe a should rein things back a little. This is something I can test when I have a working board on my bench. It may be that some of those multi-chip operations were necessary for timing reasons, so I am a little hesitant to make that much of a change.

I had a look at it again, and realised I had missed an obvious solution.

Chip enable and output enable do slightly different things, chip enable does a lot more during programming. In normal use it is basically a built in OR gate. Both inputs have to be low in order to read the chip. Which as I have already worked out, is exactly what I need.

That's a fairly minimal change, and actually frees up a 3 input NAND gate. I lose the gating with the read signal, but that was never there on the original anyway. (I will try to add that back in the final design)


A couple of tweaks to the schematic and a couple of tweaks to some mounting holes and that is ready (again).

At that point, I ordered the PCBs. Tune into part 3 to see how they came out.


Adverts

You can now get a ZX80 kit for $200.

Sorry, right price, wrong advert.

You can now get a Minstrel 2 kit for $200. 1980s pricing.

Or you can get a Minstrel 3 kit for $200

Patreon

You can support me via Patreon, and get access to advance previews of development logs on new projects and behind the scenes updates. These are often in more detail than I can fit in here, and some of these posts contain bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.