mirror of
https://github.com/cc65/cc65.git
synced 2024-10-31 20:06:11 +00:00
New diodemo version by Oliver; update of the README file
git-svn-id: svn://svn.cc65.org/cc65/trunk@3619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
0930ab22da
commit
aa577a7a1d
@ -32,6 +32,14 @@ Description: Another graphics demo written by groepaz/hitmen.
|
|||||||
Platforms: The program is currently only running on the C64, but should
|
Platforms: The program is currently only running on the C64, but should
|
||||||
be portable to the C128 and CBM510 (and maybe more machines).
|
be portable to the C128 and CBM510 (and maybe more machines).
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Name: diodemo
|
||||||
|
Description: A disc copy program written and contributed by Oliver
|
||||||
|
Schmidt, <ol.sc@web.de>. Supports single or dual disc copy.
|
||||||
|
Platforms: The program does depend on conio and dio (direct disk i/o),
|
||||||
|
so it does currently compile for the Atari and Apple ][
|
||||||
|
machines.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Name: gunzip65
|
Name: gunzip65
|
||||||
Description: A gunzip utility for 6502 based machines written by Piotr
|
Description: A gunzip utility for 6502 based machines written by Piotr
|
||||||
@ -85,5 +93,5 @@ Name: tgidemo
|
|||||||
Description: Shows some of the graphics capabilities of the "tiny graphics
|
Description: Shows some of the graphics capabilities of the "tiny graphics
|
||||||
interface".
|
interface".
|
||||||
Platforms: Runs on all platforms that have TGI support:
|
Platforms: Runs on all platforms that have TGI support:
|
||||||
C64
|
Apple ][, C64, C128, Oric Atmos, Geos and Lynx.
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ static driveid_t AskForDrive (const char* Name)
|
|||||||
Char = cgetc ();
|
Char = cgetc ();
|
||||||
if (isdigit (Char)) {
|
if (isdigit (Char)) {
|
||||||
cputc (Char);
|
cputc (Char);
|
||||||
Drive = (driveid_t) (Drive * 10 + Char - '0');
|
Drive = Drive * 10 + Char - '0';
|
||||||
}
|
}
|
||||||
} while (Char != CH_ENTER);
|
} while (Char != CH_ENTER);
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ static void AskForDisk (const char* Name, driveid_t Drive)
|
|||||||
static char* AllocBuffer (sectsize_t SectSize, sectnum_t SectCount, sectnum_t* ChunkCount)
|
static char* AllocBuffer (sectsize_t SectSize, sectnum_t SectCount, sectnum_t* ChunkCount)
|
||||||
/* Allocate a copy buffer on the heap and return a pointer to it */
|
/* Allocate a copy buffer on the heap and return a pointer to it */
|
||||||
{
|
{
|
||||||
void* Buffer = NULL;
|
char* Buffer = NULL;
|
||||||
unsigned long BufferSize;
|
unsigned long BufferSize;
|
||||||
unsigned int Chunks = 1;
|
unsigned int Chunks = 1;
|
||||||
|
|
||||||
@ -101,11 +101,11 @@ static char* AllocBuffer (sectsize_t SectSize, sectnum_t SectCount, sectnum_t* C
|
|||||||
}
|
}
|
||||||
} while (Buffer == NULL && ++Chunks <= MAX_CHUNKS);
|
} while (Buffer == NULL && ++Chunks <= MAX_CHUNKS);
|
||||||
|
|
||||||
return (char*) Buffer;
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main (void)
|
int main (int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
driveid_t SourceId;
|
driveid_t SourceId;
|
||||||
driveid_t TargetId;
|
driveid_t TargetId;
|
||||||
@ -126,9 +126,28 @@ int main (void)
|
|||||||
cputs ("\r\n");
|
cputs ("\r\n");
|
||||||
|
|
||||||
/* Get source and target drive id (which may very well be identical) */
|
/* Get source and target drive id (which may very well be identical) */
|
||||||
SourceId = AskForDrive ("Source");
|
switch (argc) {
|
||||||
TargetId = AskForDrive ("Target");
|
case 1:
|
||||||
cputs ("\r\n\n");
|
SourceId = AskForDrive ("Source");
|
||||||
|
TargetId = AskForDrive ("Target");
|
||||||
|
cputs ("\r\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
SourceId = TargetId = atoi (argv[1]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
SourceId = atoi (argv[1]);
|
||||||
|
TargetId = atoi (argv[2]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
cprintf ("\r\nToo many arguments\r\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
cputs ("\r\n");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Check for single drive copy or inital iteration */
|
/* Check for single drive copy or inital iteration */
|
||||||
@ -136,8 +155,10 @@ int main (void)
|
|||||||
AskForDisk ("Source", SourceId);
|
AskForDisk ("Source", SourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open drive on initial iteration */
|
/* Check for initial iteration */
|
||||||
if (Source == NULL) {
|
if (Source == NULL) {
|
||||||
|
|
||||||
|
/* Open source drive */
|
||||||
Source = dio_open (SourceId);
|
Source = dio_open (SourceId);
|
||||||
if (Source == NULL) {
|
if (Source == NULL) {
|
||||||
cprintf ("\r\n\nError %d on opening Drive %d\r\n", (int) _oserror, SourceId);
|
cprintf ("\r\n\nError %d on opening Drive %d\r\n", (int) _oserror, SourceId);
|
||||||
@ -147,7 +168,7 @@ int main (void)
|
|||||||
SectSize = dio_query_sectsize (Source);
|
SectSize = dio_query_sectsize (Source);
|
||||||
SectCount = dio_query_sectcount (Source);
|
SectCount = dio_query_sectcount (Source);
|
||||||
|
|
||||||
/* */
|
/* Allocate buffer */
|
||||||
Buffer = AllocBuffer (SectSize, SectCount, &ChunkCount);
|
Buffer = AllocBuffer (SectSize, SectCount, &ChunkCount);
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
cputs ("\r\n\nError on allocating Buffer\r\n");
|
cputs ("\r\n\nError on allocating Buffer\r\n");
|
||||||
@ -163,7 +184,7 @@ int main (void)
|
|||||||
|
|
||||||
/* Read one sector */
|
/* Read one sector */
|
||||||
if (dio_read (Source, Sector, Buffer + (Sector - ChunkOffset) * SectSize) != 0) {
|
if (dio_read (Source, Sector, Buffer + (Sector - ChunkOffset) * SectSize) != 0) {
|
||||||
cprintf ("\r\n\nError %d on reading Drive %d\r\n", (int) _oserror, SourceId);
|
cprintf ("\r\n\nError %d on reading from Drive %d\r\n", (int) _oserror, SourceId);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +194,7 @@ int main (void)
|
|||||||
AskForDisk ("Target", TargetId);
|
AskForDisk ("Target", TargetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open drive on initial iteration */
|
/* Open target drive on initial iteration */
|
||||||
if (Target == NULL) {
|
if (Target == NULL) {
|
||||||
Target = dio_open (TargetId);
|
Target = dio_open (TargetId);
|
||||||
if (Target == NULL) {
|
if (Target == NULL) {
|
||||||
@ -197,7 +218,7 @@ int main (void)
|
|||||||
|
|
||||||
/* Write one sector */
|
/* Write one sector */
|
||||||
if (dio_write (Target, Sector, Buffer + (Sector - ChunkOffset) * SectSize) != 0) {
|
if (dio_write (Target, Sector, Buffer + (Sector - ChunkOffset) * SectSize) != 0) {
|
||||||
cprintf ("\r\n\nError %d on opening Drive %d\r\n", (int) _oserror, TargetId);
|
cprintf ("\r\n\nError %d on writing to Drive %d\r\n", (int) _oserror, TargetId);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user