// SPDX-License-Identifier: GPL-3.0-or-later #ifndef VCC_CASSETTE_H #define VCC_CASSETTE_H #define VCC_TAPE_OK 0 #define VCC_TAPE_EOF 1 #define VCC_TAPE_IO (-1) #define VCC_TAPE_INVALID (-2) #define VCC_TAPE_LONG (-3) #define VCC_TAPE_BUSY (-4) #define VCC_TAPE_TYPE (-5) // One foreground stream at a time. Position the tape and select Record or // Play before opening. Names are 1-8 printable ASCII characters and are // case-sensitive, as in BASIC. The guest cannot confirm recording at the port. int vcc_tape_open_write(const char *name); int vcc_tape_write_line(const char *line); // printable ASCII, adds one CR int vcc_tape_open_read(const char *name); int vcc_tape_read_line(char *line, unsigned capacity); // capacity includes NUL int vcc_tape_close(void); // Read returns OK for a complete line (including a blank line), EOF only for // a checked end block (a final text fragment is delivered first), LONG after // consuming an oversized line, and IO for a damaged or incomplete recording. // An unsuccessful read leaves line empty. // Close releases a reader even after an error and finishes a writer's tape. #endif