WYZ lib or AYFX integration

Requests for features
Post Reply
jordi
Member
Posts: 61
Joined: Sun Oct 28, 2018 3:35 pm

WYZ lib or AYFX integration

Post by jordi »

It's my Santa Claus desire: an easy integration of FX and AY into our games. :D


It's a real pain point to integrate any library
https://www.z88dk.org/forum/viewtopic.php?id=11166

They are all using some custom assembler code (from pasmo or whatever), and require very high technical knowldge of assembly just for integration on our code.


Could you please please please integrate it into the z88dk?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

That seems like a sensible idea and very neatly ties into an old issue that was raised on GitHub. I think it should be possible to pull in WYZ without too many problems. The issue can be found here: https://github.com/z88dk/z88dk/issues/184
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

My current opinion is that it may be easier to be on top of z88dk first, because of the many different varieties of music players and the different machines, because while many have the same AY chip, they are all accessed differently. But if you want to tie it into z88dk I don't have problems with it.

Also I'm not sure which tracker player we should be using, yet. On the Spectrum I'd probably use beepola and the compiled beeper engines. But AY is important too and I feel like I might need to port a tracker to both ZX as well as MSX this year anyway.

But I guess the first main thing to do is to clean up a tracker code to be useable as normal regular z80 code, and perhaps without self-modifying code. I don't think it's hard to do but I do lack the time right now.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

Also, here are 2 related links on playing music on the Spectrum wiht z88dk in the forums:

https://www.z88dk.org/forum/viewtopic.php?id=9634
https://www.z88dk.org/forum/viewtopic.php?id=5088
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I'm taking a look at the wyz player first of all - it "looks" like the easiest one to wrap in a C API and a machine dependent backend API.

Hopefully I'll have something working by the weekend - I can now understand some of the problems people have been having - to start with, I've no idea where the REPRODUCE_EFECTO label comes from!
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I've now got WYZPlayer baked into Classic for MSX and ZX so I'd really appreciate some feedback on it.

There's some docs located here: https://github.com/z88dk/z88dk/wiki/Classic-WYZ-Player which are hopefully easy to follow. There needs to be a bit of manipulation of the .asm file that is generated by WYZTracker. This basically works around z80asm currently lacking the db, dw directives and additionally wraps up the instrument/effects tables into something that can be easily accessed by C code.

I've given an example program for setting up interrupts for both ZX and MSX (ROM target).
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

I've installed a WYZTracker and generated with deafult parameters, a file quezesto.mus.asm and quezesto.mus (from the included songs).

Then I've downloaded the latest nightly and managed to compile both versions.

The Spectrum version works but the MSX version doesn't. And I did got the port error warning in the emulator, as I said in the other thread.

If you want the package I could post it somewhere.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks a lot for the hint. I've tracked down the MSX problem to an issue with different interrupt timing on emulators and some buggy code that issued a reti before the interrupt routine had finished. I'll push an update this evening - I'm guessing in the past I'd not noticed it since the ISRs I was testing with were fast to execute.

Which emulator/how do I show the problems with the PSG? The generic player code for the MSX and ZX is identical and it looks like register 7 is protected
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

dom wrote:Thanks a lot for the hint. I've tracked down the MSX problem to an issue with different interrupt timing on emulators and some buggy code that issued a reti before the interrupt routine had finished. I'll push an update this evening - I'm guessing in the past I'd not noticed it since the ISRs I was testing with were fast to execute.
The MSX interrupt is also complicated, but different than the ZX version. I need to look it up but there are several tricky stuff there. I'll ask around more, but that is likely something I can fix in the application level (in my game code, for example).
Which emulator/how do I show the problems with the PSG? The generic player code for the MSX and ZX is identical and it looks like register 7 is protected
According to https://www.msx.org/forum/msx-talk/emul ... msx?page=4, it says: "Just ensure that ?10? is written in the top two bits of register 7." (although I saw bits of assembly code where I saw all your port+7 was set with "10", so I wonder why).

On page 1 of that thread, there is this text: "When running the same game in the OpenMSX emulator I noticed that it gives a warning about unsafe PSG settings exactly at the same moment. As the Red Book says, if both 6th and 7th bits of PSG register 7 are set to one, this may damage the older machines with the real PSG chip." Yes, I use OpenMSX (amongst others).
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I'm just tagging in at the appropriate vector in high ram so there's nothing fancy going on in the interrupt routines.

I thought it was openmsx that was being used. I'm not seeing those warnings now I've fixed the interrupt handling - I'm guessing it was a side effect of the interrupt handler being interrupted which is never going to end well.

I'll carry on adding support for other machines most of them are hopefully easier, apart from the dreaded CPC of course.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

Thanks for working on the interrupts part. I understand there is still work on it right now?

Will look into it when it's ready. Is the MSX part finished?

