CBMSTUFF FORUM
C code for accessing the SCP hardware - Printable Version

+- CBMSTUFF FORUM (https://www.cbmstuff.com/forum)
+-- Forum: CBMSTUFF PRODUCTS (https://www.cbmstuff.com/forum/forumdisplay.php?fid=1)
+--- Forum: SuperCard Pro (https://www.cbmstuff.com/forum/forumdisplay.php?fid=3)
+---- Forum: Developer Area (https://www.cbmstuff.com/forum/forumdisplay.php?fid=13)
+---- Thread: C code for accessing the SCP hardware (/showthread.php?tid=115)



C code for accessing the SCP hardware - admin - 04-08-2014

Keir Fraser has updated his Disk Utilities package to support the SCP hardware. If you are interested in getting ahold of some working C source code for accessing the SCP hardware, Keir has made his Disk Utilities package open source and it can be found here:

https://github.com/keirf/Disk-Utilities

You should be able to drop in the scp.c, scp_dump.c, and scp.h files into any project and modify them as needed.

Thanks Keir for providing this!


RE: C code for accessing the SCP hardware - r-lind - 02-20-2015

Disk-Utilities now works with Mac OS X (10.10.2)

1. Download FTDI drivers here and install: http://www.ftdichip.com/Drivers/VCP.htm

2. Download Disk-Utilities and compile:
git clone https://github.com/keirf/Disk-Utilities.git

Personally I had to comment out some code and change default USB serial device like this:
diff -urN ../GIT/Disk-Utilities/libdisk/container/imd.c ./libdisk/container/imd.c
--- ../GIT/Disk-Utilities/libdisk/container/imd.c 2015-02-20 11:17:24.000000000 +0100
+++ ./libdisk/container/imd.c 2015-02-20 11:57:52.000000000 +0100
@@ -234,11 +234,11 @@
if ((thdr.mode == 0xff) || !ti->nr_sectors)
continue;

- if (ti->nr_sectors >= 256) {
+ /* if (ti->nr_sectors >= 256) {
warnx("T%u.%u: Unexpected number of IBM-MFM sectors (%u)",
cyl(trk), hd(trk), ti->nr_sectors);
continue;
- }
+ } */

retrieve_ibm_mfm_track(
d, trk, &secs, &cyls, &heads, &nos, &marks, &dat);
diff -urN ../GIT/Disk-Utilities/scp/scp_dump.c ./scp/scp_dump.c
--- ../GIT/Disk-Utilities/scp/scp_dump.c 2015-02-20 11:17:24.000000000 +0100
+++ ./scp/scp_dump.c 2015-02-20 11:59:34.000000000 +0100
@@ -21,7 +21,8 @@
#include <libdisk/util.h>
#include "scp.h"

-#define DEFAULT_SERDEVICE "/dev/ttyUSB0"
+/* #define DEFAULT_SERDEVICE "/dev/ttyUSB0" */
+#define DEFAULT_SERDEVICE "/dev/cu.usbserial-SCP-JIM"
#define DEFAULT_NRTRACKS 164

#define log(_f, _a...) do { if (!quiet) printf(_f, ##_a); } while (0)


RE: C code for accessing the SCP hardware - admin - 02-20-2015

Great! Thanks for the info!