source: thomson/elec/CrO2/software/cro2.cpp@ 53c4be3

main
Last change on this file since 53c4be3 was 53c4be3, checked in by Adrien Destugues <pulkomandy@…>, 12 years ago
  • Support for ZX spectrup TAP files.

git-svn-id: svn://localhost/thomson@17 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/* CrO2 datassette emulator
2 * Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
3 *
4 * Distributed under the terms of the MIT licence.
5 */
6
7#include <iostream>
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <stdint.h>
12#include <unistd.h>
13
14
15#include "device.h"
16#include "k5.h"
17#include "gui.h"
18
19int main(int argc, char **argv)
20{
21 if(argc < 2){
22 Gui gui(&argc, &argv);
23 exit(0);
24 }
25
26 try {
27 Device& dev = Device::getDevice(); // Constructor inits communication.
28
29 if(strcmp(argv[1], "get") == 0){
30 int nBytes = 0;
31 unsigned char buffer[275];
32 memset(buffer, 0, 275);
33 nBytes = dev.read(buffer, sizeof(buffer));
34 if (nBytes < 0) fprintf(stderr, "USB error %s\n", usb_strerror());
35 }else if(strcmp(argv[1], "put") == 0){
36
37 // load file
38 Tape* file = Tape::load(argv[2]);
39
40 dev.write(*file);
41
42 delete file;
43 }else{
44 // TODO print usage
45 exit(2);
46 }
47
48 return 0;
49 }
50 catch(const char* error)
51 {
52 std::cerr << error << std::endl;
53 }
54
55 exit(0);
56}
57
Note: See TracBrowser for help on using the repository browser.