Sunday 19 February 2012

Bubble Bobble running now

So, this is an awesome game and I thought it'd be as good as any to test out my FPGA board... actually, better than most because I don't currently emulate disk IO... :)

Sadly, it kept crashing on the intro screen... it's supposed to play music and carry on, but it just sat there with ghosts moving around but nothing much happening. I eventually tracked it down to when I'd modified the WAIT_n logic the other day... and IN r,(C) worked fine but IN A,(n) returned n instead of the data. And it just so happens that bb4cpc uses that method for determining the vblank. Interestingly, it only actually used that for music playback.

Anyway, bb4cpc running on my CPC FPGA board:

I also decided to register a domain name as things are progressing well now. Shorty, catchy, to the point: :)

Wednesday 8 February 2012

Instruction timings take 2, also did I mention my video works?

This news is about a week old now, I just never got round to posting it. My new SCART interface is perfect. Rock solid, awesome, etc... And yet, I only discovered that by accident!

So, if you remember back a week, you'll remember I'd built a new SCART board with transistors to provide a higher current, etc. Well, this board features a socket instead of being wired up directly to a SCART lead. As a result, I wired it up wrongly and when I swapped the composite over to composite out instead of composite in, the jittery sync problem disappeared. I discovered by chance, when I was trying to put the audio on the correct pins that as soon as I connected them up, the picture was jittery and stable when i disconnected them. After a bit of investigation, I realised that the tape input on my new board was left floating and I was outputting that bit to the speaker resulting in random white noise. That explained the rubbish sound quality, but not the jittery video sync... well, that seems to just be because I'm pumping 3.3V down the audio pins in the scart cable and it's either overloading the TV or inducing stray pulses on the composite line. I've not reworked that circuit yet to reduce the voltage, instead just stopped tape input noise being sent to the speakers (much like a 464plus).

Anyway, I then discovered quite by accident that if I use my gold plated SCART lead direct into the TV, the picture is perfect. Stunningly good, in fact, but any combination of the other leads or SCART box I have makes it look speckly. Obviously, a good quality SCART cable does matter!

And so, to tonight's news...

I realised a while ago that the instruction timings weren't actually correct. It turns out the T80 soft core asserts IORQ on the rising edge of T2, not after it as the Z80 manual suggests. I guess this is reasonable, but means that my logic sees IORQ a cycle earlier than it should and so IO instructions weren't getting stretched enough in all cases. I finally made a workaround tonight, and the results seem pretty close to the software emulators now:

Basically, the image shows the colour palette is only out by 3us... this could be fixed by a simple delay, but I just want to make sure that everything else is timed correctly first!