uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 92b5624e2f0ab429775673db9787b3ce538dd774
parent 7d74fa95f0c885fc6a5f3827496b59f8a17687c3
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Sat, 13 Nov 2021 10:57:54 -0500

(brainfuck.tal) Minor cleanup

Diffstat:
Mprojects/examples/exercises/brainfuck.tal | 17+++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/projects/examples/exercises/brainfuck.tal b/projects/examples/exercises/brainfuck.tal @@ -28,24 +28,21 @@ BRK -( - > Move the pointer to the right - < Move the pointer to the left - + Increment the memory cell at the pointer - - Decrement the memory cell at the pointer - [ Jump past the matching ] if the cell at the pointer is 0 - ] Jump back to the matching [ if the cell at the pointer is nonzero - , Input a character and store it in the cell at the pointer - . Output the character signified by the cell at the pointer ) - @op ( op -- ) + ( Move the pointer to the right ) LIT '> !~ ,&movr JCN [ .pointer LDZ2k INC2 ROT STZ2 POP RTN ] &movr + ( Move the pointer to the left ) LIT '< !~ ,&movl JCN [ .pointer LDZ2k DEC2 ROT STZ2 POP RTN ] &movl + ( Increment the memory cell at the pointer ) LIT '+ !~ ,&incr JCN [ .pointer LDZ2 STH2k LDA INC STH2r STA POP RTN ] &incr + ( Decrement the memory cell at the pointer ) LIT '- !~ ,&decr JCN [ .pointer LDZ2 STH2k LDA DEC STH2r STA POP RTN ] &decr + ( Output the character signified by the cell at the pointer ) LIT '. !~ ,&emit JCN [ .pointer LDZ2 LDA EMIT POP RTN ] &emit + ( Jump past the matching ] if the cell at the pointer is 0 ) LIT '[ !~ ,&next JCN [ POP ,goto-next JSR RTN ] &next + ( Jump back to the matching [ if the cell at the pointer is nonzero ) LIT '] !~ ,&prev JCN [ POP ,goto-back JSR RTN ] &prev POP