Arkos Tracker 2 in z88dk

Post Reply
eldeljar
Member
Posts: 30
Joined: Sun Feb 12, 2017 6:04 pm

Arkos Tracker 2 in z88dk

Post by eldeljar »

Hello, I would like to use music created with the Arkos Tracker 2 tool, but I am not able to do so.

The code is created with Rasm, but with the Rasm compiler and the "Diskark" tool you can generate the assembler code for SDCC.

The problem is that it generates a file with a .z80 extension and when trying to compile with z80asm it gives errors (before compiling I change the extension to .asm). I attach the file that has generated me for SDCC:

https://drive.google.com/file/d/1xnw_sK ... sp=sharing

I have looked at the documentation for z88dk but Arkos Tracker is not mentioned for music.

Does anyone use or have Arkos Tracker 2 integrated to work with z80asm?
If not, could someone tell me what changes I would have to make to the attached document to make it work with z80asm


Thank you
User avatar
jorgegv
Member
Posts: 58
Joined: Wed Nov 18, 2020 5:08 pm

Re: Arkos Tracker 2 in z88dk

Post by jorgegv »

In the "Disark" tool manual I see:
Of course the "source profile" parameter accept other values:

winape, maxam, pasmo, vasm, sdcc, orgams.
You can also omit the sourceProfile, in which case Disark produces a source with no specificity at all, which is fine for many many assemblers.
Did you try to generate assembler source for the different assemblers? It seems the macros/mnemonics used by the one you posted are not understood by z80asm, but maybe the "generic" profile mentioned in the docs will work?
andydansby
Member
Posts: 50
Joined: Fri May 27, 2016 8:58 pm

Re: Arkos Tracker 2 in z88dk

Post by andydansby »

Arkos Tracker 2 has been on my todo list for a while, but I just haven't gotten around to it. Best guess for it now is to compile it with the built in compiler and include it in an asm file as a binary blob with known entry points.
User avatar
dom
Well known member
Posts: 1477
Joined: Sun Jul 15, 2007 10:01 pm

Re: Arkos Tracker 2 in z88dk

Post by dom »

Because we've got WYZ and Vortex players in the library (for multiple targets) a while ago I was looking at including Arkos as well and getting it working across more exotic machines.

However, looking at the downloaded archive I just found it really confusing what player code needed to be included so I gave up - the kit I looked at had different players and implementations for zx, cpc, msx.

I suspect the best way to add it to a project is to either do it as a binary blob as @andydansby suggests or export as vasm (since I gave vasm z80asm compatible syntax when I first ported it).
eldeljar
Member
Posts: 30
Joined: Sun Feb 12, 2017 6:04 pm

Re: Arkos Tracker 2 in z88dk

Post by eldeljar »

Hello, thank you all very much for the answers.

Before answering, I mention that I am trying to integrate the player "The AKM (Minimalist) player".

@Jorgegv: I have tried with all the profiles.

@andydansby: I don't know what a "binary blob" is and how to do it.

Things I have changed to try to make it work:
- Add to the beginning of the code "SECTION code_user".
- I have added "DEFC" in front of the first line. The z80asm compiler gives no error, but I don't know if this is correct.
- The public functions I think are: _PLY_AKM_INIT, _PLY_AKM_STOP and _PLY_AKM_PLAY. I guess I would have to add "PUBLIC _PLY_AKM_INIT" to the beginning of the code to be able to use them from C.

Lastly, if this doesn't work, I'll contact the author of the "disark" tool to see if he can include "z80asm" between the profiles.
andydansby
Member
Posts: 50
Joined: Fri May 27, 2016 8:58 pm

Re: Arkos Tracker 2 in z88dk

Post by andydansby »

A binary blob is jargon for a chunk of data or code that's not native to the compiling program. It's usually, but not always, loaded via asm using a link into assembler with something like. This is just a quick overview, not a step by step.

In an assembler file, place a bit of code like:
BINARY "awesomeProgam.bin" ;;BINARY BLOB

What you would do is compile awesomeProgam.asm using an alternative assembler compiler, be it Rasm, SDCC or whatever. Generate a symbol table with that compiler. Using that symbol file, find the entry points to the program loadMusic, playMusic or the like and find the hex address. Link those addresses into your compiler pushing the correct values. You may want to use the IM2 to trigger a call to the player or some other means.

In a few weeks, I'm going to be posting a tutorial (I use older version of Z88dk, but it will pretty much all apply) on loading images into the compiler. It's really the same concept, except it's going to be a program that you will be loading instead. I may have caught up with writing and programming to touch base on this subject in a month or so. I can be a bit slow on the tutorials since I'm pretty busy as of late.

andy
eldeljar
Member
Posts: 30
Joined: Sun Feb 12, 2017 6:04 pm

