Asdfjkl;

From Esolang
Jump to navigation Jump to search

asdfjkl; is an extension of asdf and 1234.The pointer begins at memory location 3. It can be moved left or right infinitely. IO is memory mapped. To read from the console, toggle the bit at location 0 twice without moving or hitting a loop; this will read one bit from the console into location 2. To write to the console, toggle the bit at location 1 twice without moving or hitting a loop; this will write one bit from location 2 to the console. Since all console IO is bytewise, all reads and writes to the console are buffered (8 bits).

Instruction Description
a Toggles the bit at the current location and sets the toggle flag.
s If the toggle flag is clear, move the pointer right. If the toggle flag is set, move the pointer left. Either way, clear the toggle flag.
d If the bit at the current location is 1, jump forward to the matching f. Also, clear the toggle flag.
f If the bit at the current location is 0, jump backward to the matching d. Also, clear the toggle flag.
j Flip the current bit and move the pointer left. If the pointer ends at location -4, the pointer is moved to location 0.
k If the pointer is at location -3, read a character from the console and put it in locations 0 through 7; then move the pointer to location 0. If the pointer is at location -2, write a character to the console corresponding to locations 0 through 7; then move the pointer to location 0. At any other location, move the pointer right.
l Specifies a jump symbol. If the pointer is below 0, do nothing. If the current bit is TRUE, skip back to either the previous jump symbol or the start of the program. If the current bit is FALSE, skip forward to either the next jump symbol or the end of the program.
; Specified code-jump. Jump right the number of the pointed byte in the code.

Examples

Hello, world!

asaasaasssasaasssasaaaasssasaasssasaaaaaaaasssasaaaasssasaaaasssasaasssasaasssasaasssasaasssasaaaasssasaasssasaaaasssasaaaaaasssas
aaaasssasaasssasaaaasssasaaaaaasssasaaaasssasaasssasaaaaaaaasssasaaaasssasaasssasaasssasaaaasssasaaaaaaaasssasaasssasaaaaaaaaaaaas
ssasaaaaaasssasaasssasaaaaaasssasaasssasaaaasssasaasssasaaaaaaaasssasaasssasaaaaaasssasaaaasssasaasssasaaaasssasaaaasssasaasssasaa
aasssasaaaaaasssasaaaasssasaaaasssasaasssasaaaaaaaasssasaasssasaaaaaaaasssasaa

Move the pointer right, regardless of toggle bit (note: may perform I/O at low addresses)

aasss

Move the pointer left, regardless of toggle bit (note: may perform I/O at low addresses)

aas

Cat Program

jjjkjkjjk