; By The Almighty Pegasus Epsilon <pegasus@pimpninjas.org>
;
; More info at http://www.deater.net/weave/vmwprod/asm/ascii_asm.html
;
; Never say "it can't be done" to me.
;
; Oh, and you'll need NASM. Tough breaks, Vinnie.
; -------------------------------------------------------------
; It seems things have changed in the wonderful world of linux.
; So I have updated this today (Feb 21 2023, 4:28am).
; I also include build instructions, since I forgot how to build it.
;
; see that it's all ascii:
; $ nasm ascii.asm -o ascii.bin
; $ hexdump -C ascii.bin
;
; actually run it:
; $ nasm ascii.asm -f elf32 -o ascii.o
; $ ld ascii.o -no-pie -melf_i386 -o ascii
; $ ./ascii
BITS 32 ; for assembling into bin format, to prove it's really all ascii
SECTION .code progbits write align=2
global _start
_start:
xor al, 0x3C ; put string length (28) into edx
and al, 0x5C ; "
push eax ; "
pop edx ; "
xor eax, 0x3A6A3A36 ; make newline
xor eax, 0x30445445 ; "
push eax ; build string on stack
push "o so" ; "
push "y to" ; "
push "p wa" ; "
push "ve u" ; "
push "e ga" ; "
push "Vinc" ; "
push esp ; put pointer to string into ecx
pop ecx ; "
sub eax, 0x56634F36 ; mov eax, 0x080480CD
sub eax, 0x56634F36 ; "
sub eax, 0x55634F36 ; "
push eax ; save 0x80CD for later
pop ebp ; "
sub ax, 0x5072 ; point stack to end + 8 (0x8049074)
sub ax, 0x5072 ; "
sub ax, 0x4F75 ; "
push eax ; "
pop esp ; "
xor al, 0x31 ; point eax to int80 + 2 (0x8049067)
xor al, 0x22 ; "
push eax ; save int80 offset
push ebp ; make int80
pop eax ; load int80 into ax
pop esp ; load int80 offset
push ax ; make int80
inc ebx ; ebx = 1 == stdout
xor eax, 0x4B444B4B ; mov eax, 4 == write()
and eax, 0x34343444 ; "
.int80:
db '!!' ; int80h
dec ebx ; ebx == 0 (no error)
xor al, 0x41 ; mov eax, 1 == _exit()
and al, 0x21 ; "
.end: