Mist/Mistica FPGA

You need an actual VIC.

Moderator: Moderators

Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Mist/Mistica FPGA

Post by Vic20-Ian »

nippur72 wrote: Mon Jun 22, 2020 11:01 am I was able to setup the IDE and compile for the Mister.

I merged the the audio section of the 6561 I wrote for the MiST last year, indeed the Mister code was very old dating back to my intervention, so it also lacks all the improvements on the video section that have been written for the MiST in the while. It's a pity there there is no central repository with just one single implementation always kept update.

I've put the resulting .RBF file here if you want to give it a try. Consider that I don't own a Mister yet, so it was a completely "blind" build. It's the first ever Mister core that I compile, so I don't know if it starts at all.

Anyway, if everything is ok, you should be able to hear the voice in Berzerk MMX+. Please let me know.

Regarding the audio distortion you mentioned, I guess it's something that has to do with "audio mixing" outside of the VIC20 emulation. I don't know much of the Mister yet, the code looks foreign to me, also because it's a much more complex machine than the MiST. Apparently there is a HDMI audio, a SPDIF audio and normal audio. And also a "linux audio"!

The issue I supect might be here, but I'm totally clueless:

Code: Select all

always @(posedge clk) begin
	reg signed [16:0] a1, a2, a3, a4;

	a1 <= is_signed ? {ca[15],ca} : {2'b00,ca[15:1]};
	a2 <= a1 + {linux_audio[15],linux_audio};

	pre_out <= a2[16:1];

	case(mix)
		0: a3 <= a2;
		1: a3 <= $signed(a2) - $signed(a2[16:3]) + $signed(pre_in[15:2]);
		2: a3 <= $signed(a2) - $signed(a2[16:2]) + $signed(pre_in[15:1]);
		3: a3 <= {a2[16],a2[16:1]} + {pre_in[15],pre_in};
	endcase

	if(att[4]) a4 <= 0;
	else a4 <= a3 >>> att[3:0];

	//clamping
	out <= ^a4[16:15] ? {a4[16],{15{a4[15]}}} : a4[15:0];
end

Hi Nippur,

I just tested this on Mister and the Berzerk MMX+ audio is working great, many thanks.

Best regards,
Ian
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Mist/Mistica FPGA

Post by nippur72 »

cool, I will open a "pull request" on the official repo so that the improvement can be included in the future releases.

Is channel mixing still distorded ? I've read somewhere that signed/unsigned values are a common source of distortion.
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Mist/Mistica FPGA

Post by Vic20-Ian »

I will try a few games tomorrow and let you know
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Mist/Mistica FPGA

Post by beamrider »

Finally got around to trying this...

The channel mixing is still heavily distorted in my experience.

Video

Thanks for looking at it though. Perhaps when you get your MiSTer you can improve it.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Mist/Mistica FPGA

Post by nippur72 »

I don't have a MiSTer yet, but let's see if we can at least identify the issue.

The audio output of the emulated 6561 is subject to a lowpass and highpass filtering to simulate the real VIC20 frequency response. It's converted from 6 bits to 16 bits in the process. Then the signal is driven into a sound mixer specific to Mister (I don't know the details). The output of this mixer is then feed into a 1-bit converter which is the final audio output of the MiSTer.

I've hacked the source code skipping all the filtering and the mixing, so the audio now goes strictly from the 6561 to the 1 bit converter. So if it sounds good, then we know where the problem is.

You can try the resulting .rbf image here.

As before, I compiled it "blindly" so I don't know if it works at all. If you don't hear any sound, it's likely I've messed it too much. Please report here.

"NO VIC 20 EMULATION WILL LEFT BEHIND."
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Mist/Mistica FPGA

Post by beamrider »

Thanks.

The link appears to require permissions.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Mist/Mistica FPGA

Post by nippur72 »

oops, I forgot to share in google drive. Now it should allow access
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Mist/Mistica FPGA

Post by beamrider »

thanks.

That works great. The sound is very clear now.

I'll use this core, I can't see any downside to bypassing the mixer.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Mist/Mistica FPGA

Post by nippur72 »

I am happy it works :) so the issue can be handled later without hurry.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: Mist/Mistica FPGA

Post by nippur72 »

If you want to check, I've uploaded here another version which has the filters but NOT the mixing; just to circumscribe the issue further.
verm71
Vic 20 Newbie
Posts: 1
Joined: Fri Jan 01, 2021 2:02 pm
Location: Ottawa, Canada
Occupation: Software Engineer

Re: Mist/Mistica FPGA

Post by verm71 »

I can confirm that the problem returns in the Jul 28 unofficial build, whereas it was fine in the Jul 26 build. This would appear to point to the filters as the culprit.
Post Reply