Palettemate / enhanced video ULA with 4096 colours

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Mon Jun 05, 2017 3:06 pm

Rich Talbot-Watkins wrote:Ah yeah I get it, so it goes through two palette lookups - once through the standard palette to get an actual physical colour index, and then looks that up in your extended palette (is that right?).

In which case I see less need for a second switchable palette. Changing 4 6 colours per scanline (24us in the horizontal border, 12 STAs = 24us) is enough for nearly anyone's needs I would think, apart from certain exceptional problems like Dominic's HAM mode experimentation. As Beeb programmers we're used to working around limitations, and I suspect with careful image processing and exploiting midline palette changes, there might be ways to get even more colour changes in, in much the same way as your rainbow demo Rob :)
Yes - that's right. The standard palette at FE21 is used to map logical colours to the 16 physical colours. The extended palette at FE23 is then used to map each of the 16 physical colours to a 12-bit RGB value.
Rich Talbot-Watkins wrote:Edit: it'd be a late change to make, but it would possibly be more versatile to split up the two writes in this way, so that the first set the most significant two bits of the RGB (doubled to the least significant bits), and an optional second write could fine-tune it by setting the least significant bits. Just a thought... :?
How would the indexing work? Some sort of auto-incrementing?

My plan is to work on the 12MHz modes tonight and then see how much space is left. I clawed some back when I put in the re-initialisation mechanism so there may be room for some additional stuff.

User avatar
Rich Talbot-Watkins
Posts: 1367
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Rich Talbot-Watkins » Mon Jun 05, 2017 6:54 pm

Hey Rob

When doing the 12 MHz modes, think how this is going to work with the smooth horizontal offset stuff. Currently that has 16 MHz granularity doesn't it, which will be useless with the new modes, so you might have to go to 48 MHz granularity instead... Or use a different pixel clock base for those modes.

How are you mapping the registers currently? Are you using FE22 for anything? Don't know if all these commands would necessarily fit (for elegance I would've said 2 bits "command", 6 bits "value", but there are more than 4 different commands if we include setting base palette index, two different commands to set the lsb and msb RGBs, and all the horizontal scrolling controls, plus extended palette enable/disable).

But yeah, I would have suggested a way of setting the base index which then auto increments. But I can already see problems, e.g. you don't want it to auto increment if you still want to write the lsb values. So maybe this idea is just best ignored :?

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Mon Jun 05, 2017 8:56 pm

Rich Talbot-Watkins wrote:When doing the 12 MHz modes, think how this is going to work with the smooth horizontal offset stuff. Currently that has 16 MHz granularity doesn't it, which will be useless with the new modes, so you might have to go to 48 MHz granularity instead... Or use a different pixel clock base for those modes.
I think this is fairly straightforward - I already have a "scrolling clock" that operates at full speed in modes 0-3 and half-speed in modes 4-6. I've just added an extra case to switch it to 12MHz in the new modes. The part I'm finding difficult is disentangling all the bits where I've used a single 16MHz signal to do multiple things...
Rich Talbot-Watkins wrote:How are you mapping the registers currently? Are you using FE22 for anything? Don't know if all these commands would necessarily fit (for elegance I would've said 2 bits "command", 6 bits "value", but there are more than 4 different commands if we include setting base palette index, two different commands to set the lsb and msb RGBs, and all the horizontal scrolling controls, plus extended palette enable/disable).
FE22 is an additional control register with the top 4-bits indicating the operation and the bottom 4-bits any associated value. Currently, I have:
0000xxxx = reset additional features (so palette reverts to standard Beeb and horizontal scrolling/left blanking is reset)
0001xnnn = set horizontal scroll offset
0010nnnn = set left blanking size

I will probably use values 3 and 4 for the enable/disable and 12MHz modes.
Rich Talbot-Watkins wrote:But yeah, I would have suggested a way of setting the base index which then auto increments. But I can already see problems, e.g. you don't want it to auto increment if you still want to write the lsb values. So maybe this idea is just best ignored
Maybe so. My demo changes 8 colours per scanline and I'm sure that others can do a better job than me!

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Tue Jun 06, 2017 8:38 pm

Got the Mode 0 12Mhz equivalent working today. This gives a 480 x 256 pixel 8 colour mode by splitting each byte into 6 pixels and 2 attribute bits. This gives 2 colours per 6 pixel block.

I've coded it so that the palette at FE21 is programmed in the same way as mode 2 as this was simpler. I've discarded all the shift register stuff for this mode so the output colour is given by: (attr_hi, attr_lo, 0, pixel). At the moment, the attribute bits are the 2 least-significant in each byte (i.e. bits 1 and 0) but I can easily change this.

