View Full Version : BBC-Micro & Qix?
tcdev
5th February 2008, 11:20 AM
I'm pondering the idea of doing Qix next...
I'd actually start with the BBC-Micro, which uses the same video controller, the Motorola CRTC6845. I'd use the opencores implementation and start with the BBC only to familiarise myself with the required glue logic and also verify functionality of the core itself.
Qix has two 6809s and 64KB of video memory, not to mention 32KB of combined ROM and 4KB of dual-port RAM, if not more. Add a few PIAs into the mix and it's quite a bit of memory and logic. I'd look at synchronising the whole system with a master clock running at a multiple of the video clock, and time-slicing access to a single bank of SRAM.
At least that's the plan after a preliminary look at the MAME driver...
Don't hold your breath! ;)
Chris
5th February 2008, 10:48 PM
If I held my breath every time you suggested a crackpot arcade port, I'd be a deep shade of blue by now.
tcdev
5th February 2008, 10:57 PM
Sort of like the shade of blue I turned waiting for NES sound? ;)
... or external 68K support?
djam
6th February 2008, 05:21 AM
Ask me to do something, I'm sure I can take much longer
then both of you can :|
tcdev
6th February 2008, 11:19 PM
OK, since you're volunteering, we'll put you down for either the Sega Dreamcast or the Nintendo Gamecube core - which would you prefer?
tcdev
7th February 2008, 02:08 AM
It would appear that the BBC micro will be a little more work than I originally estimated. The 6845 does little more than provide video timing and refresh, and in Mode 7 the text display is actually generated by another chip, the SAA5050, for example. At this stage I don't know if the BASIC ROM boots up in mode 7 but I suspect it does?!?
In any case, I've created a project for the P2 target and have technically started on the implementation using the CRTC6845S core from the Japanese Rock-Ola project (which I notice doesn't support reading of the registers via the CPU interface - not sure if that will be a problem).
Fun fun fun...
tcdev
7th February 2008, 02:44 PM
I started on the implementation of the SAA5050 by ripping the character generator ROM data from the MESS driver. Then I realised that getting MODE 7 to work would require a working VIDEO_ULA, CRTC6845 *AND* SAA5050!
So I abandoned the SAA5050 for now, and instead concentrated on getting MODE 6 display to work. This requires 8KB of video memory, minimal functionality in the VIDEO_ULA (basically just serialisation) and CRTC6845 functionality.
Running MESSD, I recorded the values written to the CRTC6845 registers in mode 6 - they were slightly different to the documented values in the Advanced User Guide. I then hard-coded the register values into the 6845 verilog implementation. Ditto for my VIDEO_ULA.
I then took a dump of MODE 6 video memory from a running MESSD image, and seeded the 8KB video memory inside the FPGA with the bitmap data.
The end result is an *almost* correct MODE 6 (PAL) display! :)
Not bad for 1 night's work! :cool:
Next step is to fix the display, then add the CPU and ROMs and enough memory address decoding to get the BASIC ROM to boot in MODE 6...
tcdev
10th February 2008, 12:32 PM
I've all-but-fixed the video addressing for MODE 6, and in theory it should work in all the hires video modes (0-6). The only problem is the left-hand column shows a spurious character, but that's almost definitely because I don't know the phase relationships between the 1/2/4/8 MHz clocks produced by the video ULA...
Next step is to hook up the CPU and ROMS... and fudge enough of the system memory addresses to boot to BASIC... (SHIELAs are always hard work!) ;) Hopefully I can squeeze them into internal RAM (or alternatively put the BASIC ROM in external SRAM) so I don't need to timeslice RAM accesses just yet...
MiniMorph
14th February 2008, 06:59 PM
A BBC FPGA is great news as that is my favourite platform.
I have lots of useful information to extend the FPGA once you have it working.
I have lots of disks of software too ;)
I will be watching this project with interest.
tcdev
14th February 2008, 09:56 PM
This is frustrating the crap out of me atm, because I still can't get the emulation to boot to the BASIC prompt and I've burnt plenty of hours in the process!
MODE 6 video should be implemented correctly - I can seed the video RAM with a dump from MESS and I can see "BBC Computer" & "BASIC" & ">" if I disconnect the CPU clock.
I know the MOS ROM is getting as far as calling the routine to print "BBC Computer", but never gets to the routine that actually puts the pixels on the screen. My next task is to trace the execution to see exactly where it deviates from MESS - this should point to some missing/incorrect functionality.
FYI the option links have been hard-coded to boot in MODE 6 - and they're definitely being read correctly. The 6845 registers are not writable and have been initialised with MODE 6 values. The system is consequently fetching video data from $2000-$3FFF, which is correct for MODE 6.
Aside from the CPU, MOS & BASIC ROMS, 16KB ram mirrored at $4000, 6845, the system VIA with limited I/O (incl. option links), basic video ULA functionality and paged ROM register, that's about all I have implemented atm. I have also tried running with and without keyboard and VSYNC interrupts.
Not sure how far I'll take the project at this point. The original intention was to merely familiarise myself with the 6845, then when I found out how complicated the BBC was, it became more of a challenge! ;) I'd like to get it booting at least, then make the 6845 writable so modes 0-6 all work. But there's issues that I'll need to address given the current design...
tcdev
15th February 2008, 02:35 AM
*FINALLY*!!!
Turned out I didn't see the NOT gate on the keyboard schematics - so the ROM was looping waiting for the CTRL key to be released!!!
Now I see...
BBC Computer 16K
BASIC
... but no ">".
I'm assuming that "BASIC" is printed by the BASIC ROM... which means the paged rom register and decode logic is also working correctly.
Now to work out why no prompt... :confused:
tcdev
17th February 2008, 01:07 AM
I can type in and run a simple BASIC program.
http://members.iinet.net.au/~msmcdoug/pace/platforms/pace-p2/bbc-micro.jpg
Hangs on a syntax error ("Mistake") but I'm guessing it's something to do with the sound... otherwise so far so good...
*Plenty* of work to do though...
tcdev
26th February 2008, 07:31 AM
The BBC still hangs on an error. It's getting lost somewhere in the VDU display routines, because it never returns from the routine that prints the message.
That aside, I've finished the MODE 0-6 implementation, including colour and flashing support, both of which turned out to be trivial once I understood the encoding. The video ULA is quite simple in hindsight. So I can use the BASIC drawing commands and get pretty graphics on the screen.
The cursor is missing because the 6845 implementation I'm using doesn't support it. The opencores version does, but has other missing functionality required for the BBC, so I'll most likely lift the cursor implementation from that and add it to the "Rockola" (Verilog) version I'm using - looks trivial. Then IIUC I need to add cursor support to the video ULA.
I've started on the SAA5050 implementation, but there's a few problems. Mode 7 programs the 6845 for interlace mode (despite what the AUG says) and of course it's not supported by the core either! :( Right now I've hard-coded a "non-interlaced MODE 7" mode and am trying to at least get a legible display on that...
Can't convince Chris to start on the sound core - he's too busy not getting his 68K board working! ;)
tcdev
27th February 2008, 02:39 AM
It would appear my BBC problems are due to a 6502 core bug! :eek:
The 'B' flag pushed onto the stack when a BRK instruction is executed is seemingly never getting reset - ever! So every subsequent interrupt after a BRK instruction looks like a BRK interrupt. As a result the ROM twists itself in a knot after a number of invocations... and bang!
My attempt "fix" to the 6502 core gave better, abeit not perfect, results. Given the nature of my "fix" it should be proof enough that the core is at fault. At least now I can successfully use a soft-key reset sequence to reset the entire BBC emulation.
I await comment from the 6502 core author!
tcdev
5th March 2008, 09:54 AM
I've completed a preliminary implementation of the sound chip. Using the BASIC sound command, it generally sounds as expected. The tone generators have programmable pitch, volume and duration.
The noise generator does *something*. Further verification sometime down the track when I start running some games...
Still awaiting the 6502 B flag fixes from MikeJ... might even have a look at fixing them myself...
tcdev
5th March 2008, 12:06 PM
I bit the bullet and sat down to study the 6502 core tonight.
End result - I've got a "fix" that allows the BBC to run without crashing!!! I'm pretty sure the fix is "legit" but there's more testing to be done until it'll get an official release.
So, working BBC with colour & sound!!!
MiniMorph
26th March 2008, 08:05 PM
This is Awesome !
I only just noticed the second page on the on this Thread !
Doh.
Anyway MikeJ will be pleased too, I am pretty sure he is interested in a BBC Micro version.
You keep saying you do not have a DE1. I have 4 spare. Do you want me to send you one ???
I would love to get your code running on my DE1. I can then crack on with emulating the tape/ floppy/ hard disk and econet. I am a wizz at Embedded firmware. I am a total novice at HDL, but I want to learn.
In any case keep up the good work.
tcdev
26th March 2008, 11:08 PM
Anyway MikeJ will be pleased too, I am pretty sure he is interested in a BBC Micro version.
You keep saying you do not have a DE1. I have 4 spare. Do you want me to send you one ???
I would love to get your code running on my DE1. I can then crack on with emulating the tape/ floppy/ hard disk and econet. I am a wizz at Embedded firmware. I am a total novice at HDL, but I want to learn.
In any case keep up the good work.
I've been in contact with Mike about the BBC recently - he asked me for the Video ULA and sound chip code, which I sent him. And then a few days later realised that his very own web page already has an implementation of the sound chip! Doh!!!
As for the DE1, thanks for the offer, I'd love to get my hands on one to port all my projects! Let me know what you need in terms of postage etc... I'm in Sydney Australia if you didn't already know.
I'm also interested in getting floppy emulation going on a number of platforms, including the BBC. To this end, I'm in the process of adding a generic OSD module which I've "stolen" from the Vector06C project (see related thread) which, incidently, also emulates the WD1793 I need for the TRS-80. My next step was to add that support to PACE, but in a more modular form so the floppy disk controller front-end could be interchanged to emulate various floppy controllers, such as the BBC one.
I should point out that I'll be OS for 2 months as of 21st April (on my honeymoon) so there won't be a lot I can do with it until after I return. I'm taking my EEE PC with me, but I don't think I'd get away with taking a DE1 as well! ;)
Thanks and Regards,
Mark
MiniMorph
29th March 2008, 09:53 AM
PM me with your address and I will send you the board.
I wish MikeJ would do some ports to the DE1 too, but he seems to prefer Xilinx.
I have both, but the DE1 is by far the best fit board out there for Retro Computing at it's price point. Having static ram and DRAM is good ;)
That is until you or mike release your own platforms that is.
MiniMorph
14th April 2009, 07:58 PM
I noted you said you spent time making the Sound chip only to find it already done on MikeJ's site. I actually knew that before you even started making the BBC micro HDL. It was published on my Wiki as well.
I deleted the Wiki Recently as it had been spammed. I therefore thought an update to the BBC Micro Forum entry was a better place to put the information.
So here you go :-
http://www.minimorph.com/phpBB3/viewtopic.php?f=9&t=14&start=0
Notice this page too :- http://members.lycos.co.uk/mmbeeb/
This is especially useful as it should allow the DE1 SD Card slot to be used with virtually no additional HDL or Firmware!!!!!!!!!!
It sounded like you were quite close to having all but mode 7 working, if a 6522 can be bolted on then mmbeeb may well work ? Maybe I should build a mmbeeb for my real bbc's it would be a good way to get the data off my BBC.
I know Mode 7 is a whole lot of extra work but it is quite similar to text mode on a VGA controller ??
tcdev
14th April 2009, 10:42 PM
Notice this page too :- http://members.lycos.co.uk/mmbeeb/
This is especially useful as it should allow the DE1 SD Card slot to be used with virtually no additional HDL or Firmware!!!!!!!!!!
It sounded like you were quite close to having all but mode 7 working, if a 6522 can be bolted on then mmbeeb may well work ? Maybe I should build a mmbeeb for my real bbc's it would be a good way to get the data off my BBC.
I know Mode 7 is a whole lot of extra work but it is quite similar to text mode on a VGA controller ??
The mmBeeb is certainly interesting, and would be a nice way to use an SD card on the DE1 definitely! Funnily enough I've been aware of SD interfaces for a couple of micros (not BBC though), yet it has never occurred to me to implement these in PACE - I've always been too focused on the original hardware! You've opened up a whole new realm of possibilities - thanks!!
Now all I need is the time to do it. :( Right now the PACE team is working on some related hardware, so for now it'll have to sit on the ToDo list...
It's been a while since I looked at the BBC... I can't recall the issue with Mode 7. I thought it had cursor control logic as well?!?
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.