New BBC Master dual processor demo - Twinhead

new graphics/music demos - bitshifters, 0xc0de, The Master + others
Post Reply
User avatar
SarahWalker
Posts: 1598
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

New BBC Master dual processor demo - Twinhead

Post by SarahWalker »

Just released at Revision 2021, a new BBC Master demo by myself and some of the guys at Desire - Twinhead. This is I believe the first full dual processor demo, requiring a 6502 copro.

Note that this _probably_ requires a real Acorn copro, at least in the current version - it's been tested on both external 3 MHz and 4 MHz Acorn copros, but I've been told it will hang roughly halfway through on PiTubeDirect. I need to buy the latter and figure out what's going on... It's totally untested on anything else, and in particular absolutely requires the 24-byte FIFO to be present, which I gather isn't the case on all modern Tube ULA replacements.

It will run on both B-em and BeebEm, though the latter makes an absolute hash of the music so is not recommended!

Youtube link for those without the hardware : https://youtu.be/AvUCeJ6SEUI
Attachments
Progen_and_Desire_-_Twinhead_V2.zip
(83.18 KiB) Downloaded 121 times
Twinhead.gif
Twinhead.gif (7.86 KiB) Viewed 6589 times
Last edited by SarahWalker on Mon Apr 12, 2021 7:46 pm, edited 1 time in total.
User avatar
marcusjambler
Posts: 1147
Joined: Mon May 22, 2017 12:20 pm
Location: Bradford
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by marcusjambler »

Wow this is great =D>
Confirmed working on a Master with a Kortink Reco6502mini copro :D
User avatar
danielj
Posts: 9900
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by danielj »

marcusjambler wrote: Sun Apr 04, 2021 11:21 am Wow this is great =D>
Confirmed working on a Master with a Kortink Reco6502mini copro :D
That has a short FIFO IIRC?
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

Excellent demo Sarah.

I've run tried the following second processors:

- 3MHz Acorn cheese-wedge - works

- PiTubeDirect Co Pro 0 (279MHz) - hangs
- PiTubeDirect Co Pro 1 (3MHz) - hangs
- PiTubeDirect Co Pro 2 (279MHz) - hangs
- PiTubeDirect Co Pro 3 (4MHz) - hangs

- PiTubeDirect Co Pro 16 (69MHz lib6502) - works

