~rabbits/orca-toy

341899d609e3aa579f1818df0de202da12ba209d — neauoire 1 year, 8 months ago 43ecd96
Implemented M and L operators
2 files changed, 16 insertions(+), 5 deletions(-)

M README.md
M orca.tal
M README.md => README.md +1 -1
@@ 33,7 33,7 @@ To display the list of operators inside of Orca, use `CmdOrCtrl+G`.
- `I` **increment**(*step* mod): Increments southward operand.
- `J` **jumper**(*val*): Outputs northward operand.
- `K` **konkat**(*len*): Reads multiple variables.
- `L` **less**(*a* *b*): Outputs smallest of inputs.
- `L` **lesser**(*a* *b*): Outputs smallest of inputs.
- `M` **multiply**(*a* b): Outputs product of inputs.
- `N` **north**: Moves Northward, or bangs.
- `O` **read**(*x* *y* read): Reads operand with offset.

M orca.tal => orca.tal +15 -4
@@ 309,7 309,7 @@ RTN
	( get right ) DUP2 INCR GET-PORT-RIGHT STH
	( incr y ) #01 +
	( get result ) EQUr STHr
	( bang on true ) #fc * #2e + 
	( bang if equal ) #fc * #2e + 
	SET-PORT-OUTPUT
	
RTN


@@ 322,7 322,8 @@ RTN

@op-h ( x y char -- )

	POP POP2
	POP
	#01 + GET-PORT-RIGHT
	
RTN



@@ 346,13 347,23 @@ RTN

@op-l ( x y char -- )

	POP POP2
	POP ( TODO: detect capitalization )
	( get left ) DUP2 DECR GET-PORT-LEFT STH
	( get right ) DUP2 INCR GET-PORT-RIGHT STH
	( incr y ) #01 +
	( min ) STH2r LTHk #01 JCN SWP POP GET-CHAR 
	SET-PORT-OUTPUT
	
RTN

@op-m ( x y char -- )

	POP POP2
	POP ( TODO: detect capitalization )
	( get left ) DUP2 DECR GET-PORT-LEFT STH
	( get right ) DUP2 INCR GET-PORT-RIGHT STH
	( incr y ) #01 +
	( get result ) MULr STHr GET-CHAR
	SET-PORT-OUTPUT
	
RTN