SpectROM - Speccy emulator for the Pi co-pro

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Tue Jan 23, 2018 8:01 am

jgharston wrote: Edit: (I had to check the code for this) and in BASIC, Spectrum to BBC can be done with:
attr%=((attr%AND1)*4)+((attr%AND6)DIV2) + ((attr%AND8)*4)+((attr%AND48)DIV2) + (attr%AND&C0)
which rotates the INK and PAPER bits of the %FIgrbGRB of the Spectrum attribute byte into %FIbgrBGR.
Luckily this is hardware not software, so I can just re-order the bits appropriately.

Dave

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 8:35 am

Dave: I'm afraid that I've had to change the VHDL again to get the border in:

The Spectrum display effectively has 17 logical colours (16+border) but only has 15 physical colours as bright and dark black are the same. Ideally, VideoNuLA would implement border control but it doesn't get the required sync signals so we have 16 logical and 16 physical colours on the Beeb side...

So, in Spectrum mode, I map a palette index of 0 ("dark" black) to 8 ("bright" black) unless the current attribute byte has a special value of 0x80 (flashing dark black on dark black).

This means that I can get the emulator to set up the border area with the special attribute and VideoNuLA outputs it as colour 0. This is set to the appropriate border colour using the extended palette.

If the emulator sees the special attribute value 0x80 in the display area, it simply converts it to 0x00 and VideoNuLA displays it as colour 8.

If you want more details, or can see a simpler way of doing this, just let me know.

Cheers,

Rob

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Tue Jan 23, 2018 9:49 am

Hi Rob,
RobC wrote: If you want more details, or can see a simpler way of doing this, just let me know.
Can I test my understanding of what you have just said...

To get a red border around the screen you would have to do the following:
- Set logical colour 0 in the extended palette to Red
- Tweak the 6845 to display additional rows and columns to be filled with "border"
- Write attribute byte 0x80 into the parts of the screen memory associated with the "border", which VideoNuLA will translate to logical colour 0

To give an actual example: Your original Speccy mode used Mode 0 with a reduced display area of 64 columns x 24 rows. To add a border that was 4 spectrum characters wide all the way around the mode needs to be reprogrammed to 80 columns x 32 rows, which happens to be the original Mode 0.

Or have I got completely the wrong end of this stick with the need for additional display memory?

Dave

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 10:10 am

hoglet wrote:Or have I got completely the wrong end of this stick with the need for additional display memory?
No - you're spot on. I'm using a 640x256 mode 0 so no tweaking of the 6845 anymore, just VDU 22,0.

I'm then filling character rows 0-3 and 28-31 with 0x80. I'm also filling the first and last four character columns of the remaining rows with 0x80 to create the sides of the border.

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Tue Jan 23, 2018 10:25 am

RobC wrote:
hoglet wrote:Or have I got completely the wrong end of this stick with the need for additional display memory?
No - you're spot on. I'm using a 640x256 mode 0 so no tweaking of the 6845 anymore, just VDU 22,0.

I'm then filling character rows 0-3 and 28-31 with 0x80. I'm also filling the first and last four character columns of the remaining rows with 0x80 to create the sides of the border.
OK, I'll do the same.

Dave

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by Rich Talbot-Watkins » Tue Jan 23, 2018 1:09 pm

So Rob, when are we going to see a video of this in action then? :)

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by jgharston » Tue Jan 23, 2018 1:28 pm

hoglet wrote:Or have I got completely the wrong end of this stick with the need for additional display memory?
Looks right. Essentially doing something similar to what ZXDisp does, which does:
MODE 9
COLOUR 128+border
CLS
VDU 28,4,27,35,4
COLOUR 128+paper
CLS

Code: Select all

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

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by jgharston » Tue Jan 23, 2018 1:32 pm

Also, I've lost track, what's the byte arrangement in screen memory when set up for Spectrum-style display? Using MODE 0 as the base suggests the Spectrum 1bpp display bitmap is mapped directly onto some of the BBC 1bpp display bitmap, but how are the attribute bytes mapped?

Code: Select all

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

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by Rich Talbot-Watkins » Tue Jan 23, 2018 2:44 pm

jgharston wrote:Also, I've lost track, what's the byte arrangement in screen memory when set up for Spectrum-style display? Using MODE 0 as the base suggests the Spectrum 1bpp display bitmap is mapped directly onto some of the BBC 1bpp display bitmap, but how are the attribute bytes mapped?
Rob squeezed an extra attribute mode into the VideoNuLA. So bascially byte pairs form {attribute, 8 pixels at 8MHz/pixel}. The attribute is exactly in Spectrum format, including 1 bit each for BRIGHT and FLASH.

