Compare commits

...

3 Commits

1 changed files with 27 additions and 10 deletions

View File

@ -1,5 +1,5 @@
( a blank file )
( TODO fix ugly stack effects )
( TODO selecting within patterns + basic editing )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
@ -52,7 +52,10 @@
&songpos $2 ( position in song table )
@tracker
&selected-pattern $1
&selected-song-line $1
&selected-channel $1
&selected-col $1
&selected-pane $1 ( song pane = 00, patterns = 01 )
( program )
@ -64,7 +67,7 @@
#0f25 .System/b DEO2
;module ;k-init-module/run JSR2
;on-input .Controller/vector DEO2
;on-input .Controller/vector DEO2
;redraw JSR2
BRK
@ -77,22 +80,36 @@ BRK
#0080 .Screen/x DEO2
;get-selected-song-line-address JSR2 ;draw-patterns JSR2
BRK
RTN
@on-input ( -> )
.tracker/selected-pane LDZ #00 EQU ,&song JCN
BRK
&song
;move-song-selection JSR2
BRK
( moves the cursor in the song )
@move-song-selection
.Controller/button DEI
DUP #10 AND ,&up JCN
#20 AND ,&down JCN
BRK
RTN
&up
.tracker/selected-pattern LDZ #01 SUB .tracker/selected-pattern STZ
POP
.tracker/selected-song-line LDZ #00 EQU ,&end JCN ( line 0 - don't move up )
.tracker/selected-song-line LDZ #01 SUB .tracker/selected-song-line STZ
,&end JMP
&down
.tracker/selected-pattern LDZ #01 ADD .tracker/selected-pattern STZ
.tracker/selected-song-line LDZ #01 ADD #00 SWP #0004 MUL2 ( selected song line offset )
.kalama/module LDZ2 #0003 ADD2 LDA2 ( song length ) EQU2 ,&end JCN ( if we're off the end of the song, don't move )
.tracker/selected-song-line LDZ #01 ADD .tracker/selected-song-line STZ
,&end JMP
&end
;redraw JSR2
BRK
RTN
@draw-patterns ( addr* )
DUP2
@ -109,7 +126,7 @@ BRK
RTN
@get-selected-song-line-address ( -- addr* )
.tracker/selected-pattern LDZ #00 SWP #0004 MUL2
.tracker/selected-song-line LDZ #00 SWP #0004 MUL2
.kalama/module LDZ2 #0005 ADD2 ADD2
RTN
@ -179,7 +196,7 @@ RTN
DUP #ff EQU ;&note-off JCN2
DUP #00 EQU ;&blank JCN2
DUP #0c MOD ( note minus octave )
DUP #0c MOD ( note without octave )
#00 SWP #0002 MUL2
;&notes ADD2 LDA2 SWP
#20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( first note character )