I would like to download again but I don't really want to re-download and re-install the nightly every day, since it's getting large nowadays. (It's nearing 70MB now!)
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I believe the interrupt code is now correct. No ill effects in any of the emulators I've tried.

I think the size means that I forgot to strip the windows sdcc binaries again, I've just stripped them and the size of sdcc has gone down from 31M to 3M. I've also cranked up compression on the zip files so the next build should be substantially smaller - thanks for letting me know about that.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

Thanks! I've decided not to wait for the latest nightly and downloaded the thing.

Yes, it works now with your example code in your link above. At least, I've only tested the MSX version this time.
jordi
Member
Posts: 61
Joined: Sun Oct 28, 2018 3:35 pm

Post by jordi »

dom wrote:I'm taking a look at the wyz player first of all - it "looks" like the easiest one to wrap in a C API and a machine dependent backend API.

Hopefully I'll have something working by the weekend - I can now understand some of the problems people have been having - to start with, I've no idea where the REPRODUCE_EFECTO label comes from!
Did you got it from https://sites.google.com/site/wyzplayer/downloads


Regards
jordi
Member
Posts: 61
Joined: Sun Oct 28, 2018 3:35 pm

Post by jordi »

jordi wrote:
dom wrote:I'm taking a look at the wyz player first of all - it "looks" like the easiest one to wrap in a C API and a machine dependent backend API.

Hopefully I'll have something working by the weekend - I can now understand some of the problems people have been having - to start with, I've no idea where the REPRODUCE_EFECTO label comes from!
Did you got it from https://sites.google.com/site/wyzplayer/downloads


Regards
Wops I didn't read it the rest of the messages. Ignore this one.
jordi
Member
Posts: 61
Joined: Sun Oct 28, 2018 3:35 pm

Post by jordi »

dom wrote:I've now got WYZPlayer baked into Classic for MSX and ZX so I'd really appreciate some feedback on it.

There's some docs located here: https://github.com/z88dk/z88dk/wiki/Classic-WYZ-Player which are hopefully easy to follow. There needs to be a bit of manipulation of the .asm file that is generated by WYZTracker. This basically works around z80asm currently lacking the db, dw directives and additionally wraps up the instrument/effects tables into something that can be easily accessed by C code.

I've given an example program for setting up interrupts for both ZX and MSX (ROM target).
Really appreciate your work!! Thank you, and it was really fast ;)

It would be great to also integrate FX parts into the calls, as WYZ supports them
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks for the link - I was looking at the WYZTracker GitHub project and couldn't find that sfx.asm file.

I've now added it, wrapped it with a C api, updated the wiki page and more usefully provided an in-tree example that's here: https://github.com/z88dk/z88dk/tree/mas ... /sound/wyz - it was basically my test program so it made sense to add it.

Have fun!
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I've taken the VortexTracker integration by @stefanbylund and added it into classic for MSX and ZX targets.

Using it is similar to WYZ, and there's an example here: https://github.com/z88dk/z88dk/tree/mas ... /sound/vt2
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

I just wanted to say I've finally had some time to test the new updates, and I can confirm that both the vortextracker as the new wyztracker work, too. This was nice.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Post by Timmy »

dom wrote:I'll carry on adding support for other machines most of them are hopefully easier, apart from the dreaded CPC of course.
What is actually the problem with the CPC playing code provided with the wyz player? Or is it the interrupt part you're having problems with? (No I've never built CPC code myself, and for my next test I'll try out the GB target first.)
dom wrote:I think the size means that I forgot to strip the windows sdcc binaries again, I've just stripped them and the size of sdcc has gone down from 31M to 3M. I've also cranked up compression on the zip files so the next build should be substantially smaller - thanks for letting me know about that.
I noticed the size has reduced by 5M, so that's nice.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Timmy wrote:What is actually the problem with the CPC playing code provided with the wyz player? Or is it the interrupt part you're having problems with? (No I've never built CPC code myself, and for my next test I'll try out the GB target first.)
I'd imagine nothing is wrong with it, it's just historically I've not had a good time with the CPC: I've found the firmware very picky and I've got memories of being "scolded" by CPC developers.
Timmy wrote:I noticed the size has reduced by 5M, so that's nice.
I'd expected more, but I guess debug information compresses well! I should start removing targets rather than adding them: that would reduce the download size! :)
jordi
Member
Posts: 61
Joined: Sun Oct 28, 2018 3:35 pm

Post by jordi »

I'm trying to bring some noise management in effects from pOpE (so effects become more powerful), but not fully succeeded

My pull request is there, any clue will be great.

https://github.com/z88dk/z88dk/pull/1430/files
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: WYZ lib or AYFX integration

Post by Timmy »

I saw this discussion in msx.org, they are probably talking about new versions of WYZ formats and tracker and (probably) a 50/60 Hz identifier.

Probably interesting to follow.

https://www.msx.org/forum/msx-talk/deve ... ile-format
Post Reply