Problem : While running the reader or the writer the system freezes. Sol : This is due to the optimizations made by the compiler. Declare the variable used for polling as "volatile" to avoid compiler optimizations on that variable. Eg : volatile unsigned char busy; while((busy=inb(STATUS)));