Example #1
0
/* Delete Non-DOS Partition User Interface */
void Delete_N_DOS_Partition_Interface()
{
  int input=0;

  Clear_Screen(0);
  Print_Centered(4,"Delete Non-DOS Partition",BOLD);

  Display_Primary_Partition_Information_SS();

  BlinkPrintAt(4,18,"WARNING!");

  printf(" Data in the deleted Non-DOS Partition will be lost.");
  printAt(4,19,"What Non-DOS Partition do you want to delete..? ");

  flags.esc=FALSE;
  input=(int)Input(1,52,19,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */

  if(flags.esc==FALSE)
    {
    Delete_Primary_Partition(input-1);

    Clear_Screen(0);
    Print_Centered(4,"Delete Non-DOS Partition",BOLD);
    Display_Primary_Partition_Information_SS();
    cprintAt(4,21,"Non-DOS Partition deleted");
    printAt(4,24,"                                    ");

    Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
    }
}
Example #2
0
/* Delete Extended DOS Partition Interface */
void Delete_Extended_DOS_Partition_Interface()
{
  int input=0;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Clear_Screen(0);

  Print_Centered(4,"Delete Extended DOS Partition",BOLD);

  Display_Primary_Partition_Information_SS();

  BlinkPrintAt(4,18,"WARNING!");

  printf(" Data in the deleted Extended DOS Partition will be lost.");
  printAt(4,19,"Do you wish to continue (Y/N).................? ");

  flags.esc=FALSE;
  input=(int)Input(1,52,19,YN,0,0,ESCR,0,0,NULL,NULL);

  if( (flags.esc==FALSE) && (input==TRUE) )
    {
    Delete_Primary_Partition(int(pDrive->ptr_ext_part-pDrive->pri_part));
    Clear_Extended_Partition_Table(flags.drive_number-128);

    Clear_Screen(0);
    Print_Centered(4,"Delete Extended DOS Partition",BOLD);
    Display_Primary_Partition_Information_SS();

    cprintAt(4,21,"Extended DOS Partition deleted");

    printAt(4,24,"                                    ");

    Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
    }
}
Example #3
0
/* Change Current Fixed Disk Drive */
void Change_Current_Fixed_Disk_Drive()
{
  int new_drive_number;
  int old_drive_number=flags.drive_number;

  Clear_Screen(0);
  Print_Centered(0,"Change Current Fixed Disk Drive",BOLD);

  Display_All_Drives();

  printAt(4,21,"Enter Fixed Disk Drive Number (1-%d)......................."
                                       ,(flags.maximum_drive_number-127));

  new_drive_number=(int)Input(1,62,21,NUM,1,(flags.maximum_drive_number-127)
   ,ESCR,(flags.drive_number-127),0,NULL,NULL);

  if( (new_drive_number<=0)
   || (new_drive_number>(flags.maximum_drive_number-127)) )
    {
    flags.drive_number=old_drive_number;
    }
  else
    {
    flags.drive_number=new_drive_number+127;
    }
}
Example #4
0
void main(void)
{
/*--------------initialization-----------*/

  Set_System();
  NVIC_Configuration();
  GPIO_Config();
  SD_Card_Check();
  USB_Init();
  ADC_Configuration();
  Timer_Configuration();
  LCD_Initial();
  Clear_Screen(BLACK); 
  Display_Logo(110,150);  
 
/*----------Power ON Information----------*/ 

  Display_Str(80, 87, GRN,   PRN, "System Initializing");
  Display_Str(102, 71, GRN,   PRN, "Please Wait");
  Display_Str(8, 39, WHITE, PRN, "DSO FW Copyright (c) BenF 2010-2011"); 
  Display_Str(8, 23, YEL,   PRN, "LIB ver 3.13");
  
  //WaitForKey();

  // check for presence of APP and jump to start
  pApp = (APP_Interface *)*(u32 *)(APP_VECTORS + 7 * 4);
  if (pApp->Signature == APP_SIGNATURE)
      pApp->APP_Start();

  Display_Str(150, 23, RED, PRN, "No APP found");
  while (1);
}
Example #5
0
void Test_I2C_OLED(void)
{
	Clear_Screen();
	SH1106_I2COLED_Wcmd(I2COLED_Display_ON);/* set display on  */

	show_logo(0);
	while(1);
}
Example #6
0
void out_p(int signal)
{
    end();
    Clear_Screen();    
    Move_Cursor(1, 1);
    Display_Cursor();
    exit(0);
}
Example #7
0
/* Display/Modify Partition Information */
void Display_Partition_Information()
{
  int input;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Beginning:

  Clear_Screen(0);
  if(flags.extended_options_flag==FALSE)
   Print_Centered(4,"Display Partition Information",BOLD);
  else Print_Centered(4,"Display/Modify Partition Information",BOLD);

  Display_Primary_Partition_Information_SS();

  if(pDrive->num_of_log_drives>0)
    {
    printAt(4,17,"The Extended DOS Partition contains Logical DOS Drives.");
    printAt(4,18,"Do you want to display the logical drive information (Y/N)......?");

    if(flags.extended_options_flag==TRUE)
      {
      printAt(4,19,"  (Optional:  Type the number of the partition to modify.)");

      input=(int)Input(1,69,18,YN,0,0,ESCR,1,0,"1","4");

      if( ((input-48)>=1) && ((input-48)<=4) )
        {
        Modify_Primary_Partition_Information((input-48));
        goto Beginning;
        }
      }
    else input=(int)Input(1,69,18,YN,0,0,ESCR,1,0,NULL,NULL);

    if(input==TRUE)
      {
      Display_Or_Modify_Logical_Drive_Information();
      if(flags.extended_options_flag==TRUE) goto Beginning;
      }
    }
  else
    {
    if(flags.extended_options_flag==FALSE)
     Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
    else
     {
     printAt(4,18,"Enter the number of the partition you want to modify (1-4)......?");

     flags.esc=FALSE;
     input=(int)Input(1,69,18,NUM,1,4,ESCR,1,0,NULL,NULL);

     if(flags.esc==FALSE)
       {
       Modify_Primary_Partition_Information(input);
       goto Beginning;
       }
     }
    }
}
Example #8
0
/*
 * Initialize the screen module.
 */
void Init_Screen(void) {
    bool iflag = Begin_Int_Atomic();

    s_cons.row = s_cons.col = 0;
    s_cons.currentAttr = DEFAULT_ATTRIBUTE;
    Clear_Screen();

    End_Int_Atomic(iflag);
}
Example #9
0
void oled_test(void)
{
   //Reset_IC();                    
	Init_IC();                      
	Clear_Screen();
	All_Screen();					 
	

	OLED_Clear();
	OLED_ShowNum(0, 0, 2567890134, 10, 12);
	OLED_ShowString(0, 12, "abcdefghijk");
	
	while(1)
	{       
		OLED_Refresh_Gram();
		nrf_delay_ms(1500);
		Clear_Screen();
	}
}
Example #10
0
/* Delete Primary DOS Partition Interface */
void Delete_Primary_DOS_Partition_Interface()
{
  int input=0;
  int partition_to_delete;

  Clear_Screen(0);

  Print_Centered(4,"Delete Primary DOS Partition",BOLD);
  Display_Primary_Partition_Information_SS();

  BlinkPrintAt(4,19,"WARNING!");

  printf(" Data in the deleted Primary DOS Partition will be lost.");
  printAt(4,20,"What primary partition do you want to delete..? ");

  flags.esc=FALSE;
  input=(int)Input(1,52,20,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */

  if(flags.esc==FALSE)
    {
    partition_to_delete=input-1;

    printAt(4,22,"Are you sure (Y/N)..............................? ");
    flags.esc=FALSE;
    input=(int)Input(1,54,22,YN,0,0,ESCR,0,0,NULL,NULL);

    if( (input==TRUE) && (flags.esc==FALSE) )
      {
      Delete_Primary_Partition(partition_to_delete);

      Clear_Screen(0);

      Print_Centered(4,"Delete Primary DOS Partition",BOLD);
      /* */
      Display_Primary_Partition_Information_SS();
      cprintAt(4,21,"Primary DOS Partition deleted");

      Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
      }
    }
}
Example #11
0
/*******************************************************************************
 Function Name : main
 Description :
*******************************************************************************/
void   main(void){
	u16 i, x, y;
	u16 pict_y;

	Display_Info("main", 0);
	/*--------------initialize the hardware-----------*/
	NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0xC000);
	NVIC_Configuration();
	/*----------display APP version ----------*/
	// (0,0) lower left
	__Display_Str(0, 112, TXT_COLOR, BKGND_COLOR, msg_app_ver);
	__Display_Str(0, 96, TXT_COLOR, BKGND_COLOR, msg_chans);
	__Display_Str(0, 80, RED, BKGND_COLOR, msg_free);
	__Display_Str(0, 64, RED, BKGND_COLOR, msg_warr);
	/*--------initialization --------*/
	Read_Config();
	if(confp->initialized != INIT_FLAG){	// check for first time run
		Reset_Config();
	}
	// initialize based on saved parameters
	Set_Base(0);	// fastest sample speed
	Set_Range(confp->sig_range);
	Set_Orientation(confp->orient);
	Delay_MS(4000);
	Clear_Screen( BKGND_COLOR );
	confp->mode = confp->rtn_mode;
	switch(confp->mode){
		case PHA:
			Init_Spectrum();
			Display_Spectrum ();
			break;
		case RATE:
			Init_Rate();
			Display_Rate();
			break;
		case MENU:
			Display_Menu(confp->menu_index);
			break;
	}
	if (SD_Card_On() == 0){
		if (FAT_Info()){
			if (FAT_Info()){
				__Display_Str(0, 0, RED, BKGND_COLOR, SD_Msgs[SDErr]);
			}
		}
	}
	Beep(BEEP_500Hz, 500);
	/*--------application main loop --------*/
	ctr_key = KEY_SAMPLE;
	ctr_refresh = confp->refresh_time * 1000;	// in mS
	Scan_Samples();	// never returns from this call
}
Example #12
0
/* Ask user if they want to use large disk support (FAT 32) */
void Ask_User_About_FAT32_Support()
{
  Clear_Screen(0);

  Print_Centered(5,"Free FDISK is capable of using large disk support to allow you to    ",0);
  Print_Centered(6,"create partitions that are greater than 2,048 MB by using FAT32      ",0);
  Print_Centered(7,"partitions.  If you enable large disk support, any partitions or     ",0);
  Print_Centered(8,"logical drives greater than 512 MB will be created using FAT32.      ",0);
  Print_Centered(10,"IMPORTANT:  If you enable large disk support, some operating systems ",0);
  Print_Centered(11,"will be unable to access the partitions and logical drives that are  ",0);
  Print_Centered(12,"over 512 MB in size.                                                 ",0);

  Print_Centered(17,"Do you want to use large disk (FAT32) support (Y/N)....?    ",0);

  flags.fat32=(int)Input(1,62,17,YN,0,0,NONE,1,0,NULL,NULL);
}
Example #13
0
void show_Downlaod(UINT8_T choice)
{
	if (sh1106_oled_unstable == 1)
		return;

#if NEZHA_MIFI_V4R1
	Clear_Screen();
#endif
	
	SH1106_PicDisplay( sh1106_Download_Page_Start,
								 sh1106_Download_Page_Num,
								 sh1106_Download_Coloum,
								 sh1106_Download_Width,
								 &download_Status[choice],
								 sh1106_Download_Bytes_Num
								 );
}
Example #14
0
void show_USB_status(UINT8_T choice)
{
	if (sh1106_oled_unstable == 1)
		return;

#if NEZHA_MIFI_V4R1
	Clear_Screen();
#endif
	
	SH1106_PicDisplay( sh1106_USB_status0_Page_Start,
								 sh1106_USB_status0_Page_Num,
								 sh1106_USB_status0_Coloum,
								 sh1106_USB_status0_Width,
								 &USB_Status[choice],
								 sh1106_USB_status0_Bytes_Num
								 );
}
Example #15
0
void ONKEY_Bootup(void)
{
	if (sh1106_oled_unstable == 1)
		return;

#if NEZHA_MIFI_V4R1
	Clear_Screen();
#endif
	
	SH1106_PicDisplay( sh1106_LOGO0_Page_Start,
								 sh1106_LOGO0_Page_Num,
								 sh1106_LOGO0_Coloum,
								 sh1106_LOGO0_Width,
								 &logo[0],
								 sh1106_LOGO0_Bytes_Num
								 );
}
Example #16
0
/* List the Partition Types */
void List_Partition_Types()
{
  int index=0;
  int row=4;
  int column=0;
  do
    {
    if( (index==0) || (index==64) || (index==128) || (index==192) )
      {
      Clear_Screen(0);
      Print_Centered(1,"List Partition Types",BOLD);
      row=4;
      column=0;
      }

    if( row==20 )
      {
      row=4;
      column += 20;
      }

    cprintAt(column,row,"%3d ",index);
    printf("%s",partition_lookup_table_buffer_long[index]);

    if( (index==63) || (index==127) || (index==191) || (index==255) )
      {

     printAt(0,23,"Press ");cprintf("Any Key");printf(" to continue");

     asm{
       mov ah,7
       int 0x21
       }
      }

    row++;
    index++;
    }while(index<=255);
Example #17
0
void main(void)
{
char key;            // player input data
int  player_x = 40;  // player's x position
// SECTION: initialization

// set up the console text graphics system
Init_Graphics();

// clear the screen
Clear_Screen();

// SECTION: main event loop, this is where all the action  
// takes place, the general loop is erase-move-draw

while(game_running)
     {
     // SECTION: erase all the objects or clear screen

     // nothing to erase in our case   

     // SECTION: get player input
     if (kbhit())
        {
        // get keyboard data, and filter it
        key = toupper(getch());

        // is player trying to exit, if so exit
        if (key=='Q' || key==27)
           game_running = 0; 

        // is player moving left        
        if (key=='A')
           player_x--;
           
        // is player moving right
        if (key=='S')
           player_x++;
	
		} // end if   

     // SECTION: game logic and further processing
     
     // make sure player stays on screen 
     if (++player_x > MAX_X)
        player_x=MAX_X;     

     if (--player_x < 0)
        player_x=0;     

     // SECTION: draw everything

     // draw next star at random position
     Set_Color(15,0);
     Draw_String(rand()%80, SCROLL_POS,".\n");
     // draw player 
     Set_Color(rand()%15,0);
     Draw_String(player_x,0,"<-*->");
	 Draw_String(0,0,"");//keeps cursor at the left of the screen

     // SECTION: synchronize to a constant frame rate
     Sleep(40);   

     } // end while

// SECTION: shutdown and bail
Clear_Screen();

printf("\nG A M E  O V E R \n\n");

} // end main
Example #18
0
/* Returns a 0 if successful and a 1 if unsuccessful */
int Create_Logical_Drive_Interface()
{
  long input=0;

  int drive_created=FALSE;
  int maximum_possible_percentage;
  int numeric_type;

  long maximum_partition_size_in_MB;

  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Determine_Free_Space();

  if(pDrive->ext_part_largest_free_space>=2)
    {
    do
      {
      if(flags.fprmt==TRUE) flags.fat32=TRUE;

      maximum_partition_size_in_MB
       = Max_Log_Part_Size_In_MB();

      Clear_Screen(0);

      if(drive_created==TRUE)
	{
	cprintAt(4,22,"Logical DOS Drive created, drive letters changed or added");
	}

      Print_Centered(1,"Create Logical DOS Drive in the Extended DOS Partition",BOLD);

      Display_Extended_Partition_Information_SS();

      if('Z'==Determine_Drive_Letters())
	{
	printAt(4,22,"                                                           ");
	cprintAt(4,22,"Maximum number of Logical DOS Drives installed.");
	Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
	if(flags.fprmt==TRUE) flags.fat32=FALSE;
	return(1);
	}

      printAt(4,17,"Total Extended DOS Partition size is ");

      if( (flags.version==4) || (flags.version==5) || (flags.version==6) )
	cprintf("%4d",pDrive->ext_part_size_in_MB);
      else Print_UL_B(pDrive->ext_part_size_in_MB);

      printf(" Mbytes (1 Mbyte = 1048576 bytes)");

      printAt(4,18,"Maximum space available for partition is ");

      if( (flags.version==4) || (flags.version==5) || (flags.version==6) )
        cprintf("%4d",maximum_partition_size_in_MB);
      else Print_UL_B(maximum_partition_size_in_MB);

      printf(" Mbytes ");

      maximum_possible_percentage
       = Convert_To_Percentage(maximum_partition_size_in_MB
       ,pDrive->ext_part_size_in_MB);

      cprintf("(%3d%%)",maximum_possible_percentage);

      printAt(4,20,"Enter logical drive size in Mbytes or percent of disk space (%)...");

      flags.esc=FALSE;

      if( (flags.version==4) || (flags.version==5) || (flags.version==6) )
       input=Input(4,70,20,NUMP,1,maximum_partition_size_in_MB,ESCR
       ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL);
      else input=Input(6,70,20,NUMP,1,maximum_partition_size_in_MB,ESCR
       ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL);

      if(flags.esc==TRUE)
        {
        if(flags.fprmt==TRUE) flags.fat32=FALSE;
        return(1);
        }

      if( (flags.fprmt==TRUE) && (input>=128) && (input<=2048) )
        {
        printAt(4,21,"This drive is a FAT32 by default, switch to FAT16 (Y/N)?    ");
        flags.fat32=!Input(1,61,21,YN,0,0,NONE,1,0,NULL,NULL);
        }

      numeric_type=6;
      numeric_type=Partition_Type_To_Create(input,numeric_type);

      Create_Logical_Drive(numeric_type,input);
      drive_created=TRUE;

      }while(pDrive->ext_part_largest_free_space>=2);
    }

  Clear_Screen(0);
  Print_Centered(1,"Create Logical DOS Drive in the Extended DOS Partition",BOLD);
  Display_Extended_Partition_Information_SS();
  cprintAt(4,22,"All available space in the Extended DOS Partition");
  cprintAt(4,23,"is assigned to logical drives.");
  Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);

  if(flags.fprmt==TRUE) flags.fat32=FALSE;

  return(0);
}
Example #19
0
/* Get input from keyboard */
unsigned long Input(int size_of_field,int x_position,int y_position,int type
 ,int min_range,long max_range,int return_message,long default_value
 ,long maximum_possible_percentage,char optional_char_1[1],char optional_char_2[1])
{
  /*
  size_of_field:                 number of characters for the user to enter,
                                 if size of field is 0 then no input box
				 is drawn on the screen.
  x_position, y_position:        screen coordinates to place the input box
  type                           type of input--CHAR  A single character as
                                                      specified by min_range
                                                      and max_range.  min_range
                                                      and max_range are the
                                                      min. and max. ASCII
                                                      values possible for this
                                                      input field. The ASCII
                                                      values in these 2 fields
                                                      should be of capital
                                                      characters only.  If the
                                                      user enters a lower case
                                                      character it will be
						      converted to uppercase.
						YN    Either a yes or no.
						NUM   A number as specified
                                                      by min_range and
                                                      max_range.
                                                NUMP  A number or percentage
                                                      within the limits of
                                                      the size_of_field.
                                                ESC   Waits for the ESC key
                                                      only
  return_message                                ESCR  Displays "Press
                                                      Esc to return to FDISK
						      Options"
                                                ESCE  Displays "Press
						      Esc to exit FDISK"
                                                ESCC  Displays "Press Esc to
                                                      continue"
						NONE  Does not display a
                                                      return message.
  default_value                  The default value that is displayed for
                                 input.  This option only works with the NUM
				 type or the YN type.
                                 Set this to -1 if it is not used.
  maximum_possible_percentage                   If type is NUMP, this is the
                                                maximum percentage possible.
  optional_char_1[1] and
  optional_char_2[1]             2 optional character fields for use with
                                 the NUM type when size_of_field==1
                                 Also is used as two option number fields
                                 (converted to char value) when type==CHAR
                                 and a single digit numeric input is possible.
                                 In this case these two variables define a
                                 range.  When type==YN this functions the same
                                 as with NUM type above.
  */

  char input;
  char line_buffer[18];

  unsigned long multiplier;

  int char_max_range;
  int default_value_preentered=FALSE;
  int index;
  int invalid_input=FALSE;
  int line_buffer_index=0;
  int proper_input_given=FALSE;
  int percent_entered=FALSE;
  int percent_just_entered=FALSE;

  unsigned long data_max_range=max_range;
  unsigned long data;

  /* Clear line buffer */
  index=0;
  do
    {
    line_buffer[index]=0;
    index++;
    }while(index<10);

  /* Place appropriate text on the screen prior to obtaining input */
  if(type!=ESC)
    {
    Position_Cursor(x_position,y_position);

    cprintf("[");

    index=0;
    do
      {
      cprintf(" ");
      index++;
      }while(index<size_of_field);

    cprintf("]");
    }

  /* Display the return message */
  if( (return_message==ESCR) || (return_message==ESCE) || (return_message==ESCC) )
    {
    printAt(4,24,"                                                 ");
    printAt(4,24,catgets(cat,4,1,"Press"));
    cprintf(" Esc ");
    printf(catgets(cat,4,2,"to"));
    printf(" ");
    }

  if(return_message==ESCR) printf(catgets(cat,4,3,"return to FDISK options"));

  if(return_message==ESCE) printf(catgets(cat,4,4,"exit FDISK"));

  if(return_message==ESCC) printf(catgets(cat,4,5,"continue"));

  /* Set the default value for NUM type, if applicable */
  if( (default_value>=0) && (type==NUM) && (size_of_field==1) )
    {
    Position_Cursor(x_position+1,y_position);
    printf("%d",default_value);
    line_buffer_index=0;
    line_buffer[0]=default_value+48;
    }

  /* Set the default value for NUMP type, if applicable */
  if( (default_value>=0) && (type==NUMP) && (size_of_field>1) )
    {
    ltoa(default_value,line_buffer,10);
    line_buffer_index=strlen(line_buffer);

    /* Display line_buffer */
    index=line_buffer_index;
    do
      {
      Position_Cursor((x_position+size_of_field-line_buffer_index+index)
       ,y_position);
      index--;
      cprintf("%c",line_buffer[index]);
      }while(index>0);

    default_value_preentered=TRUE;
    }

  /* Set the default value for YN type, if applicable */
  if( (default_value>=0) && (type==YN) && (size_of_field==1) )
    {
    Position_Cursor(x_position+1,y_position);

    if(default_value==1)
      {
      printf("Y");
      line_buffer_index=0;
      line_buffer[0]='Y';
      data=TRUE;
      }

    if(default_value==0)
      {
      printf("N");
      line_buffer_index=0;
      line_buffer[0]='N';
      data=FALSE;
      }
    }

  do
    {
    if(type!=ESC) Position_Cursor((size_of_field+x_position),y_position);

    /* Obtain keypress from keyboard */
    asm{
      mov ah,7
      int 0x21
      mov BYTE PTR input,al
      }

    /* Zero the default value if type==NUMP, the enter, esc, or backspace key */
    /* has not been pressed, and the default value is pre-entered. */
    if( (default_value>=0) && (type==NUMP) && (size_of_field>1)
     && (input!=8) && (input!=13) && (input!=27)
     && (default_value_preentered==TRUE) )
      {
      line_buffer_index=0;

      index=0;
      do
        {
        line_buffer[index]=0;
        index++;
        }while(index<10);

      default_value_preentered=FALSE;
      }

    /* Clear error messages from screen */
    if(type!=YN)
      {
      printAt(4,22,"                                                              ");
      }

    printAt(4,23,"                                                    ");
    Position_Cursor(4,24);

    /* Esc key has been hit */
    if(input==27)
      {
      flags.esc=TRUE;
      proper_input_given=TRUE;
      data=0;
      type=99;
      }

    /* Enter key has been hit */
    if(input==13)
      {
      if( ( (type==CHAR) || (type==YN) ) && (line_buffer[0]!=0) && ( (data==TRUE) || (data==FALSE) || (data!=99) ) )
        {
        proper_input_given=TRUE;

        type=99;
        }

      if( (type==NUMYN) && (line_buffer[0]!=0) )
        {
        data=line_buffer[0];
        proper_input_given=TRUE;
        type=99;
        }

      if( (type==CHARNUM) && (line_buffer[0]!=0) )
        {
        proper_input_given=TRUE;
	data=line_buffer[0];

        type=99;
        }

      if( (type==NUMCHAR) && (line_buffer[0]!=0) )
        {
        proper_input_given=TRUE;
        data=line_buffer[0];

        type=99;
        }

      if( (type==NUM) && (line_buffer[0]!=0) )
        {
        proper_input_given=TRUE;

        /* Convert line_buffer to an unsigned integer in data */
        data=0;
        index=strlen(line_buffer)-1;
        multiplier=1;
        do
          {
          data=data+((line_buffer[index]-48)*multiplier);
          index--;
          multiplier=multiplier*10;
          }while(index>=0);

        /* Make sure that data is <= max_range */
        if(data>data_max_range)
          {
          data=0;
          proper_input_given=FALSE;

	  cprintAt(4,22,catgets(cat,4,6,"Requested partition size exceeds the maximum available space"));

	  /* Set input=0xff to avoid processing this time around */
          input='\xff';
          }
        else type=99;
        }

      if( (type==NUMP) && (line_buffer[0]!=0) )
        {
        proper_input_given=TRUE;

        /* Convert line_buffer to an unsigned integer in data */
        data=0;
        index=strlen(line_buffer)-1;

        if(percent_entered==TRUE) index--;

        multiplier=1;
        do
          {
          data=data+((line_buffer[index]-48)*multiplier);
          index--;
          multiplier=multiplier*10;
          }while(index>=0);


        if(percent_entered==TRUE) data=(data*data_max_range)/maximum_possible_percentage;

        /* Make sure that data is <= max_range */
        if(data>data_max_range)
          {
	  data=0;
          proper_input_given=FALSE;

	  cprintAt(4,22,catgets(cat,4,6,"Requested partition size exceeds the maximum available space"));

	  /* Set input=0xff to avoid processing this time around */
          input='\xff';
          }
        else type=99;
        }

#ifdef DEBUG
      if( (debug.input_routine==TRUE) && (type==99) )
        {
        Clear_Screen(NULL);

        printf("Input entered by user:  %d",data);
        Pause();
        }
#endif
      }

#ifdef DEBUG
    if(debug.input_routine==TRUE)
      {
      printAt(50,22,"                  ");

      printAt(50,22,"Input:  %d",input);
      }
#endif

    /* Process the backspace key if type==CHARNUM. */
    if( (type==CHARNUM) && (input==8) )
      {
      type=NUM;

      input='\xff';
      line_buffer[0]='0';
      line_buffer_index=1;

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    /* Process a legitimate entry if type==CHARNUM. */
    if( (type==CHARNUM) && ( ((input-48)>=1) && ((input-48)<=max_range) ) )
      {
      type=NUM;

      line_buffer[0]='0';
      line_buffer_index=1;
      }

    if( (type==CHARNUM)
     && ( (input==optional_char_1[0])
     || ( (input-32)==optional_char_1[0])
     || (input==optional_char_2[0])
     || ( (input-32)==optional_char_2[0]) ) )
      {
      if(input>=97) input=input-32;

      line_buffer_index=1;
      line_buffer[0]=input;
      input='\xff';
      type=CHARNUM;

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    /* Process a legitimate entry if type==NUMYN. */
    if( (type==NUMYN) && ( (input=='Y') || (input=='N') || (input=='y')
     || (input=='n') ) )
      {
      type=YN;

      line_buffer[0]=' ';
      line_buffer_index=1;
      }

    /* Process a legitimate entry if type==NUMCHAR. */
    if( (type==NUMCHAR) && (optional_char_1[0]!=NULL)
     && (optional_char_2[0]!=NULL) )
      {
      char_max_range=atoi(optional_char_2);

      if( (input>='1') && (input<=(char_max_range+48)) )
        {
        line_buffer_index=1;
        line_buffer[0]=input;
        type=NUMCHAR;

        Position_Cursor((x_position+1),y_position);
        cprintf("%c",line_buffer[0]);
        }

      if( (input<'1') || (input>(char_max_range+48)) )
        {
        line_buffer_index=0;
        line_buffer[0]=0;
        type=CHAR;
        }
      }

    /* Process optional character fields. */
    if( (type==NUM) && ( (optional_char_1[0]!=NULL)
     || (optional_char_2[0]!=NULL) ) )
      {
      if( (input==optional_char_1[0]) || ( (input-32)==optional_char_1[0]) )
        {
	if(input>=97) input=input-32;

        line_buffer_index=1;
        line_buffer[0]=input;
        input='\xff';
        type=CHARNUM;

        Position_Cursor((x_position+1),y_position);
        cprintf("%c",line_buffer[0]);
        }

      if( (input==optional_char_2[0]) || ( (input-32)==optional_char_2[0]) )
        {
        if(input>=97) input=input-32;

        line_buffer_index=1;
        line_buffer[0]=input;
        input='\xff';
        type=CHARNUM;

        Position_Cursor((x_position+1),y_position);
        cprintf("%c",line_buffer[0]);
        }
      }

    if( (type==CHAR) && (optional_char_1[0]!=NULL)
     && (optional_char_2[0]!=NULL) )
      {
      char_max_range=atoi(optional_char_2);

      if( (input>='1') && (input<=(char_max_range+48)) )
        {
        line_buffer_index=1;
        line_buffer[0]=input;
        type=NUMCHAR;

        Position_Cursor((x_position+1),y_position);
        cprintf("%c",line_buffer[0]);
        }
      }

    if( ( (type==YN) || (type==NUMYN) ) && (optional_char_1[0]!=NULL)
     && (optional_char_2[0]!=NULL) )
      {
      char_max_range=atoi(optional_char_2);

      if( (input>='1') && (input<=(char_max_range+48)) )
        {
        line_buffer_index=1;
        line_buffer[0]=input;
        type=NUMYN;

        Position_Cursor((x_position+1),y_position);
        cprintf("%c",line_buffer[0]);
        }
      }

    if(type==CHAR)
      {
      /* Convert to upper case, if necessary. */
      if(input>=97) input=input-32;

      if( (input>=min_range) && (input<=max_range) )
        {
        line_buffer[0]=input;
        data=input;
        }
      else
        {
        proper_input_given=FALSE;
	line_buffer[0]=' ';
        data=99;

        Position_Cursor(4,23);
        cprintf("Invalid entry, please enter %c-",min_range);
        cprintf("%c.",max_range);
        }

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    /* Process the backspace key if type==NUMCHAR. */
    if( (type==NUMCHAR) && (input==8) )
      {
      type=CHAR;

      line_buffer[0]=' ';
      line_buffer_index=1;

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    if(type==YN)
      {
      switch (input) {
	case 'Y':
	  line_buffer[0]='Y';
	  data=TRUE;
	  break;
	case 'y':
	  line_buffer[0]='Y';
	  data=TRUE;
	  break;
	case 'N':
	  line_buffer[0]='N';
	  data=FALSE;
	  break;
	case 'n':
	  line_buffer[0]='N';
	  data=FALSE;
	  break;
	default:
	  proper_input_given=FALSE;
	  line_buffer[0]=' ';
	  data=99;

	  cprintAt(4,23,catgets(cat,4,7,"Invalid entry, please enter Y-N."));

	}

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    /* Process the backspace key if type==NUMYN. */
    if( (type==NUMYN) && (input==8) )
      {
      type=YN;
      line_buffer[0]=' ';
      line_buffer_index=1;

      Position_Cursor((x_position+1),y_position);
      cprintf("%c",line_buffer[0]);
      }

    if( (type==NUM) && (input!='\xff') )
      {
      /* If the backspace key has not been hit. */
      if(input!=8)
        {
	invalid_input=FALSE;

        if(size_of_field>1)
	  {
	  min_range=0;
	  max_range=9;
	  }

	if( (input>='0') && (input<='9') )input=input-48;
	else
	  {
	  if(input<10) input=11;
	  }

	if( ( (size_of_field>1) && (input>max_range) ) || (input>9) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,"Invalid entry, please enter %d-%d.",min_range,max_range);
	  invalid_input=TRUE;
	  }

	if( (size_of_field==1) && ( (input<min_range) || ( (input>max_range) && (input<10) ) ) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,"%d is not a choice, please enter ",input);
	  cprintf("%d-%d.",min_range,max_range);
	  invalid_input=TRUE;
	  }

	if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field>1) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,catgets(cat,4,8,"Invalid entry."));
	  invalid_input=TRUE;
          }

	if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field==1) )
	  {
	  line_buffer_index=0;
	  }

	if(invalid_input==FALSE)
	  {
	  if( (line_buffer_index==1) && (line_buffer[0]=='0') )
	    {
	    line_buffer[0]=0;
	    line_buffer_index=0;
	    }

	  line_buffer[line_buffer_index]=(input+48);
	  line_buffer_index++;
	  }
	}
      else
	{
	/* If the backspace key has been hit */
	line_buffer_index--;
	if(line_buffer_index<0) line_buffer_index=0;
	line_buffer[line_buffer_index]=0;

	if(line_buffer_index==0)
	  {
	  line_buffer[0]='0';
	  line_buffer_index=1;
	  }
	}

      /* Clear text box before displaying line_buffer */
      index=0;
      do
	{
	Position_Cursor((x_position+1+index),y_position);
	printf(" ");

	index++;
	}while(index<size_of_field);

      /* Display line_buffer */
      index=line_buffer_index;
      do
	{
	Position_Cursor((x_position+size_of_field-line_buffer_index+index),y_position);
	index--;
	cprintf("%c",line_buffer[index]);
	}while(index>0);
      }

    if( (type==NUMP) && (input!='\xff') )
      {
      /* If the backspace key has not been hit. */
      if(input!=8)
	{
	invalid_input=FALSE;

	if(size_of_field>1)
	  {
	  min_range=0;
	  max_range=9;
	  }

	if( (input=='%') && (percent_entered==FALSE) )
	  {
	  percent_entered=TRUE;
	  percent_just_entered=TRUE;
	  }

	if( (input>='0') && (input<='9') )input=input-48;
	else
	  {
	  if(input<10) input=11;
	  }

	if( (percent_entered==FALSE) && (percent_just_entered==FALSE) && ( ( (size_of_field>1) && (input>max_range) ) || (input>9) ) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,"Invalid entry, please enter %d-%d.",min_range,max_range);
	  invalid_input=TRUE;
	  }

	if( (percent_entered==FALSE) && (size_of_field==1) && ( (input<min_range) || ( (input>max_range) && (input<10) ) ) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,"%d is not a choice, please enter ",input);
	  cprintf("%d-%d.",min_range,max_range);
	  invalid_input=TRUE;
	  }

	if( ( (percent_entered==TRUE) && (percent_just_entered==FALSE) ) || ( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field>1) ) )
	  {
	  proper_input_given=FALSE;

	  cprintAt(4,23,catgets(cat,4,8,"Invalid entry."));
          invalid_input=TRUE;
	  }

        if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field==1) )
          {
          line_buffer_index=0;
          }

        if(invalid_input==FALSE)
          {
          if( (line_buffer_index==1) && (line_buffer[0]=='0') )
            {
            line_buffer[0]=0;
            line_buffer_index=0;
            }

          if(percent_just_entered==TRUE)
            {
            percent_just_entered=FALSE;
            line_buffer[line_buffer_index]='%';
            line_buffer_index++;
            }
          else
            {
            line_buffer[line_buffer_index]=(input+48);
            line_buffer_index++;
            }
          }
        }
      else
        {
	/* If the backspace key has been hit */
        line_buffer_index--;
        if(line_buffer_index<0) line_buffer_index=0;
        line_buffer[line_buffer_index]=0;

	if(line_buffer_index==0)
          {
          line_buffer[0]='0';
          line_buffer_index=1;
          }

        if(percent_entered==TRUE) percent_entered=FALSE;
        }

      /* Clear text box before displaying line_buffer */
      index=0;
      do
        {
        Position_Cursor((x_position+1+index),y_position);
        printf(" ");

        index++;
        }while(index<size_of_field);

      /* Display line_buffer */
      index=line_buffer_index;
      do
        {
        Position_Cursor((x_position+size_of_field-line_buffer_index+index),y_position);
        index--;
        cprintf("%c",line_buffer[index]);
        }while(index>0);
      }

