Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CycoPH committed Apr 26, 2021
0 parents commit f9738ee
Show file tree
Hide file tree
Showing 18 changed files with 2,738 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.o
*.lbl
*.map
*.xex
.vs
*.user
*.filters
Debug/
Release/
!bin/rmt2atasm.exe
tune.asm
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Relocatable RMT player for atasm assembler
==========================================

Set of samples and code to include Raster-Music-Tracker songs with
programs written in atasm assenbler.


How to convert a song to the relocatable source
-----------------------------------------------

To convert any RMT song to the relocatable format for inclusion in your program,
you need to:

- Export the song from RMT as a stripped file, select "File", "Export as...",
file type of "RMT stripped song file".
You can select any memory location, other options are according to your
needs. Remember to copy the RMT FEATures presented, and write them to the
file `rmt_feat.asm`, as this file is needed to assemble the player.
Edit the `rmt_feat.asm` file and replace all the `equ` with `=`

- Use the included C program `rmt2atasm` to convert the RMT file to a relocatable
assembly file, use as:
```
rmt2atasm my_song.rmt > tune.asm
```


Main player and sample song files
---------------------------------

The file `atasm/rmtplayr.asm` is the full RMT player source, converted to atasm syntax.


Samples
-------

There are two sample folders (Test1 and Test2)

Build scripts are provided.
44 changes: 44 additions & 0 deletions atasm/out.sample_rmt_feat.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
;*
;* RMT FEATures definitions
;*
;* For optimizations of RMT player routine to concrete RMT modul only!
;* --------BEGIN--------
;* asm_src/sfx/sfx.rmt
FEAT_SFX = 1
FEAT_GLOBALVOLUMEFADE = 0 ;RMTGLOBALVOLUMEFADE variable
FEAT_NOSTARTINGSONGLINE = 0
FEAT_INSTRSPEED = 1
FEAT_CONSTANTSPEED = 9 ;(0 times)
FEAT_COMMAND1 = 1 ;(96 times)
FEAT_COMMAND2 = 0 ;(0 times)
FEAT_COMMAND3 = 1 ;(1 times)
FEAT_COMMAND4 = 1 ;(1 times)
FEAT_COMMAND5 = 0 ;(0 times)
FEAT_COMMAND6 = 0 ;(0 times)
FEAT_COMMAND7SETNOTE = 1 ;(1 times)
FEAT_COMMAND7VOLUMEONLY = 0 ;(0 times)
FEAT_PORTAMENTO = 0 ;(0 times)
FEAT_FILTER = 0 ;(0 times)
FEAT_FILTERG0L = 0 ;(0 times)
FEAT_FILTERG1L = 0 ;(0 times)
FEAT_FILTERG0R = 0 ;(0 times)
FEAT_FILTERG1R = 0 ;(0 times)
FEAT_BASS16 = 0 ;(0 times)
FEAT_BASS16G1L = 0 ;(0 times)
FEAT_BASS16G3L = 0 ;(0 times)
FEAT_BASS16G1R = 0 ;(0 times)
FEAT_BASS16G3R = 0 ;(0 times)
FEAT_VOLUMEONLYG0L = 0 ;(0 times)
FEAT_VOLUMEONLYG2L = 0 ;(0 times)
FEAT_VOLUMEONLYG3L = 0 ;(0 times)
FEAT_VOLUMEONLYG0R = 0 ;(0 times)
FEAT_VOLUMEONLYG2R = 0 ;(0 times)
FEAT_VOLUMEONLYG3R = 0 ;(0 times)
FEAT_TABLETYPE = 0 ;(0 times)
FEAT_TABLEMODE = 0 ;(0 times)
FEAT_TABLEGO = 0 ;(0 times)
FEAT_AUDCTLMANUALSET = 0 ;(0 times)
FEAT_VOLUMEMIN = 0 ;(0 times)
FEAT_EFFECTVIBRATO = 0 ;(0 times)
FEAT_EFFECTFSHIFT = 0 ;(0 times)
;* --------END--------
114 changes: 114 additions & 0 deletions atasm/out.test_me.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
;
; SFX
; example by raster/c.p.u., 2006,2009
;
;
*=$2000
STEREOMODE = 0 ;0 => compile RMTplayer for mono 4 tracks
; ;1 => compile RMTplayer for stereo 8 tracks
; ;2 => compile RMTplayer for 4 tracks stereo L1 R2 R3 L4
; ;3 => compile RMTplayer for 4 tracks stereo L1 L2 R3 R4
;
;
.include "rmtplayr.asm" ;include RMT player routine
;
;
*=$4000
.include "../tune.asm"
.local
;
;
MODUL = $4000 ;address of RMT module
KEY = $2fc ;keypressed code
RANDOM = $d20a ;random value
;
* = $6000
start
;
ldx #<text
ldy #>text
jsr $c642 ;print info text to screen
;
lda #$f0 ;initial value
sta RMTSFXVOLUME ;sfx note volume * 16 (0,16,32,...,240)
;
lda #$ff ;initial value
sta sfx_effect
;
ldx #<MODUL ;low byte of RMT module to X reg
ldy #>MODUL ;hi byte of RMT module to Y reg
lda #2 ;starting song line 0-255 to A reg
jsr RASTERMUSICTRACKER ;Init
;
ldy #<vbi
ldx #>vbi
lda #$07
jsr $e45c ;Start VBI routine
;
;
loop
lda #255
sta KEY ;no key pressed
;
waitkey
lda KEY ;keycode
cmp #255
beq waitkey ;no key pressed
;
and #63
tay
lda (121),y ;keycode -> ascii
;
cmp #$31 ; < key '1' ?
bcc loop
cmp #$39 ; >= key '9' ?
bcs loop
and #$0f ;A=1..8
pha ;sfx number
;
lda RANDOM ;random number
and #$07 ;0..7
ora #$08 ;8..15
asl
asl
asl
asl ;*16
sta RMTSFXVOLUME
;
pla ;sfx number
sta sfx_effect ;VBI routine is watching this variable
;
jmp loop
;
;
;
vbi
;
lda sfx_effect
bmi lab2
asl ; * 2
tay ;Y = 2,4,..,16 instrument number * 2 (0,2,4,..,126)
ldx #3 ;X = 3 channel (0..3 or 0..7 for stereo module)
lda #12 ;A = 12 note (0..60)
jsr RASTERMUSICTRACKER+15 ;RMT_SFX start tone (It works only if FEAT_SFX is enabled !!!)
;
lda #$ff
sta sfx_effect ;reinit value
;
lab2
jsr RASTERMUSICTRACKER+3 ;1 play
;
jmp $e462 ;end vbi
;
;
;
sfx_effect .byte 0 ;sfx number variable
;
text .byte "Press 1-8 for SFX (random volume)",$9b
;
;
;
*=$2E0
.word start ;run addr
;
;that's all... :-)
Loading

0 comments on commit f9738ee

Please sign in to comment.