I just installed an SD slim floppy emulator into my Kaypro 4/84, as drive C (I made a drive select decoder to handle it). It works fine as a quad density floppy, and I can change the image by pushing the button.
I tried to write a program to select image file, but can't get it working. Here is the crucial part of my program (Aztec C 80)
Code: Select all
static struct {
char DAHEADERSIGNATURE[8]; /* Must be set to HxCFEDA */
unsigned char cmd_code; /* Command code */
unsigned char params[8]; /* Parameters */
unsigned char cmd_checksum; /* Parameters checksum */
unsigned char filler[1024]; /* Make enough space to read a 1k sector into struct */
} cmd;
slot = atoi(argv[1]);
/* Prepare command sector */
strcpy(cmd.DAHEADERSIGNATURE, "HxCFEDA");
cmd.cmd_code = 4; /* select image index */
cmd.params[0] = slot&0xff; /* Set index */
cmd.params[1] = slot>>8;
/* Calculate checksum */
cmd.cmd_checksum = 0;
for(a=0; a<=7; a++)
cmd.cmd_checksum += cmd.params[a];
/* Write command */
printf("Selecting slot %d... ", slot);
bios(9,2,0); /* Select disk C */
bios(10,255,0); /* Set track 255 */
bios(11,0,0); /* Set sector 0 */
bios(12,&cmd,0); /* Set DMA buffer */
a=bios(14,1,0); /* Write sector */
printf(a?"FAIL\n":"OK\n");