~rabbits/orca-toy

0599939edada10d20892e2fa069d483197a79c77 — neauoire 1 year, 8 months ago ce8f201
Fixed loop-around issue with B
1 files changed, 50 insertions(+), 52 deletions(-)

M orca.tal
M orca.tal => orca.tal +50 -52
@@ 88,8 88,12 @@

	;untitled-txt ;new-file JSR2

	( fill grid with dots )
	;start JSR2
	( start )
	;clear JSR2
	;unlock JSR2
	#9a .timer/speed STZ
	#01 .timer/alive STZ

	;redraw JSR2

BRK


@@ 154,17 158,6 @@ BRK

@on-mouse (-> )
	
	.Mouse/state DEI #00 EQU ,&no-touch JCN

		.Mouse/y DEI2 .Screen/height DEI2 #0008 -- -- #0008 << ;on-touch-bar JCN2
		.Mouse/y DEI2 .Screen/height DEI2 #0010 -- -- #0008 << ,&no-touch JCN

		.Mouse/x DEI2 #03 SFT2 SWP POP .selection/x1 STZ
		.Mouse/y DEI2 #03 SFT2 SWP POP .selection/y1 STZ
		;redraw JSR2

	&no-touch

	( clear last cursor )
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2


@@ 180,6 173,14 @@ BRK
	.cursor/y LDZ2 .Screen/y DEO2
	;cursor_icn .Screen/addr DEO2
	#32 .Mouse/state DEI #01 EQU + .Screen/color DEO

	.Mouse/state DEI #00 EQU ,&no-touch JCN
		.Mouse/y DEI2 .Screen/height DEI2 #0008 -- -- #0008 << ,on-touch-bar JCN
		.Mouse/y DEI2 .Screen/height DEI2 #0010 -- -- #0008 << ,&no-touch JCN
		.Mouse/x DEI2 #03 SFT2 SWP POP .selection/x1 STZ
		.Mouse/y DEI2 #03 SFT2 SWP POP .selection/y1 STZ
		;redraw JSR2
		&no-touch
	
BRK



@@ 204,25 205,6 @@ BRK

BRK

@start ( -- )

	#00 .grid/height LDZ
	&ver
		#00 .grid/width LDZ
		&hor
			GET-ITERATORS #2e SET-CELL
			INCR
			LTHk ,&hor JCN
		POP2
		INCR
		LTHk ,&ver JCN
	POP2

	#9a .timer/speed STZ
	#01 .timer/alive STZ

RTN

( operations )

@get-bang ( x y -- bang )


@@ 253,11 235,13 @@ RTN
	
	DUP2 LDA-CELL
	( if character is dot )
	DUP #2e NEQ ,&no-bar JCN
	DUP CHAR-DOT NEQ ,&no-bar JCN
		( check if x,y is grid )
		POP
		DUP2 MOD8 #00 EQU SWP MOD8 #00 EQU #0101 NEQ2 ,&no-marker8 JCN POP2 ;marker8_icn RTN &no-marker8
		DUP2 #01 AND #00 EQU SWP #01 AND #00 EQU #0101 NEQ2 ,&no-marker4 JCN POP2 ;marker4_icn RTN &no-marker4
		DUP2 MOD8 #00 EQU SWP MOD8 #00 EQU #0101 NEQ2 ,&no-marker8 JCN 
			POP2 ;marker8_icn RTN &no-marker8
		DUP2 #01 AND #00 EQU SWP #01 AND #00 EQU #0101 NEQ2 ,&no-marker4 JCN 
			POP2 ;marker4_icn RTN &no-marker4
		POP2 ;font RTN
	&no-bar
	STH POP2 STHr


@@ 269,7 253,7 @@ RTN

@op-a ( x y char -- )

	POP
	POP ( TODO: detect capitalization )
	( get left ) DUP2 SWP #01 - SWP LDA-CELL-VALUE STH
	( get right ) DUP2 INCR LDA-CELL-VALUE STH
	( incr y ) #01 +


