Esempio n. 1
0
/*
 * Initialize the extended trap mechanism.
 */
void init_extended_traps (void)
{
	m68k_call_trapaddr = here ();
	calltrap (deftrap2 (m68k_call_handler, TRAPFLAG_NO_RETVAL, _T("m68k_call")));

	m68k_return_trapaddr = here();
	calltrap (deftrap2 (m68k_return_handler, TRAPFLAG_NO_RETVAL, _T("m68k_return")));

	exit_trap_trapaddr = here();
	calltrap (deftrap2 (exit_trap_handler, TRAPFLAG_NO_RETVAL, _T("exit_trap")));

	uae_sem_init (&trap_mutex, 0, 1);
}
Esempio n. 2
0
void uaeres_install (void)
{
	uae_u32 functable, datatable;
	uae_u32 initcode, getfunc;
	TCHAR tmp[100];

	_stprintf (tmp, L"UAE resource %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
	res_name = ds (L"uae.resource");
	res_id = ds (tmp);

	/* initcode */
	initcode = here ();
	calltrap (deftrap (res_initcode)); dw (RTS);
	/* getfunc */
	getfunc = here ();
	calltrap (deftrap (res_getfunc)); dw (RTS);

	/* FuncTable */
	functable = here ();
	dl (getfunc); /* getfunc */
	dl (0xFFFFFFFF); /* end of table */

	/* DataTable */
	datatable = here ();
	dw (0xE000); /* INITBYTE */
	dw (0x0008); /* LN_TYPE */
	dw (0x0800); /* NT_RESOURCE */
	dw (0xC000); /* INITLONG */
	dw (0x000A); /* LN_NAME */
	dl (res_name);
	dw (0xE000); /* INITBYTE */
	dw (0x000E); /* LIB_FLAGS */
	dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
	dw (0xD000); /* INITWORD */
	dw (0x0014); /* LIB_VERSION */
	dw (UAEMAJOR);
	dw (0xD000); /* INITWORD */
	dw (0x0016); /* LIB_REVISION */
	dw (UAEMINOR);
	dw (0xC000); /* INITLONG */
	dw (0x0018); /* LIB_IDSTRING */
	dl (res_id);
	dw (0x0000); /* end of table */

	res_init = here ();
	dl (SIZEOF_LIBRARY + 16); /* size of device base */
	dl (functable);
	dl (datatable);
	dl (initcode);
}
Esempio n. 3
0
int main (int argc, char **argv)
{
    struct timerequest *timereq = 0;
    struct MsgPort *timeport;
    int result = calltrap (0, 0);

    if (result == 1)
	fprintf (stderr, "timehack already running.\n");
    else if (result == 2)
	fprintf (stderr, "timehack not supported with this version of UAE.\n");
    if (result != 0)
	exit (5);

    timeport = CreatePort (0, 0);
    if (timeport)
	timereq = CreateStdIO(timeport);

    if (timereq == 0)
	goto fail;

    if (OpenDevice ("timer.device", UNIT_VBLANK, timereq, 0) != 0)
	goto fail;

    SetTaskPri (FindTask (NULL), 20); /* same as input.device */
    for (;;) {
        struct timeval cur_sys_time;

        timereq->tr_node.io_Command = TR_GETSYSTIME;
        DoIO(timereq);
        cur_sys_time = timereq->tr_time;
        calltrap (1, &timereq->tr_time);
        if (timereq->tr_time.tv_secs > cur_sys_time.tv_secs
	    || (timereq->tr_time.tv_secs == cur_sys_time.tv_secs
		&& timereq->tr_time.tv_micro > cur_sys_time.tv_micro))
	{
            timereq->tr_node.io_Command = TR_SETSYSTIME;
            DoIO(timereq);
        }

        timereq->tr_time.tv_secs = 1;
	timereq->tr_time.tv_micro = 0;
        timereq->tr_node.io_Command = TR_ADDREQUEST;
	DoIO(timereq);
    }
    fail:
    fprintf (stderr, "Couldn't start timehack (that's bad!)\n");
    exit (5);
}
Esempio n. 4
0
uaecptr libemu_InstallFunctionFlags (TrapFunction f, uaecptr libbase, int offset,
				     int flags, const char *tracename)
{
    int i;
    uaecptr retval;
    uaecptr execbase = get_long (four);
    int trnum;
    uaecptr addr = here();
    calltrap (trnum = deftrap2 (f, flags, tracename));
    dw (RTS);

    _68k_areg(1) = libbase;
    _68k_areg(0) = offset;
    _68k_dreg(0) = addr;
    retval = CallLib (execbase, -420);

    trapoldfunc[trnum] = retval;
#if 0
    for (i = 0; i < n_libpatches; i++) {
	if (libpatches[i].libbase == libbase)
	    break;
    }
    if (i == n_libpatches) {
	int j;
	libpatches[i].libbase = libbase;
	for (j = 0; j < 300; j++)
	    libpatches[i].functions[j] = NULL;
	n_libpatches++;
    }
    libpatches[i].functions[-offset/6] = f;
#endif
    return retval;
}
Esempio n. 5
0
static int initint (TrapContext *ctx)
{
	uae_u32 tmp1;
	uaecptr p;

	if (irq_init)
		return 1;
	m68k_dreg (regs, 0) = 26;
	m68k_dreg (regs, 1) = 65536 + 1;
	p = CallLib (ctx, get_long (4), -0xC6); /* AllocMem */
	if (!p)
		return 0;
	tmp1 = here ();
	calltrap (deftrap2 (uaenet_int_handler, TRAPFLAG_EXTRA_STACK, _T("uaenet_int_handler")));
	put_word (p + 8, 0x020a);
	put_long (p + 10, ROM_netdev_resid);
	put_long (p + 18, tmp1);
	m68k_areg (regs, 1) = p;
	m68k_dreg (regs, 0) = 3; /* PORTS */
	dw (0x4a80); /* TST.L D0 */
	dw (0x4e75); /* RTS */
	CallLib (ctx, get_long (4), -168); /* AddIntServer */
	irq_init = 1;
	return 1;
}
Esempio n. 6
0
/*
 * Initialize the extended trap mechanism.
 */
void init_extended_traps (void)
{
    m68k_call_trapaddr = here ();
    calltrap (deftrap2 ((TrapHandler)m68k_call_handler, TRAPFLAG_NO_RETVAL, "m68k_call"));

    m68k_return_trapaddr = here();
    calltrap (deftrap2 ((TrapHandler)m68k_return_handler, TRAPFLAG_NO_RETVAL, "m68k_return"));

    exit_trap_trapaddr = here();
    calltrap (deftrap2 ((TrapHandler)exit_trap_handler, TRAPFLAG_NO_RETVAL, "exit_trap"));

    if(trap_mutex != 0)
      uae_sem_destroy(&trap_mutex);
    trap_mutex = 0;
    uae_sem_init (&trap_mutex, 0, 1);
}
Esempio n. 7
0
/*
 * Installs the UAE LIBRARY
 */
void emulib_install (void)
{
    uaecptr a = here ();
    org (RTAREA_BASE + 0xFF60);
//    dw (0x4eb9);
//    dw ((RTAREA_BASE >> 16) | get_word (RTAREA_BASE + 36));
//    dw (get_word (RTAREA_BASE + 38) + 12);
    calltrap (define_trap (uaelib_demux, 0, ""));
    dw (RTS);
    org (a);
}
Esempio n. 8
0
/*
 * Install the server
 */
void uaeexe_install (void)
{
	uaecptr loop;

	if (!uae_boot_rom)
		return;
	loop = here ();
	org (UAEEXE_ORG);
	calltrap (deftrapres (uaeexe_server, 0, _T("uaeexe_server")));
	dw (RTS);
	org (loop);
}
Esempio n. 9
0
void rtarea_init (void)
{
    rtarea_init_mem ();

#ifdef USE_AUTOCONFIG
    uae_u32 a;
    char uaever[32];
    snprintf (uaever, 32, "uae-%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);

    EXPANSION_uaeversion = ds (uaever);
    EXPANSION_explibname = ds ("expansion.library");
    EXPANSION_doslibname = ds ("dos.library");
    EXPANSION_uaedevname = ds ("uae.device");

    deftrap (NULL); /* Generic emulator trap */
    lasttrap = 0;

    EXPANSION_nullfunc = here ();
    calltrap (deftrap (nullfunc));
    dw (RTS);

    a = here();
    /* Standard "return from 68k mode" trap */
    org (RTAREA_BASE + 0xFF00);
    calltrap (deftrap2 (m68k_mode_return, TRAPFLAG_NO_RETVAL, ""));

    org (RTAREA_BASE + 0xFF80);
    calltrap (deftrap2 (getchipmemsize, TRAPFLAG_DORET, ""));

    org (RTAREA_BASE + 0xFF10);
    calltrap (deftrap2 (uae_puts, TRAPFLAG_NO_RETVAL, ""));
    dw (RTS);

    org (a);
#endif
    
    filesys_install_code ();
}
Esempio n. 10
0
static void uae_library_install (struct uae_library *library)
{
	library->aptr_name = ds (library->name);
	library->aptr_id = ds (library->id);

    for (uae_library_trap_def *t = library->traps; t->function; t++) {
        t->aptr = here ();
        calltrap (deftrap2 (t->function, t->flags, _T("")));
        dw (RTS);
    }

	library->aptr_func_table = here ();
    for (uae_library_trap_def *t = library->traps + 1; t->function; t++) {
        dl (t->aptr);
    }
	dl (0xFFFFFFFF); // end of table

	library->aptr_data_table = here ();
	dw (0xE000);     // INITBYTE
	dw (0x0008);     // LN_TYPE
	dw (0x0900);     // NT_LIBRARY
	dw (0xE000);     // INITBYTE
	dw (0x0009);     // LN_PRI
	dw (0xCE00);     // -50
	dw (0xC000);     // INITLONG
	dw (0x000A);     // LN_NAME
	dl (library->aptr_name);
	dw (0xE000);     // INITBYTE
	dw (0x000E);     // LIB_FLAGS
	dw (0x0600);     // LIBF_SUMUSED | LIBF_CHANGED
	dw (0xD000);     // INITWORD
	dw (0x0014);     // LIB_VERSION
	dw (library->version);
	dw (0xD000);
	dw (0x0016);     // LIB_REVISION
	dw (library->revision);
	dw (0xC000);
	dw (0x0018);     // LIB_IDSTRING
	dl (library->aptr_id);
	dl (0x00000000); // end of table

	library->aptr_init = here ();
	dl (SIZEOF_LIBRARY + library->data_size);
	dl (library->aptr_func_table);
	dl (library->aptr_data_table);
	dl (library->traps[0].aptr);

    write_log (_T("%s installed (%s)\n"),
               library->name, MODULE_SUFFIX);
}
Esempio n. 11
0
void initparallel (void) {
    write_log("initparallel uae_boot_rom = %d\n", uae_boot_rom);
#ifdef AHI
    if (uae_boot_rom) {
        write_log("installing ahi_winuae\n");
        uaecptr a = here (); //this install the ahisound
        org (rtarea_base + 0xFFC0);
        calltrap (deftrapres (ahi_demux, 0, _T("ahi_winuae")));
        dw (RTS);
        org (a);
#ifdef AHI_V2
        init_ahi_v2 ();
#endif
    }
#endif
}
Esempio n. 12
0
/* initial entry of SegmentTracker: on first startup of UAE register some
   traps for the patched functions */
void segtracker_install (void)
{
    write_log("segtracker: install\n");

    // setup init trap to setup patches
    init_addr = here ();
    calltrap (deftrap2 (segtracker_init, TRAPFLAG_EXTRA_STACK, _T("segtracker_init")));
    dw (RTS);

    // exec
    patch_func_init_post_call(OpenLibrary, &pf_OpenLibrary,
                              TRAPFLAG_EXTRA_STACK, PATCH_SAVE_NONE);
    // dos
    patch_func_init_post_call(LoadSeg, &pf_LoadSeg, 0, PATCH_SAVE_D1_RESTORE_A0);
    patch_func_init_post_call(NewLoadSeg, &pf_NewLoadSeg, 0, PATCH_SAVE_D1_RESTORE_A0);
    patch_func_init_pre_call(UnLoadSeg, &pf_UnLoadSeg, 0);
}
Esempio n. 13
0
uaecptr libemu_InstallFunctionFlags (TrapFunction f, uaecptr libbase, int offset,
				     int flags, const char *tracename)
{
    int i;
    uaecptr retval;
    uaecptr execbase = get_long (four);
    int trnum;
    uaecptr addr = here();
    calltrap (trnum = deftrap2 (f, flags, tracename));
    dw (RTS);

    _68k_areg(1) = libbase;
    _68k_areg(0) = offset;
    _68k_dreg(0) = addr;
    retval = CallLib (execbase, -420);

    trapoldfunc[trnum] = retval;
    return retval;
}
Esempio n. 14
0
void netdev_install (void)
{
	uae_u32 functable, datatable;
	uae_u32 initcode, openfunc, closefunc, expungefunc;
	uae_u32 beginiofunc, abortiofunc;

	if (!currprefs.sana2)
		return;
	if (log_net)
		write_log (_T("netdev_install(): 0x%x\n"), here ());

	ethernet_enumerate_free ();
	ethernet_enumerate (td, NULL);

	ROM_netdev_resname = ds (getdevname());
	ROM_netdev_resid = ds (_T("UAE net.device 0.2"));
	timerdevname = ds (_T("timer.device"));

	/* initcode */
	initcode = here ();
	calltrap (deftrap2 (dev_init, TRAPFLAG_EXTRA_STACK, _T("uaenet.init"))); dw (RTS);

	/* Open */
	openfunc = here ();
	calltrap (deftrap2 (dev_open, TRAPFLAG_EXTRA_STACK, _T("uaenet.open"))); dw (RTS);

	/* Close */
	closefunc = here ();
	calltrap (deftrap2 (dev_close, TRAPFLAG_EXTRA_STACK, _T("uaenet.close"))); dw (RTS);

	/* Expunge */
	expungefunc = here ();
	calltrap (deftrap2 (dev_expunge, TRAPFLAG_EXTRA_STACK, _T("uaenet.expunge"))); dw (RTS);

	/* BeginIO */
	beginiofunc = here ();
	calltrap (deftrap2 (dev_beginio, TRAPFLAG_EXTRA_STACK, _T("uaenet.beginio"))); dw (RTS);

	/* AbortIO */
	abortiofunc = here ();
	calltrap (deftrap2 (dev_abortio, TRAPFLAG_EXTRA_STACK, _T("uaenet.abortio"))); dw (RTS);

	/* FuncTable */
	functable = here ();
	dl (openfunc); /* Open */
	dl (closefunc); /* Close */
	dl (expungefunc); /* Expunge */
	dl (EXPANSION_nullfunc); /* Null */
	dl (beginiofunc); /* BeginIO */
	dl (abortiofunc); /* AbortIO */
	dl (0xFFFFFFFFul); /* end of table */

	/* DataTable */
	datatable = here ();
	dw (0xE000); /* INITBYTE */
	dw (0x0008); /* LN_TYPE */
	dw (0x0300); /* NT_DEVICE */
	dw (0xC000); /* INITLONG */
	dw (0x000A); /* LN_NAME */
	dl (ROM_netdev_resname);
	dw (0xE000); /* INITBYTE */
	dw (0x000E); /* LIB_FLAGS */
	dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
	dw (0xD000); /* INITWORD */
	dw (0x0014); /* LIB_VERSION */
	dw (0x0004); /* 0.4 */
	dw (0xD000); /* INITWORD */
	dw (0x0016); /* LIB_REVISION */
	dw (0x0000); /* end of table already ??? */
	dw (0xC000); /* INITLONG */
	dw (0x0018); /* LIB_IDSTRING */
	dl (ROM_netdev_resid);
	dw (0x0000); /* end of table */

	ROM_netdev_init = here ();
	dl (0x00000100); /* size of device base */
	dl (functable);
	dl (datatable);
	dl (initcode);

	nscmd_cmd = here ();
	dw (CMD_READ);
	dw (CMD_WRITE);
	dw (CMD_FLUSH);
	dw (S2_DEVICEQUERY);
	dw (S2_GETSTATIONADDRESS);
	dw (S2_CONFIGINTERFACE);
	dw (S2_ADDMULTICASTADDRESS);
	dw (S2_DELMULTICASTADDRESS);
	dw (S2_MULTICAST);
	dw (S2_BROADCAST);
	dw (S2_TRACKTYPE);
	dw (S2_UNTRACKTYPE);
	dw (S2_GETTYPESTATS);
	dw (S2_GETSPECIALSTATS);
	dw (S2_GETGLOBALSTATS);
	dw (S2_ONEVENT);
	dw (S2_READORPHAN);
	dw (S2_ONLINE);
	dw (S2_OFFLINE);
	dw (S2_ADDMULTICASTADDRESSES);
	dw (S2_DELMULTICASTADDRESSES);
	dw (NSCMD_DEVICEQUERY);
	dw (0);

}
Esempio n. 15
0
void uaeserialdev_install (void)
{
	uint32_t functable, datatable;
	uint32_t initcode, openfunc, closefunc, expungefunc;
	uint32_t beginiofunc, abortiofunc;

	if (!currprefs.uaeserial)
		return;

	ROM_uaeserialdev_resname = ds (_T("uaeserial.device"));
	ROM_uaeserialdev_resid = ds (_T("UAE serial.device 0.1"));

	/* initcode */
	initcode = here ();
	calltrap (deftrap (dev_init)); dw (RTS);

	/* Open */
	openfunc = here ();
	calltrap (deftrap (dev_open)); dw (RTS);

	/* Close */
	closefunc = here ();
	calltrap (deftrap (dev_close)); dw (RTS);

	/* Expunge */
	expungefunc = here ();
	calltrap (deftrap (dev_expunge)); dw (RTS);

	/* BeginIO */
	beginiofunc = here ();
	calltrap (deftrap (dev_beginio)); dw (RTS);

	/* AbortIO */
	abortiofunc = here ();
	calltrap (deftrap (dev_abortio)); dw (RTS);

	/* FuncTable */
	functable = here ();
	dl (openfunc); /* Open */
	dl (closefunc); /* Close */
	dl (expungefunc); /* Expunge */
	dl (EXPANSION_nullfunc); /* Null */
	dl (beginiofunc); /* BeginIO */
	dl (abortiofunc); /* AbortIO */
	dl (0xFFFFFFFFul); /* end of table */

	/* DataTable */
	datatable = here ();
	dw (0xE000); /* INITBYTE */
	dw (0x0008); /* LN_TYPE */
	dw (0x0300); /* NT_DEVICE */
	dw (0xC000); /* INITLONG */
	dw (0x000A); /* LN_NAME */
	dl (ROM_uaeserialdev_resname);
	dw (0xE000); /* INITBYTE */
	dw (0x000E); /* LIB_FLAGS */
	dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
	dw (0xD000); /* INITWORD */
	dw (0x0014); /* LIB_VERSION */
	dw (0x0004); /* 0.4 */
	dw (0xD000); /* INITWORD */
	dw (0x0016); /* LIB_REVISION */
	dw (0x0000);
	dw (0xC000); /* INITLONG */
	dw (0x0018); /* LIB_IDSTRING */
	dl (ROM_uaeserialdev_resid);
	dw (0x0000); /* end of table */

	ROM_uaeserialdev_init = here ();
	dl (0x00000100); /* size of device base */
	dl (functable);
	dl (datatable);
	dl (initcode);

	nscmd_cmd = here ();
	dw (NSCMD_DEVICEQUERY);
	dw (CMD_RESET);
	dw (CMD_READ);
	dw (CMD_WRITE);
	dw (CMD_CLEAR);
	dw (CMD_START);
	dw (CMD_STOP);
	dw (CMD_FLUSH);
	dw (SDCMD_BREAK);
	dw (SDCMD_SETPARAMS);
	dw (SDCMD_QUERY);
	dw (0);
}
Esempio n. 16
0
int main (int argc, char **argv)
{
    struct timerequest *timereq = 0;
    struct MsgPort *timeport;
    struct timeval *tz_offset;
    struct Device *TimerBase;
    int quit = 0;
    int result = calltrap (0, 0);

    if (result == 1)
        fputs ("timehack already running.\n", stderr);
    else if (result == 2)
        fputs ("timehack not supported with this version of UAE.\n", stderr);
    if (result != 0)
        exit (5);

    timeport = (struct MsgPort *) CreatePort (0, 0);
    if (timeport)
        timereq = (struct timerequest *) CreateStdIO(timeport);

    if (timereq == 0)
        goto fail;

    if (OpenDevice ("timer.device", UNIT_VBLANK, (struct IORequest *) timereq, 0) != 0)
        goto fail;
    TimerBase = timereq->tr_node.io_Device;

    SetTaskPri (FindTask (NULL), 20); /* same as input.device */

    tz_offset = get_tz_offset();

    while (!quit) {
        struct timeval cur_sys_time;

        timereq->tr_node.io_Command = TR_GETSYSTIME;
        DoIO ((struct IORequest *)timereq);
        cur_sys_time = timereq->tr_time;
        calltrap (1, &timereq->tr_time);
        if (timereq->tr_time.tv_secs != cur_sys_time.tv_secs
                || (timereq->tr_time.tv_secs == cur_sys_time.tv_secs
                    && ABS(timereq->tr_time.tv_micro - cur_sys_time.tv_micro) > 1000))
        {
            AddTime (&timereq->tr_time, tz_offset);
            timereq->tr_node.io_Command = TR_SETSYSTIME;
            DoIO ((struct IORequest *)timereq);
        }

        timereq->tr_time.tv_secs = 1;
        timereq->tr_time.tv_micro = 0;
        timereq->tr_node.io_Command = TR_ADDREQUEST;
        DoIO ((struct IORequest *)timereq);

        if (SetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
            quit = TRUE;
    }
    /* Exit and error handling badly needs tidying up - Rich */
    CloseDevice ((struct IORequest *)timereq);
    DeleteStdIO ((struct IOStdReq *)timereq);
    DeletePort (timeport);
    exit (0);

fail:
    fputs ("Couldn't start timehack (that's bad!)\n", stderr);
    exit (5);
}
Esempio n. 17
0
void scsidev_install (void)
{
    uae_u32 functable, datatable;
    uae_u32 initcode, openfunc, closefunc, expungefunc;
    uae_u32 beginiofunc, abortiofunc;

    if (!currprefs.scsi)
	return;
    if (log_scsi)
	write_log ("scsidev_install(): 0x%x\n", here ());

    ROM_scsidev_resname = ds (UAEDEV_SCSI);
    ROM_scsidev_resid = ds ("UAE scsi.device 0.2");

    /* initcode */
    initcode = here ();
    calltrap (deftrap (dev_init)); dw (RTS);

    /* Open */
    openfunc = here ();
    calltrap (deftrap (dev_open)); dw (RTS);

    /* Close */
    closefunc = here ();
    calltrap (deftrap (dev_close)); dw (RTS);

    /* Expunge */
    expungefunc = here ();
    calltrap (deftrap (dev_expunge)); dw (RTS);

    /* BeginIO */
    beginiofunc = here ();
    calltrap (deftrap (dev_beginio));
    dw (RTS);

    /* AbortIO */
    abortiofunc = here ();
    calltrap (deftrap (dev_abortio)); dw (RTS);

    /* FuncTable */
    functable = here ();
    dl (openfunc); /* Open */
    dl (closefunc); /* Close */
    dl (expungefunc); /* Expunge */
    dl (EXPANSION_nullfunc); /* Null */
    dl (beginiofunc); /* BeginIO */
    dl (abortiofunc); /* AbortIO */
    dl (0xFFFFFFFFul); /* end of table */

    /* DataTable */
    datatable = here ();
    dw (0xE000); /* INITBYTE */
    dw (0x0008); /* LN_TYPE */
    dw (0x0300); /* NT_DEVICE */
    dw (0xC000); /* INITLONG */
    dw (0x000A); /* LN_NAME */
    dl (ROM_scsidev_resname);
    dw (0xE000); /* INITBYTE */
    dw (0x000E); /* LIB_FLAGS */
    dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
    dw (0xD000); /* INITWORD */
    dw (0x0014); /* LIB_VERSION */
    dw (0x0004); /* 0.4 */
    dw (0xD000); /* INITWORD */
    dw (0x0016); /* LIB_REVISION */
    dw (0x0000); /* end of table already ??? */
    dw (0xC000); /* INITLONG */
    dw (0x0018); /* LIB_IDSTRING */
    dl (ROM_scsidev_resid);
    dw (0x0000); /* end of table */

    ROM_scsidev_init = here ();
    dl (0x00000100); /* size of device base */
    dl (functable);
    dl (datatable);
    dl (initcode);

    diskdev_install ();
}
Esempio n. 18
0
void hardfile_install (void)
{
    uae_u32 functable, datatable;
    uae_u32 initcode, openfunc, closefunc, expungefunc;
    uae_u32 beginiofunc, abortiofunc;

    ROM_hardfile_resname = ds ("uaehf.device");
    ROM_hardfile_resid = ds ("UAE hardfile.device 0.2");

    /* initcode */
    initcode = filesys_initcode;

    /* Open */
    openfunc = here ();
    calltrap (deftrap (hardfile_open)); dw (RTS);

    /* Close */
    closefunc = here ();
    calltrap (deftrap (hardfile_close)); dw (RTS);

    /* Expunge */
    expungefunc = here ();
    calltrap (deftrap (hardfile_expunge)); dw (RTS);

    /* BeginIO */
    beginiofunc = here ();
    calltrap (deftrap (hardfile_beginio));
    dw (0x48E7); dw (0x8002); /* movem.l d0/a6,-(a7) */
    dw (0x0829); dw (0); dw (30); /* btst #0,30(a1) */
    dw (0x6608); /* bne.b +8 */
    dw (0x2C78); dw (0x0004); /* move.l 4,a6 */
    dw (0x4EAE); dw (-378); /* jsr ReplyMsg(a6) */
    dw (0x4CDF); dw (0x4001); /* movem.l (a7)+,d0/a6 */
    dw (RTS);

    /* AbortIO */
    abortiofunc = here ();
    calltrap (deftrap (hardfile_abortio)); dw (RTS);

    /* FuncTable */
    functable = here ();
    dl (openfunc); /* Open */
    dl (closefunc); /* Close */
    dl (expungefunc); /* Expunge */
    dl (EXPANSION_nullfunc); /* Null */
    dl (beginiofunc); /* BeginIO */
    dl (abortiofunc); /* AbortIO */
    dl (0xFFFFFFFFul); /* end of table */

    /* DataTable */
    datatable = here ();
    dw (0xE000); /* INITBYTE */
    dw (0x0008); /* LN_TYPE */
    dw (0x0300); /* NT_DEVICE */
    dw (0xC000); /* INITLONG */
    dw (0x000A); /* LN_NAME */
    dl (ROM_hardfile_resname);
    dw (0xE000); /* INITBYTE */
    dw (0x000E); /* LIB_FLAGS */
    dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
    dw (0xD000); /* INITWORD */
    dw (0x0014); /* LIB_VERSION */
    dw (0x0004); /* 0.4 */
    dw (0xD000);
    dw (0x0016); /* LIB_REVISION */
    dw (0x0000);
    dw (0xC000);
    dw (0x0018); /* LIB_IDSTRING */
    dl (ROM_hardfile_resid);
    dw (0x0000); /* end of table */

    ROM_hardfile_init = here ();
    dl (0x00000100); /* ??? */
    dl (functable);
    dl (datatable);
    dl (initcode);
}