The picture below isn't very clear but is showing 480 pixels across the screen with combinations of red on black, magenta on blue, yellow on green and white on cyan. These can obviously be changed by reprogramming the palette. It's quite a nice mode on screen - certainly for text, it's got a good resolution and plenty of colours. If anyone knows of a decent 6-pixel font, it would be good to try it out...
IMG_20170606_212039.jpg
12MHz attribute mode - 8 colours, 480 x 256
I've got a little bit more work to do to get the mode 1 equivalent working - my idea here is to have the output colour defined by (attr_hi, attr_lo, pixel_hi, pixel_lo). Again, the palette would be set up in the same way as mode 2.

User avatar
Rich Talbot-Watkins
Posts: 1367
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Rich Talbot-Watkins » Tue Jun 06, 2017 9:18 pm

RobC wrote:Got the Mode 0 12Mhz equivalent working today. This gives a 480 x 256 pixel 8 colour mode by splitting each byte into 6 pixels and 2 attribute bits. This gives 2 colours per 6 pixel block.
Great job! =D>
If anyone knows of a decent 6-pixel font, it would be good to try it out...
Well, of course, the Teletext font itself is a nice 6 pixel wide font, but you'd have to design it by hand. But you can get a pretty decent 6 pixel wide font just by taking the original Acorn font and ANDing it with itself shifted left!
I've got a little bit more work to do to get the mode 1 equivalent working - my idea here is to have the output colour defined by (attr_hi, attr_lo, pixel_hi, pixel_lo). Again, the palette would be set up in the same way as mode 2.
For me the MODE 1 version is the most interesting one: 16 colours with reasonably good resolution. Hope you can get it working OK! In that photo you posted, the resolution looks surprisingly low... is that really 480 across? The pixels should be narrower than they are tall, but it looks like the resolution I'd expect of the MODE 1 type screen.

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by jgharston » Tue Jun 06, 2017 9:31 pm

RobC wrote:If anyone knows of a decent 6-pixel font, it would be good to try it out...
ArcThin is a decent enough 5+1 pixel font:
Image

TtxtFont is the same but with teletext characters (and shifted right one pixel):
Image

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Tue Jun 06, 2017 9:35 pm

@RobC. All a bit complex sounding to me.

But is it possible to get one of the 80 x 25 text modes up to 8 or 16 colours? The reason I asked is that sort of text mode with those number of colours is the basic ANSI terminal. Currently SteveF's Term runs very nicely as a monochrome vt100 temrianl in mode3, I was hoping some way to get basic ANSI colour (8 colours + 8 bright colours). I guessing the answer is no but hoping otherwise.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 6:56 am

Rich Talbot-Watkins wrote:But you can get a pretty decent 6 pixel wide font just by taking the original Acorn font and ANDing it with itself shifted left!
Thanks - I've used this trick before but had completely forgotten it!
Rich Talbot-Watkins wrote:For me the MODE 1 version is the most interesting one: 16 colours with reasonably good resolution. Hope you can get it working OK! In that photo you posted, the resolution looks surprisingly low... is that really 480 across? The pixels should be narrower than they are tall, but it looks like the resolution I'd expect of the MODE 1 type screen.
Pretty sure I'll get it working as most of it is already in and I've still got a bit of space left. I only debugged the mode 0/3 version first as I found it simpler to understand what I was seeing on screen. The display is definitely 480 pixels wide - if I wasn't so rubbish at photography, you'd see that each character row has characters containing a column of pixels at one of the six offsets. There are 80 of these on screen. I also modified the attributes on each row.
jgharston wrote:ArcThin is a decent enough 5+1 pixel font...
Many thanks - they look really good.
Elminster wrote:But is it possible to get one of the 80 x 25 text modes up to 8 or 16 colours? The reason I asked is that sort of text mode with those number of colours is the basic ANSI terminal. Currently SteveF's Term runs very nicely as a monochrome vt100 temrianl in mode3, I was hoping some way to get basic ANSI colour (8 colours + 8 bright colours). I guessing the answer is no but hoping otherwise.
With one of the 6-pixel fonts given above, you could do 80x25 in 8 colours and have a pretty decent display - I'll have a look at writing a demo for this when I've got some time. The mode 1/6 equivalent should do a perfectly readable 40x25 in 16 colours. Using the extended palette, there may well be some tricks you can do to simulate 80x25 with 8+8 bright on a machine with shadow RAM.

