Nikolay Igotti
Self printing program in assembly (part 2)
Shortest self printing program in assembly I managed to write. 69 bytes long. If anyone knows shorter version, please let me know.
.globl _start
.type _start, @function
_start:
movl $_start, %esi
xorl %edi, %edi
loop:
movzb (%esi,%edi),%eax
and $0xf, %al
cmp $0xa, %al
sbb $0x69,%al
das
mov $0x20, %dl
shll $16, %edx
orl %eax, %edx
shll $0x8, %edx
movzb (%esi,%edi),%eax
shr $0x4, %al
cmp $0xa, %al
sbb $0x69,%al
das
orl %eax, %edx
movl %edx, (%esp)
xorl %eax, %eax
incl %eax
movl %eax, %ebx
shll $0x2, %eax
movl %esp, %ecx
movl %eax, %edx
int $0x80
incl %edi
cmpl $69, %edi
jle loop
xorl %eax, %eax
incl %eax
int $0x80
Posted at 05:49PM Jun 15, 2007 by nike in Personal | Comments[0]
Comments:
Friday Jun 15, 2007