C language on MSDOS...

C program which I wrote.
It can set pixels, draw a circle, and draw a box.
All very primitive- technology from 30 years ago.

It is old graphics card and MSDOS (FreeDOS) which runs in a hard drive partition.
C compiler is not free but it is not sold anymore.
Software from 1992! Eventually it is Borland C++.
It can use XMS and EMS memory.


//#include
#include
#include
#include

char far* cgam = (char far*) MK_FP(0xb800,0x0000);
char shofs[]={6,4,2,0};
char clpatt[]={0x3f,0xcf,0xf3,0xfc};
char stpatt[]={0xc0,0x30,0x0c,0x03};
int cgaofs[]={0,8192};

void setpix(int x,int y,int c)
{int rx,ry,rc,rcl;

rx=x>>2;
ry=(y>>1)*80;
ry+=cgaofs[y&1];
rc=*(cgam+rx+ry);

rcl=rc&clpatt[x&3];
rcl|=stpatt[x&3]&(c<y2)goto complete;
reloopx: setpix(x++,y,c);
if(x>x2){x=x0;y++;goto reloopy;}goto reloopx;
complete:}

void main ()
{

int i,i2,x,y;

asm mov ax,0x0004
asm int 0x10

box(35,5,103,100,2);
box(55,35,123,135,1);
box(75,65,143,165,3);

circle(150,100,50,1);

while(!getch());

asm mov ax,0x0003
asm int 0x10
}