home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SGTOOL11.ARC
/
COPYMEM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-25
|
2KB
|
77 lines
/*
SG C Tools 1.1
(C) 1993 Steve Goldsmith
All Rights Reserved
VDC memory copy example. Shows how fast copymemvdc() is by copying the top
half of display and attribute memory to the bottom half of the screen.
Compiled with HI-TECH C 3.09 (CP/M-80).
To compile with HI-TECH C and SG C Tools source on same disk use:
C COPYMEM.C -LC128
*/
#include <hitech.h>
#include <conio.h>
#include <vdc.h>
#define appClrScrCh 32
#define appBoxCh 137
void makescreen(void);
void copyscreen(void);
extern uchar vdcScrHorz;
extern uchar vdcScrVert;
extern ushort vdcScrSize;
extern ushort vdcDispMem;
extern ushort vdcAttrMem;
main()
{
savevdc(); /* save vdc regs and set global vars */
clrscrvdc(appClrScrCh); /* clear screen */
clrattrvdc(vdcAltChrSet); /* clear attributes */
setcursorvdc(0,0,vdcCurNone); /* turn cursor off */
outvdc(vdcFgBgColor,vdcDarkBlue); /* set new screen color */
makescreen(); /* draw top screen */
while (getch() != 0x0D); /* wait for return press */
copyscreen(); /* copy top screen to bottom */
restorevdc(); /* restore registers saved by savevdc() */
clrscrvdc(appClrScrCh);
clrattrvdc(vdcAltChrSet+vdcWhite);
}
void makescreen(void)
{
uchar X, Y, CopyLines;
CopyLines = (vdcScrVert >> 1); /* copy half the screen */
filldspvdc(0,0,vdcScrHorz,appBoxCh); /* draw top of box */
for (Y = 1; Y < CopyLines-1; Y++) /* draw sides */
{
filldspvdc(0,Y,1,appBoxCh);
filldspvdc(vdcScrHorz-1,Y,1,appBoxCh);
}
filldspvdc(0,CopyLines-1,vdcScrHorz,appBoxCh); /* draw bottom */
printstrvdc(28,2,vdcAltChrSet+vdcDarkCyan,
"VDC memory copy example");
printstrvdc(15,4,vdcAltChrSet+vdcWhite,
"Press [RETURN] to copy this to bottom of screen.");
for (Y = 0; Y < 4; Y++) /* draw alt chr set */
for (X = 0; X < 64; X++)
filldspvdc(X+8,Y+6,1,Y*64+X);
}
void copyscreen(void)
{
ushort ScrSize;
ScrSize = (vdcScrVert >> 1)*vdcScrHorz;
copymemvdc(vdcDispMem,vdcDispMem+ScrSize,ScrSize); /* copy screen mem */
copymemvdc(vdcAttrMem,vdcAttrMem+ScrSize,ScrSize); /* copy attr mem */
while (getch() != 0x0D); /* wait for return */
}