Compare commits

...

5 Commits

Author SHA1 Message Date
Nico a12ec03aca default values a bit saner 2021-05-31 18:08:00 +01:00
Nico 31e04e1665 add backspace to zero field, fix input stack effects 2021-05-31 17:50:23 +01:00
Nico 051479be07 fix playhead drawing 2021-05-31 17:15:56 +01:00
Nico 3239b1cae2 fix stopping on pause 2021-05-31 15:22:26 +01:00
Nico 7fa3146088 reset playhead on pause 2021-05-28 19:17:34 +01:00
1 changed files with 37 additions and 8 deletions

View File

@ -115,7 +115,8 @@ RTN
DUP #10 AND ,&up JCN ( check the if the four directions are pressed )
DUP #20 AND ,&down JCN
DUP #40 AND ,&left JCN
#80 AND ,&right JCN
DUP #80 AND ,&right JCN
POP
RTN ( if none are pressed, break )
&up
POP ( pop the controller )
@ -123,8 +124,8 @@ RTN
.Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ
RTN
&down
POP2
PTN_LEN #0001 SUB2 .Edit/selection-y LDZ EQU ,&end JCN
POP
PTN_LEN #0001 SUB2 LOB .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
RTN
&left
@ -134,26 +135,52 @@ RTN
RTN
&right
POP
PTN_WIDTH #0001 SUB2 .Edit/selection-x LDZ EQU ,&end JCN
PTN_WIDTH #0001 SUB2 LOB .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
&end
RTN
@set-initial-value ( sets the initial value for the currently selected pattern item. )
.Edit/selection-x LDZ
DUP #00 EQU ,&note JCN
DUP #01 EQU ,&inst JCN
DUP #02 EQU ,&vol JCN
&note
#48 ,&store JMP
&inst
#01 ,&store JMP
&vol
#88
&store
;get-selected-addr JSR2 STA
RTN
@handle-editing ( key -- )
DUP #2b EQU ,&plus JCN
#2d EQU ,&minus JCN
DUP #2d EQU ,&minus JCN
DUP #08 EQU ,&bksp JCN
POP
RTN
&plus
POP ( pop the key )
#00 .Edit/selection-x LDZ EQU ;get-selected-addr JSR2 LDA #6c EQU AND ,&end JCN ( if we're on a note and out of bounds, skip moving )
;get-selected-addr JSR2 LDA #00 EQU ,&initial JCN
;get-selected-addr JSR2 DUP2 STH2 ( stash selection address and keep another copy on the stack )
LDA #01 ADD STH2r STA
RTN
&initial
;set-initial-value JSR2
RTN
&minus
POP
#00 .Edit/selection-x LDZ EQU ;get-selected-addr JSR2 LDA #0c EQU AND ,&end JCN ( if we're on a note and out of bounds, skip moving )
;get-selected-addr JSR2 DUP2 STH2 ( stash selection address and keep another copy on the stack )
LDA #01 SUB STH2r STA
RTN
&bksp
POP
#00 ;get-selected-addr JSR2 STA
RTN
&end
RTN
@ -176,7 +203,6 @@ RTN
BRK
&prev
POP
.Playback/pattern-index LDZ #01 SUB .Playback/pattern-index STZ
.Playback/pattern-index LDZ ;alloc-load-pattern JSR2
BRK
@ -203,7 +229,8 @@ BRK
@pause ( pause playback )
#00 .Playback/tick STZ
#ff .Audio1/pitch DEO
#ff .Audio0/pitch DEO
#0000 .Playback/position STZ2
RTN
@draw-nibble ( nibble )
@ -304,11 +331,13 @@ RTN
.Draw/playhead-y LDZ2 .Screen/y DEO2
.Draw/playhead-x LDZ2 .Screen/x DEO2
#20 .Screen/color DEO
.Playback/position LDZ2 #0000 EQU2 ,&end JCN
( draw new playhead )
.Draw/pattern-y LDZ2 .Playback/position LDZ2 #0001 SUB2 #0004 MUL2 ADD2 #0008 SUB2 DUP2 .Draw/playhead-y STZ2
.Draw/pattern-y LDZ2 .Playback/position LDZ2 #0004 MUL2 ADD2 #000b SUB2 DUP2 .Draw/playhead-y STZ2
.Screen/y DEO2
;playhead_icon .Screen/addr DEO2
#21 .Screen/color DEO
&end
RTN
@draw