asdf

From Esolang
Jump to navigation Jump to search

asdf is an esoteric programming language created by user:David.werecat which uses only 4 instructions: a, s, d and f.

Instructions

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.

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

Toggle the bit at the current location and clear the toggle flag

ass

Cat

daasaasasaasssaasssasssf

External resources