// using in-line assembly to check the zero flag, this program displays a statement // a certain number of times, using the cx register for a counter // thanks to Mark Lessley for his input on this example #include #include main() { unsigned char row=10; unsigned char col=10; //Byte size data unsigned int counter=5; clrscr(); asm MOV CX,counter //cx=counter AGAIN: asm MOV AH,2 // AH=02 of INT 10H to set cursor asm MOV BH,0 //page 0 asm MOV DH,row // load the row value asm MOV DL,col // load the column value asm INT 10H // call INT 10H to set cursor asm PUSH CX // save the counter printf("This is a test!"); row++; col++; asm POP CX //restore the counter asm DEC CX; // decrement the counter asm JNZ AGAIN // go back if ZF not high getch(); } //Note: While C statements must end with a semicolon; it is optional for statements with the prefix asm.