Re: OT: DOS programming EPP



PaulCsouls wrote:

I found this program for testing 16 bit addressing. I used one of the
control bits for an upper byte/lower byte switch. It works.

Paul C


/*parallel.c*/


#include <stdio.h>
#include <pc.h>
#include <time.h>
#include "parallel.h"
#define PPORT 0x378
#define DATASPP 0
#define STATSPP 1
#define CONTSPP 2
#define ADDREPP 3
#define DATAEPP 4
#define UPnotLOW 0x04



char *helptxt[8] =
 {"*****************************************",
	"*                                       *",
	"* parallel.c Paul C 6/5/03      *",
	"*                                       *",
	"* This program tests the parallel port  *",
	"* 			                             *",
	"*                                       *",
	"*****************************************"};

char *infotxt[6] =
 {"*****************************************",
 "*                                       *",
 "* parallel.c Paul C 6/5/03      *",
  "* version 1.0 6/5/03 initial release    *",
  "*                                       *",
  "*****************************************"};

char *usagetxt[6] =
 {"*****************************************",
  "*                                       *",
  "* usage parallel h                      *",
  "*       parallel i                      *",
  "*                                       *",
  "*****************************************"};

int main(int argc, char *argv[])
{/**/

	int i,cmd,temp,data,ContSpp,upaddr,loaddr;

	if(argc == 2){
		if (*argv[1] == 'h'){
			for(i=0;i<8;i++){
				printf("%s\n", helptxt[i]);
			};
		}else if (*argv[1] == 'i'){
			for(i=0;i<6;i++){
				printf("%s\n", infotxt[i]);
			};
		}else{
			for(i=0;i<6;i++){
				printf("%s\n", usagetxt[i]);
			};
		}
	}else{
		ContSpp = 0x40;
		upaddr = 0x22;
		loaddr = 0x33;
		data = 0x44;
		printf("Parallel Port\n");
		/*init port*/
		outportb(PPORT+CONTSPP,ContSpp);
		outportb(PPORT+CONTSPP,ContSpp & ~UPnotLOW);
		outportb(PPORT+ADDREPP,loaddr);
		outportb(PPORT+CONTSPP,ContSpp | UPnotLOW);
		outportb(PPORT+ADDREPP,upaddr);
		outportb(PPORT+DATAEPP,data);
		outportb(PPORT+CONTSPP,0x00);
		printf("done\n");

	}

	return 0;
}/*end main*/



"C" and i do not get along with each other.
Firstly, the last time i looked, the printer port was 8 bits = a byte, so why fiddle with 16 bits?
Secondly, i do not see what the program is attempting to do; please do not attempt to explain.
.