The next batch of CPLDs has arrived so, after I've sorted out the mode 1 12MHz stuff, I'll get on to building some more boards :D

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Wed Jun 07, 2017 8:36 am

RobC wrote:
Elminster wrote:But is it possible to get one of the 80 x 25 text modes up to 8 or 16 colours? The reason I asked is that sort of text mode with those number of colours is the basic ANSI terminal. Currently SteveF's Term runs very nicely as a monochrome vt100 temrianl in mode3, I was hoping some way to get basic ANSI colour (8 colours + 8 bright colours). I guessing the answer is no but hoping otherwise.
With one of the 6-pixel fonts given above, you could do 80x25 in 8 colours and have a pretty decent display - I'll have a look at writing a demo for this when I've got some time. The mode 1/6 equivalent should do a perfectly readable 40x25 in 16 colours. Using the extended palette, there may well be some tricks you can do to simulate 80x25 with 8+8 bright on a machine with shadow RAM.
That would be amazing for my project. But I think should be useful for others, i.e. if you can get one of the new screen modes up to the same standard as the minimum expected on modern machine it opens up things like, ANSI ART, easier to port GFX type programs, easier to do/better loooking client server stuff where Beeb is the client etc.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 9:30 am

Elminster wrote:That would be amazing for my project. But I think should be useful for others, i.e. if you can get one of the new screen modes up to the same standard as the minimum expected on modern machine it opens up things like, ANSI ART, easier to port GFX type programs, easier to do/better loooking client server stuff where Beeb is the client etc.
I think it might well be useful for text displays and for games where the attribute/colour clash effect is minimised. Obviously this board improves the palette (that was the original intention) but we're still limited to the memory bandwidth of the Beeb's video system (2MB/s) so it's not going to give more colours at higher resolutions. The 12MHz modes are simply a different way of trading resolution for colour depth (with attribute clash being another trade off).

I've now got the mode 1 version working - 16 colours at 240x256 with 4 colours per 3 pixel block. One thing I haven't done is to see what happens in other modes. I also need to check that scrolling/blanking works and put in the disable mechanism.

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Wed Jun 07, 2017 9:35 am

Well I shall wait to see your Demo's and see what we get, but currently sounds like only way I am likely to get a usable size with extra colours. Otherwise stuck in monochrome or tiny display.

Thanks.

dominicbeesley
Posts: 650
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by dominicbeesley » Wed Jun 07, 2017 11:08 am

How's about this? It would require an extra option bit and a bit of vhdl but not much....

Instead of using two attribute bits use three, the final one coming from the left or rightmost pixel, in 6 pixels per char mode define the palette in such a way as to ignore it. Then add a switch for a 5 pixel character only mode where you define all the colours but only copy 5 bits into the shift register. This would give a text-only mode with more colours and should only require a minor tweak to the VHDL that copies to the shift reg? The fonts should still work, mostly, as I think all the alphanumeric chars have a blank column of pixels...

It still wouldn't be able to do all the ANSI stuff but would be closer and with some translation coding would render most displays well. I've been hankering for a decent ANSI display on my master which I occasionally use as a VT100 terminal

D

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 12:33 pm

So is this essentially still spitting out pixels at 12MHz, reading the 3 attribute bits and just replacing the leftmost (or rightmost) bit with 0?

It could probably be done as I've got some space left. This would give 80x32 (or 80x25) using a 5-wide font with 8 colours + background. In fact, with 7 + background, it might even be possible to have a "palette flip" bit that allows you to do 7 bright colours + background and 7 dark colours + background.

I'm inclined to move the attribute bits to the high bits - does anyone have an objection to this?

User avatar
tricky
Posts: 2847
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by tricky » Wed Jun 07, 2017 12:44 pm

I don't know about the implementation, but to (rudely) jump in and give you a chance to expand your idea:
I'm not quite sure what you are proposing here, but I don't think the clock would give 5 pixels per byte.
If you are suggesting say 6, but where the 6th is colour 0 (or assumed to be a 0 bit), I think that may work and should be fine for 8 colour/combination text.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 1:01 pm

tricky wrote:I don't know about the implementation, but to (rudely) jump in and give you a chance to expand your idea:
I'm not quite sure what you are proposing here, but I don't think the clock would give 5 pixels per byte.
If you are suggesting say 6, but where the 6th is colour 0 (or assumed to be a 0 bit), I think that may work and should be fine for 8 colour/combination text.
Yes - that's what I was getting at. 12MHz with 6 pixels output for every byte read but with the 6th pixel fixed to be a '0' (being the space between letters). This would free up 3 attribute bits per byte giving a choice of 8 foreground colours. Seeing colour 0 could trigger a "palette flip" but I guess it might be hard to keep track of it...

