From 345c2f0b7646b53a2ed1629ebfab7d153fce1d4a Mon Sep 17 00:00:00 2001 From: nihilazo Date: Wed, 2 Mar 2022 16:18:51 +0000 Subject: [PATCH] broke selection movement within song into seperate routine, preparing for input to other parts of the UI --- tracker.tal | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/tracker.tal b/tracker.tal index 5dc26b3..75907be 100644 --- a/tracker.tal +++ b/tracker.tal @@ -1,5 +1,5 @@ ( a blank file ) -( TODO fix ugly stack effects, add bounds-checking for pattern movemenv ) +( 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 @@ -80,22 +83,33 @@ 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 POP - .tracker/selected-pattern LDZ #00 EQU ,&end JCN - .tracker/selected-pattern LDZ #01 SUB .tracker/selected-pattern STZ + .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 #00 SWP #0004 MUL2 .kalama/module LDZ2 #0003 ( song length ) ADD2 LDA2 EQU2 ,&end JCN ( if we're off the end of the song, don't move ) - .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 @@ -112,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 @@ -182,7 +196,7 @@ RTN DUP #ff EQU ;¬e-off JCN2 DUP #00 EQU ;&blank JCN2 - DUP #0c MOD ( note minus octave ) + DUP #0c MOD ( note without octave ) #00 SWP #0002 MUL2 ;¬es ADD2 LDA2 SWP #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( first note character )