void fixalert( char *ppath ) { savepath = ppath; while( *(++savepath) != 'C' ) ; if( !(Drvmap() & 4) ) *savepath = 'A'; }
/* GetBaseDrive() * ==================================================================== * Get the A drive or C drive depending upon if there is a hard disk. */ char GetBaseDrive( void ) { int drv; char Drive; drv = (( Drvmap() & 4L ) ? ( 2 ) : ( 0 ) ); Drive = drv + 'A'; return( Drive ); }
void test010203(void) { WORD res; BYTE ok; WORD drives = Drvmap(); WORD dr2 = drives & (~drive); // remove tested drive int drvExisting = -1; int drvNonexisting = -1; int i; for(i=15; i>= 0; i--) { if((dr2 & (1 << i)) != 0) { // drive exists? drvExisting = i; } if((dr2 & (1 << i)) == 0) { // drive doesn't exist? if(i == drive) { // if it's not in dr2, but it's our drive, skip it continue; } drvNonexisting = i; } } res = Dsetdrv(drvExisting); // switch to existing drive ok = drives == res; // OK when returns existing drives if(ok) { WORD drv = Dgetdrv(); ok = drvExisting == drv; // OK if drive changed if(!ok) { out_swsw("Was switching to ", drvExisting, ", Dgetdrv returned ", drv); } } out_tr_b(0x0102, "Dsetdrv to existing drive", ok); res = Dsetdrv(drvNonexisting); // switch to non-existing drive ok = drives == res; // OK when returns existing drives if(ok) { WORD drv = Dgetdrv(); ok = drvNonexisting == drv; // TOS 1.02: OK if drive change to non-existing anyway if(!ok) { out_swsw("Was switching to ", drvNonexisting, ", Dgetdrv returned ", drv); } } out_tr_b(0x0103, "Dsetdrv to non-existing drive", ok); }
/**************************************************************** * * * test la chaŒne renvoy‚e par scrp_read() * * * ****************************************************************/ boolean test_scrap_path(char *scrap_path) { int len = (int)strlen(scrap_path); if (len == 0) { int device, err; /* C:\ existe ? */ if (Drvmap() & (1<<2)) device = 'C'; else device = 'A'; sprintf(scrap_path, "%c:\\CLIPBRD", device); /* cr‚e le r‚pertoire */ if ((err = Dcreate(scrap_path)) < 0 && err != -36) { error_msg(err); return TRUE; } strcat(scrap_path, "\\"); /* on pr‚vient l'AES */ if (!scrp_write(scrap_path)) { error_msg(Z_CLIPBOARD_NOT_INSTALLABLE); return TRUE; } } else if (scrap_path[len-1] != '\\') { if (Fsfirst(scrap_path, FA_SUBDIR)) { /* c'est un r‚pertoire sans \ … la fin (C:\CLIPBRD) */ scrap_path[len] = '\\'; scrap_path[len+1] = '\0'; } else /* c'est pas un r‚pertoire (C:\CLIPBRD\SCRAP.TXT) */ *(strrchr(scrap_path, '\\')+1) = '\0'; } return FALSE; } /* test_scrap_path */
void test0101(void) { WORD res; BYTE ok; WORD drives = Drvmap(); res = Dsetdrv(drive); ok = drives == res; // OK if returning bitmap of drives if(ok) { WORD drv = Dgetdrv(); ok = drive == drv; // OK if drive changed } out_tr_b(0x0101, "Dsetdrv to selected drive", ok); }
/* return text of current dir into specified buffer */ long xgetdir(char *buf, int drv) { DND *p; int len; /* M01.01.1024.02 */ drv = (drv == 0) ? run->p_curdrv : drv-1 ; if( !(Drvmap() & (1<<drv)) || (ckdrv(drv) < 0) ) /* M01.01.1031.01 */ { *buf = 0; return(EDRIVE); } p = dirtbl[(int)(run->p_curdir[drv])]; len = LEN_ZPATH - 3; /* M01.01.1024.02 */ buf = dopath(p,buf,&len); /* M01.01.1024.02 */ *--buf = 0; /* null as last char, not slash */ return(E_OK); }
void test0104(void) { WORD res; BYTE ok; #define DRIVE_OUT_OF_RANGE 30 WORD drives = Drvmap(); res = Dsetdrv(DRIVE_OUT_OF_RANGE); // switch to out of range drive ok = drives == res; // OK when returns existing drives if(ok) { WORD drv = Dgetdrv(); ok = DRIVE_OUT_OF_RANGE == drv; // OK if drive changed if(!ok) { out_swsw("Was switching to ", DRIVE_OUT_OF_RANGE, ", Dgetdrv returned ", drv); } } out_tr_b(0x0104, "Dsetdrv to out of range", ok); }
void biosmain(void) { BOOL show_initinfo; /* TRUE if welcome screen must be displayed */ BYTE *p; bios_init(); /* Initialize the BIOS */ trap1( 0x30 ); /* initial test, if BDOS works: Sversion() */ if (!HAS_RTC) trap1( 0x2b, os_dosdate); /* set initial date in GEMDOS format: Tsetdate() */ /* Steem needs this to initialize its GEMDOS hard disk emulation. * This may change drvbits. See Steem sources: * File steem/code/emulator.cpp, function intercept_bios(). */ Drvmap(); /* * if it's not the first boot, we use the existing bootdev. * this allows a boot device that was selected via the welcome * screen to persist across warm boots. */ if (first_boot) bootdev = blkdev_avail(DEFAULT_BOOTDEV) ? DEFAULT_BOOTDEV : FLOPPY_BOOTDEV; #if INITINFO_DURATION == 0 show_initinfo = FALSE; #elif ALWAYS_SHOW_INITINFO show_initinfo = TRUE; #else show_initinfo = first_boot; #endif if (show_initinfo) bootdev = initinfo(); /* show the welcome screen */ KDEBUG(("bootdev = %d\n", bootdev)); /* boot eventually from a block device (floppy or harddisk) */ blkdev_boot(); defdrv = bootdev; trap1( 0x0e , defdrv ); /* Set boot drive: Dsetdrv(defdrv) */ #if ENABLE_RESET_RESIDENT run_reset_resident(); /* see comments above */ #endif /* * build default environment, just a PATH= string */ strcpy(default_env,PATH_ENV); p = default_env + sizeof(PATH_ENV); /* point to first byte of path string */ strcpy(p,DEF_PATH); *p = 'A' + defdrv; /* fix up drive letter */ p += sizeof(DEF_PATH); *p = '\0'; /* terminate with double nul */ #if WITH_CLI if (early_cli) { /* run an early console */ PD *pd = (PD *) trap1_pexec(PE_BASEPAGE, "", "", default_env); pd->p_tbase = (LONG) coma_start; pd->p_tlen = pd->p_dlen = pd->p_blen = 0; trap1_pexec(PE_GOTHENFREE, "", pd, ""); } #endif autoexec(); /* autoexec PRGs from AUTO folder */ /* clear commandline */ if(cmdload != 0) { /* Pexec a program called COMMAND.PRG */ trap1_pexec(PE_LOADGO, "COMMAND.PRG", "", default_env); } else if (exec_os) { /* start the default (ROM) shell */ PD *pd; pd = (PD *) trap1_pexec(PE_BASEPAGE, "", "", default_env); pd->p_tbase = (LONG) exec_os; pd->p_tlen = pd->p_dlen = pd->p_blen = 0; trap1_pexec(PE_GO, "", pd, ""); } #if CONF_WITH_SHUTDOWN /* try to shutdown the machine / close the emulator */ shutdown(); #endif /* hide cursor */ cprintf("\033f"); kcprintf(_("System halted!\n")); halt(); }