User avatar
Rich Talbot-Watkins
Posts: 1367
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Rich Talbot-Watkins » Wed Jun 07, 2017 1:05 pm

Yeah, I just want to point out that, even though we've been discussing this as an 80 column mode with 8 colours, for most use-cases it will actually be "fixed background + 4 colours". Likewise the hack you're talking about where the rightmost pixel is forced to 0, and the bit used as a further attribute bit, will usefully give you "fixed background + 8 colours" (as Rob said).

Not sure if that negates the usefulness of this mode for an ANSI terminal but it's worth emphasising the point I guess.

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Wed Jun 07, 2017 1:23 pm

Rich Talbot-Watkins wrote:Yeah, I just want to point out that, even though we've been discussing this as an 80 column mode with 8 colours, for most use-cases it will actually be "fixed background + 4 colours". Likewise the hack you're talking about where the rightmost pixel is forced to 0, and the bit used as a further attribute bit, will usefully give you "fixed background + 8 colours" (as Rob said).

Not sure if that negates the usefulness of this mode for an ANSI terminal but it's worth emphasising the point I guess.
Currently we have ANSI mono, so even 8 colours is fine as we can just treat the 8 bright codes as the usual one. Will still look pretty good compared to mono.(Assuming I understood correctly)

dominicbeesley
Posts: 650
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by dominicbeesley » Wed Jun 07, 2017 1:32 pm

Well 8 fore/back combinations would be better than none, the back ground should need to be fixed as you could define a different fore/back for each of the combinations if I've understood how it works. That would need some translation in the terminal software but it should be good enough, certainly for most purposes. I'm thinking of things like a bash prompt, I've just run one of my more colourful scripts and the colours are:

grey on black
green on black
bright yellow on bright blue
red on white
dark yellow on black

so only 5 colour combinations on screen. With a bit of jiggery pokery

if the fast palette switching was available then it would be possible to make it 8 colour combos per line without sacrificing too many processor cycles....

D

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Wed Jun 07, 2017 2:03 pm

Yes would be good enough for command line, but for ASCII ART, BBS, Muds etc would be hard to work out how to handle missing colours. They would probably look bad, so for htem it would probaably have to be 8 colour minimum 9brights are optional) or run in mono, would probably look so weird in 4 or 5 in might not be worth it. But we shall see, I wait with excitment.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 2:58 pm

Okay - so I've implemented Dominic's suggestion. As it was pretty close to what I was doing for the 12MHz mode 1, it didn't take up too much extra logic.

As Rich TW says, the way this stuff works, you get 8 sets of two colours (1 foreground + 1 background). You can set the palette up so that it's black + 7 foreground colours or do white on blue, grey on green etc.

With a 5+1 font, it'll do 80x32 (or 80x25 in mode 3) - I'll try knocking up a demo as soon as I can.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Wed Jun 07, 2017 9:35 pm

Here's a quick demo I've knocked up of the 3-bit attribute mode. I've set the palette up with a black background and the usual Beeb colours + grey for the foreground.

Rather than code up a suitable text printing routine, I just mangled JGH's ArcThin font into a separate file for each colour so I'm not really showing the ability to have a different colour for each character (apart from the prompt). The font files are being *EXEC'd between each line of text. Even so, I'm really pleased with the result - seeing it live, it's hard to believe that it's coming out of a Beeb!
IMG_20170607_222737.jpg
VideoNuLA 80 x 25 with 8 foreground colours demo

User avatar
sydney
Posts: 2249
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by sydney » Wed Jun 07, 2017 10:01 pm

Rob. WOW! That is awesome!

dominicbeesley
Posts: 650
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by dominicbeesley » Thu Jun 08, 2017 8:46 am

Excellent! I really really want some!

User avatar
Rich Talbot-Watkins
Posts: 1367
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Rich Talbot-Watkins » Thu Jun 08, 2017 9:09 am

Bravo! That's a lovely text-only mode, with a really unique but simple way of controlling the colour of the characters. In the future I think it'd be pretty straightforward to write a support ROM which intercepts WRCHV and provides VDU extensions for displaying characters and setting colours, so you can get all these features through the regular OS calls. I don't imagine reimplementing PLOT though (for line drawing etc) in the 2-bit-attribute modes - not that it wouldn't be possible, but that sounds like a *lot* of work, and the attribute clash probably makes it not really worthwhile. These modes were created for carefully designed games! :)

