~rabbits/nasu

4fbc4e0d9b307b2f51e9d8983ad48d3b2f46c0ee — neauoire a month ago 2683a38
Ported to new sprite engine
1 files changed, 56 insertions(+), 56 deletions(-)

M src/nasu.tal
M src/nasu.tal => src/nasu.tal +56 -56
@@ 67,7 67,7 @@

|00 @System     [ &vector $2 &pad     $6 &r      $2 &g     $2 &b     $2 ]
|10 @Console    [ &vector $2 &read    $1 &pad    $5 &write $1 ]
|20 @Screen     [ &vector $2 &width   $2 &height $2 &pad   $2 &x     $2 &y $2 &addr $2 &color $1 ]
|20 @Screen     [ &vector $2 &width   $2 &height $2 &pad   $2 &x     $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button  $1 &key    $1 ]
|90 @Mouse      [ &vector $2 &x       $2 &y      $2 &state $1 &chord $1 ]
|a0 @File       [ &vector $2 &success $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2 ]


@@ 162,7 162,7 @@ BRK

	#08 ! ,&no-toggle JCN
		.state/blink TOGGLE
		#23 .state/blink LDZ #09 * + ;draw-filepath JSR2
		#03 .state/blink LDZ #09 * + ;draw-filepath JSR2
		#00 .state/timer STZ 
	&no-toggle
	


@@ 237,7 237,7 @@ BRK
	DUP ( ctrl+r ) #72 ! ,&no-name JCN
		.state/trap TOGGLE
		#00 .state/blink STZ 
		#23 ;draw-filepath JSR2 POP BRK &no-name
		#03 ;draw-filepath JSR2 POP BRK &no-name
	DUP ( ctrl+s ) #73 ! ,&no-save JCN
		;save-file JSR2 
		;draw-state JSR2 POP BRK  &no-save


@@ 257,20 257,20 @@ BRK
		&continue
	DUP ( backspace ) #08 ! ,&no-edit-backspace JCN
		( clamp ) .path/length LDZ #00 = ,&edit-end JCN
		#20 ;draw-filepath JSR2
		#00 ;draw-filepath JSR2
		.path/length LDZ #01 - STHk .path/length STZ
		#00 .path/name STHr + STZ
		#21 ;draw-filepath JSR2 POP BRK
		#01 ;draw-filepath JSR2 POP BRK
		&no-edit-backspace
	DUP ( special ) #20 > ,&no-edit-enter JCN
		#00 .state/trap STZ
		#21 ;draw-filepath JSR2 POP BRK
		#01 ;draw-filepath JSR2 POP BRK
		&no-edit-enter
	( clamp ) .path/length LDZ #1f = ,&edit-end JCN
	DUP .path/name .path/length LDZ STHk + STZ
	STHr #01 + STHk .path/length STZ
	#00 .path/name STHr + STZ
	#23 ;draw-filepath JSR2
	#03 ;draw-filepath JSR2
	&edit-end
	POP



@@ 356,7 356,7 @@ BRK
		;redraw JSR22
		&no-load
	DUP HOR SWP - #04 ! ,&no-name JCN
		#20 ;draw-filepath JSR2
		#00 ;draw-filepath JSR2
		;untitled-txt ;new-file JSR2
		;redraw JSR2
		&no-name


@@ 378,7 378,7 @@ BRK
	DUP #07 > OVR HOR SWP - #05 > #0101 !! ,&no-rename JCN
		.state/trap TOGGLE
		#00 .state/blink STZ 
		#23 ;draw-filepath JSR2
		#03 ;draw-filepath JSR2
		&no-rename
	DUP #01 + .settings/color LDZ ! ,&no-eraser JCN
		#00 .settings/color STZ


