Page 1 of 1

Controling brightness on BBC micro computer

PostPosted: Tue Aug 23, 2016 12:22 am
by Viewmaster
I'm toying with an ideas again. :)

The red/green/blue output from the old BBC micro computer
to the monitor is not analogue so the brightness cannot be controlled.

I was wondering if anyone has ever put 3 transistors, one in each colour,
in order to control the brightness ?

Using faster assembly language one might then have a machine which could run
variable number of lines for NBTV.

I was thinking of that LEGO camera that was mentioned by Harry, and using the Beeb
as the display for demos.

Re: Controling brightness on BBC micro computer

PostPosted: Tue Oct 11, 2016 5:36 am
by dominicbeesley
That may be possible but it may well be easier to just use one of the other output ports (user port or printer port). I suspect you'd be struggling for speed though....I might have a go later as I've got a BBC on the desk next to me as we speak with its lid off...

It might be possible to trick the video ula and the 6845 chip into doing 32 lines but I think the slowest pixel clock is quite fast so it would want a lot of pixels on each line though there may be a way of tricking it to output the same pixel repeatedly

D

Re: Controling brightness on BBC micro computer

PostPosted: Tue Oct 11, 2016 4:28 pm
by Viewmaster
dominicbeesley wrote:That may be possible but it may well be easier to just use one of the other output ports (user port or printer port). I suspect you'd be struggling for speed though....I might have a go later as I've got a BBC on the desk next to me as we speak with its lid off...

It might be possible to trick the video ula and the 6845 chip into doing 32 lines but I think the slowest pixel clock is quite fast so it would want a lot of pixels on each line though there may be a way of tricking it to output the same pixel repeatedly

D

Dominic, thanks for your ideas.

But now, I haven't bothered with the beeb as I am using a BBC BASIC emulator on my old laptop.

This is extremely fast ( I can scan and draw about 1,000 pixels per second on test).
Not only that but I now have 256x256x256 colours if need be!

One could use assembly language on the old beeb to speed things up but for me,
the emulator solves all.

Re: Controling brightness on BBC micro computer

PostPosted: Tue Oct 11, 2016 11:03 pm
by dominicbeesley
Fair play, but you've whet my appetite so I've spent a while looking at the 6522 datasheets and think I might have a cunning plan...

D

Re: Controling brightness on BBC micro computer

PostPosted: Tue Oct 11, 2016 11:41 pm
by Viewmaster
dominicbeesley wrote:Fair play, but you've whet my appetite so I've spent a while looking at the 6522 datasheets and think I might have a cunning plan...

D


Well, not sure if you have a particular project in mind but many others with beeb's
would be interested if you could cunningly get multi colours from the beeb.

But for the non purist who is not dedicated to the old beeb,
a PC emulator is the easiest way to go.
The one I use is BBC4BASIC and a simple VDU call gives all colours.

Good luck, Dominic, in your cunning enterprise. :)

Re: Controling brightness on BBC micro computer

PostPosted: Thu Oct 13, 2016 10:37 pm
by dominicbeesley
Well, I had to give it a go, it took a bit of fiddling.

It hangs off the user port and uses Timer1 of the user VIA to generate a 20kHz square wave on PB7, this is fed to a transistor's base whose collector is connected back to the NMI line (available as a pin on the 1MHz bus). This generates a non-maskable interrupt 20,000 times a second and is the "pixel clock". An NMI routine then outputs the video data on the bottom PB0..3 lines of the user port and the sync signal on PB5.

The lines PB0-3 are fed to an inverting op-amp via suitable DAC resistors to give 16 greys and sync. As can be seen on the baby picture this isn't quite enough for detailed dark areas, however it would not be difficult to add a couple more pins and get 64 grey levels which is usually good enough.

The code is currently a BASIC/assembly language program that parks itself on the NMI vector at &0D00. After a bit of optimisation I got it running well enough that it only slows down the computer to half its original speed! My first attempt only left 16% of the original clock cycles over. The most complex bit is working out when to do a sync, with a bit of thought I could probably speed that up a little.

The scope traces shows the signal with a lot of spikes an overshoots - I don't think that this is me but the LM324N opamp tends to get giddy when fed with fast transients. I can't remember how I tamed it last time, I seem to remember it not liking working into too high an impedance load...

Once the code is running the computer is free to do other tasks and happily sits there outputting NBTV in the background. If there is interest I could improve this quite a bit.

- make a 1MHz bus version, leaving user port free (for MMC interface)
- make a ROM that can output NBTV in the background,
- colour?
- faster code

D

Re: Controling brightness on BBC micro computer

PostPosted: Thu Oct 13, 2016 11:08 pm
by Viewmaster
Dominic, I am very impressed on your beeb knowledge and to be able to do what you have done.
Bringing the old beeb into NBTV land.

I bet many would be interested in a NBTV newsletter article on what you have achieved.

If you go any further with this perhaps you can let us all know,
possibly under a new 'NBTV BBC micro' thread.

I forecast the sale of second hand beebs going up soon. :D

Re: Controling brightness on BBC micro computer

PostPosted: Fri Oct 14, 2016 9:59 am
by M3DVQ
Oh my! That's amazing.
Now I'm pondering if I could do the same thing on a ZX Spectrum. Would just need a patched ROM to jump to a particular location on the NMI...

Re: Controling brightness on BBC micro computer

PostPosted: Fri Oct 14, 2016 10:00 am
by M3DVQ
Viewmaster wrote:I forecast the sale of second hand beebs going up soon. :D


I have three under the bed :)

Re: Controling brightness on BBC micro computer

PostPosted: Fri Oct 14, 2016 7:51 pm
by dominicbeesley
Its certainly possible on a z80, I did it, with colour, a few years ago on my CP/M machine - http://z80homebrew.blogspot.co.uk/2009/ ... olour.html

On a Spectrum it might be difficult to keep the normal screen output going at the same time as I think the screen uses the NMI...or is that the ZX81?

D

Re: Controling brightness on BBC micro computer

PostPosted: Fri Oct 14, 2016 7:56 pm
by AncientBrit
Hi Dominic,

I second the comments.
Well done, an amazing bit of work.
I think it deserves a write up in the Newsletter,

Kind regards,

Graham

Re: Controling brightness on BBC micro computer

PostPosted: Sat Oct 15, 2016 12:37 am
by M3DVQ
dominicbeesley wrote:Its certainly possible on a z80, I did it, with colour, a few years ago on my CP/M machine - http://z80homebrew.blogspot.co.uk/2009/ ... olour.html

On a Spectrum it might be difficult to keep the normal screen output going at the same time as I think the screen uses the NMI...or is that the ZX81?

D


It's the ZX80 and ZX81 that use the CPU to generate the display. The Spectrum ULA reads directly from RAM. The CPU gets halted if it is also trying to access that contended RAM but that's not a problem as the NBTV driver can just run in the other 32KB.
The awkward bit will be deriving a suitable clock to drive the interrupt. Can't just use the 3.5MHz CPU clock on the I/O port divided down because of the aforementioned memory contention.

Re: Controling brightness on BBC micro computer

PostPosted: Tue Oct 18, 2016 10:56 pm
by dominicbeesley
Thanks lads, I may well write it up for the newsletter but the televisor is destined for storage later this week as we are trying (slowly) to move house.

On the spectrum thing it should be possible then, a bit of jitter shouldn't matter so long as the NMI vector is free and uncontended. On the beeb there is a bit of jitter (due to differing instruction lengths and other factors) but the televisor doesn't seem to mind!

D