It'd be nice if the attribute were simply 4 bits 'ink', 4 bits 'paper', but that'd make FLASH impossible in hardware. Although I wonder how feasible it'd be to actually have the parasite send packets to the host to invert the appropriate attributes every n frames on VSync? Would doubtless be too slow on a screen full of FLASH characters, but in normal usage (and particularly in a game), how many flash attributes are there? Would make the VideoNuLA attribute mode far more useful and generic!

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 3:10 pm

Rich Talbot-Watkins wrote:So Rob, when are we going to see a video of this in action then? :)
I'll try to put something up tonight. I've put in a fast whole-row transfer and have been using the border to watch how much of the frame is taken up with each type of video update. It's much better than it was but still not quick enough to keep up when the screen is scrolling.

Loads are all LDA &abs and, if the data is all prepared first, there's no waiting for the parasite so anything >4 cycles should be computed on the Pi. (This also means that there's no point in soft-copying a scrolling screen using a back buffer on the host.)

The killers are the stores as I'm pretty much forced to use STA (scraddr),Y and I'm storing 8x the attribute data. I've done a reasonable amount of unrolling in the whole-row transfer and am going to look if I can do something similar (using self-modifying code) for the shorter transfers.

The ideal would be to be able to do LDA #immediate, STA &abs. At the Leicester ABUG, cmorley mentioned using the TUBE registers as a code buffer with the peripheral/parasite writing code in to them on the fly. I've only just remembered this, and it would need changes to the PiTubeDirect code, but I might look into it at some point!

The other thing I need to sort out is a timer to action border and sound updates at the correct point in the frame.
jgharston wrote:Also, I've lost track, what's the byte arrangement in screen memory when set up for Spectrum-style display? Using MODE 0 as the base suggests the Spectrum 1bpp display bitmap is mapped directly onto some of the BBC 1bpp display bitmap, but how are the attribute bytes mapped?
There's nowhere near enough room in the CPLD to hold all the attributes for a row/line so each attribute byte operates on just 8 pixels and is sent immediately before the pixels it operates on. So, 0x3000 contains the first attribute byte and 0x3008 contains the corresponding pixels etc.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 3:13 pm

Rich Talbot-Watkins wrote:Rob squeezed an extra attribute mode into the VideoNuLA. So bascially byte pairs form {attribute, 8 pixels at 8MHz/pixel}. The attribute is exactly in Spectrum format, including 1 bit each for BRIGHT and FLASH.

It'd be nice if the attribute were simply 4 bits 'ink', 4 bits 'paper', but that'd make FLASH impossible in hardware. Although I wonder how feasible it'd be to actually have the parasite send packets to the host to invert the appropriate attributes every n frames on VSync? Would doubtless be too slow on a screen full of FLASH characters, but in normal usage (and particularly in a game), how many flash attributes are there? Would make the VideoNuLA attribute mode far more useful and generic!
Posted before I saw this. Yes - I've recently got hold of a Thomson MO6 and I think it has an attribute mode with exactly that format. I'll look at implementing the flashing stuff in software and see how it performs. (Sorry Dave!)

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 5:49 pm

RobC wrote:I've recently got hold of a Thomson MO6 and I think it has an attribute mode with exactly that format. I'll look at implementing the flashing stuff in software and see how it performs. (Sorry Dave!)
Of course, the problem with implementing a true 4-bit/4-bit attribute mode is that it has 16 physical colours and so I can't do my border trick :(

However, I've just about managed to put in the "Thomson" mode separately. It's called by doing ?&FE22=&63 and has a few constraints due to the shortage of logic:

i) The attribute bit order replicates the Spectrum mode (apart from the top bit which sets the msb of the background colour).
ii) The msb of the attribute byte doubles up as a flash bit! So the OS controlled flashing must be turned off in &FE20.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by Rich Talbot-Watkins » Tue Jan 23, 2018 6:35 pm

RobC wrote:Of course, the problem with implementing a true 4-bit/4-bit attribute mode is that it has 16 physical colours and so I can't do my border trick :(
I think you still can: you just reserve logical colour 8 for the border, and have the parasite translate all 'bright' blacks to logical colour 0 instead of 8. Seems like it would work exactly the same to me! (assuming that you are mapping normal colours to logical colours 0-7, and bright colours to 8-15, and assuming you're still doing a further lookup to your extended palette once you've got a logical colour number).
However, I've just about managed to put in the "Thomson" mode separately. It's called by doing ?&FE22=&63 and has a few constraints due to the shortage of logic:

i) The attribute bit order replicates the Spectrum mode (apart from the top bit which sets the msb of the background colour).
ii) The msb of the attribute byte doubles up as a flash bit! So the OS controlled flashing must be turned off in &FE20.
Not quite with you on (i), but (ii) is actually a great idea, particularly if you engineer its meaning to be to invert ink and paper, rather than just giving the inverse colour!

By the way, the Thomson MO6 seems utterly obscure - I can't imagine how you even got to know about it and its attribute screen, let alone actually get hold of one!

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 7:09 pm

Rich Talbot-Watkins wrote:I think you still can: you just reserve logical colour 8 for the border, and have the parasite translate all 'bright' blacks to logical colour 0 instead of 8...and assuming you're still doing a further lookup to your extended palette once you've got a logical colour number
Yes - I think you're right. I hadn't properly processed the idea of having separate bright bits for foreground and background :oops:
Rich Talbot-Watkins wrote:Not quite with you on (i), but (ii) is actually a great idea, particularly if you engineer its meaning to be to invert ink and paper, rather than just giving the inverse colour!

By the way, the Thomson MO6 seems utterly obscure - I can't imagine how you even got to know about it and its attribute screen, let alone actually get hold of one!
(i) is just a way of saying that I've had to keep the Spectrum attribute bit order due to lack of space.
On (ii), it swaps paper and ink rather than inverting the colours.

I was kindly pointed at the MO6 on eBay by Revaldinho as it's a 6809 machine and I did the Flex port. It's certainly unusual but seems like a good machine although I did make the mistake of powering it on before checking the PSU and got a blast of magic smoke!

I found details of its graphics modes here: http://www.cpcwiki.eu/index.php/Thomson

The 16 colour 12-bit palette is implemented by a RAMDAC and the rest of the board is made up of the 6809, ROM, RAM, a couple of PIAs and a gate array. Given it came out in 1986, it did make me wonder why Acorn couldn't have improved the palette on the Master.

Maybe it's the next candidate for a Beeb-based emulator? :)

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Jan 23, 2018 9:53 pm

I've put a video up showing SpectROM in action: https://youtu.be/ULzpLhT43ac

It's just me playing some games badly but it shows the current state of play. (The quality isn't great - I need to sort out how to do captures from my DVD-recorder again...)

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by jgharston » Wed Jan 24, 2018 4:26 pm

Rich Talbot-Watkins wrote:
jgharston wrote:Also, I've lost track, what's the byte arrangement in screen memory when set up for Spectrum-style display? Using MODE 0 as the base suggests the Spectrum 1bpp display bitmap is mapped directly onto some of the BBC 1bpp display bitmap, but how are the attribute bytes mapped?
Rob squeezed an extra attribute mode into the VideoNuLA. So bascially byte pairs form {attribute, 8 pixels at 8MHz/pixel}. The attribute is exactly in Spectrum format, including 1 bit each for BRIGHT and FLASH.
So, is this:

Code: Select all

+------------+------------+------------+------------+
|&3000 attrs |&3008 pixels|&3010 attrs |&3018 pixels|...
|&3001 attrs |&3009 pixels|&3011 attrs |&3019 pixels|...
|&3002 attrs |&300A pixels|&3012 attrs |&301A pixels|...
|&3003 attrs |&300B pixels|&3013 attrs |&301B pixels|...
|&3004 attrs |&300C pixels|&3014 attrs |&301C pixels|...
|&3005 attrs |&300D pixels|&3015 attrs |&301D pixels|...
|&3006 attrs |&300E pixels|&3016 attrs |&301E pixels|...
|&3007 attrs |&300F pixels|&3017 attrs |&301F pixels|...
+------------+------------+------------+------------+
|&3280 attrs |&3088 pixels|&3090 attrs |&3098 pixels|...
|&3281 attrs |&3088 pixels|&3090 attrs |&3098 pixels|...
etc
where the Spectrum hardware equivalent is:

Code: Select all

+------------+------------+------------+------------+
|&5800 attrs |&4000 pixels|&5B01 attrs |&4001 pixels|...
|&5800 attrs |&4100 pixels|&5B01 attrs |&4101 pixels|...
|&5800 attrs |&4200 pixels|&5B01 attrs |&4201 pixels|...
|&5800 attrs |&4300 pixels|&5B01 attrs |&4301 pixels|...
|&5800 attrs |&4400 pixels|&5B01 attrs |&4401 pixels|...
|&5800 attrs |&4500 pixels|&5B01 attrs |&4501 pixels|...
|&5800 attrs |&4600 pixels|&5B01 attrs |&4601 pixels|...
|&5800 attrs |&4700 pixels|&5B01 attrs |&4701 pixels|...
+------------+------------+------------+------------+
|&5820 attrs |&4020 pixels|&5B21 attrs |&4021 pixels|...
|&5820 attrs |&4120 pixels|&5B21 attrs |&4121 pixels|...
etc (ignoring the 4x4 offset to simulate the border)
Last edited by jgharston on Wed Jan 24, 2018 4:31 pm, edited 1 time in total.

