Compare commits
3 Commits
0479f0f396
...
b321104198
Author | SHA1 | Date |
---|---|---|
Nico | b321104198 | |
Nico | 4750c4fce8 | |
Nico | 4be183387c |
48
main.usm
48
main.usm
|
@ -73,7 +73,6 @@
|
|||
#0007 .Draw/playhead-x STZ2
|
||||
#0004 .Draw/pattern-hspacing STZ2
|
||||
|
||||
#08 .Edit/selection-y STZ
|
||||
BRK
|
||||
|
||||
@get-selected-addr ( -- addr* ) ( get the address of the current selection in the pattern )
|
||||
|
@ -104,21 +103,30 @@ RTN
|
|||
&end
|
||||
RTN
|
||||
|
||||
@on-button ( -> )
|
||||
.Controller/key DEI
|
||||
@handle-editing ( key -- )
|
||||
DUP #2b EQU ,&plus JCN
|
||||
DUP #2d EQU ,&minus JCN
|
||||
#2d EQU ,&minus JCN
|
||||
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 DUP2 STH2 ( stash selection address and keep another copy on the stack )
|
||||
LDA #01 ADD STH2r STA
|
||||
RTN
|
||||
&minus
|
||||
#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
|
||||
&end
|
||||
RTN
|
||||
|
||||
@on-button ( -> )
|
||||
.Controller/button DEI ( get button )
|
||||
;handle-cursor JSR2
|
||||
BRK
|
||||
&plus
|
||||
;get-selected-addr JSR2 DUP2 STH2 LDA #01 ADD STH2r STA POP2
|
||||
BRK
|
||||
&minus
|
||||
;get-selected-addr JSR2 DUP2 STH2 LDA #01 SUB STH2r STA POP2
|
||||
BRK
|
||||
&end
|
||||
BRK
|
||||
.Controller/key DEI
|
||||
;handle-editing JSR2
|
||||
BRK
|
||||
|
||||
@on-frame ( -> )
|
||||
;draw JSR2
|
||||
|
@ -162,13 +170,23 @@ RTN
|
|||
|
||||
( draw-note draws a byte as a note name and number on the screen )
|
||||
@draw-note ( byte )
|
||||
DUP #0c DIV #01 SUB STH ( stash octave )
|
||||
DUP #6c LTH ,¬e JCN ( if note is in range, draw note, otherwise continue to draw a rest )
|
||||
#3b ;draw-char JSR2
|
||||
#00 ;draw-char JSR2
|
||||
#3d ;draw-char JSR2 ( draws "[ ]" )
|
||||
POPr ( remove octave from returnstack )
|
||||
POP
|
||||
RTN
|
||||
¬e
|
||||
#0c MOD #00 SWP ;notes ADD2 LDA DUP #7f AND ;draw-char JSR2
|
||||
#80 AND ,&else JCN ( if the high bit is unset )
|
||||
#0d ;draw-char JSR2 ( draw a dash )
|
||||
#00 ;draw-char JSR2 ( draw a space )
|
||||
,&then JMP
|
||||
&else
|
||||
#03 ;draw-char JSR2 ( otherwise draw a # )
|
||||
&then
|
||||
STHr ;draw-nibble JSR2 ( unstash and draw octave number )
|
||||
RTN
|
||||
|
||||
|
||||
|
@ -319,7 +337,7 @@ RTN
|
|||
52 00 20
|
||||
53 00 66
|
||||
54 00 66
|
||||
55 00 66
|
||||
ff 00 66
|
||||
56 00 ff
|
||||
57 00 66
|
||||
]
|
||||
|
|
Reference in New Issue