dominicbeesley
Posts: 650
Joined: Tue Apr 30, 2013 11:16 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by dominicbeesley » Thu Jun 08, 2017 9:21 am

I'm up for helping with a support ROM, I've just translated the character plotting stuff for the 6809 board so its more or less fresh in my mind.

D

User avatar
Elminster
Posts: 3137
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Elminster » Thu Jun 08, 2017 10:06 am

@RobC. I was pretty excited before when I had no idea what I would use the VideoNula for, but now you have show this I am exceedingly excited, I have a number of ideas for a full colour standard text window, so now I am dribbling with anticaption.

Edit: or maybe anticipation.
Last edited by Elminster on Thu Jun 08, 2017 11:43 am, edited 1 time in total.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by RobC » Thu Jun 08, 2017 11:17 am

Thanks everyone. To be fair, if it wasn't for all your suggestions around attribute modes, I wouldn't have thought of it - the implementation was the easy bit! I've been using this mode a bit this morning and I really like it - even had a little play with a quick coloured characters demo:
IMG_20170608_102953.jpg
80 x 32 mode
I've almost got it working correctly for 40 x 32 or 40 x 25 as well but there's a slight bug in my VHDL...

I'm still waiting on some components before I can build more boards - Farnell won't have the oscillators for a month so I had to go to RS (at four times the price!). Also, it's my daughter's birthday this week so I'm organising things for that. Hopefully, I can get some boards made next week.

I've only thought a little bit about a ROM and am currently writing a manual for this so any help would be great. I was thinking of a 16K ROM with the thin font, VDU 19 for the extended palette, modified WRCH, some enable/disable/reset commands and possibly my palette selection routine.

User avatar
Rich Talbot-Watkins
Posts: 1367
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by Rich Talbot-Watkins » Thu Jun 08, 2017 11:56 am

The thing to define very clearly will be how to express the 'attributes' in terms of a COLOUR command.

e.g. for the 6 pixel-per-byte MODE 1, we have colours 0-3, as per always. Then we have 4 'offsets'. So can you just write this as COLOUR 4..7, COLOUR 8..11, COLOUR 12..15? It would be nice if that would just work. But what about if you write COLOUR 7: COLOUR 128? That's not possible (background and foreground colours with a different colour offset). So does the most recent one override the previous one? Probably - though it's potentially a little confusing - but I can't really see another way. These modes will require the user to understand their limitations.

For the 6 pixel-per-byte MODE 0, we have either 4 or 8 colour offsets, depending on the mode type. I guess being able to write COLOUR 0..7 or COLOUR 0..15 should work.

A quick look at the AUG shows that ?&D2 and ?&D3 contain text colour bytes which are ORed and EORed into memory respectively. This being the case, I think the attributes would require no special case code to implement with this same system - there must always be a combination of values which would result in the attribute bits being forced to the right value, as well as allowing the actual pattern byte to be modified according to the foreground and background colours. So the text printing code from the OS could probably be copied verbatim, reusing the same ZP variables, for extra compatibility.

It probably makes sense to expand the MODE numbers as well, and set the VDU variables according to the new MODE's specifications where appropriate. The nice thing is that these modes are nearly exactly the same as their standard equivalents in terms of setting text windows, memory layout, etc.

I guess there's no reason why points, lines, horizontal fill, and filled triangles couldn't be implemented for the graphics modes. We have the entire OS 1.20 source (I think the OS 3.20 extended PLOT codes are probably a bit too ambitious though, and stuff like circles would come out elliptical with the non-5:4 aspect ratio!). Plotted pixels would just override the previous attributes in that byte, though there's no reason why an additional GCOL bit couldn't be used to specify "don't overwrite existing attributes".

User avatar
tricky
Posts: 2847
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by tricky » Thu Jun 08, 2017 12:11 pm

I think I asked before about a standard way to check if the new ula was present and a ROM seemed best.
Is there a spare *fx, check for error or unexpected himem when a mode is selected way of checking?
JGH?
I was just wondering about graphics ROM compatibility, but I guess that it might just work.

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Post by jgharston » Thu Jun 08, 2017 2:34 pm

tricky wrote:I think I asked before about a standard way to check if the new ula was present and a ROM seemed best.
Is there a spare *fx, check for error or unexpected himem when a mode is selected way of checking?
JGH?
I'll have a look when I get home. (I'm in the library and running out of Internet) There should be a simple way to do it, plus a simple API to encapsulate it in.

As for setting colours, just use the standard COLOUR API. COLOUR 0+n = foreground, COLOUR 128+n = background, viz http://beebwiki.mdfs.net/Physical_colour_numbers

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

Post Reply