Inline Mixer - saving clocks
Re: Inline Mixer - saving clocks
Music is process a 60hz, so once per field. I guess a JMP could be used yes since it should be the only place that calls that subroutine. But the latter is in C and I never tried that in C. Why would you like to do that?
-
- Posts: 1445
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: Inline Mixer - saving clocks
THIS ONE has my new noise method in it. Does it sound like noise? They sound the same to me, but I have poor hearing.
It only is 3 clocks less than my best LFSR to date, but I have not tried to optimize it yet.
It only is 3 clocks less than my best LFSR to date, but I have not tried to optimize it yet.
- Attachments
-
- NewNoiseTest.hex
- (35.84 KiB) Downloaded 368 times
Re: Inline Mixer - saving clocks
The 2 sound very close and I can't hear anything that doesn't sound perfectly LFSR like. The only difference I can detect is a slightly lower pitch to the one triggered by the 'A' button which seems consistent across effects.
-
- Posts: 1445
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: Inline Mixer - saving clocks
OK - in that case I think I can have
4 normal wave channels
1 wave channel that can also do dumb PCM
2 noise channels
That will mean I can have 3 wave + 1 noise exclusive for music
2 wave + 1 noise exclusive for sfx
If it is useful for more general purpose games - I THINK I have now saved enough clocks that you could squeeze in an extra wave channel without touching the PCM channel. (do many people use the PCM channel to play back samples at different pitch anyway ?)
4 normal wave channels
1 wave channel that can also do dumb PCM
2 noise channels
That will mean I can have 3 wave + 1 noise exclusive for music
2 wave + 1 noise exclusive for sfx
If it is useful for more general purpose games - I THINK I have now saved enough clocks that you could squeeze in an extra wave channel without touching the PCM channel. (do many people use the PCM channel to play back samples at different pitch anyway ?)
Re: Inline Mixer - saving clocks
Damn cool however you are pulling this off.
AFAIK only games are Gorillas(fixed frequency sample), Columns(multiple frequency sample), and TQ(kernel waves, like T2K) using PCM channel. Personally I plan to use the same music-immune PCM/kernel waves method like T2K for as much as possible in the future but the possibility of another wave is a rather enticing option if it can be worked in at compile time.
Do you think there is a possibility to squeeze UART buffers in with normal PCM channel(which currently you can't have both) with the extra cycles you achieved?
AFAIK only games are Gorillas(fixed frequency sample), Columns(multiple frequency sample), and TQ(kernel waves, like T2K) using PCM channel. Personally I plan to use the same music-immune PCM/kernel waves method like T2K for as much as possible in the future but the possibility of another wave is a rather enticing option if it can be worked in at compile time.
Do you think there is a possibility to squeeze UART buffers in with normal PCM channel(which currently you can't have both) with the extra cycles you achieved?
-
- Posts: 1445
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: Inline Mixer - saving clocks
I see that the current UART code is 47 clocks.
Keeping the full featured PCM channel I have only save 24 clocks.
So you would have to do some serious optimizing of the UART code to do that.
I have not looked at it. Maybe if you did an odds/evens for TX and RX you would be OK.
Keeping the full featured PCM channel I have only save 24 clocks.
So you would have to do some serious optimizing of the UART code to do that.
I have not looked at it. Maybe if you did an odds/evens for TX and RX you would be OK.
Re: Inline Mixer - saving clocks
I created an experimental branch with an optimized mixer:
https://github.com/Jubatian/uzebox/tree/mixer_boost
This incorporates techniques I used for Flight of a Dragon, and CunningFellow's optimizations on the noise channel. It is (was) difficult to determine what to use and how since a very substantial improvement comes from reducing the count of register used (push & pop overhead), in a later kernel, maybe even r18 will not be present in the inline mixer (I plan to later use GPIOR0 for a few important kernel flags like I did in Flight of a Dragon which can improve performance and could add capabilities, such as an option to set display mode - see the temporal interference topic).
Currently this mixer saves 23 clocks compared to the original, which gives some improvement in VBlank time available for user code. Not that much like the kernel boost (57 cycles per scanline), but still substantial (when using the UART, you get 26 clocks).
Games and stuff in the master repo seem to work. Test! If it is OK, I will merge in.
https://github.com/Jubatian/uzebox/tree/mixer_boost
This incorporates techniques I used for Flight of a Dragon, and CunningFellow's optimizations on the noise channel. It is (was) difficult to determine what to use and how since a very substantial improvement comes from reducing the count of register used (push & pop overhead), in a later kernel, maybe even r18 will not be present in the inline mixer (I plan to later use GPIOR0 for a few important kernel flags like I did in Flight of a Dragon which can improve performance and could add capabilities, such as an option to set display mode - see the temporal interference topic).
Currently this mixer saves 23 clocks compared to the original, which gives some improvement in VBlank time available for user code. Not that much like the kernel boost (57 cycles per scanline), but still substantial (when using the UART, you get 26 clocks).
Games and stuff in the master repo seem to work. Test! If it is OK, I will merge in.
Re: Inline Mixer - saving clocks
Well, I'm pretty impressed by those optimizations. I looked so many times at ways to reduce the cycles count on that code! Specially the saturation bit, so simple and elegant...kudos!
-
- Posts: 1445
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: Inline Mixer - saving clocks
Oh - I forgot about this.
I don't think I ever posted the next big speed gain I made. Using a common counter for the wave channels.
I'll dig up that code.
I don't think I ever posted the next big speed gain I made. Using a common counter for the wave channels.
I'll dig up that code.
Re: Inline Mixer - saving clocks
Wish to see that! I don't see how it is supposed to work though as for me it seems like there is nothing which could be made common between the channels (they may run at arbitrarily differing frequency).CunningFellow wrote: ↑Wed Nov 01, 2017 3:59 am Oh - I forgot about this.
I don't think I ever posted the next big speed gain I made. Using a common counter for the wave channels.
I'll dig up that code.
Well, Flight of a Dragon is slowly creeping in the mainline It is almost at the point where you could use the UART together with 5 channels with Mode 3, it is just a few cycles short of this point.