Tube Elite with hardware outputs

Got a programming project in mind? Tell everyone about it!
minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Tube Elite with hardware outputs

Postby minwah » Mon Mar 05, 2018 1:39 pm

I have been playing around with the Tube Elite source code, to add hardware output functionality for certain events. I am using a Deltronics Control It box as an interface, but it would also work with NCST I/O adaptor, or you could make your own board. It uses the parallel/printer port PA0-PA7 data pins to control 8 outputs.

I played around with the Control It software and the Deltronics BASIC examples, and quickly realised neither worked with Tube enabled. The following link helped me to understand why that was, and enabled me to write a small test program in assembly:

http://central.kaserver5.org/Kasoft/Typeset/BBC/Ch44.html

EDIT: note the link is for the user port, I am using the parallel port for outputs which uses different addresses, but same principal.

With that done, I moved onto the Tube Elite source, and with a bit of help was able to build and run it:

http://stardot.org.uk/forums/viewtopic.php?f=2&t=14607

My plan was to add outputs for the following:

Code: Select all

#  val     description

1   1     Condition Green } RGB LED should make yellow when both outputs on
2   2     Condition Red   }
3   4     Cabin Temp High / Altitude Low
4   8     Laser Temp High
5  16     Energy Bank 1
6  32     Energy Bank 2
7  64     Energy Bank 3
8 128     Energy Bank 4   


...and I have just about achieved that. Poor quality but you might be able to make out what is happening here (output #1 is the bottom LED):

https://twitter.com/minsoftgames/status/970396439867265024

I need to get some parts to make a box to sit on top of the monitor housing the LEDs so they are easy to see. I also need to finish off the code (at the moment when you die, the energy bank and condition green lights come back on), and when done will add the required code changes here.

Is anyone interested in this? I'm guessing very few people have a Deltronics or similar box, although it shouldn't be too hard to put together a DIY one...

Oh, and I also added cassette motor control so I can have the Blue Danube playing when the docking computers are on :D
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

User avatar
Lardo Boffin
Posts: 927
Joined: Thu Aug 06, 2015 6:47 am
Contact:

Re: Tube Elite with hardware outputs

Postby Lardo Boffin » Mon Mar 05, 2018 2:29 pm

That is deeply cool. 8)
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Retroclinic Datacentre + HDD, Viglen twin 40/80 5.25" discs, acorn cassette, Acorn 6502 coproc
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc
BBC Master

crj
Posts: 830
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Tube Elite with hardware outputs

Postby crj » Mon Mar 05, 2018 5:11 pm

Wow. This is a really neat idea!

minwah wrote:I'm guessing very few people have a Deltronics or similar box

Indeed. My instinct is that, with not much effort, this could be elaborated into something a little bigger using hardware that's a little more off-the-shelf. Especially if several people were interested.

What if, instead of just outputting 8 bits from the User Port, you strobed out 8-bit values? (i.e. you present the value then waggle one of the control lines so the receiver knows it's there. The 6522 can do this for you.) Each value could be a 4-bit address, and a 4-bit value, allowing you to give the actual level of energy banks, laser temperature, etc. rather than just a binary value.

With the ability to express sixteen 4-bit values, I can think of lots of other things it would be awesome to include:
  • Location: Witch space, galactic hyperspace, hyperspace, deep space, space station safe zone, docking computers, docked, dead
  • Missile status
  • Shields (more useful than energy banks, actually)
  • Fuel
  • Speed
  • ...
You could route those signals to an Arduino and drive a few metres of AdaFruit neopixels or similar for a full-on light show. (-8

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Tue Mar 06, 2018 11:30 am

crj wrote:What if, instead of just outputting 8 bits from the User Port, you strobed out 8-bit values? (i.e. you present the value then waggle one of the control lines so the receiver knows it's there. The 6522 can do this for you.) Each value could be a 4-bit address, and a 4-bit value, allowing you to give the actual level of energy banks, laser temperature, etc. rather than just a binary value.


I like this idea, although it's a bit more involved. The thing I'd be concerned with is the speed...would there need to be a handshake between the 6522 and Arduino? I don't know much about the control lines but presume there would be a slight delay. It might mean sending different info on different frames, which could mean slightly delayed outputs. I'm not sure without trying it how much of a delay/issue there might be. I wondered if it might be possible to monitor the outputs without use of the control lines, but I suspect there would be timing issues.

If you wanted to play around with your idea, I'd be interested to see what you come up with...especially how to use the control lines programmatically. I will have a play around with the 4bit/4bit method once I've finished my 'simple' implementation...
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

User avatar
vanpeebles
Posts: 416
Joined: Wed Nov 28, 2012 10:01 am
Location: UK
Contact:

Re: Tube Elite with hardware outputs

Postby vanpeebles » Tue Mar 06, 2018 2:22 pm

Will you be building a big enclosed cabin with lots of gauges? 8)

crj
Posts: 830
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Tube Elite with hardware outputs

Postby crj » Tue Mar 06, 2018 3:05 pm

minwah wrote:I like this idea, although it's a bit more involved. The thing I'd be concerned with is the speed...would there need to be a handshake between the 6522 and Arduino? I don't know much about the control lines but presume there would be a slight delay. It might mean sending different info on different frames, which could mean slightly delayed outputs. I'm not sure without trying it how much of a delay/issue there might be. I wondered if it might be possible to monitor the outputs without use of the control lines, but I suspect there would be timing issues.

Take a look at pages 403 onwards in the Advanced User Guide (which you can find online if you don't have a paper copy). Writing binary 101xxxxx to the 6522's Peripheral Control Register puts it into "pulse" mode. This means it automatically puts a pulse on CB2 each time you send a new value to PB0-7.

I'm not totally familiar with the Arduino family, but I'll just bet you could wire CB2 to a pin that caused an interrupt. Then, given you wouldn't be sending another value for several microseconds, there would be plenty of time for the Arduino to capture the value.

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Wed Mar 07, 2018 2:05 pm

vanpeebles wrote:Will you be building a big enclosed cabin with lots of gauges? 8)


I thought about something like that a few years ago, but talked myself out of it...although it would be great! An arcade driving cabinet has been on my 'to build' list for about 5 years but I'm struggling to find the time. One day!
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Wed Mar 07, 2018 2:06 pm

crj wrote:Take a look at pages 403 onwards in the Advanced User Guide (which you can find online if you don't have a paper copy). Writing binary 101xxxxx to the 6522's Peripheral Control Register puts it into "pulse" mode. This means it automatically puts a pulse on CB2 each time you send a new value to PB0-7.


Thanks. I had read some of that already but only down to where it starts sounding complicated. I will give it a proper read at some point...
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

crj
Posts: 830
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Tube Elite with hardware outputs

Postby crj » Wed Mar 07, 2018 2:21 pm

minwah wrote:
vanpeebles wrote:Will you be building a big enclosed cabin with lots of gauges? 8)


I thought about something like that a few years ago, but talked myself out of it...

I'd suggest repurposing a Space Harrier arcade machine. Except that would be sacrilege because Space Harrier is another masterpiece in its own right. Besides, the sit-on version ain't cheap!

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Wed Mar 07, 2018 5:25 pm

crj wrote:I'd suggest repurposing a Space Harrier arcade machine. Except that would be sacrilege because Space Harrier is another masterpiece in its own right. Besides, the sit-on version ain't cheap!


Yeah, I wouldn't do that to any dedicated arcade game. If I did scratch build one, it would be more in the style of the Star Wars cockpit which is more enclosed - more places to put lights & switches etc.
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

crj
Posts: 830
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Tube Elite with hardware outputs

Postby crj » Wed Mar 07, 2018 6:26 pm

Hohum.

It occurred to me that somebody somewhere must make an off-the-shelf system you could integrate into a custom Elite playing platform. So I Googled; they do.

Problem: a nice one like that with six degrees of freedom and the strength to move around an Elite cockpit costs 28 000 €. Ouch.

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Thu Mar 08, 2018 3:06 pm

crj wrote:Hohum.

It occurred to me that somebody somewhere must make an off-the-shelf system you could integrate into a custom Elite playing platform. So I Googled; they do.

Problem: a nice one like that with six degrees of freedom and the strength to move around an Elite cockpit costs 28 000 €. Ouch.


I've ordered two! :lol:
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: Tube Elite with hardware outputs

Postby minwah » Tue Apr 03, 2018 1:17 pm

Here's a pic of my breadboard test setup in action:

20180331_161546.jpg


From left to right are:

Energy banks (4x red LEDs)
Cabin temp / altitute warning (RGB LED)
Laser temp warning (RGB LED)
Condition (RGB LED)

I've got some LED-lit arcade buttons to play around with too...
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

User avatar
Lardo Boffin
Posts: 927
Joined: Thu Aug 06, 2015 6:47 am
Contact:

Re: Tube Elite with hardware outputs

Postby Lardo Boffin » Tue Apr 03, 2018 1:35 pm

=D> =D> =D>
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Retroclinic Datacentre + HDD, Viglen twin 40/80 5.25" discs, acorn cassette, Acorn 6502 coproc
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc
BBC Master

User avatar
myelin
Posts: 340
Joined: Tue Apr 26, 2016 9:17 pm
Location: San Francisco, CA, USA
Contact:

Re: Tube Elite with hardware outputs

Postby myelin » Tue Apr 03, 2018 5:52 pm

Nice work!
SW/EE from New Zealand, now in San Francisco, making BBC/Electron hardware projects for fun.
Most popular: fast serial port, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.