1 /*
2 * vim: filetype=c:tabstop=4:ai:expandtab
3 * SPDX-License-Identifier: ICU
4 * scspell-id: b39ac98e-f62e-11ec-98a8-80ee73e9b8e7
5 *
6 * ---------------------------------------------------------------------------
7 *
8 * Copyright (c) 2007-2013 Michael Mondy
9 * Copyright (c) 2012-2016 Harry Reed
10 * Copyright (c) 2013-2016 Charles Anthony
11 * Copyright (c) 2021-2023 The DPS8M Development Team
12 *
13 * All rights reserved.
14 *
15 * This software is made available under the terms of the ICU
16 * License, version 1.8.1 or later. For more details, see the
17 * LICENSE.md file at the top-level directory of this distribution.
18 *
19 * ---------------------------------------------------------------------------
20 */
21
22 #define BUFSZ (4096 * 9 / 2)
23
24 struct tape_state
25 {
26 //enum tape_mode { tape_no_mode, tape_read_mode, tape_write_mode, tape_survey_mode } io_mode;
27 enum tape_mode
28 {
29 tape_no_mode, tape_rd_ctlr, tape_rd_9, tape_rd_bin, tape_initiate_rd_mem,
30 tape_wr_9, tape_wr_bin, tape_initiate_wr_mem, tape_MTP_wr, tape_wr_ctrl_regs, tape_survey,
31 } io_mode;
32 bool is9;
33 uint8 buf [BUFSZ];
34 t_mtrlnt tbc; // Number of bytes read into buffer
35 uint words_processed; // Number of Word36 processed from the buffer
36 // XXX bug: 'sim> set tapeN rewind' doesn't reset rec_num
37 int rec_num; // track tape position
38 char device_name [MAX_DEV_NAME_LEN];
39 word16 cntlrAddress;
40 word16 cntlrTally;
41 int tape_length;
42 };
43
44 extern struct tape_state tape_states [N_MT_UNITS_MAX];
45
46 extern UNIT mt_unit [N_MT_UNITS_MAX];
47 extern DEVICE tape_dev;
48 extern UNIT mtp_unit [N_MTP_UNITS_MAX];
49 extern DEVICE mtp_dev;
50
51 void mt_init(void);
52 void mt_exit (void);
53 int get_mt_numunits (void);
54 //UNIT * getTapeUnit (uint driveNumber);
55 //void tape_send_special_interrupt (uint driveNumber);
56 t_stat loadTape (uint driveNumber, char * tapeFilename, bool ro);
57 t_stat attachTape (char * label, bool withring, char * drive);
58 #ifndef QUIET_UNUSED
59 t_stat detachTape (char * drive);
60 #endif
61 iom_cmd_rc_t mt_iom_cmd (uint iomUnitIdx, uint chan);
62 t_stat unloadTape (uint driveNumber);
63 t_stat mount_tape (int32 arg, const char * buf);
64 t_stat signal_tape (uint tap_unit_idx, word8 status0, word8 status1);