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
DUP #04 NEQ ^$no-aleft JNZ
( sel decr ) ~selection.to -- =selection.to $no-aleft
DUP #08 NEQ ^$no-aright JNZ
( sel incr ) ~selection.to ++ =selection.to $no-aright
POP
,clamp-selection JSR2
,redraw JSR2
,ctrl-end JMP2
$no-alt
( ctrl + arrow )
~Controller #0f AND #01 NEQ ^$no-ctrl JNZ
~Controller #04 SFT
DUP #01 NEQ ^$no-cup JNZ
( jump scroll ) #0004 ,scroll-up JSR2 $no-cup
DUP #02 NEQ ^$no-cdown JNZ
( jump scroll ) #0004 ,scroll-down JSR2 $no-cdown
DUP #04 NEQ ^$no-cleft JNZ
( jump line ) ,goto-linestart JSR2 $no-cleft
DUP #08 NEQ ^$no-cright JNZ
( jump line ) ,goto-lineend JSR2 $no-cright
POP
,redraw JSR2
,ctrl-end JMP2
$no-ctrl
( arrow )
~Controller #f0 AND #00 EQU ,$no-arrow JNZ2
~Controller #f0 AND
DUP #10 NEQ ^$no-arrowup JNZ
( clamp ) ~position.y #0000 EQU2 ^$no-arrowup JNZ
,find-lineoffset JSR2 =position.x ~position.y -- =position.y
,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowup
DUP #20 NEQ ^$no-arrowdown JNZ
( clamp:TODO )
,find-lineoffset JSR2 =position.x ~position.y ++ =position.y ,find-lineoffset JSR2 =position.x ~position.y ++ =position.y
,find-selection JSR2 DUP2 =selection.from ++ =selection.to ,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowdown
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 DUP #40 NEQ ^$no-arrowleft JNZ
@no-ctrl-down ( clamp ) ~selection.from ,document.body EQU2 ^$no-arrowleft JNZ
~Controller #40 NEQ ,no-ctrl-left JNZ2 ~selection.from -- DUP2 =selection.from ++ =selection.to $no-arrowleft
( clamp ) ~selection.from ,document.body EQU2 ,no-ctrl-left JNZ2 DUP #80 NEQ ^$no-arrowright JNZ
~selection.from -- DUP2 =selection.from ++ =selection.to ( clamp:TODO )
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 #aa =Console.byte
@no-ctrl-left ~selection.from ++ DUP2 =selection.from ++ =selection.to $no-arrowright
~Controller #80 NEQ ,no-ctrl-right JNZ2 POP
~selection.from ++ DUP2 =selection.from ++ =selection.to ,clamp-selection JSR2
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,follow-selection JSR2
@no-ctrl-right ,redraw JSR2
( alt ) $no-arrow
~Controller #0f AND #02 NEQ ,no-alt JNZ2
~Controller #04 SFT #01 NEQ ,no-aup JNZ2
,find-wordstart JSR2 =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aup
~Controller #04 SFT #02 NEQ ,no-adown JNZ2
,find-wordend JSR2 =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-adown
~Controller #04 SFT #04 NEQ ,no-aleft JNZ2
~selection.to -- =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aleft
~Controller #04 SFT #08 NEQ ,no-aright JNZ2
~selection.to ++ =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aright
@no-alt
( ctrl )
~Controller #0f AND #01 NEQ ,no-ctrl JNZ2
~Controller #04 SFT #01 NEQ ,no-cup JNZ2
#0004 ,scroll-up JSR2
,redraw JSR2 ,ctrl-end JMP2
@no-cup
~Controller #04 SFT #02 NEQ ,no-cdown JNZ2
#0004 ,scroll-down JSR2
,redraw JSR2 ,ctrl-end JMP2
@no-cdown
~Controller #04 SFT #04 NEQ ,no-cleft JNZ2
,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-cleft
~Controller #04 SFT #08 NEQ ,no-cright JNZ2
,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-cright
@no-ctrl
@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)