1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/*
* The ARAnyM BetaDOS driver.
*
* 2001/2002 STan
*
* Based on:
* @(#)cookiefs/dosmain.c
*
* Copyright (c) Julian F. Reschke, 28. November 1995
* All rights reserved.
*
**/
#include <mintbind.h>
#include <mint/basepage.h>
#include <stdlib.h>
#include <string.h>
#include "mintfake.h"
#define DEVNAME "DEV.DOS Filesystem"
#define VERSION "0.1"
#if 0
#include "nfd.h"
#define TRACE(x) NFD(x)
#define DEBUG(x) NFD(x)
#else
#define TRACE(x)
#define DEBUG(x)
#endif
char DriverName[] = DEVNAME" "VERSION;
long ldp;
void __CDECL ShowBanner( void );
void* __CDECL InitDevice( long bosDevID, long dosDevID );
unsigned long get_cookie (unsigned long tag);
/* Diverse Utility-Funktionen */
static int Bconws( char *str )
{
int cnt = 0;
while (*str) {
cnt++;
if (*str == '\n') {
Bconout (2, '\r');
cnt++;
}
Bconout (2, *str++);
}
return cnt;
}
void __CDECL ShowBanner( void )
{
Bconws (
"\n\033p "DEVNAME" "VERSION" \033q "
"\nCopyright (c) ARAnyM Development Team, "__DATE__"\n"
);
}
struct cookie
{
long tag;
long value;
};
unsigned long get_cookie (unsigned long tag)
{
struct cookie *cookie = *(struct cookie **)0x5a0;
if (!cookie) return 0;
while (cookie->tag) {
if (cookie->tag == tag) return cookie->value;
cookie++;
}
return 0;
}
/* FIXME: from bosmeta.c */
int bosfs_initialize();
void* __CDECL InitDevice( long bosDevID, long dosDevID )
{
if (get_cookie(0x4D694E54L /*'MiNT'*/))
{
return (void*)-1;
}
/*
* We _must_ use the bosDevID to define the drive letter here
* because MetaDOS (in contrary to BetaDOS) does not provide
* the dosDevID
*/
DEBUG(("InitDevice: [dosDev=%ld, bosDev=%ld]", dosDevID, bosDevID ));
if ( bosfs_initialize() < 0 )
{
return (void*)-1;
}
return &ldp;
}
|