fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/devices/cassette.h *
7 * Created: 2020-04-30 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2020 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PCE_DEVICES_CASSETTE_H
24#define PCE_DEVICES_CASSETTE_H 1
25
26
27#include <drivers/pti/pti.h>
28
29
30typedef struct {
31 void *set_inp_ext;
32 void (*set_inp) (void *ext, unsigned char val);
33
34 void *set_play_ext;
35 void (*set_play) (void *ext, unsigned char val);
36
37 void *set_run_ext;
38 void (*set_run) (void *ext, unsigned char val);
39
40 pti_img_t *read_img;
41 char *read_name;
42
43 pti_img_t *write_img;
44 char *write_name;
45
46 char modified;
47 char eof;
48
49 char run;
50 char motor;
51 char play;
52 char record;
53
54 char auto_play;
55 char auto_motor;
56
57 char out_val;
58 char inp_val;
59
60 unsigned long clock;
61 unsigned long remainder;
62 unsigned long position;
63
64 unsigned long motor_delay;
65 unsigned long motor_delay_count;
66
67 unsigned long counter;
68} cassette_t;
69
70
71int cas_set_msg (cassette_t *cas, const char *msg, const char *val);
72
73void cas_init (cassette_t *cas);
74void cas_free (cassette_t *cas);
75
76cassette_t *cas_new (void);
77void cas_del (cassette_t *cas);
78
79void cas_set_inp_fct (cassette_t *cas, void *ext, void *fct);
80void cas_set_play_fct (cassette_t *cas, void *ext, void *fct);
81void cas_set_run_fct (cassette_t *cas, void *ext, void *fct);
82
83void cas_set_clock (cassette_t *cas, unsigned long val);
84
85void cas_set_auto_play (cassette_t *cas, int val);
86void cas_set_auto_motor (cassette_t *cas, int val);
87void cas_set_motor_delay (cassette_t *cas, unsigned long val);
88
89int cas_set_read_name (cassette_t *cas, const char *fname);
90int cas_set_write_name (cassette_t *cas, const char *fname, int create);
91
92int cas_commit (cassette_t *cas);
93
94int cas_get_position (const cassette_t *cas, double *tm);
95int cas_set_position (cassette_t *cas, double tm);
96
97int cas_truncate (cassette_t *cas, double tm);
98int cas_space (cassette_t *cas, double tm);
99
100void cas_set_play (cassette_t *cas, int val);
101void cas_set_record (cassette_t *cas, int val);
102void cas_press_keys (cassette_t *cas, int play, int record);
103
104void cas_print_state (cassette_t *cas);
105
106void cas_set_motor (cassette_t *cas, int val);
107
108int cas_get_inp (const cassette_t *cas);
109
110void cas_set_out (cassette_t *cas, int val);
111
112void cas_clock (cassette_t *cas);
113
114
115#endif