- Matchbox Co Pro 0 - 20171007_0719 Firmware (3MHz - Arlet's 65C02 Core) - hangs
- Matchbox Co Pro 1 - 20171007_0719 Firmware (4MHz - Arlet's 65C02 Core) - hangs
- Matchbox Co Pro 2 - 20171007_0719 Firmware (16MHz - Arlet's 65C02 Core) - hangs
- Matchbox Co Pro 3 - 20171007_0719 Firmware (64MHz - Arlet's 65C02 Core) - hangs

- Matchbox Co Pro 0 - 20160228_1555 Firmware (4MHz - AlanD's 65C02 Core) - works
- Matchbox Co Pro 1 - 20160228_1555 Firmware (8MHz - AlanD's 65C02 Core) - works
- Matchbox Co Pro 2 - 20160228_1555 Firmware (16MHz - AlanD's 65C02 Core) - hangs
- Matchbox Co Pro 3 - 20160228_1555 Firmware (32MHz - AlanD's 65C02 Core) - hangs

The PiTubeDirect hangs all happen at 2 min 1 seconds on this screen:
capture19.png
The Matchbox 20171007_0719 hangs all happen at 2 mins 42 seconds on this screen:
capture23.png
The preceeding sequence is corrupt:
capture22.png
The Matchbox 20160228_1555 hang happens much earlier:
capture24.png
capture25.png
I've also tried BeebFPGA and it runs to completion, but sadly there are lots of 6845 issues, which is rather a shame, since I worked hard to get all the BitShifter's demos running.

So it looks like this is a great test for discovering 65C02 emulation issues!

Are you planning to release the source at some point? That would make debugging these emulation issues much easier.

Dave
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

Sarah,

I've started looking into the emulation issues and found something a bit unexepected.

This is from running the PiTubeDirect debugger on Co Pro 16 (the one that works).

On the Co Processor, I'm seeing writes to &FEE3 in this section:
capture27.png
Here's the code with the write:

Code: Select all

1a50 4c df 19 jmp 19DF
1a53 a9 00    lda #00
1a55 8d e3 fe sta FEE3
1a58 20 cd 19 jsr 19CD
1a5b 85 7e    sta 7E
1a5d 85 6b    sta 6B
1a5f 20 cd 19 jsr 19CD
It looks like possibly this section of code is incorrectly using the host address for a tube register, rather than the parasite address?

This was one of the sequences that crashes on the Matchbox. The address range &FEE0-&FEE7 on the Matchbox is used for bank switching. So writing there may cause a section of code to vanish.

Dave
User avatar
SarahWalker
Posts: 1598
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by SarahWalker »

Whoops! Pretty certain I started out with the correct host/parasite addresses, but probably started getting them confused at some point; on Acorn hardware they're all partially decoded so it works by accident. Shouldn't be too difficult to fix...
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

SarahWalker wrote: Sun Apr 04, 2021 2:05 pm on Acorn hardware they're all partially decoded so it works by accident.
That's true on the host side, but on the parasite they are fully decoded:
tube_decoding.PNG
That's from the external 6502 Co Pro schematic; I believe the internal one is the same.

So I'm not sure what's going on here.

Dave
User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by Arcadian »

So fluid, fast and smooth - what a great achievement having a dedicated demo for the Master Turbo.

Is there a possibility of all collaborators doing a talk at either a Saturday or Thursday ABug event do you think?
Please subscribe to the ABug YouTube channel!
User avatar
marcusjambler
Posts: 1147
Joined: Mon May 22, 2017 12:20 pm
Location: Bradford
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by marcusjambler »

That has a short FIFO IIRC?
I think that could be the case because running it side by side with an actual Master turbo shows up some corruption in a few sections on the kortink copro run through.
Simon
Posts: 329
Joined: Sun Apr 12, 2020 9:20 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by Simon »

This is fantastic, super smooth.
Electron (+1, +3, AP5)
Electron (RH +1, Pegasus)
BBC B 1770, boobip, Acorn Speech,Econet)
BBC B+ 128k (Acorn Speech)
Master 512 (ARA III, VideoNuLA, Econet)
PiTubeDirect, RGBtoHDMI, Pi1MHZ
Master Compact (Econet)
Econet: RiscPC 700 / A3020 / A3000
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

Sarah,

I've been looking into why the 3D Pyramid sequence (after the two-headed dog) hangs in PiTubeDirect on CoPros 0..3.

Debugging is hard-going, because that particular Co Pro doesn't include a debugger. However, I'm about 95% sure that during that sequence, the stack becomes unbalanced and wraps. There is evidence of this if you inspect the stack after a crash:

Code: Select all

0100  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0110  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0120  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0130  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0140  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0150  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0160  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
0170  c2 71 43 1a 64 7d 64 7d 6a 7d 64 7d 6a 7d 64 7d  .qC.d}d}j}d}j}d}
0180  6a 7d 64 7d 6a 7d 6a 7d 7c 8a ba 7e c2 71 43 1a  j}d}j}j}|..~.qC.
0190  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01a0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01b0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01c0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01d0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01e0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
01f0  c2 71 43 1a c2 71 43 1a c2 71 43 1a c2 71 43 1a  .qC..qC..qC..qC.
PiTubeDirect CoPro 0..3 definitely mis-handles the case where JSR or RTS causes the stack to wrap. The stack pointer ends up at the right address, but the data is read/written incorrectly.

The lib6502 Co Processor handles stack wrapping correctly, which is why I think it works.

I've also tried the 65816 Co Processor, and this also fails in an identical way. That has a debugger, and the stack is definitely wrapping during that sequence.

Do you deliberately rely on stack wrapping at this point, or is that accidental?

I'm going to work with Dominic and see if we can fix this in PiTubeDirect....

Dave

BTW, if it's any help, now I know what's going on, I can run a real Acorn 6502 Co Processor and capture an instruction trace with a logic analyzer. But you could probably do the same in b-em.
Last edited by hoglet on Wed Apr 07, 2021 9:31 am, edited 1 time in total.
User avatar
SarahWalker
Posts: 1598
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by SarahWalker »

Totally accidental. Looks to be the result of two effects sharing the same code (triangle sorting + plotting) with different ideas of how the stack should be managed. Shouldn't be too difficult to fix, but PiTubeDirect should really handle this!
dp11
Posts: 1757
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by dp11 »

I think it is more the stack wraps around ie overflows. PiTubeDirect fast core does handle this except in the case where a JSR/RTS is used and the stack pointer is at an odd address.
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

