~rabbits/nasu

09c7ba692e1b52e315b5bed205566451fed4f3c1 — neauoire 1 year, 1 month ago 9934cfc
Clamp pixel selection
2 files changed, 32 insertions(+), 25 deletions(-)

M src/main.tal
M src/utils.tal
M src/main.tal => src/main.tal +30 -25
@@ 66,20 66,18 @@
@filepath $40 ( ext ) $4

( interface )
@toolview  [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@colorview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@blendview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@dataview  [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@preview   [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@zoomview  [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@tileview
	&x1 $2 &y1 $2
	&x2 $2 &y2 $2
@nametable
	&x $2 &y $2
	&x2 $2 &y2 $2
@workspace-frame  [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@zoomview-frame  [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]

@toolview        &x1 $2 &y1 $2 &x2 $2 &y2 $2
@colorview       &x1 $2 &y1 $2 &x2 $2 &y2 $2
@blendview       &x1 $2 &y1 $2 &x2 $2 &y2 $2
@dataview        &x1 $2 &y1 $2 &x2 $2 &y2 $2
@preview         &x1 $2 &y1 $2 &x2 $2 &y2 $2
@zoomview        &x1 $2 &y1 $2 &x2 $2 &y2 $2
@tileview        &x1 $2 &y1 $2 &x2 $2 &y2 $2
@nametable       &x  $2 &y  $2 &x2 $2 &y2 $2

@workspace-frame &x1 $2 &y1 $2 &x2 $2 &y2 $2
@zoomview-frame  &x1 $2 &y1 $2 &x2 $2 &y2 $2

( program )



@@ 328,6 326,9 @@ BRK
			DUP2 #0100 !! ,&no-down JCN
				.Mouse/x DEI2 .tileview/x1 LDZ2 -- 8// NIP
				.Mouse/y DEI2 .tileview/y1 LDZ2 -- 8// NIP
					( select zoom )
					DUP2 8* .selection/zy LDZ + SWP 8* .selection/zy LDZ + SWP ;set-selection-zoom JSR2
					( select from )
					;set-selection-from JSR2
				,&end JMP
				&no-down


@@ 509,9 510,9 @@ RTN
RTN

@set-selection-zoom ( x y -- )
 
	.selection/zy STZ 
	.selection/zx STZ 

	#7f AND .selection/zy STZ 
	#7f AND .selection/zx STZ 

RTN



@@ 572,8 573,12 @@ RTN

@mod-selection-zoom ( x y -- )

	.selection/zy LDZ + .selection/zy STZ
	.selection/zx LDZ + .selection/zx STZ
	( set zoom )
	DUP2 
	.selection/zy LDZ + SWP 
	.selection/zx LDZ + SWP 
		;set-selection-zoom JSR2
	( set from )
	.selection/zx LDZ 8/ .selection/zy LDZ 8/ ;set-selection-from JSR2
	;draw-tileview-zoom JSR2



@@ 790,10 795,10 @@ RTN
	POP2
	POP2r POP2r
	( guides )
	#00 #08 .selection/zy LDZ - 8MOD2 8** #0007 ++ STH2
	#00 #07 .selection/zy LDZ - 8MOD2 8** #0001 -- #0008 ++ STH2
	.tileview/x1 LDZ2 .tileview/x2 LDZ2 .tileview/y1 LDZ2 STH2kr ++ #02 ;line-hor-dashed JSR2
	.tileview/x1 LDZ2 .tileview/x2 LDZ2 .tileview/y1 LDZ2 STH2r ++ #0040 ++ #02 ;line-hor-dashed JSR2
	#00 #08 .selection/zx LDZ - 8MOD2 8** #0007 ++ STH2
	#00 #07 .selection/zx LDZ - 8MOD2 8** #0001 -- #0008 ++ STH2
	.tileview/x1 LDZ2 STH2kr ++ .tileview/y1 LDZ2 .tileview/y2 LDZ2 #02 ;line-ver-dashed JSR2
	.tileview/x1 LDZ2 STH2r ++ #0040 ++ .tileview/y1 LDZ2 .tileview/y2 LDZ2 #02 ;line-ver-dashed JSR2



@@ 1105,7 1110,7 @@ RTN
	;make-icn .Screen/addr DEO2
	#01 .Screen/sprite DEO
	( filepath )
	#03 ;draw-filepath JSR2
	#01 ;draw-filepath JSR2

RTN



@@ 1131,7 1136,7 @@ RTN
	.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2
	.toolview/y1 LDZ2 .Screen/y DEO2
	;save-icn .Screen/addr DEO2
	#0f05 .state/changed LDZ #01 JCN SWP POP .Screen/sprite DEO
	#0f05 .state/changed LDZ POP? .Screen/sprite DEO

RTN



@@ 1355,7 1360,7 @@ RTN

	STH STH
	( y2 ) STHkr #06 + LDZ2
	( y1 ) STHkr #02 + LDZ2 #0001 -- ( flip sign ) GTH2k #01 JCN SWP2
	( y1 ) STHkr #02 + LDZ2 #0001 -- ( flip sign ) GTH2k JMP SWP2
	&ver
		( save ) DUP2 .Screen/y DEO2
		( x1 ) STHkr LDZ2 #0001 -- .Screen/x DEO2


@@ 1366,7 1371,7 @@ RTN
		INC2 GTH2k ,&ver JCN
	POP2
	( x2 ) STHkr #04 + LDZ2
	( x1 ) STHkr LDZ2 #0001 -- ( flip sign ) GTH2k #01 JCN SWP2
	( x1 ) STHkr LDZ2 #0001 -- ( flip sign ) GTH2k JMP SWP2
	&hor
		( save ) DUP2 .Screen/x DEO2
		( y1 ) STHkr #02 + LDZ2 #0001 -- .Screen/y DEO2

M src/utils.tal => src/utils.tal +2 -0
@@ 44,6 44,8 @@
%ROL { DUP #07 SFT SWP #10 SFT + }
%ROR { DUP #70 SFT SWP #01 SFT + }

%POP? { JMP SWP POP }

%RELEASE-MOUSE { #0096 DEO }

%AUTO-NONE { #00 .Screen/auto DEO }