-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserial.h
74 lines (62 loc) · 2.75 KB
/
serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* serial.h - serial (disk) functions for c64 emulator */
#ifndef __SERIAL_H
#define __SERIAL_H
#define SERIAL_TIME_OUT (-1)
#define SERIAL_DEVICE_NOT_PRESENT (-2)
#define SERIAL_END_OF_FILE (256)
/* function declarations */
void serial_init();
int serial_read();
int serial_write(int atn, int a);
/*
typedef struct {
int (*open) (int channel, const char *command);
int (*close) (int channel);
int (*read) (int channel);
int (*write) (int channel, int size, const char *data);
} DiskDriver;
*/
/*
How the C1541 is called by the C64:
LOAD "filename",8
/28 /f0 filename /3f
/48 /60 read data /5f
/28 /e0 /3f
SAVE "filename",8
/28 /f1 filename /3f
/28 /61 send data /3f
/28 /e1 /3f
OPEN 15,8,15,"string"
/28 /ff string /3f
PRINT# 15,"string"
/28 /6f string\n /3f
CLOSE 15
/28 /ef /3f
I used '/' to denote bytes sent under Attention (ATN low).
+---------+------------+---------------+------------+-------------------+
| ST Bit | ST Numeric | Cassette | Serial | Tape Verify |
| Position| Value | Read | Bus R/W | + Load |
+---------+------------+---------------+------------+-------------------+
| 0 | 1 | | time out | |
| | | | write | |
+---------+------------+---------------+------------+-------------------+
| 1 | 2 | | time out | |
| | | | read | |
+---------+------------+---------------+------------+-------------------+
| 2 | 4 | short block | | short block |
+---------+------------+---------------+------------+-------------------+
| 3 | 8 | long block | | long block |
+---------+------------+---------------+------------+-------------------+
| 4 | 16 | unrecoverable | | any mismatch |
| | | read error | | |
+---------+------------+---------------+------------+-------------------+
| 5 | 32 | checksum | | checksum |
| | | error | | error |
+---------+------------+---------------+------------+-------------------+
| 6 | 64 | end of file | EOI line | |
+---------+------------+---------------+------------+-------------------+
| 7 | -128 | end of tape | device not | end of tape |
| | | | present | |
+---------+------------+---------------+------------+-------------------+
*/
#endif