@@ 639,8 639,8 @@ RTN
			BANK ++ [ DUP2 ] .Screen/addr DEO2
			.settings/focus LDZ2 == #0d *
			.settings/blending LDZ +
			.settings/depth LDZ #20 * +
			#20 + .Screen/color DEO
			.settings/depth LDZ #80 * +
			#00 + .Screen/sprite DEO
			INCR LTHk ,&hor JCN
		POP2
		POPr


@@ 667,7 667,7 @@ RTN
			OVR #08 * TOS .tileview/x1 LDZ2 ++ .Screen/x DEO2
			( get pixel offset ) GET-ITERATORS SWP TOS ROT TOS
			( add focus ) STH2kr SWP2r STH2kr SWP2r ADD-POSITIONS
			;get-pixel JSR2 #20 + .Screen/color DEO
			;get-pixel JSR2 #00 + .Screen/sprite DEO
			INCR LTHk ,&hor JCN
		POP2
		INCR LTHk ,&ver JCN


@@ 767,33 767,33 @@ RTN
	( colors )
	.toolview/x1 LDZ2 STH2k .Screen/x DEO2
	;circle-icns [ .settings/color LDZ #01 = TOS #0008 ** ] ++ .Screen/addr DEO2
	#21 .Screen/color DEO
	#01 .Screen/sprite DEO
	STH2kr #0008 ++ .Screen/x DEO2
	;circle-icns [ .settings/color LDZ #02 = TOS #0008 ** ] ++ .Screen/addr DEO2
	#22 .Screen/color DEO
	#02 .Screen/sprite DEO
	STH2kr #0010 ++ .Screen/x DEO2
	;circle-icns [ .settings/color LDZ #03 = TOS #0008 ** ] ++ .Screen/addr DEO2
	#23 .Screen/color DEO
	#03 .Screen/sprite DEO
	( tools )
	STH2kr #0020 ++ .Screen/x DEO2
	;tool-brush .Screen/addr DEO2
	#21 .settings/tool LDZ #00 = + .Screen/color DEO
	#01 .settings/tool LDZ #00 = + .Screen/sprite DEO
	STH2kr #0029 ++ .Screen/x DEO2
	;tool-selector .Screen/addr DEO2
	#21 .settings/tool LDZ #01 = + .Screen/color DEO
	#01 .settings/tool LDZ #01 = + .Screen/sprite DEO
	STH2r #0030 ++ .Screen/x DEO2
	;zoom-icns [ .settings/zoom LDZ TOS #0008 ** ++ ] .Screen/addr DEO2
	#21 .settings/zoom LDZ + .Screen/color DEO
	#01 .settings/zoom LDZ + .Screen/sprite DEO
	( file i/o )
	,draw-state JSR
	.toolview/x2 LDZ2 STH2k #0018 -- .Screen/x DEO2
	;load-icn .Screen/addr DEO2
	#21 .Screen/color DEO
	#01 .Screen/sprite DEO
	STH2r #0020 -- .Screen/x DEO2
	;make-icn .Screen/addr DEO2
	#21 .Screen/color DEO
	#01 .Screen/sprite DEO
	( filepath )
	#23 ;draw-filepath JSR2
	#03 ;draw-filepath JSR2

RTN



@@ 802,7 802,7 @@ RTN
	.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2
	.toolview/y1 LDZ2 .Screen/y DEO2
	;save-icn .Screen/addr DEO2
	#25 .state/changed LDZ #0a * + .Screen/color DEO
	#05 .state/changed LDZ #0a * + .Screen/sprite DEO

RTN



@@ 812,16 812,16 @@ RTN
	.blendview/x1 LDZ2 .Screen/x DEO2
	.blendview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	( get blending ) .settings/blending LDZ
	( get depth ) .settings/depth LDZ #20 *
	( draw ) #20 + + #21 ;draw-byte JSR2
	( get depth ) .settings/depth LDZ #80 *
	( draw ) + #01 ;draw-byte JSR2

	.settings/focus LDZ2 .Screen/addr DEO2
	#00 #10
	&loop
		OVR #04 MOD #00 SWP #0008 ** .blendview/x1 LDZ2 ++ .Screen/x DEO2
		OVR #04 / #00 SWP #0008 ** .blendview/y1 LDZ2 ++ .Screen/y DEO2
		#20 .Screen/color DEO
		OVR #20 + .settings/depth LDZ #20 * + .Screen/color DEO
		#00 .Screen/sprite DEO
		OVR #00 + .settings/depth LDZ #80 * + .Screen/sprite DEO
		INCR LTHk ,&loop JCN
	POP2



@@ 835,14 835,14 @@ RTN
	;path/name
	&loop
		DUP2 LDA DUP #00 ! #20 * - TOS #0008 ** ;font ++ .Screen/addr DEO2 
		STHkr .Screen/color DEO
		STHkr .Screen/sprite DEO
		.Screen/x DEI2 #0008 ++ .Screen/x DEO2
		#0001 ++
		LDAk #00 ! ,&loop JCN
	POP2
	POPr
	( clear last ) 
	#20 .Screen/color DEO
	#00 .Screen/sprite DEO

RTN



@@ 851,7 851,7 @@ RTN
	( value )
	.preview/x1 LDZ2 .Screen/x DEO2
	.preview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	.settings/ratio LDZ #22 ;draw-byte JSR2
	.settings/ratio LDZ #02 ;draw-byte JSR2

	( stash address )
	.settings/focus LDZ2 STH2k .Screen/addr DEO2


@@ 869,13 869,13 @@ RTN
			#0101 !! ,&outside JCN 
				( get tile ) STH2kr .Screen/addr DEO2
				( get blending ) .settings/blending LDZ
				( get depth ) .settings/depth LDZ #20 *
				( draw ) #20 + + .Screen/color DEO
				( get depth ) .settings/depth LDZ #80 *
				( draw ) + .Screen/sprite DEO
				( incr ) STH2r #0008 [ .settings/depth LDZ #08 * TOS ++ ] ++ STH2
				,&resume JMP
			&outside
			;halftone-icn .Screen/addr DEO2
			#23 .Screen/color DEO
			#03 .Screen/sprite DEO
			&resume
			INCR LTHk ,&hor JCN
		POP2


@@ 890,13 890,13 @@ RTN
	.colorview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	.colorview/x1 LDZ2 .Screen/x DEO2
	.System/r GET-COLOR ;draw-short/parse JSR2 .Screen/addr DEO2
	#20 .settings/color LDZ + .Screen/color DEO
	.settings/color LDZ .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	.System/g GET-COLOR ;draw-short/parse JSR2 .Screen/addr DEO2
	#20 .settings/color LDZ + .Screen/color DEO
	.settings/color LDZ .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	.System/b GET-COLOR ;draw-short/parse JSR2 .Screen/addr DEO2
	#20 .settings/color LDZ + .Screen/color DEO
	.settings/color LDZ .Screen/sprite DEO

	.colorview/x1 LDZ2 .colorview/y1 LDZ2 
		[ .System/r GET-COLOR ] ,draw-slider JSR


@@ 915,7 915,7 @@ RTN
	#00 #10
	&loop
		OVR STHkr > #08 * TOS ;slider-icns ++ .Screen/addr DEO2
		#22 .Screen/color DEO
		#02 .Screen/sprite DEO
		.Screen/x DEI2 #0002 ++ .Screen/x DEO2
		INCR LTHk ,&loop JCN
	POP2


@@ 928,16 928,16 @@ RTN
	( position )
	.dataview/x1 LDZ2 .Screen/x DEO2
	.dataview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	.settings/focus LDZ2 BANK -- #22 ;draw-short JSR2
	.settings/focus LDZ2 BANK -- #02 ;draw-short JSR2

	( depth1 )
	#00 #04
	&loop
		.dataview/x1 LDZ2 .Screen/x DEO2
		OVR #08 * TOS .dataview/y1 LDZ2 ++ .Screen/y DEO2
		OVR #02 * TOS .settings/focus LDZ2 ++ LDA2 #23 ;draw-short JSR2
		OVR #02 * TOS .settings/focus LDZ2 ++ LDA2 #03 ;draw-short JSR2
		.dataview/x1 LDZ2 #0020 ++ .Screen/x DEO2
		OVR #02 * TOS .settings/focus LDZ2 ++ #0008 ++ LDA2 #23 ;draw-short JSR2
		OVR #02 * TOS .settings/focus LDZ2 ++ #0008 ++ LDA2 #03 ;draw-short JSR2
		INCR LTHk ,&loop JCN
	POP2



@@ 961,7 961,7 @@ RTN
			[ STHr ] [ STH2r ] #0008 ++ LDA SWP 
			#07 SWP - SFT #01 AND
			#02 * +
			#20 + .Screen/color DEO
			.Screen/sprite DEO
			INCR LTHk ,&hor JCN
		POP2
		INCR LTHk ,&ver JCN


@@ 977,11 977,11 @@ RTN
	.zoomview/y1 LDZ2 #0021 ++ .Screen/y DEO2
	.zoomview/x1 LDZ2 .Screen/x DEO2
	;opshift-icn .Screen/addr DEO2
	#21 .Screen/color DEO
	#01 .Screen/sprite DEO

	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;oproll-icn .Screen/addr DEO2
	#21 .Screen/color DEO
	#01 .Screen/sprite DEO

RTN



@@ 990,7 990,7 @@ RTN
	( clear last cursor )
	.pointer/x LDZ2 .Screen/x DEO2
	.pointer/y LDZ2 .Screen/y DEO2
	#30 .Screen/color DEO
	#40 .Screen/sprite DEO

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


@@ 998,7 998,7 @@ RTN

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

RTN



@@ 1006,16 1006,16 @@ RTN

	STH SWP 
		DUP #04 SFT ,&parse JSR .Screen/addr DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
		#0f AND ,&parse JSR .Screen/addr DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
		DUP #04 SFT ,&parse JSR .Screen/addr DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
		#0f AND ,&parse JSR .Screen/addr DEO2
		( draw ) STHr .Screen/color DEO
		( draw ) STHr .Screen/sprite DEO
	RTN
	&parse ( value -- addr* )
		DUP #09 GTH ,&above JCN 


@@ 1029,10 1029,10 @@ RTN
	
	STH
		DUP #04 SFT ,draw-short/parse JSR .Screen/addr DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
		#0f AND ,draw-short/parse JSR .Screen/addr DEO2
		( draw ) STHr .Screen/color DEO
		( draw ) STHr .Screen/sprite DEO

RTN



@@ 1042,16 1042,16 @@ RTN
	STH2r STH2r
	&ver
		( save ) OVR2 .Screen/y DEO2
		( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
		( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
		( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
		( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
		( incr ) INCR2
		OVR2 OVR2 LTS2 ,&ver JCN
	POP2 POP2
	.rect/x1 LDZ2 .rect/x2 LDZ2
	&hor
		( save ) OVR2 .Screen/x DEO2
		( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
		( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
		( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
		( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
		( incr ) INCR2
		OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
	POP2 POP2


@@ 1168,7 1168,7 @@ RTN
	STH .Screen/y DEO2
	&loop
		( save ) OVR2 .Screen/x DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/pixel DEO
		( incr ) SWP2 #0002 ++ SWP2
		LTH2k ,&loop JCN
	POP2 POP2 POPr


@@ 1180,7 1180,7 @@ RTN
	STH ROT2 .Screen/x DEO2
	&loop
		( save ) OVR2 .Screen/y DEO2
		( draw ) STHkr .Screen/color DEO
		( draw ) STHkr .Screen/pixel DEO
		( incr ) SWP2 #0002 ++ SWP2
		LTH2k ,&loop JCN
	POP2 POP2 POPr