#ifdef DEBUG
    if(debug.input_routine==TRUE)
      {
      printAt(60,23,"                ");

      printAt(60,24,"                ");

      printAt(50,23,"Line Buffer:  %10s",line_buffer);

      printAt(50,24,"Line Buffer Index:  %d",line_buffer_index);

      if(percent_entered==TRUE)
        {
        printAt(75,24,"P");
        }
      else
        {
        printAt(75,24,"  ");
        }
      }
#endif

    /* Place brackets back on screen as a precautionary measure. */
    if(type!=ESC)
      {
      Position_Cursor(x_position,y_position);
      cprintf("[");

      Position_Cursor((x_position+size_of_field+1),y_position);
      cprintf("]");
      }

    }while(proper_input_given==FALSE);

  return(data);
}
int main (int argc, char *argv[]) 
{
 //Get a console handle
 HWND ConsoleWindow = GetConsoleWindow();
 
 //Get a STD handle
 HWND StdHandle = GetStdHandle (STD_OUTPUT_HANDLE);

 //Set cursor invisible
 CONSOLE_CURSOR_INFO CURSOR;
 CURSOR.dwSize = 1;
 CURSOR.bVisible = FALSE;
 SetConsoleCursorInfo (StdHandle, &CURSOR);
 
 //Get Current Font
 for (;;)
 {
  CONSOLE_FONT_INFO GETFONT;
  GetCurrentConsoleFont (StdHandle, FALSE, &GETFONT);
  COORD Fontsize = GetConsoleFontSize (StdHandle, GETFONT.nFont);
  SHORT Font_X = Fontsize.X;
  SHORT Font_Y = Fontsize.Y;
  if (Font_X != 8 || Font_Y != 12)
  {
   system ("chcp 437 > NUL");
   MessageBox (ConsoleWindow, "Please change Console Font to Raster Font  ( 8 x 12 ).", "Notice", MB_TOPMOST | MB_OK | MB_ICONINFORMATION);
   Envir_Error ();
   printf ("\rPress any key to continue...");
   system ("pause>nul");
  }
  else
   break;
 }
 
 //Change Settings
 //SetWindowLong (ConsoleWindow, GWL_STYLE, WS_THICKFRAME);
 //SetWindowLong (ConsoleWindow, GWL_STYLE, WS_CAPTION);
 //SetWindowPos  (ConsoleWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_SHOWWINDOW);
 SetWindowPos  (ConsoleWindow, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_SHOWWINDOW);

 //Get a handle to device context
 HDC DeviceContext = GetDC (ConsoleWindow);
 
 //Color
 COLORREF Color_White = RGB (255,255,255);
 COLORREF Color_Black = RGB ( 0 , 0 , 0 );
 
 //Title and Resize
 system ("mode con cols=75 lines=50");
 system ("title Console Snake     [ Developer: KVD 2013 ]");
 system ("color 0A");
 
 //Multi-Thread
 pthread_t Key_Stroke_Func;
 pthread_create (&Key_Stroke_Func, NULL, (void*)Get_Key_Stroke, NULL);
 
 //Initialization
 Initialize:;
 Initialization (DeviceContext, argv[1]);
 
 //Main
 for (;;)
 {
  //Terminate / PlayAgain
  if (Flag_Terminate == True)
  {
   return 0;
  }
  else if (Flag_PlayAgain == True)
  {
   Flag_PlayAgain = False;
   Clear_Screen (DeviceContext);
   goto Initialize;
  }
  //Draw
  if (Move.Condition == UnRead)
  {
   Move.Condition = Read;
   Change_Str (DeviceContext, ConsoleWindow);
   Draw_Square (Draw.X, Draw.Y, Draw.Direction, Color_White, Erase.X, Erase.Y, Erase.Direction, Color_Black, User_Def_Delay, DeviceContext);
  }
  else
  {
   Predict_Func (Draw.Direction);
   Change_Str (DeviceContext, ConsoleWindow);
   Draw_Square (Draw.X, Draw.Y, Draw.Direction, Color_White, Erase.X, Erase.Y, Erase.Direction, Color_Black, User_Def_Delay, DeviceContext);
  }
  //End
  if (Is_Snake (Draw.X, Draw.Y) == True || Is_Block (Draw.X, Draw.Y) == True)
  {
   MessageBox (ConsoleWindow, "GAME OVER", "Notice", MB_TOPMOST | MB_OK | MB_ICONSTOP);
   Clear_String ();
   Clear_Screen (DeviceContext);
   goto Initialize;
  }
 }
 
 //End
 system ("pause>nul");
 return 0;
}
Example #21
0
/* Delete Logical Drive Interface */
int Delete_Logical_Drive_Interface()
{
  char char_number[2];

  int drive_to_delete=0;
  int index=0;
  int input=0;
  int input_ok;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Clear_Screen(0);

  Print_Centered(1,"Delete Logical DOS Drive(s) in the Extended DOS Partition",BOLD);

  Display_Extended_Partition_Information_SS();

  BlinkPrintAt(4,19,"WARNING!");
  printf(" Data in a deleted Logical DOS Drive will be lost.");

  printAt (4,20,"What drive do you want to delete...............................? ");

  Determine_Drive_Letters();

  //char drive_lettering_buffer[8] [27];   this line is for reference
  /* Place code to find the min and max drive letter here. */

  input_ok=FALSE;

  do
    {
    flags.esc=FALSE;

    if( (flags.del_non_dos_log_drives==TRUE)
     && (pDrive->num_of_non_dos_log_drives>0) )
     {
     if(pDrive->num_of_non_dos_log_drives>9)
      pDrive->num_of_non_dos_log_drives=9;
     itoa(pDrive->num_of_non_dos_log_drives,char_number,10);
     input=(int)Input(1,69,20,CHAR,67,90,ESCR,0,0,"1",char_number);
     }
    else input=(int)Input(1,69,20,CHAR,67,90,ESCR,0,0,NULL,NULL);
    /* Note:  min_range and max_range will need adjusted!!!!! */
    /* Changes will have to be made because the first logical drive letter */
    /* on the selected drive may not be D:, the drive letters on the       */
    /* drive may not be sequential.                                        */

    if(flags.esc==TRUE) return(1);

    if(flags.esc==FALSE)
      {
      /* Ensure that the entered character is legitimate. */
      index=4;
      do
        {
        if( (drive_lettering_buffer[(flags.drive_number-128)] [index]>0)
         && (drive_lettering_buffer[(flags.drive_number-128)] [index]==input) )
          {
          input=index-4;
          input_ok=TRUE;
          index=30; /* break out of the loop */
          }

        index++;
        }while(index<=26);
      }

    }while(input_ok==FALSE);

  drive_to_delete=input;

  printAt(4,22,"Are you sure (Y/N)..............................? ");
  flags.esc=FALSE;
  input=(int)Input(1,54,22,YN,0,0,ESCR,0,0,NULL,NULL);

  if( (input==TRUE) && (flags.esc==FALSE) )
    {
    Delete_Logical_Drive(drive_to_delete);

    Clear_Screen(0);
    Print_Centered(1,"Delete Logical DOS Drive(s) in the Extended DOS Partition",BOLD);
    Display_Extended_Partition_Information_SS();
    input=(int)Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
    }

  return(0);
}
Example #22
0
/* Check for interrupt 0x13 extensions */
void Check_For_INT13_Extensions()
{
  int carry;
  int drive_number=0x80;

//-  unsigned int ah_register;
  unsigned char ah_register;
  unsigned int bx_register;
  unsigned int cx_register;

#ifdef DEBUG
  if(debug.lba==TRUE)
    {
    Clear_Screen(NULL);
    Print_Centered(0,"void Check_For_INT13_Extensions() debugging screen",BOLD);
    printf("\n\n    drive     int 0x13 ext?     access w/packet\n\n");
    }
#endif

  do
    {
//    carry=99;
    carry=0;

    asm{
      mov ah,0x41
      mov bx,0x55aa
      mov dl,BYTE PTR drive_number
      int 0x13

      mov BYTE PTR ah_register,ah
      mov WORD PTR bx_register,bx
      mov WORD PTR cx_register,cx

//      jnc carry_flag_not_set    /* Jump if the carry flag is clear  */
//      }                         /* If the carry flag is clear, then */
//				/* the extensions exist.            */
//    carry=1;
//    part_table[(drive_number-128)].ext_int_13=FALSE;
      adc WORD PTR carry,0          /* Set carry if CF=1 */
      }


//    carry_flag_not_set:
//    if( (carry==99) && (bx_register==0xaa55) )
    part_table[(drive_number-128)].ext_int_13=FALSE;

    if( (!carry)  && (bx_register==0xaa55))
      {
      flags.use_extended_int_13=TRUE;
      part_table[(drive_number-128)].ext_int_13=TRUE;

      if((cx_register&0x0001)==1) part_table[(drive_number-128)].device_access_using_packet_structure=TRUE;
      else part_table[(drive_number-128)].device_access_using_packet_structure=FALSE;

      part_table[(drive_number-128)].ext_int_13_version=ah_register;

#ifdef DEBUG
      if(debug.lba==TRUE)
	{
	printf("     0x%2x          yes",drive_number);

	if((cx_register&0x0001)==1) printf("                 yes");
	else printf("                  no");

	printf("\n");
	}
#endif

      }
#ifdef DEBUG
    else if(debug.lba==TRUE) printf("     0x%2x           no\n",drive_number);
#endif

    drive_number++;
    }while(drive_number<0x88);

#ifdef DEBUG
  if(debug.lba==TRUE)
    {
    printf("\n\n\n");
    Pause();
    }
#endif

}
Example #23
0
/*
 * The workhorse output function.
 * Depending on the current console output state,
 * does literal character output or processes part of
 * an escape sequence.
 */