Re: Arkos Tracker 2 in z88dk

Post by eldeljar »

@Andydansby thanks for the info I will try.

At the moment, I have modified the asm code generated for SDCC, and it already compiles me, although I don't know if it will work when I test it from the C code.

In C code I do the following:

Code: Select all

extern void PLAYER_ARKOS_INIT (unsigned int * songdata, unsigned int subSong);
extern void PLAYER_ARKOS_PLAY ();
extern void PLAYER_ARKOS_STOP ();
The code compiles me, but if I try to use any of those functions, it gives me an error because it cannot find the symbols. I have edited the .sym file, and they are not there.

The assembler file has the following code:

Code: Select all

SECTION code_user

    PUBLIC _PLY_AKM_INIT
    PUBLIC _PLY_AKM_STOP
    PUBLIC _PLY_AKM_PLAY


// The player code that I have modified.
include "akm_sdcc.asm"

// The test music exported from Arkos Tracker 2.
_SONG:
binary "test.akm"
I am also using an old version of z88dk, but I don't think that is the problem. I leave the current code in case someone also wants to do tests:

https://drive.google.com/file/d/1OzjCbs ... sp=sharing

I compile it with the following command:
zcc +msx -Cs -no-cleanup -v -m -g -s -subtype=rom -compiler=sdcc -SO3 --max-allocs-per-node20000 --reserve-regs-iy -create-app -pragma-define:CRT_MODEL=2 -pragma-define:CRT_ENABLE_STDIO=0 -o prueba.bin @zproject.lst --fsigned-char
Regarding the test music, it is not mine, it is an example music that the Arkos Tracker 2 program has when you download it.

The player may not work even if I manage to call those functions, but at least I can continue testing for changes in the code.

Sorry if the text is not quite correct, but I am translating with Google Translator.
User avatar
dom
Well known member
Posts: 1477
Joined: Sun Jul 15, 2007 10:01 pm

Re: Arkos Tracker 2 in z88dk

Post by dom »

eldeljar wrote: Mon Oct 04, 2021 6:56 pmIn C code I do the following:

Code: Select all

extern void PLAYER_ARKOS_INIT (unsigned int * songdata, unsigned int subSong);
extern void PLAYER_ARKOS_PLAY ();
extern void PLAYER_ARKOS_STOP ();
...

The assembler file has the following code:

Code: Select all

SECTION code_user

    PUBLIC _PLY_AKM_INIT
    PUBLIC _PLY_AKM_STOP
    PUBLIC _PLY_AKM_PLAY
[I've not actually run your code, but...]

The assembler file is defining and exporting functions with these names: PLY_AKM_INIT(), PLY_AKM_STOP(), PLY_AKM_PLAY(); - that's why PLAYER_ARKOS_PLAY() are reporting a link failure.

Two ways to solve this.

1. Rename the functions in the header file
2. Export as different names using defc:

Code: Select all

PUBLIC _PLAYER_ARKOS_PLAY

defc _PLAYER_ARKOS_PLAY = _PLY_AKM_PLAY
eldeljar
Member
Posts: 30
Joined: Sun Feb 12, 2017 6:04 pm

Re: Arkos Tracker 2 in z88dk

Post by eldeljar »

Hi, I have already corrected the code and it already compiles, but the music still does not work.

I'll keep modifying the code to see if I can get it to work.

If I get it to work, I will notify you in this forum.
User avatar
dom
Well known member
Posts: 1477
Joined: Sun Jul 15, 2007 10:01 pm

Re: Arkos Tracker 2 in z88dk

Post by dom »

I think I have something working - some sound is coming out at the very least - it doesn't sound particularly tuneful, but it might give some more hints.

- The player is self modifying/contains variables so needs to be placed into RAM - I just changed the section to be data_user rather than code_user to make this happen
- PLY_AKM_PLAY() needs to be called in a loop
derekfountain
Member
Posts: 64
Joined: Mon Mar 26, 2018 1:49 pm

Re: Arkos Tracker 2 in z88dk

Post by derekfountain »

I have one of the demo AT2 tunes working from a z88dk C program. I used rasm and the binary blob method, so not the ideal approach.

I've put a (Linux) project here:

https://github.com/derekfountain/z88dk- ... r2-example

if it's of any use to anyone.
andydansby
Member
Posts: 50
Joined: Fri May 27, 2016 8:58 pm

Re: Arkos Tracker 2 in z88dk

Post by andydansby »

derekfountain wrote: Fri Oct 08, 2021 10:31 am I have one of the demo AT2 tunes working from a z88dk C program. I used rasm and the binary blob method, so not the ideal approach.

I've put a (Linux) project here:

https://github.com/derekfountain/z88dk- ... r2-example

if it's of any use to anyone.
Really nice work.
Post Reply