~rabbits/orca-toy

1e622df46240ce4750e1a9e3eea708e83563d058 — neauoire 1 year, 8 months ago 8a839b0
Implemented U operator
2 files changed, 16 insertions(+), 6 deletions(-)

M orca.c
M orca.tal
M orca.c => orca.c +1 -1
@@ 634,7 634,7 @@ opt(Grid *g, int x, int y, char c)
void
opu(Grid *g, int x, int y, char c)
{
	char step = getport(g, x - 1, y, 1);
	char step = getport(g, x - 1, y, 0);
	char max = getport(g, x + 1, y, 1);
	int step_ = cb36(step);
	int max_ = cb36(max);

M orca.tal => orca.tal +15 -5
@@ 347,7 347,7 @@ RTN
	( get rate ) DUP2 DECR GET-PORT-LEFT MIN1 STH
	( get mod ) DUP2 INCR GET-PORT-RIGHT MIN1 STH
	( incr y ) #01 +
	( get result ) SWPr .timer/frame LDZ [ ( TODO: ) TOB ] STHr / STHr MOD 
	( get result ) SWPr .timer/frame LDZ2 [ ( TODO: ) TOB ] STHr / STHr MOD 
	GET-CHAR SET-PORT-OUTPUT

RTN


@@ 358,8 358,8 @@ RTN
	( get rate ) DUP2 DECR GET-PORT-LEFT MIN1 STH
	( get mod ) DUP2 INCR GET-PORT-RIGHT MIN1 STH
	( incr y ) #01 +
	( get result ) .timer/frame LDZ [ ( TODO: ) TOB ] MULr STHr MOD #00 =
	( bang if equal ) #fc * #2e + 
	( get result ) .timer/frame LDZ2 [ ( TODO: ) TOB ] MULr STHr MOD #00 =
	( bang if equal ) #fc * CHAR-DOT + 
	SET-PORT-OUTPUT
	
RTN


@@ 385,7 385,7 @@ RTN
	( get b ) DUP2 INCR GET-PORT-RIGHT STH
	( incr y ) #01 +
	( get result ) EQUr STHr
	( bang if equal ) #fc * #2e + 
	( bang if equal ) #fc * CHAR-DOT + 
	SET-PORT-OUTPUT
	
RTN


@@ 581,7 581,17 @@ RTN

@op-u ( x y char -- )

	POP POP2
	POP
	( get step ) DUP2 DECR GET-PORT-LEFT STH
	( get max ) DUP2 INCR GET-PORT-RIGHT MIN1 STH
	( incr y ) #01 +
	( frame + max - 1 ) .timer/frame LDZ2 TOB STHkr + #01 -
	( * step ) OVRr STHr *
	( % max ) STHkr MOD
	( + step ) SWPr STHr +
	( bucket >= max ) STHr < #01 !
	( bang if equal ) #fc * CHAR-DOT + 
	SET-PORT-OUTPUT
	
RTN