Palettemate / enhanced video ULA with 4096 colours

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
User avatar
jgharston
Posts: 3023
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby jgharston » Fri Mar 23, 2018 11:39 am

RobC wrote:
SteveF wrote:Thanks Rob, I appreciate your help with this!

Sorry I didn't get a chance to test it last night but I was struggling with a kitchen issue!

What, a bit like this?
Image
Annoyingly, this happened to me twice, plus the second time the outflow from the washing machine froze as well.

Code: Select all

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

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby tricky » Fri Mar 23, 2018 2:07 pm

Having added NuLA support to Frogger by setting the NuLA colours in-game, I have just realised that I could have done it a less intrusive way.
The game uses 8 colours in standard mode and twelve colours in NuLA mode, with four of them having two variations - Magenta is Magenta and Brown.
I could have changed the game to use say Red and flashing Red/? with flashing off, this would just give me Red for both in standard mode, but allowed me to set Red and (non)flashing Red to two different red'ish colours during the set-up code and achieve the same result.

Rob, does this sound correct?

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby RobC » Sat Mar 24, 2018 1:55 pm

jgharston wrote:Rather than unsoldering my Master, I've got around to putting the repaired PSU in my original Beeb. The nULA happily co-exists with an Aries B32 board. I had to pick up A1 from the CPU on pin 10 instead of the 6522 as that's buried. ;)

That's good to know as I don't have an Aries board.

jgharston wrote:Really weird being in an 8-colour "MODE 0" :D

I wasn't sure about it at first but use it a lot now. Particularly with Flex as I like the font.

tricky wrote:I could have changed the game to use say Red and flashing Red/? with flashing off, this would just give me Red for both in standard mode, but allowed me to set Red and (non)flashing Red to two different red'ish colours during the set-up code and achieve the same result.

Rob, does this sound correct?

