Trying to work on a polled waiting loop, but I can't seem to figure out how to reset the r.x.flags or r.h.al (Can't figure out which one is the problem.) Here is my code:
I'm assuming the problem is within the if statements, and I've tried r.x.flags = 0, r.x.flags != r.x.flags, etc. Oh and I know the way I used pointers was messy, but the professor seems to like using multiple pointers instead of just one and incrementing it.Code:// Mike Varrieur // Poll Loop Assignment #include "dos.h" union REGS r; char far *ptr1, far *ptr2, far *ptr3, far *ptr4, far *ptr5, far *ptr6; // set up pointers to access information int i, x; void main(void) { r.h.ah = 0x00; // Set mode use function call r.h.al = 0x03; // Mode 80x25 Color int86(0x10, &r, &r); x = 1; // "Dummy" incrementer to keep the loop going. ptr1 = 0xB8000000; // Set starting pointers ptr2 = (ptr1 + 1992); ptr3 = (ptr1 + 1994); ptr4 = (ptr1 + 1996); ptr5 = (ptr1 + 1998); ptr6 = (ptr1 + 1000); ptr1 = (ptr1 + 1990); *ptr1 = 'W'; *ptr2 = 'a'; *ptr3 = 'c'; *ptr4 = 'k'; *ptr5 = 'y'; while(1) { do { *(ptr1 + 1) = ((rand() % 14) + 1); *(ptr2 + 1) = ((rand() % 14) + 1); *(ptr3 + 1) = ((rand() % 14) + 1); *(ptr4 + 1) = ((rand() % 14) + 1); *(ptr5 + 1) = ((rand() % 14) + 1); r.h.ah = 0x01; int86(0x16, &r, &r); if(!(r.x.flags & (1<<6))) { if((r.h.al == 'Q') || (r.h.al == 'q')) { i = 4; } *ptr6 = r.h.al; } r.x.flags = 1; }while(i<3); } }



LinkBack URL
About LinkBacks