static void Put_Char_Imp(int c) {
  again:
    switch (s_cons.state) {
        case S_NORMAL:
            if(c == ESC)
                Start_Escape();
            else
                Output_Literal_Character(c);
            break;

        case S_ESC:
            if(c == '[')
                s_cons.state = S_ESC2;
            else
                Reset();
            break;

        case S_ESC2:
            if(ISDIGIT(c)) {
                Start_Arg(0);
                goto again;
            } else if(c == ';') {
                /* Special case: for "n;m" commands, "n" is implicitly 1 if omitted */
                Start_Arg(0);
                Add_Digit('1');
                Start_Arg(1);
            } else {
                s_cons.state = S_CMD;
                goto again;
            }
            break;

        case S_ARG:
            if(ISDIGIT(c))
                Add_Digit(c);
            else if(c == ';')
                Start_Arg(s_cons.numArgs);
            else {
                s_cons.state = S_CMD;
                goto again;
            }
            break;

        case S_CMD:
            switch (c) {
                case 'K':
                    Clear_To_EOL();
                    break;
                case 's':
                    Save_Cursor();
                    break;
                case 'u':
                    Restore_Cursor();
                    break;
                case 'A':
                    Move_Cursor(s_cons.row - Get_Arg(0), s_cons.col);
                    break;
                case 'B':
                    Move_Cursor(s_cons.row + Get_Arg(0), s_cons.col);
                    break;
                case 'C':
                    Move_Cursor(s_cons.row, s_cons.col + Get_Arg(0));
                    break;
                case 'D':
                    Move_Cursor(s_cons.row, s_cons.col - Get_Arg(0));
                    break;
                case 'm':
                    Update_Attributes();
                    break;
                case 'f':
                case 'H':
                    if(s_cons.numArgs == 2)
                        Move_Cursor(Get_Arg(0) - 1, Get_Arg(1) - 1);
                    break;
                case 'J':
                    if(s_cons.numArgs == 1 && Get_Arg(0) == 2) {
                        Clear_Screen();
                        Put_Cursor(0, 0);
                    }
                    break;
                default:
                    break;
            }
            Reset();
            break;

        default:
            KASSERT(false);
    }
}
Example #24
0
/* Display Or Modify Logical Drive Information in the extended partition */
void Display_Or_Modify_Logical_Drive_Information()
{
  char char_number[1];

  int continue_loop;
  int index;
  int input;
  int input_ok;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Beginning:

  Clear_Screen(NOEXTRAS);

  if(flags.extended_options_flag==FALSE)
   Print_Centered(1,"Display Logical DOS Drive Information",BOLD);
  else Print_Centered(1,"Display/Modify Logical DOS Drive Information",BOLD);

  Display_Extended_Partition_Information_SS();

  if(flags.extended_options_flag==FALSE)
   Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
  else
    {
    printAt(4,18,"Enter the character of the logical drive you want to modify.....?");

    Determine_Drive_Letters();

    continue_loop=TRUE;
    do
      {
      flags.esc=FALSE;

      if( (flags.del_non_dos_log_drives==TRUE) && (pDrive->num_of_non_dos_log_drives>0) )
        {
        if(pDrive->num_of_non_dos_log_drives>9) pDrive->num_of_non_dos_log_drives=9;
        itoa(pDrive->num_of_non_dos_log_drives,char_number,10);
        input=(int)Input(1,69,18,CHAR,68,90,ESCC,0,0,"1",char_number);
        }
      else input=(int)Input(1,69,18,CHAR,68,90,ESCC,0,0,NULL,NULL);

      if(flags.esc==FALSE)
        {
        /* Ensure that the entered character is legitimate. */
        index=4;
        do
          {
          if( (drive_lettering_buffer[(flags.drive_number-128)] [index]>0) && (drive_lettering_buffer[(flags.drive_number-128)] [index]==input) )
            {
            input=index-4;
            input_ok=TRUE;
            index=30; /* break out of the loop */
            }

            index++;
	  }while(index<=26);
        }

      if(input_ok==TRUE) continue_loop=FALSE;
      if(flags.esc==TRUE) continue_loop=FALSE;

      }while(continue_loop==TRUE);

    if( (input_ok==TRUE) && (flags.esc==FALSE) )
      {
      Modify_Extended_Partition_Information(input);
      goto Beginning;
      }
    }
}
Example #25
0
/*
 * Initialize the screen module.
 */
