Anyone to convert a Z80 music player?

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Anyone to convert a Z80 music player?

Postby Targhan » Thu Apr 12, 2018 1:28 pm

Hi all,

I am an Amstrad CPC coder, and has released Arkos Tracker 2 lately, a cross-platform (Windows, Mac, Linux) tracker to compose for Amstrad CPC, MSX, Spectrum and Atari ST. It is still in alpha (which is why I didn't promote it outside the CPC scene), but is already very stable and, I hope, powerful.

There are three Z80 players:
- One "generic", that is the normal player, good balance between speed and memory.
- One "lightweight", smaller but also more limited.
- One "streamed", using a new format called AKY, which is some kind of compressed YM, with a very interesting compression ratio (basically, it is better than MXM, and 3 times smaller than what is done on CPC).

I have adapted all three players for all the hardware, except for Atari, as I don't know 68000. However, I believe only the AKY must be converted. It is both the simplest and fastest player, and the memory overhead is, I believe, almost negligible for an Atari ST.

So I'd like to ask if one of you would be interested in converting the player. The good news is that the format is fully documented. A good knowledge of the AY is required of course, but it is only about addressing the right registers (there is currently no SID in my tracker).

The code source of the players is fully available in the Arkos Tracker package, but if you're interested in this little project, it is better that we discuss about it here (or via PM). The format is effective, but quite simple to decode, so with a bit of guidance, the whole convertion can be done within a few evenings!

Thanks!

Targhan/Arkos.

User avatar
spiny
Disk Imager Supreme
Disk Imager Supreme
Posts: 2429
Joined: Mon Aug 11, 2003 11:53 pm
Location: just outside bristol
Contact:

Re: Anyone to convert a Z80 music player?

Postby spiny » Thu Apr 12, 2018 4:16 pm

Gwem, author of maxYMiser, would probably be a good person to talk too

http://www.preromanbritain.com/maxymiser/

User avatar
ggn
Atari God
Atari God
Posts: 1161
Joined: Sat Dec 28, 2002 4:49 pm

Re: Anyone to convert a Z80 music player?

Postby ggn » Thu Apr 12, 2018 6:23 pm

Is the 6502 player source available? Then we could use something like mos2mot to bring it to 68000 and add platform specific stuff and optimisations with a couple of passes.
is 73 Falcon patched atari games enough ? ^^

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Fri Apr 13, 2018 12:57 pm

Thanks for your answer.
The 6502 player is not available right now. Someone asked to do it, but I had no news since. But I think it's really more efficient to convert it from a Z80, the 6502 is really more limited!

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Anyone to convert a Z80 music player?

Postby FedePede04 » Fri Apr 13, 2018 7:24 pm

i tried your program in windows, it look like it run great, could have been a couple more example in its native format...
i like you interface not the usual windows interface...
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Sat Apr 14, 2018 12:10 pm

Thanks! More example will appear with time. Anyone can also participate :).

User avatar
dma
Atari Super Hero
Atari Super Hero
Posts: 829
Joined: Wed Nov 20, 2002 11:22 pm
Location: France
Contact:

Re: Anyone to convert a Z80 music player?

Postby dma » Mon Apr 16, 2018 11:45 am

Wow, nice set of features and cool non native interface.
It would be excellent if it could support the standard trackers copy/paste/block/transpose keyboard shortcuts (those present in PC FastTracker 2). :)

User avatar
ggn
Atari God
Atari God
Posts: 1161
Joined: Sat Dec 28, 2002 4:49 pm

Re: Anyone to convert a Z80 music player?

Postby ggn » Tue Apr 17, 2018 5:46 pm

Just for the heck of it, I started converting the z80 code line by line, trying to accommodate for small changes but not seeing the big picture yet. If anyone wants to have a laugh, point your browsers at https://github.com/ggnkua/Arkos-Tracker-2-ST or https://bitbucket.org/ggnkua/arkos-trac ... rc/master/ if you prefer!
is 73 Falcon patched atari games enough ? ^^

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Tue Apr 17, 2018 10:12 pm

Wow, nice set of features and cool non native interface.
It would be excellent if it could support the standard trackers copy/paste/block/transpose keyboard shortcuts (those present in PC FastTracker 2).


Thanks! Yes of course, copy/paste/undo/redo are on the TODO list (as stated in the Roadmap page). But first I wanted to have a fully finished engine, import/export and players. This should be ready quite soon.

Just for the heck of it, I started converting the z80 code line by line, trying to accommodate for small changes but not seeing the big picture yet.


Wow! That's great! HOWEVER: you should have asked me before starting, you should NOT convert the "stabilized" player, because it only means something on an Amstrad CPC (each instruction always takes the same cycles, so it's rather easy for us to have "stable" code. Too bad we don't have timers). But the code is uglier and slower because of this. So you should convert only the "PlayerAky.asm", and that's it. Do not bother with the other players (AKG, Lightweight)! I don't think they are relevant on Atari ST.

Don't hesitate if you have any question, I'll glad to help.

Also, do you think the AKY format can have a use on ST, on a game/demo? I hope so. It's must better than YM in term of compression, but it's a bit slower of course, since data has to be decoded.

Thanks again!

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Anyone to convert a Z80 music player?

Postby FedePede04 » Wed Apr 18, 2018 4:33 am

Targhan wrote:Also, do you think the AKY format can have a use on ST, on a game/demo? I hope so. It's must better than YM in term of compression, but it's a bit slower of course, since data has to be decoded.


when you say YM format do you mean leonard's STSound YM files, and if yes how do you compress the file,
and wont the file still be to big for a 8bit machine?
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
ggn
Atari God
Atari God
Posts: 1161
Joined: Sat Dec 28, 2002 4:49 pm

Re: Anyone to convert a Z80 music player?

Postby ggn » Wed Apr 18, 2018 5:41 am

Hello!

Targhan wrote:Wow! That's great! HOWEVER: you should have asked me before starting, you should NOT convert the "stabilized" player, because it only means something on an Amstrad CPC (each instruction always takes the same cycles, so it's rather easy for us to have "stable" code. Too bad we don't have timers). But the code is uglier and slower because of this.


Okay, I understand your concern. But really I wouldn't worry about slower/uglier code as from what I've seen so far the code will definitely require an optimisation pass regardless which source is used. For now the real goal is to get something working really. Then we can look into optimising it.

Of course the real driving force will be people (coders, musicians) actually wanting to use the player in productions. THEN you'll start to feel at home ("why does the player take 3 scanlines? My effect uses 99.9999% CPU and I didn't budget anything for music!")

By the way, what do you mean by "stable" here? That it takes a fixed amount of clock cycles so people can synchronise with the CRT beam easier? This is actually a thing that ST people also do so it's also of interest.

To be honest the thing that matters to me here is that the player and tune format is stabilised and there won't be major changes to it. I assume that's the case?

Targhan wrote:So you should convert only the "PlayerAky.asm", and that's it. Do not bother with the other players (AKG, Lightweight)! I don't think they are relevant on Atari ST.


Well, I just took the latest version of the player I found in the archive

As I said above, people always require light/small/fast versions of a music player, so don't dismiss that idea so quickly :). Can you outline the differences in a bit more detail? Are the other players missing features?

Targhan wrote:Don't hesitate if you have any question, I'll glad to help.


Well since you're offering help :) - In the source archive I also see an "accurate" player. Does this take a lot more time than the normal player?

There'll be plenty more questions when I'll actually try to feed a tune into this thing!

Targhan wrote:Also, do you think the AKY format can have a use on ST, on a game/demo? I hope so. It's must better than YM in term of compression, but it's a bit slower of course, since data has to be decoded.


It all depends on the people, doesn't it? But when you see talented people like dma-sc expressing interest, there's a good chance!

Targhan wrote:Thanks again!


No problem, but I'll reserve the "thanks" until there's something working! And again, don't worry about me picking the "wrong" source, by the time this is final it'll have very few similarities with the original :)
is 73 Falcon patched atari games enough ? ^^

User avatar
explorer
Retro freak
Retro freak
Posts: 10
Joined: Fri May 05, 2017 9:40 pm

Re: Anyone to convert a Z80 music player?

Postby explorer » Wed Apr 18, 2018 7:51 am

Maybe the release of AKY format file would help.

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Wed Apr 18, 2018 8:05 am

when you say YM format do you mean leonard's STSound YM files, and if yes how do you compress the file, wont the file still be to big for a 8bit machine?


My format (AKY) treats the whole music, not as a "dumb" YM list, but as small sequences of notes. Since I created the tracker, it is easy for me to split the sound stream into smaller streams. There is no "packaging" like LZ, only a smart (I hope) organization of data. So the compression ratio is much higher than some compression format we use on CPC (AYM), or MXM (on MSX), plus the player is very fast, and requires no buffer. To give you an example, a complex song of 5 mns, without any repetiting patterns, can be encoded within 16kb.

Okay, I understand your concern. But really I wouldn't worry about slower/uglier code as from what I've seen so far the code will definitely require an optimisation pass regardless which source is used. For now the real goal is to get something working really. Then we can look into optimising it.


Yes, but the "Stabilized player" code is a bit more complex to manage some branching easier. So really, my advice is NOT to convert this player.

By the way, what do you mean by "stable" here? That it takes a fixed amount of clock cycles so people can synchronise with the CRT beam easier? This is actually a thing that ST people also do so it's also of interest.


Yes, by "stable", I meant indeed "fixed amount of clock cycles". So indeed, you may want to use the "stabilized player" if you are interested in such feature, finally :).

To be honest the thing that matters to me here is that the player and tune format is stabilised and there won't be major changes to it. I assume that's the case?


Yes. The format is fully described in the package of AT2, so feel free to delve into it!

Can you outline the differences in a bit more detail? Are the other players missing features?


