~rabbits/left

30aaef6faa6d499cbe28685b7ceca25b043f2b37 — neauoire a month ago aea82d3
Ported to the new sprite engine
1 files changed, 37 insertions(+), 37 deletions(-)

M src/main.tal
M src/main.tal => src/main.tal +37 -37
@@ 55,7 55,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 &wheel $1 
|a0 @File       &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 


@@ 142,7 142,7 @@ BRK

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


@@ 171,22 171,22 @@ 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
		;on-frame .Screen/vector DEO2
		;on-button .Controller/vector DEO2
		#00 .state/blink 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
	#21 ;draw-filepath JSR2
	#01 ;draw-filepath JSR2
	&edit-end
	POP



@@ 235,7 235,7 @@ BRK
		&no-cut
	( document )
	DUP ( ctrl+r ) #52 = OVR #72 = #0000 == ,&no-name JCN
		#20 ;draw-filepath JSR2 
		#00 ;draw-filepath JSR2 
		#52 ! ,&no-rename JCN
			#00 .path/length STZ
			#0000 .path/name STZ2


@@ 248,23 248,23 @@ BRK
		;clear-textarea JSR2
		;load-file JSR2
		.selection/from LDZ2 ;select-addr/no-clear JSR2 
		#21 ;draw-filepath JSR2
		#01 ;draw-filepath JSR2
		;draw-scrollbar JSR2
		POP BRK 
		&no-open
	DUP ( ctrl+s ) #73 ! ,&no-save JCN
		;save-file JSR2
		#21 ;draw-filepath JSR2
		#01 ;draw-filepath JSR2
		;draw-scrollbar JSR2
		POP BRK 
		&no-save
	DUP ( ctrl+n ) #6e ! ,&no-make JCN
		#20 ;draw-filepath JSR2
		#00 ;draw-filepath JSR2
		;clear-textarea JSR2
		#0000 ;set-scroll-y JSR2
		;untitled-txt ;new-file JSR2
		;document/body ;select-addr/no-clear JSR2
		#21 ;draw-filepath JSR2
		#01 ;draw-filepath JSR2
		;draw-scrollbar JSR2
		&no-make
	POP 


@@ 393,13 393,13 @@ BRK
	( clear last cursor )
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2
	#30 .Screen/color DEO
	#40 .Screen/sprite DEO

	( draw new cursor )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2
	;cursor-icn .Screen/addr DEO2
	.Mouse/state DEI #00 ! #31 + .Screen/color DEO
	.Mouse/state DEI #00 ! #41 + .Screen/sprite DEO

	( wheel )
	.Mouse/wheel DEI


@@ 806,7 806,7 @@ RTN
@redraw ( -- )

	#0000 .Screen/width DEI2 #0018 #01 ;line-hor JSR2
	#21 ;draw-filepath JSR2
	#01 ;draw-filepath JSR2
	;draw-widget/memory JSR2
	;draw-textarea JSR2
	;draw-scrollbar JSR2


@@ 834,16 834,16 @@ RTN
@draw-widget ( -- )

	&scroll
		,&init JSR .scroll/y LDZ2 #22 ,draw-short JSR 
		,&init JSR .scroll/y LDZ2 #02 ,draw-short JSR 
		RTN
	&selection
		,&init JSR .selection/from LDZ2 ;document/body -- #23 ;draw-short JSR2
		,&init JSR .selection/from LDZ2 ;document/body -- #03 ;draw-short JSR2
		RTN
	&size
		,&init JSR SELECTION-LENGTH #22 ;draw-short JSR2
		,&init JSR SELECTION-LENGTH #02 ;draw-short JSR2
		RTN
	&memory
		,&init JSR SPACE-AVAILABLE #21 ;draw-short JSR2 
		,&init JSR SPACE-AVAILABLE #01 ;draw-short JSR2 
		RTN
	&init
		#fff0 .Screen/addr DEO2


@@ 851,9 851,9 @@ RTN
		&loop
			OVR2 .Screen/x DEO2
			.widget/y0 LDZ2 STH2k .Screen/y DEO2
			#20 .Screen/color DEO
			#00 .Screen/sprite DEO
			STH2r #0008 ++ .Screen/y DEO2
			#20 .Screen/color DEO
			#00 .Screen/sprite DEO
			INCR2 LTH2k ,&loop JCN
		POP2 POP2
		.widget/x0 LDZ2 .widget/y0 LDZ2


@@ 888,7 888,7 @@ RTN
		#0008 .Screen/x DEO2 
		#0008 .Screen/y DEO2
		;state-icn .Screen/addr DEO2
		DUP #21 + .Screen/color DEO
		DUP #01 + .Screen/sprite DEO
		DUP .state/changed STZ
		&skip
	POP


