Shifty
Jump to navigation
Jump to search
Shifty is an esoteric assembly language created by User:D. The primary operation is bit shifting.
Instructions
There are two unbounded registers, A
and B
.
SLB
: Set lowest bit ofA
to1
.LSH
: Left shiftA
by 1 bit.RSK x
: Right shiftA
(storing parity). Ifparity == 0
, skip forwardx
instructions.SKZ x
: IfA == 0
: Skip forwardx
instructions.XCH
ExchangeA
andB
.BR x
: Unconditionally branch backx
instructions.
Examples
Cyclic tag system simulator
; Cyclic tag simulator SLB rules: rule_1: RSK end_1 ; Move everything from A to B; ; (reversing bit order) copy_1: SKZ end_copy_1 XCH LSH XCH RSK skip_bit_1 XCH SLB XCH skip_bit_1: BR copy_1 end_copy_1: ; Production 1: 011 ; (store it in reverse bit order) SLB LSH SLB LSH ; Move everything from B to A (still reversing bit order) XCH second_copy_1: SKZ end_second_copy_1 XCH LSH XCH RSK second_skip_bit_1 XCH SLB XCH second_skip_bit_1: BR second_copy_1 end_second_copy_1: end_1: ; Same logic for other productions ; ... ; Jump back to start BR rules