Displaying QL Screens In MS-DOS

Publication

Pub Details

Date

Pages

See all articles from QL Hacker's Journal 19
[It’s not normally the policy of the QHJ to publish programs that are written for other platforms than the QL. But in this case, I can make an exception. The following program by Jeff Kuhlmann is designed to display a QL screen file on an MS-DOS computer. I’ve tried it with my MS-DOS laptop (CGA display) and with a 486 (VGA display) and it works fine on both computers.

As more and more QLers are buying PC’s, programs like this are becoming more useful. – ED]

/* SHOWGR.C - A 'C' PROGRAM TO DISPLAY '_GR' FILES
FROM THE MDOS PROMPT */
/* JEFFREY A. KUHLMANN 27FEB94 */

#include "graphics.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "io.h"
#include "conio.h"

char infn[81]; /* input file name */
char str1[81];
char buf[128*200+128];
FILE inf;
int arry[20]; /* utility array */
char rows[81]; /* row string */
char cols[81]; /* columns string */
int ctr,end,delim,col,row;
int rctr,cctr,cptr;
int chardat[8],chrptr;
char hexdat[81];
int hex[4];
int blank[4],where,pval,ccc;
int mptr,fd,gm;

main(argc,argv)
int argc;
char **argv;
{
gm=5; /* Graphic Mode */
if (argc<2) /* If no file name given on command line, */
{ /* ask for one */
setvmode(2);
puts("QL SCREEN VIEWER FOR MDOS");
puts("Press any key when done");
puts("viewing picture...");
puts("QL SCREEN file name? (w/o .SCR)");
gets(infn);
}
else strcpy(infn,argv[1]);
strcat(infn,".SCR"); /* add required extension */
setvmode(gm); /* change video mode */
fd=open(infn,O_BINARY); /* open file for reading */
mptr=0;
if (fd==-1) {setvmode(2); printf("Can't open %s",infn);
exit(0);}
read(fd,buf,128*200);
/* ^ read first 200 lines into a buffer */
for(rctr=0;rctr<200;rctr++)
/* ^ 200 pixels in 'y' direction */
for(cctr=0;cctr<128;cctr++)
/* ^ each QL line is 128 bytes */
{ pval=buf[(rctr)*128+cctr];
if(rctr&1)
/* ^ need to take into account odd scan line */
poke(0xba00,(rctr-1)*40+cctr/2+8,pval);
else
poke(0xb800,rctr*40+cctr/2+8,pval);
}
while(!kbhit()); /* wait for keypress */
setvmode(2); /* restore 80 col. mode */
exit(0);
}

Products

 

Downloadable Media

 

Image Gallery

Scroll to Top