@@ 934,7 934,7 @@ RTN
		( space-before ) DUP2 #0001 -- LDA #20 > ,&no-paren-open JCN
		( space-after ) DUP2 #0001 ++ LDA #20 > ,&no-paren-open JCN
		#01 ,&commented STR
		#23 ;draw-uf2-multiline/color STA RTN
		#03 ;draw-uf2-multiline/color STA RTN
		&no-paren-open
	DUP2 #0001 -- LDA ( right-paren ) #29 ! ,&no-paren-close JCN
		( space-before ) DUP2 #0002 -- LDA #20 > ,&no-paren-close JCN


@@ 946,9 946,9 @@ RTN
	,&commented LDR ,&end JCN
	DUP2 #0001 ++ LDA IS-LABEL ,&label JCN
	&default
		#21 ;draw-uf2-multiline/color STA RTN
		#01 ;draw-uf2-multiline/color STA RTN
	&label
		#22 ;draw-uf2-multiline/color STA RTN
		#02 ;draw-uf2-multiline/color STA RTN
	&end
		RTN
	&commented $1


@@ 964,7 964,7 @@ RTN
	&while
		;scan-font JSR2
		.Screen/x DEI2 .textarea/x1 LDZ2 GTS2 ,&outside JCN
			LDAk #20 ;draw-uf2/sprite JSR2
			LDAk #00 ;draw-uf2/sprite JSR2
			&outside
		LDAk NOT-LINEBREAK ,&no-linebreak JCN
			( move down ) #0008 .scroll/x LDZ2 -- .Screen/x DEO2


@@ 975,7 975,7 @@ RTN
		LDAk ,&while JCN
	&end
	POP2 POP2
	#00 #20 ;draw-uf2/sprite JSR2
	#00 #00 ;draw-uf2/sprite JSR2

RTN



@@ 983,7 983,7 @@ RTN

	;font-data-regular ;draw-uf2/font STA2
	#00 ;scan-font/commented STA
	#21 ,&color STR
	#01 ,&color STR
	SWP2 .Screen/y DEO2
	SWP2 .scroll/x LDZ2 -- DUP2 .Screen/x DEO2 SWP2
	&while


@@ 1007,7 1007,7 @@ RTN
	&get-color ( addr* -- addr* color )
		DUP2 .selection/from LDZ2 << ,&unselected JCN
		DUP2 .selection/to LDZ2 #0001 -- >> ,&unselected JCN
		#28 RTN
		#08 RTN
		&unselected
			,&color LDR RTN



@@ 1051,18 1051,18 @@ RTN
		( get width ) STHkr TOS ,&font LDR2 
		++ LDA 
		TOS SWPr
			( left-top ) STHkr .Screen/color DEO
			( left-top ) STHkr .Screen/sprite DEO
			.Screen/y DEI2 #0008 ++ .Screen/y DEO2
			.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
			( left-bottom ) STHkr .Screen/color DEO
			( left-bottom ) STHkr .Screen/sprite DEO
			.Screen/x DEI2 #0008 ++ .Screen/x DEO2
			.Screen/y DEI2 #0008 -- .Screen/y DEO2
			DUP #08 < ,&thin JCN
			.Screen/addr DEI2 #0008 -- .Screen/addr DEO2
			( right-top )  STHkr .Screen/color DEO
			( right-top )  STHkr .Screen/sprite DEO
			.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
			.Screen/y DEI2 #0008 ++ .Screen/y DEO2
			( right-bottom ) STHkr .Screen/color DEO
			( right-bottom ) STHkr .Screen/sprite DEO
			.Screen/y DEI2 #0008 -- .Screen/y DEO2 &thin
		SWPr
		( use width ) .Screen/x DEI2 ++ #0008 -- .Screen/x DEO2


@@ 1081,7 1081,7 @@ RTN
	&loop
		SWP2 
			DUP2 .Screen/y DEO2
			#23 .Screen/color DEO
			#03 .Screen/sprite DEO
		#0008 ++ SWP2
		LTH2k ,&loop JCN
	POP2 POP2


@@ 1095,19 1095,19 @@ RTN
	.scroll/y LDZ2 .textarea/lines LDZ2 // .scrollbar/y0 LDZ2 ++ #0008 ++ SWP2 OVR2 ++
	&stretch
		OVR2 .Screen/y DEO2
		#21 .Screen/color DEO
		#01 .Screen/sprite DEO
		INCR2 LTH2k ,&stretch JCN
	POP2 POP2

	( scroll-up )
	.scrollbar/y0 LDZ2 .Screen/y DEO2
	;scrollbar-icns/up .Screen/addr DEO2
	( draw ) #24 .Screen/color DEO
	( draw ) #04 .Screen/sprite DEO

	( scroll-down )
	.scrollbar/y1 LDZ2 #0008 -- .Screen/y DEO2
	;scrollbar-icns/down .Screen/addr DEO2
	( draw ) #24 .Screen/color DEO
	( draw ) #04 .Screen/sprite DEO

RTN



@@ 1226,7 1226,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