x86-16 ASM, IBM PC DOS, 22 19 bytes
Binary:
00000000: 400a 24b8 1109 8bd6 b168 d0c8 102c cd21 @.$......h...,.!
00000010: e2f8 c3 ...
Build with xxd -r
and test in DOSBox or your favorite DOS VM.
Unassembled:
40 0A 24 DB '@', 0AH, '$' ; the letter + NL + '$' string terminator
B8 0911 MOV AX, 0911H ; AH = DOS print string; AL = 0001 0001 bit pattern
8B D6 MOV DX, SI ; DX to output string
B1 68 MOV CL, 26*4 ; Loop 4 times for each letter in alphabet
ALOOP:
D0 C8 ROR AL, 1 ; roll repeating bit pattern to the right
10 2C ADC BYTE PTR[SI], CH ; add rightmost bit to ASCII character
CD 21 INT 21H ; print letter to console
E2 F8 LOOP ALOOP ; continue looping
C3 RET ; return to DOS
Notes:
For most flavors of DOS, we know the values of many CPU registers at the start of execution and we know SI
is 0100H
, and CH
is 0
. So by placing the output string in the beginning of the program, [SI]
will already be pointing to it. These bytes ('@',0AH,'$'
) decode to two benign instructions (INC AX
, OR AH, [SI]
), which have no effect on the program.
AL
contains the bit pattern of 0001 0001
which is bit rolled right each time and the rightmost bit added to the ASCII value of the output char in memory.