Yes - that sounds right, assuming I've understood correctly. However, one thing you can't do is write to &FE23 (or &FE22) and think that it'll have no effect on a standard machine. Unfortunately, the addresses aren't fully decoded so you'll end up writing to &FE21/&FE20 on a machine that doesn't have a VideoNuLA :(

One other effect that I hadn't really thought about until the other day was the ability to use the logical palette mapping to quickly switch between modes. Usually, you have to reprogram the palette (at &FE21) and this takes a few scanlines. However, this is bypassed when using logical palette mapping so it's possible to have horizontal split screens with e.g. the left half in mode 1 and the right half in mode 2 :D

Not sure if it's of much use but it is at least possible!

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby tricky » Sat Mar 24, 2018 4:21 pm

I check for the NuLA ROM before doing anything.

I guess you could write to NuLA and the immediately to ULA to put it back for the no NuLA case, I guess in BASIC/VDU, you would have to change MODE.

?&FE22 = &40
MODE 1
?&FE23 = nula colours
VDU reset logical colours

I use this, with interrupts disabled, after claiming the NMI.

Code: Select all

\\ 8000  00 00 00 4C 2D 80 82 18 01 56 69 64 65 6F 4E 75   ...L-Çé..VideoNu
\\ 8010  4C 41 00 31 2E 30 31 00 00 28 43 29 32 30 31 37   LA.1.01..(C)2017

.check_and_init_NuLA

   ldx #15
.check_next_rom
   stx &FE30
   ldy #8
.check_next_char
   lda VideoNuLA,y : cmp &8009,y : bne not_nula
   dey : bpl check_next_char

   lda os_rom_sel : sta &FE30

   \\ Do NuLA stuff
   RTS

.not_nula
   dex : bpl check_next_rom
   RTS

.VideoNuLA
   EQUS "VideoNuLA"


I don't know if there is a "legal" way to do this, but I suspect it involves the NuLA ROM responding to an OSBYTE or *command.

User avatar
danielj
Posts: 5977
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby danielj » Sun Mar 25, 2018 8:28 am

Is there a way to do it without looking for the ROM - as, for example, I don't always have the ROM loaded on my Master?

d.

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby tricky » Sun Mar 25, 2018 8:43 am

As it is a write only device, enhancing a write only device, I don't think so.
I think at least for some colour programming, you can write the same code that will work on both -I'm going to try later if I get a chance (see my frogger post).

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby jgharston » Sun Mar 25, 2018 4:09 pm

What i do with LDPIC is write to the hardware as though nULA is there, then write to the hardware to reset the original ULA:

Code: Select all

  960   LDA #19:JSR osbyte               :\ Wait for HSync to minimise flicker
  970   LDA #&40:STA &FE22               :\ Reset nULA
  980   LDA &248:STA &FE20               :\ Reset vULA
...
 1040   ORA dbits:STA &FE23           :\ Store index+red
...
 1080   ORA cbits:STA &FE23           :\ Store green+blue
...
 1250   .close
 1260   LDA &248:STA &FE20        :\ Reset vULA
 1270   LDA #0:JSR vramSelect     :\ Page out video RAM
 1280   LDA #0:LDY chn:JMP osfind :\ Close file and end

Code: Select all

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

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby jgharston » Sun Mar 25, 2018 4:16 pm

tricky wrote:I check for the NuLA ROM before doing anything.
...
I don't know if there is a "legal" way to do this, but I suspect it involves the NuLA ROM responding to an OSBYTE or *command.

If you don't mind changing MODE, select MODE 96, then read the current screen mode with OSBYTE 135. If nULA VDU extension is enabled it will tell you you are in MODE 96, otherwise it will tell you you are in MODE 0.

Code: Select all

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

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby RobC » Thu Apr 05, 2018 7:21 pm

For those who haven't been reading the Frogger thread, tricky and bagpuss discovered a hardware bug that affects the redefinition of flashing colours in 2 or 4 colour modes. 16 colour modes and the new modes are not affected.

The bug means that it is not possible to redefine a logical colour to one of the physical flashing colours (i.e. 8-15) in a 2 or 4 colour mode and then redefine the flashing colour to a 12-bit RGB analogue colour. The only part that doesn't work is redefining the flashing colour to an analogue colour so existing software will work as intended. And as stated above, the functionality works in 16 colour modes (e.g. mode 2) where the flashing colours were more likely to be used.

I am really sorry about this and am disappointed that I didn't pick it up during testing. The good news is that Andy/bagpuss and I have been testing a new build and I am confident that it fixes the problem. However, it does mean that the CPLD has to be reprogrammed.

If you have a suitable Altera USB blaster, I can supply instructions and the new .pof file for you to perform the upgrade yourself. Alternatively, you can return your board to me and I'll upgrade it free of charge and will cover return postage.

The upgrade also includes the ZX Spectrum and Thomson modes so there is some extra benefit for those who are still using the original build.

User avatar
KenLowe
Posts: 260
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby KenLowe » Thu Apr 05, 2018 7:41 pm

Is this what I need to program it myself?

https://www.ebay.co.uk/itm/Altera-Mini- ... 0005.m1851

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby crj » Thu Apr 05, 2018 8:28 pm

That's a cheap clone which might or might not work. Fortunately, it's reasonably easy to get both USB and Blaster interfaces correct at the electrical level so it probably won't blow anything up!

The Terasic clones for about £40 seem to be the cheapest that people actually trust.

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby RobC » Thu Apr 05, 2018 9:13 pm

KenLowe wrote:Is this what I need to program it myself?

https://www.ebay.co.uk/itm/Altera-Mini- ... 0005.m1851

Yes - it should do the job.

If you'd rather not risk it, you can always just post the board back to me.

I'll also be at Wakefield with my programming kit for anyone who wants me to update their boards there.

User avatar
KenLowe
Posts: 260
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby KenLowe » Thu Apr 05, 2018 11:12 pm

RobC wrote:
KenLowe wrote:Is this what I need to program it myself?

https://www.ebay.co.uk/itm/Altera-Mini- ... 0005.m1851

Yes - it should do the job.

If you'd rather not risk it, you can always just post the board back to me.

I'll also be at Wakefield with my programming kit for anyone who wants me to update their boards there.

Would love to get along to Wakefield, but it's just a bit too far away for me. With a bit of guidance, I'm happy to give it a go myself, so I've ordered up one of those devices. Might be a while before it arrives, though!

I notice that my NuLA board has through holes for JTAG programming, but no pins have been soldered in place. How do you program the unit without these pins? Do you just push a row of header pins into the through holes and rely on a tight interference fit to get the connection? Or is there another means of connecting? BTW, I'm happy to solder in a row of pins (straight or 90Deg), if that's what it takes.

Also, it looks like the header cable that comes with the programmer will be of limited use - as the pin out doesn't match exactly the layout of the pins on the NuLA board. Instead, I'll need to take individual jumper wires from the programmer direct to the NuLA JTAG header. Does that sound correct?

Sorry for the Noob JTAG questions!

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby RobC » Fri Apr 06, 2018 8:20 am

KenLowe wrote:Also, it looks like the header cable that comes with the programmer will be of limited use - as the pin out doesn't match exactly the layout of the pins on the NuLA board. Instead, I'll need to take individual jumper wires from the programmer direct to the NuLA JTAG header. Does that sound correct?

I use individual Dupont female-female jumpers connected to a right angle pin header. I just hold the header in place during programming as it doesn't take too long. If the connection breaks during programming, you just start again.

I wrote up some instructions in a Word document a while back so can supply that with the programming file.

User avatar
Bagpuss
Posts: 65
Joined: Mon Apr 25, 2016 2:09 pm
Location: Cornwall
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby Bagpuss » Fri Apr 06, 2018 9:16 am

KenLowe wrote:Is this what I need to program it myself?

https://www.ebay.co.uk/itm/Altera-Mini- ... 0005.m1851


That's the one I've used. These cheap clones are a bit flaky, though.
If you use the latest drivers from Quartus Lite 17.1 on Windows 10 x64, they will bluescreen the machine whenever you install them.
It seems to have something to do with it being a clone.

I found that installing the Windows 7 x64 driver from this thread, solved the problem. You do have to disable windows driver signature enforcement to get them to load, though.

I've updated my NuLA twice now with this combination of hardware/drivers, so I know it works.
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless.

atcurtis
Posts: 44
Joined: Fri Apr 08, 2016 9:47 am
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby atcurtis » Sat Apr 07, 2018 8:56 pm

Random thought:
If one ties the LPSTB line to the HSYNC, would that give one the ability to enable an IRQ per HSYNC using the system VIA?
(since light pens are essentially useless with modern LCD panels)

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby tricky » Sun Apr 08, 2018 8:12 am

If you are running non-interlaced, you can achieve a similar result with a timer, although you would have to skip the "offscreen" portion yourself.
For the Enhanced mode 1 pictures, I used carefully timed code, as once the OS has handled the interrupt and passed it on, you have wasted quite a bit of time unless you are using the boobip OS RAM module (for model A/B) and setting the vector directly to your code.

User avatar
KenLowe
Posts: 260
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby KenLowe » Sat Apr 14, 2018 5:57 pm

RobC wrote:I wrote up some instructions in a Word document a while back so can supply that with the programming file.

My programmer arrived today, so I downloaded and installed the Quartus Prime Lite software (I presume this is what I need?). The driver seems to have installed without any problem, but I have no idea how to use the software! Any chance you could send me those instructions, and the programming file? I'll PM my email address to you.

Thanks

User avatar
KenLowe
Posts: 260
Joined: Mon Oct 18, 2004 4:35 pm
Location: Scotland
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby KenLowe » Sat Apr 14, 2018 8:34 pm

All updated and working well. My cheap USB Blaster worked flawlessly (once I sorted out the wiring!). No BSOD with my Win10 setup. The USB Blaster I got has the PIC18F14K50, which does seem to be compatible with the latest drivers. Only problem I had was a lack of HDD space on my laptop. The Quartus Prime Lite software consumes quite a lot of space!

Thanks @RobC for supplying the necessary files, and for giving me some guidance on programming it.

aotta
Posts: 31
Joined: Fri May 26, 2017 8:57 am
Location: Italy
Contact:

Re: Palettemate / enhanced video ULA with 4096 colours

Postby aotta » Fri Apr 27, 2018 8:33 pm

RobC wrote:
KenLowe wrote:Also, it looks like the header cable that comes with the programmer will be of limited use - as the pin out doesn't match exactly the layout of the pins on the NuLA board. Instead, I'll need to take individual jumper wires from the programmer direct to the NuLA JTAG header. Does that sound correct?

I use individual Dupont female-female jumpers connected to a right angle pin header. I just hold the header in place during programming as it doesn't take too long. If the connection breaks during programming, you just start again.

I wrote up some instructions in a Word document a while back so can supply that with the programming file.


Hi RobC, i am interested in update my Nula too... you will post the firmware and guide here?

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby RobC » Fri Apr 27, 2018 8:40 pm

aotta wrote:Hi RobC, i am interested in update my Nula too... you will post the firmware and guide here?

PM me your e-mail address and I'll send them to you.

Cheers,

Rob

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

Re: Palettemate / enhanced video ULA with 4096 colours

Postby jgharston » Sun Apr 29, 2018 12:59 am

I've been trying to add some sample screen images to the BeebWiki, but there's a fault in image uploading that I spent most of today failing to solve. Anyway, what I did do test interaction between the VideoNuLA VDU driver extended MODEs and my software extended MODEs. The disk-based NewModes works, there's a subtle clash with the ROM-based NewModes which I haven't quite found yet.

Anyway, I've updated my ModeDemo program and made a video running it showing the standard MODEs, the software extended MODEs and the VideoNuLA extended MODEs. It uses the VideoNuLA ROM patched to put the &60+X MODEs in the standard VDU order, so that MODE 8n+X falls back to MODE X if MODE 8n+X is not available, and MODE 8n+X all have the same memory map for any n*.

* BBC extended and nULA screen modes demo


*ie all MODE 8n+0/1/2 are 20K, all MODE 8n+3 are 16K, all MODE 8n+4/5 are 10K, etc., all MODE 8n+0/3 are 80-column, all MODE 8n+1/4 are 40-column, etc.

The next thing on my to-do list is to update BBCtoBMP and BMPSave to understand the nULA attributes.

Code: Select all

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