+ else if (obj_format == RAW)
+ {
+ if (!org68k_active && used_architectures & (!(M6502 | M56001P | M56001X | M56001Y | M56001L)))
+ return error("cannot output absolute binary without a starting address (.org or command line)");
+
+ if (used_architectures & M6502)
+ {
+ // Okay, this is not the best. But it'll have to do until we revamp things a bit with sections.
+ // Basically we assume that if raw output is requested and 6502 mode was switched on, nobody
+ // switched to other architectures. The combination doesn't make much sense anyway for now.
+ m6502raw(fd);
+ return 0;
+ }
+
+ // Alloc memory for text + data construction.
+ tds = sect[TEXT].sloc + sect[DATA].sloc;
+ buf = malloc(tds);
+ chptr = buf;
+
+ // Construct text and data segments; fixup relocatable longs;
+ // finally write the text + data
+
+ p = buf;
+ objImage = buf; // Set global object image pointer
+
+ for(i=TEXT; i<=DATA; i++)
+ {
+ for(cp=sect[i].sfcode; cp!=NULL; cp=cp->chnext)
+ {
+ memcpy(p, cp->chptr, cp->ch_size);
+ p += cp->ch_size;
+ }
+ }