Example #1
0
static bool opt_workspace_frame(Tokenizer *tokz, int n, Token *toks)
{
	WRectangle geom;
	int id;
	WFrame *frame;
	
	if(!check_splits(tokz, toks[1].line))
		return FALSE;
	
	id=TOK_LONG_VAL(&(toks[1]));
	geom=get_geom();
	
	frame=create_frame(current_screen, geom, id, 0);
	
	if(frame==NULL)
		return FALSE;
	
	if(current_split==NULL)
		current_ws->splitree=(WObj*)frame;
	else if(current_split->tl==NULL)
		current_split->tl=(WObj*)frame;
	else
		current_split->br=(WObj*)frame;
	
	frame->win.split=current_split;

	add_workspace_window(current_ws, (WWindow*)frame);
	
	return TRUE;
}
Example #2
0
/* print disk drive geometry information for a particular drive */
static void do_geom(char *bios)
{
    int dr;
    struct disk_geom geom;

#if 0    
    dr = my_atoi(bios);
#endif
    dr = to_number(bios);
    if (get_geom(dr, &geom)==0) print_geom(dr, geom);
    else printf("Unrecognized BIOS device code 0x%02x\n", dr);
    
}
Example #3
0
/* print disk drive geometry for all drives */
static void do_geom_all(void)
{
   int d, hd, dr;
   struct disk_geom geom;
   
   for (hd=0; hd<0x81; hd+=0x80)
   for (d=0; d<16; d++) {
      dr = d+hd;
      if (get_geom(dr, &geom)==0) {
         if (dr==0x80) printf("\nBIOS reports %d drive%s\n", (int) geom.n_disks,
                                      (int)geom.n_disks==1 ? "" : "s");
      	 print_geom(dr, geom);
      }
   }
}
Example #4
0
static bool opt_workspace_split(int dir, Tokenizer *tokz, int n, Token *toks)
{
	WRectangle geom;
	WWsSplit *split;
	int brs, tls;
	int w, h;
	
	if(!check_splits(tokz, toks[1].line))
		return FALSE;
	   
	tls=TOK_LONG_VAL(&(toks[1]));
	brs=TOK_LONG_VAL(&(toks[2]));
	
	geom=get_geom();
	
	if(dir==HORIZONTAL)
		tls=geom.w*tls/(tls+brs);
	else
		tls=geom.h*tls/(tls+brs);
	
	split=create_split(dir, NULL, NULL, geom);
	
	if(split==NULL)
		return FALSE;
		
	split->tmpsize=tls;
	
	if(current_split==NULL)
		current_ws->splitree=(WObj*)split;
	else if(current_split->tl==NULL)
		current_split->tl=(WObj*)split;
	else
		current_split->br=(WObj*)split;
	
	split->parent=current_split;
	
	current_split=split;
	
	return TRUE;
}
Example #5
0
/* get the old BIOS disk geometry */
static int get_geom(unsigned int drive, struct disk_geom *geom)
{
    hard_t *hd;
    floppy_t *fd;
    int i;
    struct partition *pt_base;

    if((i=fetch())) {
        printf("No drive geometry information is available.\n\n");
        exit(0);
    }

#ifdef DEBUG
	printf("get_geom: drive = 0x%02X\n", drive);
	fflush(stdout);
#endif
    if (drive >= 0 && drive < buf.s.mflp) {
	fd = (floppy_t*)&buf.b[buf.s.floppy] + drive;
	hd = (hard_t*)fd;
    }
    else if (drive == 0x80) {
	hdp[drive-0x80] = hd = (hard_t*)&buf.b[buf.s.hard];
    }    
    else if (drive >= 0x81 && drive < 0x80+buf.s.mhrd) {
	if (drive > buf.s.disk) return 1;
	if (!hdp[drive-0x80]) {
	    i = get_geom(drive-1, geom);
#ifdef DEBUG
		printf("get_geom recursive return = %d  AH=0x%02X\n", i, i-1);
		fflush(stdout);
#endif
	    if (i) return i;
	}
	hd = hdp[drive-0x80];
    } else return 1;
#ifdef DEBUG
	printf("get_geom:  hd = %08X\n", (int)hd);
	fflush(stdout);
#endif
    
    memset(geom, 0, sizeof(*geom));


    if (drive >= 0x80)
        hdp[drive-0x80 + 1] = (void*)hd + sizeof(hard_t);		/* simplest increment, but may be wrong */
    
    /* regs.eax = 0x1500;           check drive type */
    /* regs.edx = drive;			*/

#ifdef DEBUG
	printf("get_geom: int13, fn=15\n");
	fflush(stdout);
#endif
   
   if (hd->fn15.flags & 1)   return 1;	/* carry was set */
   geom->type = hd->fn15.ah;
   if (geom->type == 0) return 1;
   if (geom->type == 3)
     geom->n_total_blocks = ((int)hd->fn15.cx << 16) + hd->fn15.dx;
   
   /* regs.eax = 0x0800;		*/
   /* regs.edx = drive;			*/
   
#ifdef DEBUG
	printf("get_geom: int13, fn=08\n");
	fflush(stdout);
#endif
   
   if (hd->fn08.flags&1 || hd->fn08.ah || hd->fn08.cx==0)
     return 1 + hd->fn08.ah;
   
   geom->n_sect = hd->fn08.cx & 0x3F;
   geom->n_head = ((hd->fn08.dx>>8)&0xFF)+1;
   geom->n_cyl  = (((hd->fn08.cx>>8)&0xFF)|((hd->fn08.cx&0xC0)<<2))+1;
   geom->n_disks = hd->fn08.dx & 0xFF;
   geom->pt = NULL;

   if (drive < 4)  return 0;
   
   pt_base = NULL;
   if (buf.s.disk) {
	pt_base = (struct partition *)&buf.b[buf.s.partitions];
   }
   if (pt_base && drive <= (int)buf.s.disk) {
#if 0
   				geom->pt = &pt_base[(drive&15)*4];
#else
	void *p = (void*)pt_base;
	int i = buf.s.version >= 4 ? 8 : 0;
	
	p += (drive & 15) * (PART_TABLE_SIZE + i) + i;
	geom->pt = (struct partition *)p;
	if (i) geom->serial_no = *(int*)(p-6);
#endif
   }

#ifdef DEBUG
   printf("get_geom:  PT->%08X  S/N=%08X\n", (int)geom->pt, geom->serial_no);
#endif
      
   /* regs.eax = 0x4100;      check EDD extensions present */
   /* regs.edx = drive;				*/
   /* regs.ebx = 0x55AA;			*/
#ifdef DEBUG
	printf("get_geom: int13, fn=41\n");
	fflush(stdout);
#endif
   if ((hd->fn41.flags&1)==0 && (hd->fn41.bx)==(unsigned short)0xAA55) {
      geom->EDD_flags = hd->fn41.cx;
      geom->EDD_rev = hd->fn41.ah;
   }
   
   if ((geom->EDD_flags) & EDD_SUBSET) {
      edd_t *dp;

      dp = (edd_t*)hdp[drive-0x80 + 1];
#ifdef DEBUG
	printf("get_geom:  EDD  dp = %08X\n", (int)dp);
	fflush(stdout);
#endif
    /* update the pointer to the next drive */
      hdp[drive-0x80 + 1] = (void*)dp + sizeof(edd_t);

      /* regs.eax = 0x4800;		*/
      /* regs.edx = drive;		*/
      
#ifdef DEBUG
	printf("get_geom: int13, fn=48\n");
	fflush(stdout);
#endif
      
      if ((dp->info) & EDD_PARAM_GEOM_VALID) {
         if ((geom->n_sect != dp->sectors ||
             geom->n_head != dp->heads) && !nowarn && !(warned[drive-0x80]++))
                fprintf(errstd,"Warning: Int 0x13 function 8 and function 0x48 return different\n"
                               "head/sector geometries for BIOS drive 0x%02X\n", drive);
         geom->n_cyl  = dp->cylinders;
         geom->n_head = dp->heads;
         geom->n_sect = dp->sectors;
         geom->n_total_blocks = dp->total_sectors;
      }

   }
   
   return 0;
}