mirror of
https://github.com/bobbimanners/ProDOS-Utils.git
synced 2025-03-19 20:30:09 +00:00
New utility DISCONN.SYSTEM, which disconnects any drives mapped to slot 1.
This commit is contained in:
parent
61a40957a4
commit
351184841a
15
Makefile
15
Makefile
@ -11,19 +11,28 @@ CC65LIBDIR = $(CC65DIR)/lib
|
||||
CC65INCDIR = $(CC65DIR)/include
|
||||
CA65INCDIR = $(CC65DIR)/asminc
|
||||
|
||||
all: sortdir.po sortdir.system\#ff0000
|
||||
all: sortdir.po sortdir.system\#ff0000 disconn.system\#ff0000
|
||||
|
||||
clean:
|
||||
rm -f *.s *.o *.map sortdir
|
||||
rm -f *.s *.o *.map sortdir.system* disconn.system*
|
||||
|
||||
sortdir.o: sortdir.c
|
||||
$(CC65BINDIR)/cc65 -I $(CC65INCDIR) -t apple2enh -D A2E -o sortdir.s sortdir.c
|
||||
$(CC65BINDIR)/ca65 -I $(CA65INCDIR) -t apple2enh sortdir.s
|
||||
|
||||
disconn.o: disconn.c
|
||||
$(CC65BINDIR)/cc65 -I $(CC65INCDIR) -t apple2enh -o disconn.s disconn.c
|
||||
$(CC65BINDIR)/ca65 -I $(CA65INCDIR) -t apple2enh disconn.s
|
||||
|
||||
sortdir.system\#ff0000: sortdir.o
|
||||
$(CC65BINDIR)/ld65 -m sortdir.map -o sortdir.system\#ff0000 -C apple2enh-system.cfg sortdir.o $(CC65LIBDIR)/apple2enh.lib
|
||||
|
||||
sortdir.po: sortdir.system\#ff0000
|
||||
disconn.system\#ff0000: disconn.o
|
||||
$(CC65BINDIR)/ld65 -m disconn.map -o disconn.system\#ff0000 -C apple2enh-system.cfg disconn.o $(CC65LIBDIR)/apple2enh.lib
|
||||
|
||||
sortdir.po: sortdir.system\#ff0000 disconn.system\#ff0000
|
||||
cadius deletefile sortdir.po /p8.2.5/sortdir.system
|
||||
cadius addfile sortdir.po /p8.2.5 sortdir.system\#ff0000
|
||||
cadius deletefile sortdir.po /p8.2.5/disconn.system
|
||||
cadius addfile sortdir.po /p8.2.5 disconn.system\#ff0000
|
||||
|
||||
|
59
disconn.c
Normal file
59
disconn.c
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// Very simple utility which just disconnects any drives mapped to slot 1
|
||||
// Bobbi September 2020
|
||||
//
|
||||
|
||||
#include <conio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* Disconnect drives from slot 1
|
||||
*/
|
||||
void disconnect_slot1(void) {
|
||||
uint8_t i, j;
|
||||
uint8_t *devcnt = (uint8_t*)0xbf31; // Number of devices
|
||||
uint8_t *devlst = (uint8_t*)0xbf32; // Disk device numbers
|
||||
uint16_t *s0d1 = (uint16_t*)0xbf10; // s0d1 driver vector
|
||||
uint16_t *s1d1 = (uint16_t*)0xbf12; // s3d1 driver vector
|
||||
uint16_t *s1d2 = (uint16_t*)0xbf22; // s3d2 driver vector
|
||||
if (*s0d1 == *s1d2)
|
||||
goto s1d1; // No s1d2
|
||||
for (i = 0; i <= *devcnt; ++i)
|
||||
if ((devlst[i] & 0xf0) == 0x90) {
|
||||
for (j = i; j <= *devcnt; ++j)
|
||||
devlst[j] = devlst[j + 1];
|
||||
break;
|
||||
}
|
||||
*s1d2 = *s0d1;
|
||||
--(*devcnt);
|
||||
s1d1:
|
||||
if (*s0d1 == *s1d1)
|
||||
return; // No s1d1
|
||||
for (i = 0; i <= *devcnt; ++i)
|
||||
if ((devlst[i] & 0xf0) == 0x10) {
|
||||
for (j = i; j <= *devcnt; ++j)
|
||||
devlst[j] = devlst[j + 1];
|
||||
break;
|
||||
}
|
||||
*s1d1 = *s0d1;
|
||||
--(*devcnt);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
char c;
|
||||
printf("*********************************\n");
|
||||
printf("** Will disconnect any drives **\n");
|
||||
printf("** mapped to slot 1 **\n");
|
||||
printf("*********************************\n\n");
|
||||
printf(" Press [D] to disconnect drives\n");
|
||||
printf(" Any other key to cancel\n");
|
||||
c = cgetc();
|
||||
if ((c == 'd') || (c == 'D')) {
|
||||
disconnect_slot1();
|
||||
printf("\n** Done.\n");
|
||||
} else {
|
||||
printf("\n** Cancelled.\n");
|
||||
}
|
||||
}
|
||||
|
BIN
sortdir.po
BIN
sortdir.po
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user