~rabbits/oekaki

e5f0b77db0800281e2692201bcb9d94ee8a34cc1 — neauoire 5 months ago dbf3dff
Added stack checking
1 files changed, 23 insertions(+), 15 deletions(-)

M src/oekaki.tal
M src/oekaki.tal => src/oekaki.tal +23 -15
@@ 1,6 1,6 @@
( draw your brains out )

|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1


@@ 39,13 39,12 @@
	( soft reboot ) .src/buf LDZ ?on-soft
	.Console/type DEI ?{
		;dict/default ;src/buf <scpy>
		;src/buf <open-file>
		BRK }
	BRK
		;src/buf <open-file> }
	!<post-vector>

@on-soft ( -> )
	;src/buf <open-file>
	BRK
	!<post-vector>

@meta
	00


@@ 60,10 59,10 @@

@on-console ( -> )
	.Console/read DEI .src zkey ?&open
	BRK
	!<post-vector>
	&open ( -> )
		;src/buf <open-file>
		BRK
		!<post-vector>

@on-control ( -> )
	.Controller/button DEI


@@ 91,7 90,7 @@
	DUP #08 NEQ ?{ <make-file> }
	DUP #09 NEQ ?{ <toggle-menu> }
	DUP #1b NEQ ?{ <center> }
	POP BRK
	POP !<post-vector>

@on-control-options ( -> )
	.Controller/key DEI


@@ 99,7 98,7 @@
	DUP [ LIT "n ] NEQ ?{ <make-file> }
	DUP [ LIT "s ] NEQ ?{ ;src/buf <save-file> }
	DUP [ LIT "o ] NEQ ?{ ;src/buf <open-file> }
	POP BRK
	POP !<post-vector>

@on-mouse ( -> )
	.menu/hide LDZ ?{


@@ 110,30 109,37 @@
	( tool ) .brush/tool LDZ
	( alt override ) .Controller/button DEI #02 NEQ ?{ POP #03 }
	#30 SFT ADD
	( load ) #00 SWP ;tools ADD2 LDA2 JSR2 BRK
	( load ) #00 SWP ;tools ADD2 LDA2 JSR2 !<post-vector>

@on-mouse-menu ( -> )
	[ LIT2 43 -Mouse/state ] DEI #00 NEQ SUB ;hand-icn <update-cursor>
	.Mouse/state DEI ?{ BRK }
	.Mouse/state DEI ?{ !<post-vector> }
	.Mouse/y DEI2 #0002 SUB2 #000a DIV2 NIP
	( | size )
	DUP #08 GTH ?{
		<release-mouse>
		.brush/shape LDZ #33 SFT ADD <set-shape>
		BRK }
		!<post-vector> }
	#09 SUB
	( | patt )
	DUP #09 GTH ?{ <release-mouse>
		<set-patt>
		BRK }
		!<post-vector> }
	#0b SUB
	( | tool )
	DUP #03 GTH ?{ <release-mouse>
		<set-tool>
		BRK }
		!<post-vector> }
	DUP #0a LTH ?{ <release-mouse>
		<toggle-blend> }
	POP BRK
	POP !<post-vector>

@<post-vector> ( -> )
	.System/wst DEI2 #0200 EQU2 ?{
		;dict/leak <pstr>
		#0a18 DEO
		#0101 #0e DEO2 }
	BRK

(
@|controls )


@@ 473,6 479,7 @@
	.File/name DEO2
	#0012 .File/length DEO2
	;tga .File/read DEO2
	( | update name )
	( | flip endianness )
	;tga/x STH2k LDA2 SWP STH2r STA2
	;tga/y STH2k LDA2 SWP STH2r STA2


@@ 861,6 868,7 @@
@dict &default "pict40x28.chr $1
	&save "Saved 20 $1
	&open "Opened 20 $1
	&leak "Leaked $1
	&icn-ext ".icn $1
	&chr-ext ".chr $1
	&tga-ext ".tga $1