~rabbits/nasu

9c770f37d111929b811639d1dd7a1538eed5d03b — neauoire 1 year, 9 months ago 14528d0
Completed colorview
1 files changed, 55 insertions(+), 45 deletions(-)

M nasu.usm
M nasu.usm => nasu.usm +55 -45
@@ 32,6 32,7 @@
%HEIGHT { VER TOS #0008 ** }

%RTN { JMP2r }
%CPY { STHkr }
%STEP8 { #0033 SFT2 }

%SFL { #40 SFT SFT }


@@ 286,9 287,35 @@ BRK
BRK

@on-touch-colorview ( -> )
	
	.Mouse/y DEI2 .colorview/y1 LDZ2 -- #0008 // TOB

	DUP #00 ! ,&no-r JCN
		.System/r ,&set-color JSR
		.System/r [ .settings/color LDZ #02 / + ] DEO
		&no-r
	DUP #01 ! ,&no-g JCN
		.System/g ,&set-color JSR
		.System/g [ .settings/color LDZ #02 / + ] DEO
		&no-g
	DUP #02 ! ,&no-b JCN
		.System/b ,&set-color JSR
		.System/b [ .settings/color LDZ #02 / + ] DEO
		&no-b
	POP
	
	;redraw JSR2 BRK

	( release ) #00 .Mouse/state DEO
	;redraw JSR2
	&set-color

		.settings/color LDZ STHk #02 / + DEI 
		STHr #02 MOD STHk 
		#0f SWP [ #40 * SFT ] AND 
		STHr #00 = 
		.Mouse/x DEI2 .colorview/x1 LDZ2 -- #0002 // TOB
		SWP [ #40 * SFT ] +

	RTN

BRK



@@ 306,34 333,6 @@ BRK

BRK

@set-color ( color rgb -- )
	
	STH
	DUP #00 ! ,&no-red0 JCN
		STHkr DEI DUP #04 SFT #01 +
		( add/sub ) .Mouse/state DEI #10 = #fe * +
		( resume ) #40 SFT SWP #0f AND + STHkr DEO
		&no-red0
	DUP #01 ! ,&no-red1 JCN
		STHkr DEI DUP #0f AND #01 +
		( add/sub ) .Mouse/state DEI #10 = #fe * +
		( resume ) #0f AND SWP #f0 AND + STHkr DEO
		&no-red1
	DUP #02 ! ,&no-red2 JCN
		STHkr #01 + DEI DUP #04 SFT #01 +
		( add/sub ) .Mouse/state DEI #10 = #fe * +
		( resume ) #40 SFT SWP #0f AND + STHkr #01 + DEO
		&no-red2
	DUP #03 ! ,&no-red3 JCN
		STHkr #01 + DEI DUP #0f AND #01 +
		( add/sub ) .Mouse/state DEI #10 = #fe * +
		( resume ) #0f AND SWP #f0 AND + STHkr #01 + DEO
		&no-red3
	POP
	POPr

RTN

@toggle-depth ( -- )
	
	.settings/selection LDZ


@@ 390,7 389,7 @@ RTN
		OVR DUP #08 * TOS .tileview/y1 LDZ2 ++ .Screen/y DEO2 STH
		#00 HOR
		&hor
			OVR DUP #08 * TOS .tileview/x1 LDZ2 ++ .Screen/x DEO2 STHkr
			OVR DUP #08 * TOS .tileview/x1 LDZ2 ++ .Screen/x DEO2 CPY
			TOS ROT TOS SWP2
			HOR TOS ** ++ #0010 **
			BANK ++ .Screen/addr DEO2


@@ 438,7 437,7 @@ RTN
	OVR2 SWP2 ,get-addr JSR 
	( ch1 )
	OVR2 OVR2
		STHkr #00 ,toggle-pixel JSR
		CPY #00 ,toggle-pixel JSR
	( ch2 )
	#0008 ++ 
		STHr #01 ,toggle-pixel JSR


@@ 505,9 504,6 @@ RTN
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;eye-icns .Screen/addr DEO2
	#23 .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;depth-icns .Screen/addr DEO2
	#23 .Screen/color DEO

	( file i/o )
	.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2


@@ 587,7 583,7 @@ RTN

@draw-colorview ( -- )
	
	.colorview/y2 LDZ2 .Screen/y DEO2
	.colorview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	.colorview/x1 LDZ2 .Screen/x DEO2
	;font-hex [ .System/r .settings/color LDZ GET-COLOR ] TOS #0008 ** ++ .Screen/addr DEO2
	#20 .settings/color LDZ + .Screen/color DEO


@@ 600,17 596,28 @@ RTN

	.colorview/x1 LDZ2 .colorview/y1 LDZ2 
		[ .System/r .settings/color LDZ GET-COLOR ] ,draw-slider JSR
	.colorview/x1 LDZ2 .colorview/y1 LDZ2 
	.colorview/x1 LDZ2 .colorview/y1 LDZ2 #0008 ++
		[ .System/g .settings/color LDZ GET-COLOR ] ,draw-slider JSR
	.colorview/x1 LDZ2 .colorview/y1 LDZ2 
	.colorview/x1 LDZ2 .colorview/y1 LDZ2 #0010 ++
		[ .System/b .settings/color LDZ GET-COLOR ] ,draw-slider JSR

RTN

@draw-slider ( x* y* -- )
	
	POP2 POP2
@draw-slider ( x* y* value -- )
	
	STH
	.Screen/y DEO2
	.Screen/x DEO2
	#00 #10
	&loop
		OVR STHkr > #08 * TOS ;slider-icns ++ .Screen/addr DEO2
		#22 .Screen/color DEO
		.Screen/x DEI2 #0002 ++ .Screen/x DEO2
		INCR
		LTHk ,&loop JCN
	POP2
	POPr

RTN

@draw-dataview ( -- )


@@ 656,7 663,7 @@ RTN
@draw-byte ( byte color -- )
	
	STH STH
	;font-hex #00 STHkr #f0 AND #04 SFT #08 * ++ .Screen/addr DEO2
	;font-hex #00 CPY #f0 AND #04 SFT #08 * ++ .Screen/addr DEO2
	( draw ) OVRr STHr .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;font-hex #00 STHr #0f AND #08 * ++ .Screen/addr DEO2


@@ 668,13 675,13 @@ RTN

	STH SWP 
	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
	( draw ) STHkr .Screen/color DEO
	( draw ) CPY .Screen/color DEO
	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	( draw ) STHkr .Screen/color DEO
	( draw ) CPY .Screen/color DEO
	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	( draw ) STHkr .Screen/color DEO
	( draw ) CPY .Screen/color DEO
	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	( draw ) STHr .Screen/color DEO


@@ 693,6 700,9 @@ RTN
@save-icn      fe82 8282 848a f400 
@load-icn      feaa d6aa d4aa f400 

@slider-icns
	f0f0 f0f0 f0f0 f000 ( full )
	50a0 50a0 50a0 5000 ( empty )
@circle-icns
	3844 8282 8244 3800 ( full )
	387c fefe fe7c 3800 ( line )