... | ... |
@@ -12,11 +12,11 @@ |
12 | 12 |
|
13 | 13 |
|0000 |
14 | 14 |
|
15 |
-@pointer $2 |
|
15 |
+@ptr $2 |
|
16 | 16 |
|
17 | 17 |
|0100 ( -> ) |
18 | 18 |
|
19 |
- MEMORY .pointer STZ2 |
|
19 |
+ MEMORY .ptr STZ2 |
|
20 | 20 |
|
21 | 21 |
;program |
22 | 22 |
&while |
... | ... |
@@ -31,15 +31,15 @@ BRK |
31 | 31 |
@op ( op -- ) |
32 | 32 |
|
33 | 33 |
( Move the pointer to the right ) |
34 |
- LIT '> !~ ,&movr JCN [ .pointer LDZ2k INC2 ROT STZ2 POP RTN ] &movr |
|
34 |
+ LIT '> !~ ,&movr JCN [ .ptr LDZ2k INC2 ROT STZ2 POP RTN ] &movr |
|
35 | 35 |
( Move the pointer to the left ) |
36 |
- LIT '< !~ ,&movl JCN [ .pointer LDZ2k DEC2 ROT STZ2 POP RTN ] &movl |
|
36 |
+ LIT '< !~ ,&movl JCN [ .ptr LDZ2k DEC2 ROT STZ2 POP RTN ] &movl |
|
37 | 37 |
( Increment the memory cell at the pointer ) |
38 |
- LIT '+ !~ ,&incr JCN [ .pointer LDZ2 STH2k LDA INC STH2r STA POP RTN ] &incr |
|
38 |
+ LIT '+ !~ ,&incr JCN [ .ptr LDZ2 STH2k LDA INC STH2r STA POP RTN ] &incr |
|
39 | 39 |
( Decrement the memory cell at the pointer ) |
40 |
- LIT '- !~ ,&decr JCN [ .pointer LDZ2 STH2k LDA DEC STH2r STA POP RTN ] &decr |
|
40 |
+ LIT '- !~ ,&decr JCN [ .ptr LDZ2 STH2k LDA DEC STH2r STA POP RTN ] &decr |
|
41 | 41 |
( Output the character signified by the cell at the pointer ) |
42 |
- LIT '. !~ ,&emit JCN [ .pointer LDZ2 LDA EMIT POP RTN ] &emit |
|
42 |
+ LIT '. !~ ,&emit JCN [ .ptr LDZ2 LDA EMIT POP RTN ] &emit |
|
43 | 43 |
( Jump past the matching ] if the cell at the pointer is 0 ) |
44 | 44 |
LIT '[ !~ ,&next JCN [ POP ,goto-next JSR RTN ] &next |
45 | 45 |
( Jump back to the matching [ if the cell at the pointer is nonzero ) |
... | ... |
@@ -50,14 +50,12 @@ RTN |
50 | 50 |
|
51 | 51 |
@goto-next ( -- ) |
52 | 52 |
|
53 |
- .pointer LDZ2 LDA #00 EQU JMP RTN |
|
53 |
+ .ptr LDZ2 LDA #00 EQU JMP RTN |
|
54 | 54 |
|
55 | 55 |
( depth ) LITr 00 |
56 | 56 |
INC2 |
57 | 57 |
&loop |
58 |
- LDAk LIT '[ NEQ ,&no-depth JCN |
|
59 |
- INCr |
|
60 |
- &no-depth |
|
58 |
+ LDAk LIT '[ NEQ JMP INCr |
|
61 | 59 |
LDAk LIT '] NEQ ,&no-end JCN |
62 | 60 |
STHkr #00 EQU ,&end JCN |
63 | 61 |
DECr |
... | ... |
@@ -70,14 +68,12 @@ RTN |
70 | 68 |
|
71 | 69 |
@goto-back ( -- ) |
72 | 70 |
|
73 |
- .pointer LDZ2 LDA #00 NEQ JMP RTN |
|
71 |
+ .ptr LDZ2 LDA #00 NEQ JMP RTN |
|
74 | 72 |
|
75 | 73 |
( depth ) LITr 00 |
76 | 74 |
DEC2 |
77 | 75 |
&loop |
78 |
- LDAk LIT '] NEQ ,&no-depth JCN |
|
79 |
- INCr |
|
80 |
- &no-depth |
|
76 |
+ LDAk LIT '] NEQ JMP INCr |
|
81 | 77 |
LDAk LIT '[ NEQ ,&no-end JCN |
82 | 78 |
STHkr #00 EQU ,&end JCN |
83 | 79 |
DECr |