💾 Archived View for mirrors.apple2.org.za › active › ftp.apple.asimov.net › images › programming › c… captured on 2024-12-18 at 00:01:52.
-=-=-=-=-=-=-
From newssun.med.miami.edu!news.miami.edu!usenet.ufl.edu!eng.ufl.edu!spool.mu.edu!howland.reston.ans.net!noc.near.net!uunet!world!tombaker Sat Apr 10 13:01:58 1993 Newsgroups: alt.emulators.ibmpc.apple2 Path: newssun.med.miami.edu!news.miami.edu!usenet.ufl.edu!eng.ufl.edu!spool.mu.edu!howland.reston.ans.net!noc.near.net!uunet!world!tombaker From: tombaker@world.std.com (Tom A Baker) Subject: Mapper.c -- repost with possible update Message-ID: <C567x6.7vL@world.std.com> Organization: Me, at The World Public Access UNIX, Brookline, MA Date: Thu, 8 Apr 1993 15:19:51 GMT Lines: 61 I understand that some folks out there have a different version of mapper.c source code. Also, there results some differences in how to use it. So... Here is the version I use. It is as I retreived it, BUT I added two #ifdef-#endif sections so it works under DOS if compiled with Borland C. The difference is that, unlike UNIX, MSDOS does not treat binary and text streams the same. To use: mapper < one > theother tom -------------------- cut here ----------8<-8<-8<---------------- #include <stdio.h> #ifdef __BORLANDC__ #include <fcntl.h> #endif /* * Map a disk image in Prodos block ordering to DOS 3.3 block ordering * usage: mapper < old_image > new_image */ main() { unsigned char buf[4096]; int track; #ifdef __BORLANDC__ setmode( (stdin->fd), O_BINARY ); setmode( (stdout->fd), O_BINARY ); #endif for (track = 0; track < 35; track++) { if (read(0, buf, 4096) != 4096) { perror("bad read"); exit(1); } write(1, buf, 256); write(1, &buf[0xE00], 256); write(1, &buf[0xD00], 256); write(1, &buf[0xC00], 256); write(1, &buf[0xB00], 256); write(1, &buf[0xA00], 256); write(1, &buf[0x900], 256); write(1, &buf[0x800], 256); write(1, &buf[0x700], 256); write(1, &buf[0x600], 256); write(1, &buf[0x500], 256); write(1, &buf[0x400], 256); write(1, &buf[0x300], 256); write(1, &buf[0x200], 256); write(1, &buf[0x100], 256); write(1, &buf[0xF00], 256); } }