OpenCBM
morse.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 <fcntl.h>
15 #include <stdlib.h>
16 
17 static unsigned char morse[] = {
18 #include "morse.inc"
19 };
20 
21 int ARCH_MAINDECL main(int argc, char *argv[])
22 {
23  unsigned char drv = argc > 1 ? arch_atoc(argv[1]) : 8;
24  CBM_FILE fd;
25 
26  if(cbm_driver_open_ex(&fd, NULL) == 0)
27  {
28  cbm_upload(fd, drv, 0x0500, morse, sizeof(morse));
29  cbm_listen(fd, drv, 15);
30  cbm_raw_write(fd, "U3:SOS", 6);
31  cbm_unlisten(fd);
32  cbm_driver_close(fd);
33  return 0;
34  }
35  return 1;
36 }
int CBMAPIDECL cbm_listen(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a LISTEN on the IEC serial bus.
Definition: cbm.c:945
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
int CBMAPIDECL cbm_raw_write(CBM_FILE HandleDevice, const void *Buffer, size_t Count)
Write data to the IEC serial bus.
Definition: cbm.c:870
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_unlisten(CBM_FILE HandleDevice)
Send an UNLISTEN on the IEC serial bus.
Definition: cbm.c:1100
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