static void run_auto_program(const char* filename) { char path[30]; strcpy(path, "\\AUTO\\"); strcat(path, filename); KDEBUG(("Loading %s ...\n", path)); trap1_pexec(PE_LOADGO, path, "", default_env); /* Pexec */ KDEBUG(("[OK]\n")); }
static void aes_run_rom_program(PRG_ENTRY *entry) { LONG *pd; /* FIXME: Use BDOS PD struct after fixing AES PD conflict */ /* Create a basepage with the standard Pexec() */ pd = (LONG *) trap1_pexec(5, NULL, "", NULL); pd[2] = (LONG) entry; pd[3] = pd[5] = pd[7] = 0; /* Run the program with dos_exec() to for AES reentrency issues */ dos_exec(6, NULL, (const BYTE *)pd, NULL); }
static void bootstrap(void) { #if DETECT_NATIVE_FEATURES /* start the kernel provided by the emulator */ PD *pd; LONG length; LONG r; char args[128]; args[0] = '\0'; nf_getbootstrap_args(args, sizeof(args)); /* allocate space */ pd = (PD *) trap1_pexec(PE_BASEPAGE, "mint.prg", args, default_env); /* get the TOS executable from the emulator */ length = nf_bootstrap( (char*)pd->p_lowtpa + sizeof(PD), (long)pd->p_hitpa - pd->p_lowtpa); /* free the allocated space if something is wrong */ if ( length <= 0 ) goto err; /* relocate the loaded executable */ r = trap1_pexec(PE_RELOCATE, (char*)length, pd, ""); if ( r != (LONG)pd ) goto err; /* set the boot drive for the new OS to use */ bootdev = nf_getbootdrive(); /* execute the relocated process */ trap1_pexec(PE_GO, "", pd, ""); err: trap1(0x49, (long)pd->p_env); /* Mfree() the environment */ trap1(0x49, (long)pd); /* Mfree() the process area */ #endif }
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(); }