- Generic (AKG): full blown player. It is not "compressed", manages all the effects and features of AT2. Best compromise between speed and size.
- Lightweight: the same, but with less features so that the player is smaller (less effects, less instrument possibilities). Most music will work with this set of features.
- AKY: "streamed" player. Smaller, very fast, but the music size is larger.

In the source archive I also see an "accurate" player. Does this take a lot more time than the normal player?


It does take about one/two scanlines on a CPC, so it is significant for a demo. But really, only very complex song will require it (switching hardware sound quickly between the three channels. 99.99% song don't). I wouldn't bother, but it's up to you!
Last edited by Targhan on Wed Apr 18, 2018 8:09 am, edited 1 time in total.

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Wed Apr 18, 2018 8:08 am

Maybe the release of AKY format file would help.


My mistake! I thought it was in the package, it is not. Contact me (contact at julien-nevo dot com, or via the AT2 website) and I'll send it to whoever wants it. I'll also publish it in the next release.

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Anyone to convert a Z80 music player?

Postby FedePede04 » Wed Apr 18, 2018 8:50 am

Targhan wrote:My format (AKY) treats the whole music, not as a "dumb" YM list, but as small sequences of notes. Since I created the tracker, it is easy for me to split the sound stream into smaller streams. There is no "packaging" like LZ, only a smart (I hope) organization of data. So the compression ratio is much higher than some compression format we use on CPC (AYM), or MXM (on MSX), plus the player is very fast, and requires no buffer. To give you an example, a complex song of 5 mns, without any repetiting patterns, can be encoded within 16kb.


i have also thought of doing something similar when i export my score to ymt, but i have not done it yet, because i want to do a whole new YMT editor (so i have to wait :) )
but i also compress my YM stream i have a word at every line, telling me which register that have new data
so if the word is %1000000000000000 then is only reg0 that will be change and if it say %0010100000000000 then reg 2 and 4 have new datas and so on :) it can be optimize further but it is ok for now.

my compress format "my version of Outrun Splash wave Time : lenght 4:50:43m data change 300HZ size 313041 bytes"
if the file was uncompress size would be round 1396128 bytes. it still take a lot :lol:
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Anyone to convert a Z80 music player?

Postby FedePede04 » Wed Apr 18, 2018 9:21 am

just did a quick test, I change the sounds to 200hz instead of 300hz and the splash wav size was reduce to
228983 bytes from the 313041 bytes
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Wed Apr 18, 2018 10:35 am

Well, it's still quite a lot (even for an Atari). My AKY format can come in handy, I guess :).

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Anyone to convert a Z80 music player?

Postby FedePede04 » Wed Apr 18, 2018 11:57 am

you are right its a lot but it also depend which ST you are tagging, most STE today have 4 MB and 5 min is also a quite long score plus one could reduce the HZ a little more. i have not rand into space problem yet...
but i will definitely say there are room for you player, the more the better :D, i will look forward to see what ggn does.
I will pass making a player for it, i have been doing music apps for most of my life, so now i will much rather code something else.
But good luck with it... :cheers:
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
ggn
Atari God
Atari God
Posts: 1161
Joined: Sat Dec 28, 2002 4:49 pm

Re: Anyone to convert a Z80 music player?

Postby ggn » Wed Apr 18, 2018 5:31 pm

Okay I have a question! (well I have a bunch of them but this is probably the most crucial right now) What does this snippet of code do?

Code: Select all

                ld a,11         ;Next regiser

                ld b,d
                out (c),a       ;f400 + register.
                ld b,e
                out (c),0       ;f600.
                dec b
                outi            ;f400 + value.
                ld b,e
                out (c),c       ;f680
                ex af,af'
                out (c),a       ;f6c0.
                ex af,af'


I've read some docs a bit and I understand that on the amstrad the psg is hidden behind some ports so you don't have direct access to it. I didn't get too deep into the docs so my guess for now is that the f400+register is a write to psg register select so you can select the register to write data to, while f400+value is the actual byte written to the register. But I think I should be safe and ask rather than make bad assumptions :)

Also, to give some context: on the ST the YM2149 is mapped directly to memory, so the register select/read data are aliased to $ff8800 and write data to $ff8802. So, a write to the chip would be something like

Code: Select all

move.b #register,$ffff8800.w
move.b #value,$ffff8802.w


(I'm sure that people are already typing up angry responses at my non-optimal code - relax people, it's only for illustration purposes :))

So anyway, I'd like to be sure how I should map the above Z80 code to 68k.
is 73 Falcon patched atari games enough ? ^^

Targhan
Retro freak
Retro freak
Posts: 12
Joined: Thu Mar 23, 2017 2:18 pm

Re: Anyone to convert a Z80 music player?

Postby Targhan » Thu Apr 19, 2018 7:29 am

Well, what you see is the struggle we must endure to access our dear AY :).

On a CPC, accessing the PSG must be done via the OUT instruction (because it is OUTside the Z80):
#f400 + PSG register
#f6c0 (validate the register)
#f600 (sleep)

#f400 + value
#f680 (validate the value)
#f600 (sleep)

Yay! :)


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 1 guest