~rabbits/oekaki

7b2354ade0a154e6d5e543ce97850a1f4d713851 — neauoire 2 months ago 528b14c
Format
1 files changed, 17 insertions(+), 10 deletions(-)

M src/oekaki.tal
M src/oekaki.tal => src/oekaki.tal +17 -10
@@ 198,7 198,8 @@
	( bounds x ) OVR2 INC2 .canvas/width LDZ2 GTH2 ?&outside
	( bounds y ) DUP2 .canvas/height LDZ2 GTH2 ?&outside
	( get tile addr ) get-tile-addr STH2
	( get glyph vertical offset ) DUP2 #0007 AND2 STH2 ADD2r
	( get glyph vertical offset ) DUP2 #0007 AND2 STH2
	ADD2r
	( make bit mask ) OVR2 NIP #07 AND #80 SWP SFT
	( ch0 without ) DUP #ff EOR LDAkr STHr AND
	( ch0 with ) OVR OVR2r ANDr STHr MUL ORA STH2kr STA


@@ 232,7 233,8 @@

@get-pixel ( x* y* -- x* y* color )
	( get tile addr ) get-tile-addr STH2
	( get glyph vertical offset ) DUP2 #0007 AND2 STH2 ADD2r
	( get glyph vertical offset ) DUP2 #0007 AND2 STH2
	ADD2r
	( make bit mask ) OVR2 NIP #07 AND #80 SWP SFT
	( ch1 ) DUP LDAkr STHr AND #00 NEQ SWP
	( ch2 ) STH2r #0008 ADD2 LDA AND #00 NEQ DUP ADD ORA JMP2r


@@ 390,10 392,12 @@
		( ) [ LIT2 &x2 $2 ] STH2k [ LIT2 &x $2 ] EQU2 STH2r STH2r
		( ) [ LIT2 &fn $2 ] JSR2 AND ?&end
		STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?&skipy
		STH2r ,&dy LDR2 ADD2 STH2 ,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2
		STH2r ,&dy LDR2 ADD2 STH2
		,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2
	&skipy ( -- )
		,&dx LDR2 gts2 ?&while
	STH2r ,&dx LDR2 ADD2 STH2 ,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2
	STH2r ,&dx LDR2 ADD2 STH2
	,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2
	!&while
	&end POP2r JMP2r



@@ 437,7 441,8 @@
	#8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r

@normalize-rect ( x1* y1* x2* y2* -- )
	STH2 STH2
	STH2
	STH2
	( x1 x2 ) SWP2 STH2r LTH2k [ JMP SWP2 ]
	( not-same ) EQU2k #00 SWP ADD2
	( y1 y2 ) ROT2 STH2r LTH2k [ JMP SWP2 ]


@@ 649,7 654,8 @@
		POP2 POP2 JMP2r

@<guide-rect> ( x* y* x* y* -- )
	normalize-rect STH2 STH2
	normalize-rect STH2
	STH2
	( | vertical a )
	OVR2 .Screen/x DEO2
	DUP2 .Screen/y DEO2


@@ 670,7 676,8 @@

@<pixel-times> ( times* color auto -- )
	.Screen/auto DEO
	STH #0000 SWP2 SUB2
	STH
	#0000 SWP2 SUB2
	&u ( -- )
		STHkr .Screen/pixel DEO
		INC2 ORAk ?&u


@@ 759,8 766,7 @@
	LIT2 &x $2
	DUP2 #50 SFT2 EOR2 DUP2 #03 SFT2 EOR2 LIT2 &y $2
	DUP2 ,&x STR2
	DUP2 #01 SFT2 EOR2 EOR2 ,&y STR2k
	POP JMP2r
	DUP2 #01 SFT2 EOR2 EOR2 ,&y STR2k POP JMP2r

@mclr ( src* len* -- )
	OVR2 ADD2 SWP2


@@ 772,7 778,8 @@
@zkey ( key ztr -- proc )
	OVR #21 LTH ?&eval
	LDZk #2f EQU ?&overflow
	( write char ) STH #00 STHkr LDZk ADD INC STZ2
	( write char ) STH
	#00 STHkr LDZk ADD INC STZ2
	( incr len ) STHr LDZk INC SWP STZ
	#00 JMP2r
	&overflow ( key ztr -- proc )