--- uae/src/ersatz.c 2018/04/24 16:39:55 1.1.1.3 +++ uae/src/ersatz.c 2018/04/24 16:40:50 1.1.1.4 @@ -12,6 +12,7 @@ #include "config.h" #include "options.h" +#include "uae.h" #include "memory.h" #include "custom.h" #include "readcpu.h" @@ -28,6 +29,7 @@ #define EOP_AVAILMEM 5 #define EOP_ALLOCMEM 6 #define EOP_ALLOCABS 7 +#define EOP_LOOP 8 void init_ersatz_rom (uae_u8 *data) { @@ -43,22 +45,25 @@ void init_ersatz_rom (uae_u8 *data) *data++ = 0x00; *data++ = EOP_NIMP; *data++ = 0xFF; *data++ = 0x0D; + *data++ = 0x00; *data++ = EOP_LOOP; + *data++ = 0xFF; *data++ = 0x0D; *data++ = 0x00; *data++ = EOP_DOIO; + *data++ = 0x4E; *data++ = 0x75; *data++ = 0xFF; *data++ = 0x0D; - *data++ = 0x00; *data++ = EOP_SERVEINT; *data++ = 0x4E; *data++ = 0x73; + *data++ = 0xFF; *data++ = 0x0D; *data++ = 0x00; *data++ = EOP_AVAILMEM; - *data++ = 0x4E; *data++ = 0x75; *data++ = 0xFF; *data++ = 0x0D; + *data++ = 0x00; *data++ = EOP_ALLOCMEM; *data++ = 0x4E; *data++ = 0x75; - *data++ = 0xFF; *data++ = 0x0D; *data++ = 0x00; *data++ = EOP_ALLOCABS; + *data++ = 0x4E; *data++ = 0x75; } @@ -95,10 +100,17 @@ static void ersatz_init (void) uaecptr request; uaecptr a; + if (disk_empty (0)) { + fprintf (stderr, "You need to have a diskfile in DF0 to use the Kickstart replacement!\n"); + uae_quit (); + m68k_setpc (0xF80010); + return; + } + regs.s = 0; /* Set some interrupt vectors */ for (a = 8; a < 0xC0; a += 4) { - put_long (a, 0xF80016); + put_long (a, 0xF8001A); } regs.isp = regs.msp = regs.usp = 0x800; m68k_areg(regs, 7) = 0x80000; @@ -112,11 +124,11 @@ static void ersatz_init (void) put_long (0x676 - 6*f + 2, 0xF8000C); } /* Some "supported" functions */ - put_long (0x676 - 456 + 2, 0xF80010); - put_long (0x676 - 216 + 2, 0xF8001C); - put_long (0x676 - 198 + 2, 0xF80022); - put_long (0x676 - 204 + 2, 0xF80028); - put_long (0x676 - 210 + 2, 0xF80026); + put_long (0x676 - 456 + 2, 0xF80014); + put_long (0x676 - 216 + 2, 0xF80020); + put_long (0x676 - 198 + 2, 0xF80026); + put_long (0x676 - 204 + 2, 0xF8002c); + put_long (0x676 - 210 + 2, 0xF8002a); /* Build an IORequest */ request = 0x800; @@ -180,8 +192,14 @@ void ersatz_perform (uae_u16 what) break; case EOP_NIMP: - fprintf(stderr, "Unimplemented Kickstart function called\n"); - abort (); + fprintf (stderr, "Unimplemented Kickstart function called\n"); + uae_quit (); + + /* fall through */ + case EOP_LOOP: + m68k_setpc (0xF80010); + break; + case EOP_OPENLIB: default: fprintf(stderr, "Internal error. Giving up.\n");