Browse code

(brainfuck.tal) Minor cleanup

Devine Lu Linvega authored on 13/11/2021 15:57:54
Showing 1 changed files
... ...
@@ -28,24 +28,21 @@
28 28
 	
29 29
 BRK
30 30
 
31
-(
32
-	> Move the pointer to the right
33
-	< Move the pointer to the left
34
-	+ Increment the memory cell at the pointer
35
-	- Decrement the memory cell at the pointer
36
-	[ Jump past the matching ] if the cell at the pointer is 0
37
-	] Jump back to the matching [ if the cell at the pointer is nonzero
38
-	, Input a character and store it in the cell at the pointer
39
-	. Output the character signified by the cell at the pointer )
40
-
41 31
 @op ( op -- )
42 32
 
33
+	( Move the pointer to the right )
43 34
 	LIT '> !~ ,&movr JCN [ .pointer LDZ2k INC2 ROT STZ2 POP RTN ] &movr
35
+	( Move the pointer to the left )
44 36
 	LIT '< !~ ,&movl JCN [ .pointer LDZ2k DEC2 ROT STZ2 POP RTN ] &movl
37
+	( Increment the memory cell at the pointer )
45 38
 	LIT '+ !~ ,&incr JCN [ .pointer LDZ2 STH2k LDA INC STH2r STA POP RTN ] &incr
39
+	( Decrement the memory cell at the pointer )
46 40
 	LIT '- !~ ,&decr JCN [ .pointer LDZ2 STH2k LDA DEC STH2r STA POP RTN ] &decr
41
+	( Output the character signified by the cell at the pointer )
47 42
 	LIT '. !~ ,&emit JCN [ .pointer LDZ2 LDA EMIT POP RTN ] &emit
43
+	( Jump past the matching ] if the cell at the pointer is 0 )
48 44
 	LIT '[ !~ ,&next JCN [ POP  ,goto-next JSR RTN ] &next
45
+	( Jump back to the matching [ if the cell at the pointer is nonzero )
49 46
 	LIT '] !~ ,&prev JCN [ POP ,goto-back JSR RTN ] &prev
50 47
 	POP
51 48