Logo Search packages:      
Sourcecode: cbmlink version File versions  Download package

int disk_mwrite ( const struct comm comm,
FILE *  file,
unsigned  start,
char *  buf 
)

copy data from a file to a disk drive's address space

Parameters:
comm the communication primitives
file input file
start start address (inclusive)
buf a buffer of at least 42 bytes
Returns:
zero on success, nonzero on error

Definition at line 719 of file disk.c.

References write_remote().

Referenced by drive_memory_load().

{
  unsigned len;
  register char* b = buf + 3;
  *b++ = 'M', *b++ = '-', *b++ = 'W';
  for (;;) {
    int status;
    *b++ = start, *b++ = start >> 8;
    if (!(*b++ = len = fread (b + 1, 1, 32, file)))
      return 0;
    if ((status = write_remote (comm, 15, buf + 3, len))) {
      fputs ("disk_mwrite: communication failure\n", stderr);
      return status;
    }
    start += len, b -= 3;
  }
}


Generated by  Doxygen 1.6.0   Back to index