OpenCBM
flash.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 1999 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
8 */
9 
10 #include "opencbm.h"
11 
12 #include "arch.h"
13 
14 #include <stdlib.h>
15 
16 static unsigned char flash[] = {
17 #include "flash.inc"
18 };
19 
20 int ARCH_MAINDECL main(int argc, char *argv[])
21 {
22  unsigned char drv = argc > 1 ? arch_atoc(argv[1]) : 8;
23  CBM_FILE fd;
24 
25  if(cbm_driver_open_ex(&fd, NULL) == 0)
26  {
27  cbm_upload(fd, drv, 0x0500, flash, sizeof(flash));
28  cbm_exec_command(fd, drv, "U3:", 0);
29  cbm_driver_close(fd);
30  return 0;
31  }
32  return 1;
33 }
int ARCH_MAINDECL main(int argc, char **argv)
Initialize the xum1541 device This function tries to find and identify the xum1541 device...
Definition: usbcfg.c:38
int CBMAPIDECL cbm_driver_open_ex(CBM_FILE *HandleDevice, char *Adapter)
Opens the driver, extended version.
Definition: cbm.c:683
void CBMAPIDECL cbm_driver_close(CBM_FILE HandleDevice)
Closes the driver.
Definition: cbm.c:768
#define CBM_FILE
Definition: opencbm.h:87
int CBMAPIDECL cbm_exec_command(CBM_FILE HandleDevice, unsigned char DeviceAddress, const void *Command, size_t Size)
Executes a command in the floppy drive.
Definition: cbm.c:1599
DLL interface for accessing the driver.
Define makros and functions which account for differences between the different architectures.
int CBMAPIDECL cbm_upload(CBM_FILE HandleDevice, unsigned char DeviceAddress, int DriveMemAddress, const void *Program, size_t Size)
Upload a program into a floppy's drive memory.
Definition: upload.c:133