z88dk forums

z80 Development Kit

You are not logged in.

#1 2020-02-05 09:33:21

jordi
Member
Registered: 2018-10-28
Posts: 51

WYZ lib or AYFX integration

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


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?

Offline

 

#2 2020-02-05 14:47:03

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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

Offline

 

#3 2020-02-05 14:57:08

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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.

Offline

 

#4 2020-02-05 15:03:29

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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

Offline

 

#5 2020-02-05 23:01:08

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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!

Offline

 

#6 2020-02-06 21:59:48

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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).

Offline

 

#7 2020-02-07 16:41:09

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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.

Offline

 

#8 2020-02-07 18:56:30

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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

Offline

 

#9 2020-02-07 21:03:00

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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).

Offline

 

#10 2020-02-08 14:46:10

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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.

Offline

 

#11 2020-02-09 13:17:04

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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!)

Offline

 

#12 2020-02-09 14:20:34

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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.

Offline

 

#13 2020-02-09 23:23:43

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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.

Offline

 

#14 2020-02-12 11:41:08

jordi
Member
Registered: 2018-10-28
Posts: 51

Re: WYZ lib or AYFX integration

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

Offline

 

#15 2020-02-12 11:42:31

jordi
Member
Registered: 2018-10-28
Posts: 51

Re: WYZ lib or AYFX integration

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.

Offline

 

#16 2020-02-12 12:17:03

jordi
Member
Registered: 2018-10-28
Posts: 51

Re: WYZ lib or AYFX integration

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 wink

It would be great to also integrate FX parts into the calls, as WYZ supports them

Offline

 

#17 2020-02-12 22:18:50

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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!

Offline

 

#18 2020-02-15 17:58:01

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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

Offline

 

#19 2020-02-18 23:40:09

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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.

Offline

 

#20 2020-02-20 21:45:55

Timmy
Member
Registered: 2012-03-10
Posts: 124

Re: WYZ lib or AYFX integration

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.

Offline

 

#21 2020-02-20 23:24:06

dom
Administrator
Registered: 2007-07-15
Posts: 1444
Website

Re: WYZ lib or AYFX integration

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! smile

Offline

 

#22 2020-03-28 18:01:26

jordi
Member
Registered: 2018-10-28
Posts: 51

Re: WYZ lib or AYFX integration

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

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson