summaryrefslogtreecommitdiff
path: root/docs/mplayer.md
blob: 91d182b9f5dc07850bf1fe8c5a0764b64c994a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
## Overview

**mplayer** provides easy access to Arkos 2 Minimal Player (AKM) ROM version
from SDCC.

The library adds support for priority based sound effects, so it is possible
to have two uninterrupted channels for music and leave the third one for
effects.

When the priority effects are used, an effect is played if no effect is
already being played or if the effect being played has less priority. The
effect number is used as priority, being effect number 1 the one with lowest
priority.

The player comes with a generic configuration supporting all the features. If
the songs/effects don't use everything that AKM can offer, it is possible to
configure the player to remove features saving space and CPU.

Arkos 2 Player is licensed MIT, please check `src/mplayer/akm/` directory for
further info about configuring the player.

Visit [Arkos 2 Tracker website](http://www.julien-nevo.com/arkostracker/) to
download the tracker.

## Exporting songs and effects

The player is quite complex and has a lot of options that can be disabled if
not used, reducing space and CPU use.

**mplayer** is only a fixed interface, and the player is compiled customised to
the song and effects used by the game.

Currently AKM can only be compiled with **rasm** (included in `./tools`), and then
processed with `Disark` to generate ASM compatible with `SDCC`. Once that code is
compiled, it will be relocated by the linker.

Notes on **Disark**:

  - It is not open source yet, so it needs to be put in the PATH. It is
    distributed as part of Arkos 2 Traker tools.
  - Because it uses uppercase labels, the variable exported and accessible from
    C will be all uppercase. For exampler: for `song` we will use `SONG`.

This is automated, and the only counter-intuitive step is making an ASM file
for **rasm** such as:

```
;
; to build the custom AKM player with song + effects
;

include "song_playerconfig.asm"
include "effects_playerconfig.asm"

include "../../src/mplayer/akm/akm_ubox.asm"

songDisarkGenerateExternalLabel:
include "song.asm"

effectsDisarkGenerateExternalLabel:
include "effects.asm"
```

See the example game and the commands run automatically for further details.

### Exporting the song

In Arkos 2 Tracker, export the song as "AKM", using "Export as source file" and
"Generate configuration file for players".

Save the file as `song.asm`.

It should create `song_playerconfig.asm` in the same directory.

### Exporting the effects

In Arkos 2 Tracker, export the effects as "AKX", using "Export as source file" and
"Generate configuration file for players".

Save the file as `effects.asm`.

It should create `effects_playerconfig.asm` in the same directory.