Code: Select all

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

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Wed Jan 24, 2018 4:31 pm

The VideoNuLA version looks correct to me, apart from a few cut/paste errors in the bottom line.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by jgharston » Wed Jan 24, 2018 4:33 pm

Looks like the Timex attribute-per-pixel-line screen modes are implementable fairly simply.

Edit: my typing seems to have gone to pot today.

Code: Select all

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

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Wed Jan 24, 2018 5:29 pm

jgharston wrote:Looks like the Timex attribute-per-pixel-line screen modes are implementable fairly simply.
Yes - it would just be a matter of getting the attribute data from the relevant area of memory (Timex's screen 1) and it would all work.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Feb 06, 2018 9:32 pm

I've been busy repairing a couple of A3010s lately so haven't spent as much time on this as I'd have liked. However, I think it's now at the point where I can do a first release :)

The attached disk image contains the SpectROM ROM image (SPROM) and the Pi co-pro executable (ZXSPEC). (I've been loading the ROM image to sideways RAM but it should work fine if burnt to an EPROM.)

To run it do:

Code: Select all

*FX 151,230,15 [CTRL-Break]
*SRLOAD SPROM 8000 bank_number[CTRL-Break]
*ZXSPEC [snapshot_filename]
Once the emulator is running, keys are as follows:

Code: Select all

BBC keys            Emulator/Spectrum
========            =================
F0                - Reset emulator
F1                - Enter *command
F2                - Memory dump
F3                - Load snapshot (.SNA) file
F4                - Save snapshot (.SNA) file
F5                - Toggle sound on/off
F6                - Toggle sound emulation between tone generation and PWM
Shift             - Caps-Shift
Shift-Lk          - Symbol-Shift
Tab               - Extended mode (Caps-Shift + Symbol-Shift)
Cursor keys       - Cursor keys (Caps-Shift + '5','6','7' & '8')
Delete            - Delete (Caps-Shift + '0')
,                 - , (Symbol-Shift + 'N')
.                 - . (Symbol-Shift + 'M')
This is still a work in progress and I'm still not entirely happy with the sound emulation. The default mode simply updates the BBC's tone generator with the average frequency sent to the Spectrum's beeper every frame - this is crude but is low cost. The PWM option measures the time between each flip of the Spectrum's speaker and attempts to recreate this by generating a high frequency note and flipping the volume on the Beeb's sound output.

Some games (e.g. Bombjack, Skooldaze) work better with the tone generation option but others (e.g. Sabre Wulf, Head over Heels) sound better with PWM. Others (e.g. Chase HQ) work much better with sound turned off!

As I've said before, I'm happy to upgrade existing VideoNuLAs as long as people are happy to cover postage. If you are sending your board back to me, please do include your contact details along with the board.

EDIT: Should also have said that Kempston joystick emulation is supported.
Attachments
spectrom.zip
ZX Spectrum emulator
(60.26 KiB) Downloaded 24 times

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Mon Feb 12, 2018 11:04 am

I've updated the VideoNuLA support pack to document the new Spectrum and Thomson attribute modes and have added the latest version of the SpectROM emulator. It can be downloaded from Dropbox via the following link:

https://tinyurl.com/y75cmrxe

This corrects a couple of bugs in the keyboard handling (one in the ROM and one in the application). Virus now works so I can finally play Zarch on the Beeb :D

However, I've found a couple of games that still don't work correctly (Asterix & Lightforce) that I'm investigating...

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Mon Feb 12, 2018 9:49 pm

Hi Rob,
RobC wrote:I've updated the VideoNuLA support pack to document the new Spectrum and Thomson attribute modes and have added the latest version of the SpectROM emulator.
I've just been giving this a try with a Pi Zero connected to Beeb FPGA on a DE1.

I downloaded the support pack, and it appears the specrom.ssd disk image there is corrupt. Specifically, the SPROM file starts with a bunch of text. So I went back to the ZIP file in the preceeding post and that seems to work, and I get the classic Spectrum startup screen.

Is there a good online archive of .SNA files for common games, like Manic Miner, that you (or anyone else) could point me at?

Failing that, is there any chance you could post a few example SNA files to try, or maybe include an one on the specrom.ssd disk.

Thanks,

Dave

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Mon Feb 12, 2018 10:17 pm

Thanks for pointing that out Dave. Not sure how it got corrupted but it looks like the README file has overwritten part of the ROM image.

It should be okay again now. (It's better to use the version from the Dropbox link as it fixes a couple of keyboard handling issues...)

There are some SNA files available for download here: http://www.angelfire.com/ga/jamiemyland ... nload.html

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Mon Feb 12, 2018 10:26 pm

Thanks Rob, I'll have another play tomorrow.

User avatar
hoglet
Posts: 7117
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by hoglet » Tue Feb 13, 2018 12:25 pm

This is working pretty amazingly well Rob, very impressive:
IMG_1261.JPG
IMG_1257.JPG
IMG_1258.JPG
Even the audio sounds great.

I have one outstanding Beeb FPGA VideoNuLA issue to resolve - I need to come up with a more reliable way to synchronise the "first_byte" signal that is used to determine whether the byte is an attribute byte or a pixel byte. It's getting this wrong about 50% of the time. Did this cause you some trouble as well?

Dave

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Feb 13, 2018 12:40 pm

hoglet wrote:This is working pretty amazingly well Rob, very impressive
Thanks - I'm really pleased with how well it works :D The true star is the Pi co-pro as it does all the heavy lifting.
hoglet wrote:Even the audio sounds great.
It works better in some games than others - the speech in Ghostbusters is intelligible but the sound effects in Chase HQ are awful. I might revisit it at some point but I tried various schemes before settling on the current setup.
hoglet wrote:I have one outstanding Beeb FPGA VideoNuLA issue to resolve - I need to come up with a more reliable way to synchronise the "first_byte" signal that is used to determine whether the byte is an attribute byte or a pixel byte. It's getting this wrong about 50% of the time. Did this cause you some trouble as well?
I had exactly the same issue but I got it to work reliably by latching the attribute/pixel phase on the DISEN low->high transition.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by tricky » Tue Feb 13, 2018 1:18 pm

Rob, have you tried using "periodic noise" with the frequency controlled by the sound channel for lower frequencies?

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by RobC » Tue Feb 13, 2018 1:42 pm

tricky wrote:Rob, have you tried using "periodic noise" with the frequency controlled by the sound channel for lower frequencies?
Hi tricky. I haven't - could you explain how this would work as I'm not familiar with the concept?

I've tried PCM with frequency set to the highest value and volume based on the average value of the wave over the sample period. This sounded okay when I used a decent sample rate but took up a lot of host CPU time.

The current PWM implementation which flips between full off and full on at the appropriate time sounds better but still takes up a lot of host CPU time. The parasite checks the host timer value periodically and then dedicates the host to sound processing if a speaker transition isn't far off. (It knows when the transitions should occur in real time as it is processing each frame much faster than a genuine Spectrum.)

The alternative average frequency method (update frequency and volume once per frame) is quick and sounds okay in some games (Skooldaze, Bombjack).

EDIT: Have now read up on the periodic noise generation. Never realised it could be set to the channel 1 frequency before! I'll have a play with it when time allows.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by KenLowe » Tue Feb 13, 2018 7:57 pm

This is so neat. Manic Miner running on my Beeb! What more could I ask for :D . =D> =D> =D>

Edit: I notice that a lot of downloadable snapshot games are in .z80 format and not the .sna format used by SpectROM. I found a dos utility (SPCONV) that can covert between z80 and sna formats, but it doesn't work on x64 windows machines. The solution is fairly simple, though; extract the SPCONV utility to a folder on the root of your HDD, download and install the latest DOSBox, run DOSBox, mount the SPCONV folder in DOSBox (eg mount c c:\spconv\), change directory from z: to c: and run the SPCONV utility (eg spconv circus.z80 .sna). If you add new files to the SPCONV folder from Windows, then you need to refresh DOSBox (Ctrl-F4) to make it visible in DOSBox.
Last edited by KenLowe on Tue Feb 13, 2018 10:52 pm, edited 3 times in total.

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

Re: SpectROM - Speccy emulator for the Pi co-pro

Post by tricky » Tue Feb 13, 2018 8:20 pm

I've only done it from assembler, remember to set the sound volume to silent and I'm not sure if the conversion rate of clicks per second to frequency, but it might be ok. IIRC I used it for the engine noise in my sprint emulator.

Post Reply