Thank you guys so much, that interrupt list helped a lot, I found the correct interrupt (and was using it incorrectly for a while.) Finally realized a couple stupid mistakes I had made last night and here is my working code in case anyone else ends up with the same problem:
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, ready;
char key;
void main(void)
{
r.h.ah = 0x00; // Set mode use function call
r.h.al = 0x03; // Mode 80x25 Color
int86(0x10, &r, &r);
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';
i = 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);
*(ptr6 + 1) = 0x0F;
ready = key_ready();
{
if(ready == 1)
{
key = get_ch();
*ptr6 = key;
if((key == 'Q') || (key == 'q'))
{
i = 4;
r.h.ah = 0x00; // Set mode use function call
r.h.al = 0x03; // Mode 80x25 Color
int86(0x10, &r, &r);
}
ready = 0;
}
}
}while(i<3);
}
int key_ready(void)
{
long int x;
r.h.ah=0x01; //service number 0x00
int86(0x16, &r, &r); //interrupt 0x16
x = r.x.flags; //get flag register
if ((x & (0x40)) == 0)
{
return 1; // A key is ready
}
else return 0; // Else no key
}
char get_ch(void)
{
r.h.ah=0x00; //service number 0x00
int86(0x16, &r, &r); //interrupt 0x16
return r.h.al;
}