fixing scroll logic and start implementing scrollbar
This commit is contained in:
parent
8788fbef79
commit
cd3bcd1dbe
3 changed files with 149 additions and 26 deletions
|
@ -3,4 +3,30 @@ dexe
|
||||||
noodle
|
noodle
|
||||||
orca
|
orca
|
||||||
left
|
left
|
||||||
|
ustrat
|
||||||
|
katbug
|
||||||
|
soul grind
|
||||||
|
hyperkaos
|
||||||
|
niju
|
||||||
|
pokiminz
|
||||||
|
yeet
|
||||||
|
funk
|
||||||
|
what
|
||||||
|
is
|
||||||
|
this
|
||||||
|
bizzzz
|
||||||
|
how
|
||||||
|
many
|
||||||
|
should
|
||||||
|
i
|
||||||
|
put
|
||||||
|
here?
|
||||||
|
moar
|
||||||
|
even moar
|
||||||
|
need
|
||||||
|
lotsof
|
||||||
|
entries
|
||||||
|
to
|
||||||
|
test
|
||||||
|
thebiz
|
||||||
|
andthefunk
|
||||||
|
|
Binary file not shown.
|
@ -14,7 +14,7 @@
|
||||||
%TOS { #00 SWP } %TOB { SWP POP }
|
%TOS { #00 SWP } %TOB { SWP POP }
|
||||||
|
|
||||||
%NEXT-TILE { DUP2 #0010 ADD2 }
|
%NEXT-TILE { DUP2 #0010 ADD2 }
|
||||||
%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 #03 SFT2 SWP POP }
|
%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 SUB2 #03 SFT2 SWP POP }
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
|
|
||||||
|
@ -70,13 +70,15 @@
|
||||||
( load individual sprites from the main sheet )
|
( load individual sprites from the main sheet )
|
||||||
;spritesheet .File/name DEO2
|
;spritesheet .File/name DEO2
|
||||||
#0100 .File/length DEO2
|
#0100 .File/length DEO2
|
||||||
|
|
||||||
|
( logos )
|
||||||
#0000 .File/offset-ls DEO2
|
#0000 .File/offset-ls DEO2
|
||||||
;uxn-logo .File/load DEO2
|
;uxn-logo .File/load DEO2
|
||||||
|
|
||||||
#0200 .File/offset-ls DEO2
|
#0200 .File/offset-ls DEO2
|
||||||
;xrxs-logo .File/load DEO2
|
;xrxs-logo .File/load DEO2
|
||||||
|
|
||||||
|
( buttons )
|
||||||
#00c0 .File/length DEO2
|
#00c0 .File/length DEO2
|
||||||
#0400 .File/offset-ls DEO2
|
#0400 .File/offset-ls DEO2
|
||||||
;yes-btn .File/load DEO2
|
;yes-btn .File/load DEO2
|
||||||
|
@ -90,6 +92,20 @@
|
||||||
#06c0 .File/offset-ls DEO2
|
#06c0 .File/offset-ls DEO2
|
||||||
;no-btn-active .File/load DEO2
|
;no-btn-active .File/load DEO2
|
||||||
|
|
||||||
|
( scrollbar )
|
||||||
|
#0010 .File/length DEO2
|
||||||
|
#0800 .File/offset-ls DEO2
|
||||||
|
;scroll-down-btn .File/load DEO2
|
||||||
|
|
||||||
|
#0810 .File/offset-ls DEO2
|
||||||
|
;scroll-up-btn .File/load DEO2
|
||||||
|
|
||||||
|
#0820 .File/offset-ls DEO2
|
||||||
|
;scrollbar .File/load DEO2
|
||||||
|
|
||||||
|
#0830 .File/offset-ls DEO2
|
||||||
|
;scrollbar-trough .File/load DEO2
|
||||||
|
|
||||||
( load zz font )
|
( load zz font )
|
||||||
;fontsheet .File/name DEO2
|
;fontsheet .File/name DEO2
|
||||||
#0000 .File/offset-ls DEO2
|
#0000 .File/offset-ls DEO2
|
||||||
|
@ -113,7 +129,6 @@ BRK
|
||||||
|
|
||||||
@on-frame ( -> )
|
@on-frame ( -> )
|
||||||
|
|
||||||
|
|
||||||
.ticker LDZ #01 ADD
|
.ticker LDZ #01 ADD
|
||||||
DUP .anim-speed LDZ EQU ,&next-render JCN
|
DUP .anim-speed LDZ EQU ,&next-render JCN
|
||||||
.ticker STZ
|
.ticker STZ
|
||||||
|
@ -179,6 +194,7 @@ BRK
|
||||||
#0010
|
#0010
|
||||||
#02 ] ;draw-string JSR2
|
#02 ] ;draw-string JSR2
|
||||||
;render-cart-list JSR2
|
;render-cart-list JSR2
|
||||||
|
;draw-scrollbar JSR2
|
||||||
;draw-pointer JSR2
|
;draw-pointer JSR2
|
||||||
POP
|
POP
|
||||||
BRK
|
BRK
|
||||||
|
@ -198,11 +214,13 @@ BRK
|
||||||
#0010
|
#0010
|
||||||
#02 ] ;draw-string JSR2
|
#02 ] ;draw-string JSR2
|
||||||
;render-cart-list JSR2
|
;render-cart-list JSR2
|
||||||
|
;draw-scrollbar JSR2
|
||||||
;draw-confirm-buttons JSR2
|
;draw-confirm-buttons JSR2
|
||||||
;draw-pointer JSR2
|
;draw-pointer JSR2
|
||||||
POP
|
POP
|
||||||
BRK
|
BRK
|
||||||
&state6 POP
|
&state6 POP
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@clear-screen ( -> )
|
@clear-screen ( -> )
|
||||||
|
@ -219,11 +237,12 @@ BRK
|
||||||
#0008 ADD2 ,&whiley JMP &endy POP2 POP2
|
#0008 ADD2 ,&whiley JMP &endy POP2 POP2
|
||||||
#0008 ADD2 ,&whilex JMP &endx POP2 POP2
|
#0008 ADD2 ,&whilex JMP &endx POP2 POP2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
&x $2
|
&x $2
|
||||||
&y $2
|
&y $2
|
||||||
|
|
||||||
@scoot-logos ( -> )
|
@scoot-logos ( -> )
|
||||||
|
|
||||||
.logo-coords/x LDZ2 #0021 LTH2 ,&no-scoot-x JCN
|
.logo-coords/x LDZ2 #0021 LTH2 ,&no-scoot-x JCN
|
||||||
.logo-coords/x LDZ2 #01 SFT2
|
.logo-coords/x LDZ2 #01 SFT2
|
||||||
.logo-coords/x STZ2
|
.logo-coords/x STZ2
|
||||||
|
@ -233,6 +252,7 @@ BRK
|
||||||
.logo-coords/y LDZ2 #01 SFT2
|
.logo-coords/y LDZ2 #01 SFT2
|
||||||
.logo-coords/y STZ2
|
.logo-coords/y STZ2
|
||||||
&no-scoot-y
|
&no-scoot-y
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@draw-uxn-logo ( -> )
|
@draw-uxn-logo ( -> )
|
||||||
|
@ -320,6 +340,7 @@ RTN
|
||||||
#84 .Screen/sprite DEO
|
#84 .Screen/sprite DEO
|
||||||
#0008 ADD2 ,&whilebottom JMP &endbottom POP2 POP2
|
#0008 ADD2 ,&whilebottom JMP &endbottom POP2 POP2
|
||||||
#0008 ADD2 ,&whilembottom JMP &endmbottom POP2 POP2
|
#0008 ADD2 ,&whilembottom JMP &endmbottom POP2 POP2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,9 +359,10 @@ RTN
|
||||||
#03 .Screen/pixel DEO
|
#03 .Screen/pixel DEO
|
||||||
,&x LDR2 #0001 ADD2 ,&x STR2 ,&dlscan JMP &enddlscan
|
,&x LDR2 #0001 ADD2 ,&x STR2 ,&dlscan JMP &enddlscan
|
||||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileld JMP &endld
|
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileld JMP &endld
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
&x $2
|
&x $2
|
||||||
&y $2
|
&y $2
|
||||||
|
|
||||||
@draw-tl-scanlines
|
@draw-tl-scanlines
|
||||||
#0028 ,&y STR2
|
#0028 ,&y STR2
|
||||||
|
@ -357,8 +379,8 @@ RTN
|
||||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilelu JMP &endlu
|
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilelu JMP &endlu
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
&x $2
|
&x $2
|
||||||
&y $2
|
&y $2
|
||||||
|
|
||||||
@draw-br-scanlines ( -> )
|
@draw-br-scanlines ( -> )
|
||||||
CENTER-Y ,&y STR2
|
CENTER-Y ,&y STR2
|
||||||
|
@ -374,8 +396,8 @@ RTN
|
||||||
,&x LDR2 #0001 ADD2 ,&x STR2 ,&drscan JMP &enddrscan
|
,&x LDR2 #0001 ADD2 ,&x STR2 ,&drscan JMP &enddrscan
|
||||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilerd JMP &endrd
|
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilerd JMP &endrd
|
||||||
RTN
|
RTN
|
||||||
&x $2
|
&x $2
|
||||||
&y $2
|
&y $2
|
||||||
|
|
||||||
@draw-tr-scanlines
|
@draw-tr-scanlines
|
||||||
#0028 ,&y STR2
|
#0028 ,&y STR2
|
||||||
|
@ -392,8 +414,8 @@ RTN
|
||||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileru JMP &endru
|
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileru JMP &endru
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
&x $2
|
&x $2
|
||||||
&y $2
|
&y $2
|
||||||
|
|
||||||
|
|
||||||
@draw-pointer ( -> )
|
@draw-pointer ( -> )
|
||||||
|
@ -443,10 +465,12 @@ RTN
|
||||||
|
|
||||||
@shouldnt-draw-word ( -- flag )
|
@shouldnt-draw-word ( -- flag )
|
||||||
|
|
||||||
.list-offset LDZ .list-top LDZ LTH
|
.list-offset LDZ .list-top LDZ LTH ,&no JCN
|
||||||
#00 .list-offset LDZ #00 .list-top LDZ #00 .list-height LDZ ADD2 LTH2
|
.list-offset LDZ .list-top LDZ .list-height LDZ ADD #01 SUB GTH ,&no JCN
|
||||||
ORA #01 NEQ
|
#00 RTN
|
||||||
|
|
||||||
|
&no
|
||||||
|
#01
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@finish-line ( -> )
|
@finish-line ( -> )
|
||||||
|
@ -455,7 +479,7 @@ RTN
|
||||||
|
|
||||||
&while
|
&while
|
||||||
.Screen/x DEI2
|
.Screen/x DEI2
|
||||||
.Screen/width DEI2 #0040 SUB2
|
.Screen/width DEI2 #0048 SUB2
|
||||||
|
|
||||||
EQU2 ,&end JCN
|
EQU2 ,&end JCN
|
||||||
#0c .Screen/sprite DEO
|
#0c .Screen/sprite DEO
|
||||||
|
@ -507,6 +531,7 @@ RTN
|
||||||
#00 .list-elem-offset STZ
|
#00 .list-elem-offset STZ
|
||||||
&continue INC2 ,&while JMP
|
&continue INC2 ,&while JMP
|
||||||
&end .list-offset LDZ #01 SUB .ncarts STZ POP2 POP2
|
&end .list-offset LDZ #01 SUB .ncarts STZ POP2 POP2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@get-entry-color ( -- colorByte )
|
@get-entry-color ( -- colorByte )
|
||||||
|
@ -520,12 +545,54 @@ RTN
|
||||||
#0c RTN
|
#0c RTN
|
||||||
&normal
|
&normal
|
||||||
#02
|
#02
|
||||||
|
|
||||||
|
RTN
|
||||||
|
|
||||||
|
@draw-scrollbar ( -> )
|
||||||
|
|
||||||
|
.Screen/width DEI2 #0048 SUB2 .Screen/x DEO2
|
||||||
|
#0028 .Screen/y DEO2
|
||||||
|
|
||||||
|
( how many cells to highlight
|
||||||
|
.ncarts LDZ .list-height LDZ #01 ADD LTH ,&set-max JCN
|
||||||
|
.ncarts LDZ .list-height LDZ SUB STH ,&start-loop JMP )
|
||||||
|
|
||||||
|
&set-max
|
||||||
|
|
||||||
|
&start-loop
|
||||||
|
.list-height LDZ #00
|
||||||
|
&while EQUk ,&end JCN
|
||||||
|
( trough top
|
||||||
|
DUP .list-top GTH ,&handle
|
||||||
|
;scrollbar-trough .Screen/addr DEO2
|
||||||
|
,&draw JMP
|
||||||
|
&handle
|
||||||
|
DUP .list-top LDZ .list-height LDZ ADD #03 SFT GTH ,&trough-bottom JCN
|
||||||
|
;scrollbar .Screen/addr DEO2
|
||||||
|
,&draw JMP )
|
||||||
|
&trough-bottom
|
||||||
|
;scrollbar-trough .Screen/addr DEO2
|
||||||
|
&draw
|
||||||
|
#81 .Screen/sprite DEO
|
||||||
|
INC-Y
|
||||||
|
INC ,&while JMP &end POP2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@get-select-idx-by-mouse ( -> )
|
@get-select-idx-by-mouse ( -> )
|
||||||
|
|
||||||
|
.Mouse/wheel DEI #00 EQU ,&no-scroll JCN
|
||||||
|
.Mouse/wheel DEI #01 NEQ ,&scroll-down JCN
|
||||||
|
( scroll-up )
|
||||||
|
;try-scroll-up-mouse JSR2
|
||||||
|
,&no-scroll JMP
|
||||||
|
|
||||||
|
&scroll-down
|
||||||
|
;try-scroll-down-mouse JSR2
|
||||||
|
|
||||||
|
&no-scroll
|
||||||
.Mouse/x DEI2 #0040 LTH2 ,&done JCN
|
.Mouse/x DEI2 #0040 LTH2 ,&done JCN
|
||||||
.Mouse/x DEI2 .Screen/width DEI2 #0040 SUB2 GTH2 ,&done JCN
|
.Mouse/x DEI2 .Screen/width DEI2 #0048 SUB2 GTH2 ,&done JCN
|
||||||
|
|
||||||
.Mouse/y DEI2 #0028 LTH2 ,&done JCN
|
.Mouse/y DEI2 #0028 LTH2 ,&done JCN
|
||||||
.Mouse/y DEI2 .Screen/height DEI2 #0028 SUB2 GTH2 ,&done JCN
|
.Mouse/y DEI2 .Screen/height DEI2 #0028 SUB2 GTH2 ,&done JCN
|
||||||
|
@ -542,17 +609,44 @@ RTN
|
||||||
|
|
||||||
&done
|
&done
|
||||||
#ff .select-index STZ
|
#ff .select-index STZ
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@try-scroll-up-mouse ( -> )
|
||||||
|
.list-top LDZ #00 EQU ,&no-scroll-up JCN
|
||||||
|
.list-top LDZ #01 SUB .list-top STZ
|
||||||
|
&no-scroll-up
|
||||||
|
RTN
|
||||||
|
|
||||||
|
@try-scroll-down-mouse ( -> )
|
||||||
|
.list-top LDZ .list-height LDZ ADD .ncarts LDZ #01 ADD EQU ,&no-scroll-down JCN
|
||||||
|
.list-top LDZ INC .list-top STZ
|
||||||
|
&no-scroll-down
|
||||||
|
RTN
|
||||||
|
|
||||||
|
|
||||||
|
@try-scroll-up ( -> )
|
||||||
|
.select-index LDZ
|
||||||
|
DUP .list-top LDZ NEQ ,&no-scroll-up JCN
|
||||||
|
.list-top LDZ #00 EQU ,&no-scroll-up JCN
|
||||||
|
.list-top LDZ #01 SUB .list-top STZ
|
||||||
|
&no-scroll-up
|
||||||
|
RTN
|
||||||
|
|
||||||
|
@try-scroll-down ( -> )
|
||||||
|
.select-index LDZ
|
||||||
|
DUP .list-top LDZ .list-height LDZ ADD #01 SUB NEQ ,&no-scroll-down JCN
|
||||||
|
.list-top LDZ .list-height LDZ ADD .ncarts LDZ #01 ADD EQU ,&no-scroll-down JCN
|
||||||
|
.list-top LDZ INC .list-top STZ
|
||||||
|
&no-scroll-down
|
||||||
|
RTN
|
||||||
|
|
||||||
@get-select-idx-by-key ( -> )
|
@get-select-idx-by-key ( -> )
|
||||||
|
|
||||||
.Controller/button DEI
|
.Controller/button DEI
|
||||||
|
|
||||||
DUP #10 NEQ ,&no-up JCN
|
DUP #10 NEQ ,&no-up JCN
|
||||||
.select-index LDZ
|
;try-scroll-up JSR2
|
||||||
DUP .list-top LDZ NEQ ,&no-scroll-up JCN
|
|
||||||
.list-top LDZ #01 SUB .list-top STZ
|
|
||||||
&no-scroll-up
|
|
||||||
DUP #00 EQU ,&no-dec JCN
|
DUP #00 EQU ,&no-dec JCN
|
||||||
#01 SUB .select-index STZ
|
#01 SUB .select-index STZ
|
||||||
,&no-up JMP
|
,&no-up JMP
|
||||||
|
@ -561,10 +655,7 @@ BRK
|
||||||
&no-up
|
&no-up
|
||||||
|
|
||||||
DUP #20 NEQ ,&no-down JCN
|
DUP #20 NEQ ,&no-down JCN
|
||||||
.select-index LDZ
|
;try-scroll-down JSR2
|
||||||
DUP .list-top LDZ .list-height LDZ ADD NEQ ,&no-scroll-down JCN
|
|
||||||
.list-top LDZ INC .list-top STZ
|
|
||||||
&no-scroll-down
|
|
||||||
DUP .ncarts LDZ EQU ,&no-inc JCN
|
DUP .ncarts LDZ EQU ,&no-inc JCN
|
||||||
INC .select-index STZ
|
INC .select-index STZ
|
||||||
,&no-down JMP
|
,&no-down JMP
|
||||||
|
@ -578,6 +669,7 @@ BRK
|
||||||
;set-button-state-by-mouse .Mouse/vector DEO2
|
;set-button-state-by-mouse .Mouse/vector DEO2
|
||||||
&no-a-btn
|
&no-a-btn
|
||||||
POP
|
POP
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@set-button-state-by-key ( -> )
|
@set-button-state-by-key ( -> )
|
||||||
|
@ -627,6 +719,7 @@ BRK
|
||||||
;get-select-idx-by-key .Controller/vector DEO2
|
;get-select-idx-by-key .Controller/vector DEO2
|
||||||
#04 .state STZ
|
#04 .state STZ
|
||||||
&no-action
|
&no-action
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@set-button-state-by-mouse ( -> )
|
@set-button-state-by-mouse ( -> )
|
||||||
|
@ -746,6 +839,10 @@ RTN
|
||||||
@no-btn $192
|
@no-btn $192
|
||||||
@yes-btn-active $192
|
@yes-btn-active $192
|
||||||
@no-btn-active $192
|
@no-btn-active $192
|
||||||
|
@scroll-up-btn $16
|
||||||
|
@scroll-down-btn $16
|
||||||
|
@scrollbar $16
|
||||||
|
@scrollbar-trough $16
|
||||||
@cursor [ 80c0 e0f0 f8e0 1000 ]
|
@cursor [ 80c0 e0f0 f8e0 1000 ]
|
||||||
@font $768
|
@font $768
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue