void ersatz_perform (uint16_t what) { switch (what) { case EOP_INIT: ersatz_init (); break; case EOP_SERVEINT: { uint16_t intreq = get_word (0xDFF01E); /* Just reset all the interrupt request bits */ if (intreq & 0x0008) get_byte (0xbfed01); /* possible keyboard interrupt */ put_word (0xDFF09C, intreq & 0x3FFF); break; } case EOP_DOIO: ersatz_doio (); break; case EOP_AVAILMEM: m68k_dreg (regs, 0) = m68k_dreg (regs, 1) & 4 ? 0 : 0x70000; break; case EOP_ALLOCMEM: m68k_dreg (regs, 0) = m68k_dreg (regs, 1) & 4 ? 0 : 0x0F000; break; case EOP_ALLOCABS: m68k_dreg (regs, 0) = m68k_areg (regs, 1); break; case EOP_NIMP: write_log (_T("Unimplemented Kickstart function called\n")); ersatz_failed (); /* fall through */ case EOP_LOOP: m68k_setpc (0xF80010); break; case EOP_OPENLIB: default: write_log (_T("Internal error. Giving up.\n")); ersatz_failed (); } }
static void ersatz_doio (void) { uaecptr request = m68k_areg(®s, 1); switch (get_word (request + 0x1C)) { case 9: /* TD_MOTOR is harmless */ return; case 2: case 0x8002: /* READ commands */ break; default: write_log ("Only CMD_READ supported in DoIO()\n"); ersatz_failed (); } { uaecptr dest = get_long (request + 0x28); int start = get_long (request + 0x2C) / 512; int nsecs = get_long (request + 0x24) / 512; int tr = start / 11; int sec = start % 11; while (nsecs--) { DISK_ersatz_read (tr, sec, dest); dest += 512; if (++sec == 11) sec = 0, tr++; } } }
void ersatz_perform (uae_u16 what) { switch (what) { case EOP_INIT: ersatz_init (); break; case EOP_SERVEINT: /* Just reset all the interrupt request bits */ put_word (0xDFF09C, get_word (0xDFF01E) & 0x3FFF); break; case EOP_DOIO: ersatz_doio (); break; case EOP_AVAILMEM: m68k_dreg (regs, 0) = m68k_dreg (regs, 1) & 4 ? 0 : 0x70000; break; case EOP_ALLOCMEM: m68k_dreg (regs, 0) = m68k_dreg (regs, 1) & 4 ? 0 : 0x0F000; break; case EOP_ALLOCABS: m68k_dreg (regs, 0) = m68k_areg (regs, 1); break; case EOP_NIMP: printf ("Unimplemented Kickstart function called\n"); ersatz_failed (); break; /* fall through */ case EOP_LOOP: m68k_setpc (0xF80010); break; case EOP_OPENLIB: default: printf ("Internal error. Giving up.\n"); ersatz_failed (); break; } }