/************************************************************************
Module# 43

	Title: MIRSコマンド入力 
	
	File : CIN.C		Ver.1.0 written on Dec.10,1995 by J.W.
				    1.1            Dec.22,1995 
				    2.0		   Jan.31,1995
				
*************************************************************************/
#include  "m9401.h"

extern unsigned char inportu();/*  */
extern int inportb();/*  */
extern int outportb();/*  */
extern int disp();
extern unsigned char outportu();/*  */
	
extern int mode;
extern int Seg[];
extern int V1;
extern int S;
extern int Turn;

int command()
{/* Wait for Entry Button , then Set Flag */
	int c,i;
	
	/* スタ−ト・スイッチ 入力待ち */
	while(((c = inportu(CMD)) & 0x80) == 0x80){
		/* 入力プロンプト */
		i=(int)(inportu(CMD)&0x0f);
		Seg[4] = i/10;
		Seg[3] = i%10;
		Seg[2] = 7;
		Seg[1] = 7;
        disp();
	}
	/* while(((c = inportb(EDRH)) & 0x80) == 0x80); */
		/* mode = (int)(inportu(CMD)&0x0f); */
	if ((c&0x01) == 0x01) mode=INI_MODE;
	else	       	      mode=NOMAL;
	if ((c&0x02) == 0x02) S=100;
	else                  S=65;
	if ((c&0x04) == 0x04) V1=50;
	else                  V1=45;
	if ((c&0x08) == 0x08) Turn=ON;
    	else                  Turn=OFF;
	return(ON);
}