unsigned char loadoverlay (unsigned char num) { if (overlay[num - 1].page < 0) { #ifndef __CBM__ int file; printf ("Dbg: Loading overlay %u from file\n", num); file = open (overlay[num - 1].name, O_RDONLY); if (file == -1) { log ("Opening overlay file failed"); return 0; } read (file, overlay[num - 1].addr, overlay[num - 1].size); close (file); #else if (cbm_load (overlay[num - 1].name, getcurrentdevice (), NULL) == 0) { log ("Loading overlay file failed"); return 0; } #endif return 1; } else { struct em_copy copyinfo; printf ("Dbg: Loading overlay %u from memory\n", num); copyinfo.offs = 0; copyinfo.page = overlay[num - 1].page; copyinfo.buf = overlay[num - 1].addr; copyinfo.count = overlay[num - 1].size; em_copyfrom (©info); return 1; } }
unsigned char loadfile (char *name, void *addr, void *size) { #ifndef __CBM__ int file = open (name, O_RDONLY); if (file == -1) { log ("Opening overlay file failed"); return 0; } read (file, addr, (unsigned) size); close (file); #else /* Avoid compiler warnings about unused parameters. */ (void) addr; (void) size; if (cbm_load (name, getcurrentdevice (), NULL) == 0) { log ("Loading overlay file failed"); return 0; } #endif return 1; }