#include <stdio.h>
#include <conio.h>
+#ifndef __CBM__
#include <fcntl.h>
#include <unistd.h>
+#else
+#include <device.h>
+#endif
extern void _OVERLAY1_LOAD__[], _OVERLAY1_SIZE__[];
/* In a real-world overlay program one would probably not use a #pragma but
- * rather place the all the code of certain source files into the overlay by
+ * rather place all the code of certain source files into the overlay by
* compiling them with --code-name OVERLAY1.
*/
#pragma code-name (push, "OVERLAY1");
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;
}