XXX AmigaOS:
DH0:
XXX MACD_10:
CD0:
@Ponki1986, post #1
/* diskfromvolume.e */
OPT PREPROCESS
MODULE 'dos/dos',
'dos/dosextens',
'dos',
'dos/filehandler'
ENUM ERR_NONE, ERR_KICK, ERR_LOCK, ERR_MEM, ERR_DEVICE_NOT_FOUND,ERR_ARGS
RAISE ERR_MEM IF String()=NIL,
ERR_KICK IF KickVersion()=FALSE,
ERR_LOCK IF Lock()=NIL,
ERR_ARGS IF ReadArgs()=NIL
DEF lock=NIL,
dosinfo=NIL:PTR TO dosinfo,
dos=NIL:PTR TO doslibrary,
dvi=NIL:PTR TO devinfo,
fl=NIL:PTR TO filelock,
process=NIL:PTR TO process,
bstr=NIL,
bstrLen=0,
strName=NIL,
readargs=NIL,
rargs[2]:ARRAY OF LONG
PROC main () HANDLE
KickVersion(37)
readargs:=ReadArgs('VOLUME/A', rargs, NIL)
/* wylaczenie requesterow w przypadku gdy zostanie podany bledny label */
process:=FindTask(NIL)
process.windowptr:=-1
lock := Lock(rargs[0], SHARED_LOCK)
fl:= BADDR(lock)
dos:=dosbase
dosinfo:=BADDR(dos.root.info)
dvi := BADDR(dosinfo.devinfo)
WHILE (dvi)
IF (dvi.type = DLT_DEVICE AND dvi.task = fl.task)
bstr:= BADDR(dvi.name)
bstrLen := bstr[0]
strName := String (bstrLen +1 )
StrCopy (strName, bstr +1 , bstrLen)
StrAdd(strName, ':')
ENDIF
dvi:=BADDR(dvi.next)
ENDWHILE
UnLock(lock)
IF (strName)
WriteF('\s\n', strName)
DisposeLink(strName)
ELSE
Raise( ERR_DEVICE_NOT_FOUND)
ENDIF
EXCEPT DO
SELECT exception
CASE ERR_KICK
WriteF('Requires at least V37\n')
CASE ERR_MEM
WriteF('Not enough memory\n')
CASE ERR_LOCK
WriteF('Can not lock volume \s\n', rargs[0])
CASE ERR_DEVICE_NOT_FOUND
WriteF('Device for volume \s not found\n', rargs[0])
CASE ERR_ARGS
WriteF('Bad args\n')
ENDSELECT
IF readargs THEN FreeArgs(readargs)
CleanUp(exception)
ENDPROC @Norbert, post #7
Program działa i robi nawet wiecej.
Chyba że to było zamierzone
Wystarczy jako argument podać istniejącą ścieżkę dostępu do pliku lub katalogu, a wynikiem będzie nazwa dysku.
@Norbert, post #11
@Ponki1986, post #12

@Ponki1986, post #1
@Ponki1986, post #12
uaectrl 0
/***********************************************************
* UAE - The U*nix Amiga Emulator *
* *
* UAE-Ctrl -- Emulator Control from Inside Emulation *
* (c) 1996 Tauno Taipaleenmaki <tataipal@raita.oulu.fi> *
* *
* Version 0.1 *
* *
* Command line version, Should work with any KS version *
* *
***********************************************************/
#include <clib/exec_protos.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "uae-control.h"
#include "uae_pragmas.h"
#define MAX_DRV_NAME 20
struct UAE_CONFIG config;
void print_drive_status(void);
void quit_program(int error, char *text);
/************************************
* Main program *
************************************/
int main()
{
int quit = 0,i, correct,number;
char buf[257];
char *langs[]={
"US\0","DE\0","SE\0","FR\0","IT\0",
};
/* Read UAE configuration */
i = GetUaeConfig( &config );
while( quit == 0 ) {
printf(" UAE-Control v0.1\n\n");
printf(" 1) Reset\n");
printf(" 2) Debug\n");
printf(" 3) Exit Emulator\n");
printf(" 4) Change framerate (Currently : %ld)\n", config.framerate);
printf(" 5) Toggle sound (Currently : %s)\n", config.do_output_sound ? "ON" : "OFF");
printf(" 6) Toggle fake joystick (Currently : %s)\n", config.do_fake_joystick ? "ON" : "OFF");
printf(" 7) Change language (Currently : %s)\n", langs[config.keyboard]);
printf(" 8) Eject a disk\n");
printf(" 9) Insert a disk\n");
printf("10) Exit UAE-Control\n\n");
correct = 0;
while( correct == 0 ) {
printf(" Command : ");
gets( buf );
i = atoi( buf );
if ((i > 0) && (i < 11))
correct = 1;
}
switch( i ) {
case 1:
HardReset();
break;
case 2:
DebugFunc();
break;
case 3:
ExitEmu();
break;
case 4:
printf(" Enter new framerate (1-20) :");
gets( buf );
number = atoi( buf );
if (SetFrameRate (number))
GetUaeConfig(&config);
else
printf(" Illegal value, not changed.\n");
break;
case 5:
if (config.do_output_sound)
DisableSound();
else
EnableSound();
GetUaeConfig( &config );
break;
case 6:
if (config.do_fake_joystick)
DisableJoystick();
else
EnableJoystick();
GetUaeConfig( &config );
break;
case 7:
printf(" 1 = US, 2 = DE, 3 = SE, 4 = FR, 5 = IT\n");
printf(" What will it be : ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <= 5)) {
ChangeLanguage( number-1 );
GetUaeConfig( &config );
} else {
printf(" Illegal value, not changed.\n");
}
break;
case 8:
print_drive_status();
printf(" Eject which drive (1-4): ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <=4 )) {
EjectDisk( number-1 );
GetUaeConfig( &config );
} else {
printf(" Illegal drive, not changed.\n");
}
break;
case 9:
print_drive_status();
printf(" Enter disk to drive (1-4): ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <= 4)) {
printf("Name of diskfile :");
gets( buf );
InsertDisk( (UBYTE *)&buf, number - 1 );
GetUaeConfig( &config );
} else {
printf(" Illegal drive, not changed.\n");
}
break;
case 10:
quit = 1;
break;
}
}
quit_program(0, "");
return(0);
}
/******************************************
* Prints drive status *
******************************************/
void print_drive_status(void)
{
printf(" DF0 : %s\n", config.disk_in_df0 ? config.df0_name : "EMPTY");
printf(" DF1 : %s\n", config.disk_in_df1 ? config.df1_name : "EMPTY");
printf(" DF2 : %s\n", config.disk_in_df2 ? config.df2_name : "EMPTY");
printf(" DF3 : %s\n", config.disk_in_df3 ? config.df3_name : "EMPTY");
}
/******************************************
* Quits the program *
******************************************/
void quit_program(int error, char *text)
{
if (error > 0) {
printf(" UAE-Control v0.1\n");
printf(" (c)1996 Tauno Taipaleenmaki\n\n");
printf(" ERROR: %s\n", text);
}
}