-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It took me long enough Also, I guess the language is kinda concatenative now, with proper stack management while calling scripts and all
- Loading branch information
Showing
8 changed files
with
81 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; takes the tape and encodes the neigbours of each cell in each cell | ||
; return stack summary: ( binarytape -- encodedtape ) | ||
ret | ||
peek gr1 | ||
|
||
set gr2, gr1 ; first neigbor has no shift | ||
mul gr2, 2 ; but it has a weight of 2 | ||
|
||
rot gr1, 1 ; second neighbor is the one to the left | ||
add gr2, gr1 ; and has a weight of 1, so is directly added | ||
|
||
peek gr1 ; refresh gr1 | ||
rot gr1, 1- ; third neigbor is the one to the right | ||
mul gr1, 4 ; and has a weight of 4 | ||
add gr2, gr1 | ||
|
||
pop | ||
push gr2 ; these three add the encoded tape to the return stack again | ||
flip |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; THIS IS MAIN | ||
; rule 110, calculates and prints n amount of iterations of the beginning tape t(0) | ||
; return stack summary: ( tape(0) n -- tape(n) ) | ||
cmp loop, 0 | ||
; uncomment next line if you just want to see the pretty pattern | ||
Ce LOAD classicexample.aal | ||
Ce set loop, 1 | ||
Ce set endian, 0 | ||
Ce set ir, 0 | ||
Ce ret | ||
Ce pop gr4 ; gr4 now contains n (the target amount of iterations) | ||
|
||
Ce ret ; these four lines print the initial tape | ||
Ce peek gr1 | ||
Ce print gr1 | ||
Ce flip | ||
|
||
push ir ; saving the registers this script needs before the other scripts mess them up | ||
push loop | ||
push gr4 | ||
|
||
set loop, 0 | ||
SCR binconv.aa | ||
|
||
SCR ruleconv.aa | ||
|
||
pop gr4 ; retrieving the registers this script needs | ||
pop loop | ||
pop ir | ||
|
||
ret ; these four lines print the updated tape each iteration | ||
peek gr1 | ||
print gr1 | ||
flip | ||
|
||
inc ir | ||
ucmp ir, gr4 | ||
Cg set loop, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; Takes the encoded tape and enforces rule 110 | ||
; return stack summary: ( encodedtape -- binarytape ) | ||
cmp loop, 0 | ||
Ce set loop, 1 | ||
Ce ret | ||
Ce set ir, 0 | ||
Ce peek gr4 | ||
|
||
peek gr1 | ||
len gr1, gr2 | ||
dget gr1, ir | ||
set gr3, 00111110 ; 0: 000, 1: 100, 2: 010, 3: 110, 4: 001, 5: 101, 6: 011, 7: 111 | ||
dget gr3, gr1 | ||
dset gr4, ir, gr3 | ||
|
||
inc ir | ||
cmp ir, gr2 | ||
Ce set loop, 0 | ||
Ce pop | ||
Ce push gr4 | ||
Ce flip |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ add gr1, 3 | |
print gr1 | ||
|
||
cmp gr1, 3 | ||
Ce SCR test.aa | ||
Ce SCR test.aa | ||
Ce LOAD state.aal | ||
print 8888 |