Skip to main content
Commonmark migration
Source Link

x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30!

00:       e8 20 00 00 00          call  0x25
05:       48 65 6c 6c 6f 20 57    "Hello World!Goodbye Cruel World!"
          6f 72 6c 64 21 47 6f
          6f 64 62 79 65 20 43
          72 75 65 6c 20 57 6f
          72 6c 64 21
25:       59                      pop   %ecx
26:       6a 01                   push  $0x1
28:       5b                      pop   %ebx
29:       6a 0c                   push  $0xc
2b:       5a                      pop   %edx
2c:       6a 04                   push  $0x4
2e:       58                      pop   %eax
2f:       cd 80                   int   $0x80
31:       01 c0                   add   %eax,%ecx
33:       b3 02                   mov   $0x2,%bl
35:       b2 14                   mov   $0x14,%dl
37:       2c 08                   sub   $0x8,%al
39:       cd 80                   int   $0x80
3b:       6e                      outsb  %ds:(%esi),(%dx)

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) PrintsPrints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30!

00:       e8 20 00 00 00          call  0x25
05:       48 65 6c 6c 6f 20 57    "Hello World!Goodbye Cruel World!"
          6f 72 6c 64 21 47 6f
          6f 64 62 79 65 20 43
          72 75 65 6c 20 57 6f
          72 6c 64 21
25:       59                      pop   %ecx
26:       6a 01                   push  $0x1
28:       5b                      pop   %ebx
29:       6a 0c                   push  $0xc
2b:       5a                      pop   %edx
2c:       6a 04                   push  $0x4
2e:       58                      pop   %eax
2f:       cd 80                   int   $0x80
31:       01 c0                   add   %eax,%ecx
33:       b3 02                   mov   $0x2,%bl
35:       b2 14                   mov   $0x14,%dl
37:       2c 08                   sub   $0x8,%al
39:       cd 80                   int   $0x80
3b:       6e                      outsb  %ds:(%esi),(%dx)

Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

added 59 characters in body
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

EDIT: TIO link now works again.

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

EDIT: TIO link now works again.

added 25 characters in body
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 6f "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 6f 64 62 79 65 20 43 72 72 75 65 6c 20 57 6f 72 72 6c 64 21 "Hello World!Goodbye Cruel World!" 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,dl%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 "Hello World!Goodbye Cruel World!" 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";

#x86 and x64_64 machine language on Linux, 38 61 bytes/2=30.5! 60 bytes/2=30! 00: e8 20 00 00 00 call 0x25 05: 48 65 6c 6c 6f 20 57 "Hello World!Goodbye Cruel World!" 6f 72 6c 64 21 47 6f 6f 64 62 79 65 20 43 72 75 65 6c 20 57 6f 72 6c 64 21 25: 59 pop %ecx 26: 6a 01 push $0x1 28: 5b pop %ebx 29: 6a 0c push $0xc 2b: 5a pop %edx 2c: 6a 04 push $0x4 2e: 58 pop %eax 2f: cd 80 int $0x80 31: 01 c0 add %eax,%ecx 33: b3 02 mov $0x2,%bl 35: b2 14 mov $0x14,%dl 37: 2c 08 sub $0x8,%al 39: cd 80 int $0x80 3b: 6e outsb %ds:(%esi),(%dx) Prints Hello World! to stdout and Goodbye Cruel World! to stderr. Crashing is easy in machine language. To Try it online!, compile and run the following C program.

const char main[]="\xe8 \0\0\0Hello World!Goodbye Cruel World!Yj\1[j\fZj\4X\xcd\x80\1\xc1\xb3\2\xb2\24,\b\xcd\x80n";
deleted 27 characters in body
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30
Loading
deleted 3 characters in body
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30
Loading
added 525 characters in body
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30
Loading
Source Link
ceilingcat
  • 7.7k
  • 2
  • 30
  • 30
Loading