Sunday, October 21, 2012

How to compile inline Assembly in C

How to compile Assembly inline with C

Make sure you have 32-bit libraries, install them:
apt-get install gcc-multilib

#include <stdio.h>

char Format[] = "Hello world, %d\n"; 

int main (void) { 
 asm ( "subl $8, %esp\n" 
 "movl $3, 4(%esp)\n" 
 "movl $Format, (%esp)\n" 
 "call printf\n" "addl $8, %esp\n" ); 
 return 0; 
}

gcc -m32 test.c -o test.o; ./test.o

http://stackoverflow.com/questions/11378181/use-printf-function-in-inline-asm-on-gcc

Friday, October 5, 2012

How to install Sublime Text 2 on Ubuntu

How to install Sublime Text 2 for Ubuntu

To install them:

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

Note: "sublime-text" is the latest Sublime Text 2