Rewrote ctrl parser for left

This commit is contained in:
neauoire 2021-03-31 10:00:32 -07:00
parent 409ba7ef1a
commit 23521c5a4f
2 changed files with 61 additions and 74 deletions

View File

@ -63,6 +63,7 @@
( load file ) ( load file )
,filepath ,load-file JSR2 ,filepath ,load-file JSR2
( place textarea ) ( place textarea )
#0018 =textarea.x1 ~Screen.height 8- =textarea.y2 #0018 =textarea.x1 ~Screen.height 8- =textarea.y2
@ -77,63 +78,63 @@ BRK
~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,ctrl-end JNZ2 ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,ctrl-end JNZ2
( lock ) #04 =lock ( lock ) #04 =lock
~Controller #10 NEQ ,no-ctrl-up JNZ2
( clamp ) ~position.y #0000 EQU2 ,no-ctrl-up JNZ2 ( alt + arrow )
,find-lineoffset JSR2 =position.x ~Controller #0f AND #02 NEQ ^$no-alt JNZ
~position.y -- =position.y ~Controller #04 SFT
,find-selection JSR2 DUP2 =selection.from ++ =selection.to DUP #01 NEQ ^$no-aup JNZ
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ( sel word ) ,find-wordstart JSR2 =selection.to $no-aup
@no-ctrl-up DUP #02 NEQ ^$no-adown JNZ
~Controller #20 NEQ ,no-ctrl-down JNZ2 ( sel word ) ,find-wordend JSR2 =selection.to $no-adown
,find-lineoffset JSR2 =position.x ~position.y ++ =position.y DUP #04 NEQ ^$no-aleft JNZ
,find-selection JSR2 DUP2 =selection.from ++ =selection.to ( sel decr ) ~selection.to -- =selection.to $no-aleft
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 DUP #08 NEQ ^$no-aright JNZ
@no-ctrl-down ( sel incr ) ~selection.to ++ =selection.to $no-aright
~Controller #40 NEQ ,no-ctrl-left JNZ2 POP
( clamp ) ~selection.from ,document.body EQU2 ,no-ctrl-left JNZ2 ,clamp-selection JSR2
~selection.from -- DUP2 =selection.from ++ =selection.to ,redraw JSR2
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,ctrl-end JMP2
@no-ctrl-left $no-alt
~Controller #80 NEQ ,no-ctrl-right JNZ2
~selection.from ++ DUP2 =selection.from ++ =selection.to ( ctrl + arrow )
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ~Controller #0f AND #01 NEQ ^$no-ctrl JNZ
@no-ctrl-right ~Controller #04 SFT
( alt ) DUP #01 NEQ ^$no-cup JNZ
~Controller #0f AND #02 NEQ ,no-alt JNZ2 ( jump scroll ) #0004 ,scroll-up JSR2 $no-cup
~Controller #04 SFT #01 NEQ ,no-aup JNZ2 DUP #02 NEQ ^$no-cdown JNZ
,find-wordstart JSR2 =selection.to ( jump scroll ) #0004 ,scroll-down JSR2 $no-cdown
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 DUP #04 NEQ ^$no-cleft JNZ
@no-aup ( jump line ) ,goto-linestart JSR2 $no-cleft
~Controller #04 SFT #02 NEQ ,no-adown JNZ2 DUP #08 NEQ ^$no-cright JNZ
,find-wordend JSR2 =selection.to ( jump line ) ,goto-lineend JSR2 $no-cright
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 POP
@no-adown ,redraw JSR2
~Controller #04 SFT #04 NEQ ,no-aleft JNZ2 ,ctrl-end JMP2
~selection.to -- =selection.to $no-ctrl
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aleft ( arrow )
~Controller #04 SFT #08 NEQ ,no-aright JNZ2 ~Controller #f0 AND #00 EQU ,$no-arrow JNZ2
~selection.to ++ =selection.to ~Controller #f0 AND
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 DUP #10 NEQ ^$no-arrowup JNZ
@no-aright ( clamp ) ~position.y #0000 EQU2 ^$no-arrowup JNZ
@no-alt ,find-lineoffset JSR2 =position.x ~position.y -- =position.y
( ctrl ) ,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowup
~Controller #0f AND #01 NEQ ,no-ctrl JNZ2 DUP #20 NEQ ^$no-arrowdown JNZ
~Controller #04 SFT #01 NEQ ,no-cup JNZ2 ( clamp:TODO )
#0004 ,scroll-up JSR2 ,find-lineoffset JSR2 =position.x ~position.y ++ =position.y
,redraw JSR2 ,ctrl-end JMP2 ,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowdown
@no-cup DUP #40 NEQ ^$no-arrowleft JNZ
~Controller #04 SFT #02 NEQ ,no-cdown JNZ2 ( clamp ) ~selection.from ,document.body EQU2 ^$no-arrowleft JNZ
#0004 ,scroll-down JSR2 ~selection.from -- DUP2 =selection.from ++ =selection.to $no-arrowleft
,redraw JSR2 ,ctrl-end JMP2 DUP #80 NEQ ^$no-arrowright JNZ
@no-cdown ( clamp:TODO )
~Controller #04 SFT #04 NEQ ,no-cleft JNZ2 #aa =Console.byte
,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 ~selection.from ++ DUP2 =selection.from ++ =selection.to $no-arrowright
@no-cleft POP
~Controller #04 SFT #08 NEQ ,no-cright JNZ2 ,clamp-selection JSR2
,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,follow-selection JSR2
@no-cright ,redraw JSR2
@no-ctrl $no-arrow
@ctrl-end @ctrl-end
@ -168,15 +169,6 @@ BRK
( mouse ) ( mouse )
~Mouse.state ~touch.state EQU ^no-change JNZ
#0000 =Sprite.x ~Screen.height 8- =Sprite.y
,mouse00icn =Sprite.addr
~Mouse.state #01 NEQ ^$nobutton1 JNZ ,mouse01icn =Sprite.addr $nobutton1
~Mouse.state #10 NEQ ^$nobutton2 JNZ ,mouse10icn =Sprite.addr $nobutton2
~Mouse.state #11 NEQ ^$nobutton3 JNZ ,mouse11icn =Sprite.addr $nobutton3
#01 =Sprite.color
@no-change
~Mouse.state #00 EQU ,touch-end JNZ2 ~Mouse.state #00 EQU ,touch-end JNZ2
~Mouse.x #0010 LTH2 ,touch-linebar JNZ2 ~Mouse.x #0010 LTH2 ,touch-linebar JNZ2
~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2 ~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2
@ -259,7 +251,7 @@ RTN
RTN RTN
@scroll-up ( length ) @scroll-up ( length -- )
DUP2 ~scroll.y LTH2 ^$clamp JNZ DUP2 ~scroll.y LTH2 ^$clamp JNZ
#0000 =scroll.y POP2 RTN #0000 =scroll.y POP2 RTN
@ -268,7 +260,7 @@ RTN
RTN RTN
@scroll-down ( length ) @scroll-down ( length -- )
( TODO: Clamp ) ( TODO: Clamp )
~scroll.y SWP2 ADD2 =scroll.y ~scroll.y SWP2 ADD2 =scroll.y
@ -700,11 +692,6 @@ RTN
0000 0032 4c00 0000 3c42 99a1 a199 423c 0000 0032 4c00 0000 3c42 99a1 a199 423c
] ]
@mouse00icn [ 0000 0000 0000 0000 ]
@mouse01icn [ 0078 7878 7878 7800 ]
@mouse10icn [ 001e 1e1e 1e1e 1e00 ]
@mouse11icn [ 007e 7e7e 7e7e 7e00 ]
@linebreak_icn [ 003e 7474 3414 1400 ] @linebreak_icn [ 003e 7474 3414 1400 ]
@blank_icn [ 0000 0000 0000 0000 ] @blank_icn [ 0000 0000 0000 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] @cursor_icn [ 80c0 e0f0 f8e0 1000 ]

View File

@ -15,7 +15,7 @@ WITH REGARD TO THIS SOFTWARE.
#include "uxn.h" #include "uxn.h"
#define HOR 48 #define HOR 64
#define VER 32 #define VER 32
#define PAD 2 #define PAD 2
#define RES (HOR * VER * 16) #define RES (HOR * VER * 16)