implemented check if running on EmuTOS
This commit is contained in:
@@ -105,37 +105,48 @@ int main(int argc, char *argv[])
|
|||||||
struct driver_table *dt;
|
struct driver_table *dt;
|
||||||
void *ssp;
|
void *ssp;
|
||||||
void *old_vector;
|
void *old_vector;
|
||||||
|
char **sysbase = (char **) 0x4f2;
|
||||||
|
|
||||||
(void) Cconws("retrieve BaS driver interface\r\n");
|
(void) Cconws("retrieve BaS driver interface\r\n");
|
||||||
|
|
||||||
ssp = (void *) Super(0L);
|
ssp = (void *) Super(0L); /* go to supervisor mode, we are doing dirty tricks */
|
||||||
|
|
||||||
old_vector = Setexc(0x20, my_own_trap0_handler); /* set our own temporarily */
|
/*
|
||||||
dt = get_bas_drivers(); /* trap #1 */
|
* first check if we are on EmuTOS, FireTOS want's to do everything itself
|
||||||
(void) Setexc(0x20, old_vector); /* restore original vector */
|
*/
|
||||||
|
if (* (long *)(*sysbase + 0x2c) == 0x45544f53)
|
||||||
if (dt)
|
|
||||||
{
|
{
|
||||||
struct generic_interface *ifc = &dt->interfaces[0];
|
old_vector = Setexc(0x20, my_own_trap0_handler); /* set our own temporarily */
|
||||||
|
dt = get_bas_drivers(); /* trap #1 */
|
||||||
|
(void) Setexc(0x20, old_vector); /* restore original vector */
|
||||||
|
|
||||||
printf("BaS driver table found at %p, BaS version is %d.%d\r\n", dt,
|
if (dt)
|
||||||
dt->bas_version, dt->bas_revision);
|
|
||||||
|
|
||||||
while (ifc->type != END_OF_DRIVERS)
|
|
||||||
{
|
{
|
||||||
printf("driver \"%s (%s)\" found,\r\n"
|
struct generic_interface *ifc = &dt->interfaces[0];
|
||||||
"interface type is %d (%s),\r\n"
|
|
||||||
"version %d.%d\r\n\r\n",
|
printf("BaS driver table found at %p, BaS version is %d.%d\r\n", dt,
|
||||||
ifc->name, ifc->description, ifc->type, dt_to_str(ifc->type),
|
dt->bas_version, dt->bas_revision);
|
||||||
ifc->version, ifc->revision);
|
|
||||||
if (ifc->type == MCD_DRIVER)
|
while (ifc->type != END_OF_DRIVERS)
|
||||||
{
|
{
|
||||||
setcookie(COOKIE_DMAC, (uint32_t) ifc->interface.dma);
|
printf("driver \"%s (%s)\" found,\r\n"
|
||||||
printf("\r\nDMAC cookie set to %p\r\n", ifc->interface.dma);
|
"interface type is %d (%s),\r\n"
|
||||||
|
"version %d.%d\r\n\r\n",
|
||||||
|
ifc->name, ifc->description, ifc->type, dt_to_str(ifc->type),
|
||||||
|
ifc->version, ifc->revision);
|
||||||
|
if (ifc->type == MCD_DRIVER)
|
||||||
|
{
|
||||||
|
setcookie(COOKIE_DMAC, (uint32_t) ifc->interface.dma);
|
||||||
|
printf("\r\nDMAC cookie set to %p\r\n", ifc->interface.dma);
|
||||||
|
}
|
||||||
|
ifc++;
|
||||||
}
|
}
|
||||||
ifc++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("not running on EmuTOS, exiting\r\n");
|
||||||
|
}
|
||||||
Super(ssp);
|
Super(ssp);
|
||||||
|
|
||||||
while (Cconis()) Cconin(); /* eat keys */
|
while (Cconis()) Cconin(); /* eat keys */
|
||||||
|
|||||||
Reference in New Issue
Block a user