murphys@cod.NOSC.MIL (Steven P. Murphy) (07/06/88)
The following is a very fast way to write to the screen buffer. I how this help
the person who ask how to point to the frame buffer.
compile with MSC 5.0 using > cl -AC tst.c
------------------------- cut here ------------------------------
#include <string.h>
#define SCRBUF 0xb8000000L
typedef struct SCRN_CELL {
unsigned char chr; /* character */
unsigned char att; /* attribute */
} CELL;
CELL dspbuf[25][80];
main()
{
int i,j;
for(j = 10; j <= 20; j++)
for( i = 10; i <= 60; i++) {
dspbuf[j][i].chr = 0x01; /* smily */
dspbuf[j][i].att = 0x70; /* inverse */
}
memmove((char far *)SCRBUF, dspbuf, 4000);
}
------------------------- cut here ----------------------------
it is fast because you write to a merory buffer first and then update
the screen with memmove. memove is used because in MSC 5.0 it takes
care of overlapping regons where memcpy does not.
-------------------------------------------
_ _ _ Clarke's law, 2nd varation:
' ) ) ) /
/ / / . . __ _ /_ "Any sufficiently advanced technology
/ ' (_(_/_/ (_/_)_/ /_ is indistinguishable from a rigged demo"
/
'
------------------------
S. P. Murphy
Internet: murphys@cod.nosc.mil UUCP: {ucbvax,hplabs}!sdcsvax!nosc!murphys