~rabbits/nasu

f98c016d7525229624e3e423b763b034961532fd — neauoire 1 year, 1 month ago 09c7ba6
Fixed memory leak
1 files changed, 16 insertions(+), 25 deletions(-)

M src/main.tal
M src/main.tal => src/main.tal +16 -25
@@ 283,6 283,7 @@ BRK

@on-touch-tileview ( -> )

	( test )
	.settings/tool LDZ #02 = ;&zoom JCN2
	.settings/zoom LDZ #01 = ;&zoomed JCN2
	.settings/tool LDZ #01 = ;&select JCN2


@@ 499,6 500,7 @@ RTN

	.settings/color STZ
	;draw-toolview JSR2
	;draw-colorview JSR2

RTN



@@ 574,12 576,13 @@ RTN
@mod-selection-zoom ( x y -- )

	( 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
	.selection/zx LDZ 8/ 
	.selection/zy LDZ 8/ 
		;set-selection-from JSR2
	;draw-tileview-zoom JSR2

RTN


@@ 826,14 829,6 @@ RTN

( tools )

@get-tile-addr ( x* y* -- addr* )

	STEP8 100** 4// SWP2
	STEP8 2** ++
	BANK-SPRITESHEET ++

RTN

@get-pixel ( x* y* -- color )

	( channel 1 )


@@ 853,8 848,8 @@ RTN
	( get row )
	DUP2 8MOD2
	( get tile )
	SWP2 8// 100** ++
	SWP2 STEP8 2** ++
	SWP2 #83 SFT2 ++
	SWP2 #43 SFT2 ++
	BANK-SPRITESHEET ++

RTN


@@ 862,17 857,13 @@ RTN
@put-pixel ( x* y* color -- )

	STH
	OVR2 SWP2 ,get-pixel-addr JSR
	( ch1 )
	OVR2 OVR2
		STHkr #00 ,toggle-pixel JSR
	( ch2 )
	#0008 ++
		STHr #01 ,toggle-pixel JSR
	OVR2 SWP2 ,get-pixel-addr JSR 
	( ch1 ) OVR2 OVR2 STHkr #00 ,toggle-pixel JSR
	( ch2 ) #0008 ++ STHr #01 ,toggle-pixel JSR

RTN

@toggle-pixel ( x* addr* color* -- )
@toggle-pixel ( x* addr* color -- )

	STH2
	LDAk


@@ 1017,7 1008,7 @@ RTN
		&loop
			DUP STHkr > 8* TOS ;slider-icns ++ .Screen/addr DEO2
			#02 .Screen/sprite DEO
			.Screen/x DEI2 INC2 INC2 .Screen/x DEO2
			.Screen/x DEI2k INC2 INC2 ROT DEO2
			INC GTHk ,&loop JCN
		POP2
		POPr


@@ 1032,7 1023,7 @@ RTN
		DUP 4MOD TOS 8** .blendview/x1 LDZ2 ++ .Screen/x DEO2
		DUP 4/ TOS 8** .blendview/y1 LDZ2 ++ .Screen/y DEO2
		#00 .Screen/sprite DEO
		DUP #00 + .settings/blend LDZ #b0 AND + .Screen/sprite DEO
		DUP .settings/blend LDZ #b0 AND + .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2



@@ 1120,11 1111,9 @@ RTN
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2
	#40 .Screen/sprite DEO

	( record mouse positions )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2

	( draw new cursor )
	;tool-brush #00 .settings/tool LDZ 8* ++ .Screen/addr DEO2
	#42 .Mouse/state DEI #00 ! + .Screen/sprite DEO


@@ 1136,7 1125,7 @@ RTN
	.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2
	.toolview/y1 LDZ2 .Screen/y DEO2
	;save-icn .Screen/addr DEO2
	#0f05 .state/changed LDZ POP? .Screen/sprite DEO
	#05 .state/changed LDZ #0a * + .Screen/sprite DEO

RTN



@@ 1155,6 1144,8 @@ RTN

RTN

( drawing primitives )

@draw-text ( text* color -- )

	STH