Skip to main content
deleted 46 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
0000000: 685902 ef6b33ae7b33 774992764992 84dd9bc45d9b 316360397360 ceef1f8fef1f 73ca727bca72 hY..k3wI.{3vI..].1c`9s`...s{.r 0000015: 325e33 06  3adc33 2^3.07 

Try it online!Try it online! Check Debug to see the generated SBIN code.

add 26 jmp jmp fwdrwd 1, add 1, fwdrwd 1, add 1, rwdfwd 2, sub 1 jnz fwdrwd 2, add 64 jmp rwdfwd 2, add 1, fwdrwd 2, sub 1 jnz rwdfwd 1, sub 1 jnz rwdfwd 1 jmp jmp put, rwdfwd 1 jnz fwdrwd 27 jmp put, rwdfwd 1 jnz add 10, put, get, rwdfwd 1 jmp fwdrwd 1, add 1, rwdfwd 1, sub 1 jnz rwdfwd 1 ; jnz (implicit) 
0000000: 685902 ef6b33 774992 84dd9b 316360 ceef1f 73ca72 hY..k3wI....1c`...s.r 0000015: 325e33 06  2^3. 

Try it online! Check Debug to see the generated SBIN code.

add 26 jmp jmp fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1 jnz fwd 2, add 64 jmp rwd 2, add 1, fwd 2, sub 1 jnz rwd 1, sub 1 jnz rwd 1 jmp jmp put, rwd 1 jnz fwd 27 jmp put, rwd 1 jnz add 10, put, get, rwd 1 jmp fwd 1, add 1, rwd 1, sub 1 jnz rwd 1 ; jnz (implicit) 
0000000: 685902 ae7b33 764992 c45d9b 397360 8fef1f 7bca72 hY..{3vI..].9s`...{.r 0000015: 3adc33 07 

Try it online! Check Debug to see the generated SBIN code.

add 26 jmp jmp rwd 1, add 1, rwd 1, add 1, fwd 2, sub 1 jnz rwd 2, add 64 jmp fwd 2, add 1, rwd 2, sub 1 jnz fwd 1, sub 1 jnz fwd 1 jmp jmp put, fwd 1 jnz rwd 27 jmp put, fwd 1 jnz add 10, put, get, fwd 1 jmp rwd 1, add 1, fwd 1, sub 1 jnz fwd 1 ; jnz (implicit) 
added 3960 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Try it online!Try it online! Check Debug to see the generated SBIN code.

How it worksSesos assembly

add 26 jmp jmp,  fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1,  jnz fwd 2, add 64 jmp,  rwd 2, add 1, fwd 2, sub 1,  jnz rwd 1, sub 1 jnz rwd 1 jmp jmp,  put, rwd 1,  jnz fwd 27 jmp,  put, rwd 1,  jnz add 10, put, get, rwd 1 jmp,  fwd 1, add 1, rwd 1, sub 1,  jnz rwd 1 ; jnz (implicit) 

How it works

We start by initializing the tape to ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is as follows.

Write 26 to a cell, leaving the tape in the following state.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0 

As long as the cell under the data head is non-zero, we do the following.

Copy the number to the two cells to the left and add 64 to the leftmost copy.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0 

Move the leftmost copy to the original location, then subtract 1 from the rightmost copy.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0 

The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.

 v 0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.

First, we print the character under the data head and move to the right, repeating this step until a cell with value 0 is found. After printing ABCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.

 v 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we move the data head 27 units to the left (back to the leading 0) and repeat the print-move combination until a cell with value 0 is found. This prints nothing and leaves the tape as follows.

v 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.

Afterwards, we move the content of the cell to the right to the current cell, then move the data head to units to the right.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

The next iteration is slightly different. The first printing step prints BCDEFGHIJKLMNOPQRSTUVWXYZ, leaving the tape as follows.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we move the data head 27 units to the left.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

The subsequent printing loop prints A and leaves the tape as follows.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Once again, we print a linefeed, move the content of the cell to the right to the current cell, then move the data head to units to the right.

 v 65 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

After 24 more iterations, the final step of moving the data head to the right leaves the tape in the following state.

 v 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 0 

The cell under the data head is now 0 and the program terminates.


TIO uses a newer version of Sesos, which is backwards-compatible for SASM, but generates shorter SBIN code.

Try it online! Check Debug to see the generated SBIN code.

How it works

add 26 jmp jmp, fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1, jnz fwd 2, add 64 jmp, rwd 2, add 1, fwd 2, sub 1, jnz rwd 1, sub 1 jnz rwd 1 jmp jmp, put, rwd 1, jnz fwd 27 jmp, put, rwd 1, jnz add 10, put, get, rwd 1 jmp, fwd 1, add 1, rwd 1, sub 1, jnz rwd 1 

Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

add 26 jmp jmp  fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1  jnz fwd 2, add 64 jmp  rwd 2, add 1, fwd 2, sub 1  jnz rwd 1, sub 1 jnz rwd 1 jmp jmp  put, rwd 1  jnz fwd 27 jmp  put, rwd 1  jnz add 10, put, get, rwd 1 jmp  fwd 1, add 1, rwd 1, sub 1  jnz rwd 1 ; jnz (implicit) 

How it works

We start by initializing the tape to ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is as follows.

Write 26 to a cell, leaving the tape in the following state.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0 

As long as the cell under the data head is non-zero, we do the following.

Copy the number to the two cells to the left and add 64 to the leftmost copy.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0 

Move the leftmost copy to the original location, then subtract 1 from the rightmost copy.

 v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0 

The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.

 v 0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.

First, we print the character under the data head and move to the right, repeating this step until a cell with value 0 is found. After printing ABCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.

 v 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we move the data head 27 units to the left (back to the leading 0) and repeat the print-move combination until a cell with value 0 is found. This prints nothing and leaves the tape as follows.

v 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.

Afterwards, we move the content of the cell to the right to the current cell, then move the data head to units to the right.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

The next iteration is slightly different. The first printing step prints BCDEFGHIJKLMNOPQRSTUVWXYZ, leaving the tape as follows.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Now we move the data head 27 units to the left.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

The subsequent printing loop prints A and leaves the tape as follows.

 v 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

Once again, we print a linefeed, move the content of the cell to the right to the current cell, then move the data head to units to the right.

 v 65 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 

After 24 more iterations, the final step of moving the data head to the right leaves the tape in the following state.

 v 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0 0 

The cell under the data head is now 0 and the program terminates.


TIO uses a newer version of Sesos, which is backwards-compatible for SASM, but generates shorter SBIN code.

deleted 69 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Sesos, 27 25 bytes

0000000: 685902 ef6b33 2549f2774992 86dd9b84dd9b 316360 ceef1f 73ca72 hY..k3%Ik3wI....1c`...s.r 0000015: 325e33 06 2^3. 

Try it online!Try it online! Check Debug to see the generated SBIN code.

How it works

The binary file above has been generated by assembling the following SASM code.

add 26 jmp jmp, fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1, jnz addfwd 642, fwdadd 264 jmp, rwd 2, add 1, fwd 2, sub 1, jnz rwd 1, sub 1 jnz rwd 1 jmp jmp, put, rwd 1, jnz fwd 27 jmp, put, rwd 1, jnz add 10, put, get, rwd 1 jmp, fwd 1, add 1, rwd 1, sub 1, jnz rwd 1 

Sesos, 27 25 bytes

0000000: 685902 ef6b33 2549f2 86dd9b 316360 ceef1f 73ca72 hY..k3%I....1c`...s.r 0000015: 325e33 06 2^3. 

Try it online! Check Debug to see the generated SBIN code.

How it works

The binary file above has been generated by assembling the following SASM code.

add 26 jmp jmp, fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1, jnz add 64, fwd 2 jmp, rwd 2, add 1, fwd 2, sub 1, jnz rwd 1, sub 1 jnz rwd 1 jmp jmp, put, rwd 1, jnz fwd 27 jmp, put, rwd 1, jnz add 10, put, get, rwd 1 jmp, fwd 1, add 1, rwd 1, sub 1, jnz rwd 1 

Sesos, 27 25 bytes

0000000: 685902 ef6b33 774992 84dd9b 316360 ceef1f 73ca72 hY..k3wI....1c`...s.r 0000015: 325e33 06 2^3. 

Try it online! Check Debug to see the generated SBIN code.

How it works

The binary file above has been generated by assembling the following SASM code.

add 26 jmp jmp, fwd 1, add 1, fwd 1, add 1, rwd 2, sub 1, jnz fwd 2, add 64 jmp, rwd 2, add 1, fwd 2, sub 1, jnz rwd 1, sub 1 jnz rwd 1 jmp jmp, put, rwd 1, jnz fwd 27 jmp, put, rwd 1, jnz add 10, put, get, rwd 1 jmp, fwd 1, add 1, rwd 1, sub 1, jnz rwd 1 
deleted 52 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading