exercise 6: added putchar() system call
exercise 7 implementation