void Init_Screen(void) {
    s_cons.row = s_cons.col = 0;
    s_cons.currentAttr = DEFAULT_ATTRIBUTE;
    Clear_Screen();
}
Example #26
0
/* Create DOS Partition Interface */
int Create_DOS_Partition_Interface(int type)
{
  int numeric_type;
  int partition_created=FALSE;
  int partition_slot_just_used;

  long maximum_partition_size_in_MB;
  long maximum_possible_percentage;

  unsigned long input=0;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  maximum_partition_size_in_MB
   = Max_Pri_Part_Size_In_MB(type);

  if(type==PRIMARY)
    {
    Clear_Screen(0);

    Print_Centered(4,"Create Primary DOS Partition",BOLD);

    printAt(4,6,"Current fixed disk drive: ");
    cprintf("%d",(flags.drive_number-127));

    printAt(4,8,"Do you wish to use the maximum available size for a Primary DOS Partition");

    if((flags.drive_number-128)==0)
      {
      printAt(4,9,"and make the partition active (Y/N).....................? ");
      }
    else
      {
      printAt(4,9,"(Y/N)...................................................? ");
      }

    flags.esc=FALSE;
    input=Input(1,62,9,YN,0,0,ESCR,1,0,NULL,NULL);
    if(flags.esc==TRUE) return(1);

    if(input==1)
      {
      input=maximum_partition_size_in_MB;
      numeric_type=6;  /* Set the numeric type to 6 so that it will be    */
                       /* decided by Partition_Type_To_Create().          */

      if( (flags.fprmt==TRUE) && (type==PRIMARY) && (input>=128) && (input<=2048) )
        {
        printAt(4,22,"This drive is a FAT32 by default, switch to FAT16 (Y/N)?    ");
	flags.fat32=!Input(1,61,22,YN,0,0,NONE,1,0,NULL,NULL);
        }

      /* Use the maximum available free space to create a DOS Partition */

      /* Adjust numeric type depending upon partition size and the FDISK */
      /* version emulated.                                               */
      numeric_type=Partition_Type_To_Create(input,numeric_type);

      partition_slot_just_used=Create_Primary_Partition(numeric_type,input);
      if((flags.drive_number-128)==0) Set_Active_Partition(partition_slot_just_used);
      partition_created=TRUE;
      }
    }

  if(partition_created==FALSE)
    {
    Clear_Screen(0);

    if(type==PRIMARY) Print_Centered(4,"Create Primary DOS Partition",BOLD);
    else              Print_Centered(4,"Create Extended DOS Partition",BOLD);

    printAt(4,6,"Current fixed disk drive: ");
    cprintf("%d",(flags.drive_number-127));

    Display_Primary_Partition_Information_SS();

    printAt(4,15,"Maximum space available for partition is ");

    if( (flags.version==W95) || (flags.version==W95B) || (flags.version==W98) )
      Print_UL_B(maximum_partition_size_in_MB);
    else cprintf("%4d",maximum_partition_size_in_MB);

    printf(" Mbytes ");

    maximum_possible_percentage
     = Convert_To_Percentage(maximum_partition_size_in_MB
      ,pDrive->total_hard_disk_size_in_MB);

    cprintf("(%3d%%)",maximum_possible_percentage);

    printAt(4,18,"Enter partition size in Mbytes or percent of disk space (%) to");

    if(type==PRIMARY) printAt(4,19,"create a Primary DOS Partition.................................: ");
    else              printAt(4,19,"create an Extended DOS Partition...............................: ");

    flags.esc=FALSE;

    if( (flags.version==4) || (flags.version==5) || (flags.version==6) )
     input=Input(4,69,19,NUMP,1,maximum_partition_size_in_MB,ESCR
     ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL);
    else input=Input(6,69,19,NUMP,1,maximum_partition_size_in_MB,ESCR
     ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL);

    if(flags.esc==TRUE) return(1);

    if( (flags.fprmt==TRUE) && (type==PRIMARY) && (input>=128) && (input<=2048) )
      {
      printAt(4,22,"This drive is a FAT32 by default, switch to FAT16 (Y/N)?    ");
      flags.fat32=!Input(1,61,22,YN,0,0,NONE,1,0,NULL,NULL);
      }

    if(type==PRIMARY) numeric_type=Partition_Type_To_Create(input,0);
    else numeric_type=5;

    Create_Primary_Partition(numeric_type,input);
    }

  if(flags.fprmt==TRUE) flags.fat32=FALSE;

  Clear_Screen(0);

  if(type==PRIMARY) Print_Centered(4,"Create Primary DOS Partition",BOLD);
  else              Print_Centered(4,"Create Extended DOS Partition",BOLD);

  printAt(4,6,"Current fixed disk drive: ");
  cprintf("%d",(flags.drive_number-127));

  Display_Primary_Partition_Information_SS();

  Position_Cursor(4,21);
  if(type==PRIMARY) cprintf("Primary DOS Partition created");
  else              cprintf("Extended DOS Partition created");

  Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);

  if(type==EXTENDED) Create_Logical_Drive_Interface();

  return(0);
}