@@ 281,16 265,15 @@ RTN

@op-b ( x y char -- )
	
	POP
	POP ( TODO: detect capitalization )
	( get left ) DUP2 SWP #01 - SWP LDA-CELL-VALUE STH
	( get right ) DUP2 INCR LDA-CELL-VALUE STH
	( incr y ) #01 +
	( get result ) SUBr STHr
	( loop-around ) DUP #80 < ,&no-bounds JCN #00 SWP - #24 SWP - &no-bounds
	LDA-CHAR
	SET-CELL

	( NOTE: Issue is not with modulo, but with converting ff to 36 )

RTN

@op-c ( x y char -- )


@@ 369,13 352,13 @@ RTN
		#2a SET-CELL POP STHr RTN
	&not-edge
	( collide )
	DUP2 #01 - LDA-CELL #2e EQU ,&not-collide JCN
	DUP2 #01 - LDA-CELL CHAR-DOT EQU ,&not-collide JCN
		#2a SET-CELL POP STHr RTN
	&not-collide
	( move )
	DUP2 STHr
	SWP #01 - SWP SET-CELL	
	#2e SET-CELL
	CHAR-DOT SET-CELL
	
RTN



@@ 406,7 389,7 @@ RTN
@op-s ( x y char -- )
	
	STH
	( clear ) DUP2 #2e SET-CELL
	( clear ) DUP2 CHAR-DOT SET-CELL
	( move ) #01 + DUP2 #01 SET-LOCK
	STHr SET-CELL
	


@@ 438,13 421,13 @@ RTN
		#2a SET-CELL POP STHr RTN
	&not-edge
	( collide )
	DUP2 SWP #01 - SWP LDA-CELL #2e EQU ,&not-collide JCN
	DUP2 SWP #01 - SWP LDA-CELL CHAR-DOT EQU ,&not-collide JCN
		#2a SET-CELL POP STHr RTN
	&not-collide
	( move )
	DUP2
	SWP #01 - SWP STHr SET-CELL	
	#2e SET-CELL
	CHAR-DOT SET-CELL
	
RTN



@@ 469,14 452,14 @@ RTN
@op-bang ( x y char -- )

	POP
	#2e SET-CELL
	CHAR-DOT SET-CELL

RTN

@run-char ( x y char -- )
	
	( skip dot )
	DUP #2e NEQ ,&not-dot JCN
	DUP CHAR-DOT NEQ ,&not-dot JCN
		POP POP2 RTN
	&not-dot



@@ 505,7 488,23 @@ RTN

RTN

@init ( -- )
@clear ( -- )

	#00 .grid/height LDZ
	&ver
		#00 .grid/width LDZ
		&hor
			GET-ITERATORS CHAR-DOT SET-CELL
			INCR
			LTHk ,&hor JCN
		POP2
		INCR
		LTHk ,&ver JCN
	POP2

RTN

@unlock ( -- )
	
	#00 .grid/height LDZ
	&ver


@@ 524,8 523,7 @@ RTN

@run ( -- )
	
	;init JSR2

	;unlock JSR2
	#00 .grid/height LDZ
	&ver
		#00 .grid/width LDZ


@@ 544,7 542,7 @@ RTN

@new-file ( default* -- )

	( TODO: clear )
	;clear JSR2
	STH2
	#00 #0c
	&loop


@@ 682,8 680,6 @@ RTN

RTN

@untitled-txt  "untitled.chr $1

@values ( char to b36 )
	00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00


@@ 705,6 701,8 @@ RTN
	6f 70 71 72 73 74 75 76
	77 78 79 7a

@untitled-txt  "untitled.chr $1

@cursor_icn     80c0 e0f0 f8e0 1000
@blank_icn      0000 0000 0000 0000
@position_icn   0066 4200 0042 6600