#include #include #include #include "imgdata.inc" void textattr(int newattr) { _settextcolor(newattr & 15); /* 0000xxxx */ _setbkcolor((newattr >> 4) & 7); /* 0xxx0000 */ } int main() { char *ch; int attr; int pos; if (_setvideomode(_TEXTC80) == 0) { fputs("Error setting video mode", stderr); return 1; } /* draw the array */ _settextposition(1, 1); /* top left */ /* track the position in the array .. position actually skips by two, because the array tracks pairs of ch and attr */ /* print one line less than the 80x25 that's in there: 80 x 24 x 2 = 3840 */ for (pos = 0; pos < 3840; pos += 2) { ch = &IMAGEDATA[pos]; /* pointer assignment */ attr = IMAGEDATA[pos + 1]; textattr(attr); _outmem(ch, 1); } /* done */ _settextposition(25, 1); /* bottom left */ textattr(0x0f); _outtext("Press any key to quit"); if (getch() == 0) { /* if zero, then we had an extended key .. read again to flush */ getch(); } textattr(0x00); return 0; }