dp11 wrote: Tue Apr 06, 2021 7:55 pm I think it is more the stack wraps around ie overflows. PiTubeDirect fast core does handle this except in the case where a JSR/RTS is used and the stack pointer is at an odd address.
It's slightly worse than this: there are three cases where it behaves incorrectly:
- SP=0x100: JSR writes 0xFF and 0x100
- SP=0x1FE: RTS reads 0x1FF and 0x200
- SP=0x1FF: RTS reads 0x200 and 0x201

I've quicky hacked a correct (but slow) implementation and that fixes the issue with this section of the demo.

So at least that confirms there's nothing else going on.
SarahWalker wrote: Tue Apr 06, 2021 7:51 pm Shouldn't be too difficult to fix, but PiTubeDirect should really handle this!
I tend to agree with this...

I'll work with Dominic to fix this as efficiently as is possible.

Dave
User avatar
BeebMaster
Posts: 7380
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by BeebMaster »

I thought it would be a good test for "PyClock" if it could transfer a 100K+ disc image file from my NFS share into the Native ARM RAM so I could write it to a floppy disc with my DFS writer without anything going on fire, and it worked fine. It looks superb on the Sony Trinitron, much better than the Dell flat-screen, and runs all the way through no problem with real Turbo co-processor on Station 114. It must do a *TV0 somewhere, as I have Station 114 set to TV255, so the top line was cut off.

Also the screen is a quite a bit left-aligned on the Sony TV, but seems just a tiny bit right-aligned on the Dell monitor (with PiRGBtoHDMI).

It also works from a real 5.25" floppy disc, which probably nobody else is using.

And thank you for putting all the files in one directory, it means I could easily transfer it to Econet and run it from there no problem.

On PiTube co-pro 0, it crashes at the point shown in Hoglet's first picture on Station 201 and Station 114 (although not exactly the same frame, and the music continues.)
Image
User avatar
BeebMaster
Posts: 7380
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by BeebMaster »

I'm not sure if it helps to diagnose what's happening but it doesn't seem to play all the way through when run from Econet on 65C102 Turbo co-processor, or PiTube. Sometimes it breaks down during the "Progen" sequence (Hoglet's third picture) but most often when the two dog-heads are on screen, and there is a file access (07 or 08).
Image
User avatar
hoglet
Posts: 12666
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by hoglet »

Just a quick note to say this now runs on BeebFPGA.

The issue turned out to be the default VDU FIFO depth in BeebFPGA was only 1-byte.

This has now been fixed.
User avatar
ChrisJC
Posts: 71
Joined: Sat Jan 16, 2021 2:01 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by ChrisJC »

Highly impressive. I would be interested to know how it actually works.

Chris.
User avatar
Dave Footitt
Posts: 998
Joined: Thu Jun 22, 2006 10:31 am
Location: Abandoned Uranium Workings
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by Dave Footitt »

Nice work Sarah, very impressive =D> =D>
cmorley
Posts: 1867
Joined: Sat Jul 30, 2016 8:11 pm
Location: Oxford
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by cmorley »

I went to set up my Master this afternoon to try it wondering what copro I should use... my home built 65C02 one or the Pi (following the diagnostics from Hoglet) and then I realised... I own a Master Turbo! #-o

So one *co.intube and a shift-BREAK later... wow! Great demo. I am really impressed. It definitely makes the Master stand up to be counted against the 16bit machines with their fancy blitters and bitplanes. :)
User avatar
SarahWalker
Posts: 1598
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by SarahWalker »

Updated the first post with v2, which should now work on PiTubeDirect and Matchbox. Many thanks to hoglet for tracking down what was going wrong!
User avatar
danielj
Posts: 9900
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by danielj »

Having finally managed to run this on proper hardware, it is excellent :) - very elegantly done!

d.
Simon
Posts: 329
Joined: Sun Apr 12, 2020 9:20 pm
Contact:

Re: New BBC Master dual processor demo - Twinhead

Post by Simon »

Just set my master up to test something else and ran this for the first time on hardware, and damn it's even better.

Amazing.
Electron (+1, +3, AP5)
Electron (RH +1, Pegasus)
BBC B 1770, boobip, Acorn Speech,Econet)
BBC B+ 128k (Acorn Speech)
Master 512 (ARA III, VideoNuLA, Econet)
PiTubeDirect, RGBtoHDMI, Pi1MHZ
Master Compact (Econet)
Econet: RiscPC 700 / A3020 / A3000
Post Reply

Return to “new projects and releases: demoscene”