//------------------------------------------------------------------- // int0x80.cpp // // This program will invoke system calls via the interrupt-0x80 // interface at regular periodic intervals, allowing us to view // the counting of their occurrences in our dynamic display. // // to compile: $ g++ int0x80.cpp -o int0x80 // to execute: $ ./int0x80 // // programmer: ALLAN CRUSE // written on: 01 SEP 2009 //------------------------------------------------------------------- #include // for printf() #include // for sleep() char buf = 'A'; // this is 'global' to simplify 'asm' int main( int argc, char **argv ) { // slowly draw each of the letters of the alphabet for (int i = 0; i < 26; i++) { asm( " mov $4, %eax \n"\ " mov $1, %ebx \n"\ " lea buf, %ecx \n"\ " mov $1, %edx \n"\ " int $0x80 " ); sleep( 1 ); ++buf; } printf( "\n" ); }