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 )
,filepath ,load-file JSR2
( place textarea )
#0018 =textarea.x1 ~Screen.height 8- =textarea.y2
@ -77,63 +78,63 @@ BRK
~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,ctrl-end JNZ2
( lock ) #04 =lock
~Controller #10 NEQ ,no-ctrl-up JNZ2
( clamp ) ~position.y #0000 EQU2 ,no-ctrl-up JNZ2
,find-lineoffset JSR2 =position.x
~position.y -- =position.y
,find-selection JSR2 DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-up
~Controller #20 NEQ ,no-ctrl-down JNZ2
( alt + arrow )
~Controller #0f AND #02 NEQ ^$no-alt JNZ
~Controller #04 SFT
DUP #01 NEQ ^$no-aup JNZ
( sel word ) ,find-wordstart JSR2 =selection.to $no-aup
DUP #02 NEQ ^$no-adown JNZ
( 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-selection JSR2 DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-down
~Controller #40 NEQ ,no-ctrl-left JNZ2
( clamp ) ~selection.from ,document.body EQU2 ,no-ctrl-left JNZ2
~selection.from -- DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-left
~Controller #80 NEQ ,no-ctrl-right JNZ2
~selection.from ++ DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-right
( alt )
~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
,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowdown
DUP #40 NEQ ^$no-arrowleft JNZ
( clamp ) ~selection.from ,document.body EQU2 ^$no-arrowleft JNZ
~selection.from -- DUP2 =selection.from ++ =selection.to $no-arrowleft
DUP #80 NEQ ^$no-arrowright JNZ
( clamp:TODO )
#aa =Console.byte
~selection.from ++ DUP2 =selection.from ++ =selection.to $no-arrowright
POP
,clamp-selection JSR2
,follow-selection JSR2
,redraw JSR2
$no-arrow
@ctrl-end
@ -168,15 +169,6 @@ BRK
( 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.x #0010 LTH2 ,touch-linebar JNZ2
~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2
@ -259,7 +251,7 @@ RTN
RTN
@scroll-up ( length )
@scroll-up ( length -- )
DUP2 ~scroll.y LTH2 ^$clamp JNZ
#0000 =scroll.y POP2 RTN
@ -268,7 +260,7 @@ RTN
RTN
@scroll-down ( length )
@scroll-down ( length -- )
( TODO: Clamp )
~scroll.y SWP2 ADD2 =scroll.y
@ -700,11 +692,6 @@ RTN
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 ]
@blank_icn [ 0000 0000 0000 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]

View File

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