OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11UnitTape.cpp] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 wfjm
// $Id: Rw11UnitTape.cpp 686 2015-06-04 21:08:08Z mueller $
2
//
3
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2015-06-04   686   1.0    Initial version
17
// 2015-05-17   683   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: Rw11UnitTape.cpp 686 2015-06-04 21:08:08Z mueller $
23
  \brief   Implemenation of Rw11UnitTape.
24
*/
25
 
26
#include "librtools/Rexception.hpp"
27
 
28
#include "Rw11UnitTape.hpp"
29
 
30
using namespace std;
31
 
32
/*!
33
  \class Retro::Rw11UnitTape
34
  \brief FIXME_docs
35
*/
36
 
37
// all method definitions in namespace Retro
38
namespace Retro {
39
 
40
//------------------------------------------+-----------------------------------
41
//! Constructor
42
 
43
Rw11UnitTape::Rw11UnitTape(Rw11Cntl* pcntl, size_t index)
44
  : Rw11UnitVirt<Rw11VirtTape>(pcntl, index),
45
    fType(),
46
    fEnabled(false),
47
    fWProt(false),
48
    fCapacity(0)
49
{}
50
 
51
//------------------------------------------+-----------------------------------
52
//! Destructor
53
 
54
Rw11UnitTape::~Rw11UnitTape()
55
{}
56
 
57
//------------------------------------------+-----------------------------------
58
//! FIXME_docs
59
 
60
void Rw11UnitTape::SetType(const std::string& type)
61
{
62
  throw Rexception("Rw11UnitTape::SetType",
63
                   string("Bad args: only type '") + fType + "' supported");
64
  return;
65
}
66
 
67
//------------------------------------------+-----------------------------------
68
//! FIXME_docs
69
 
70
void Rw11UnitTape::SetWProt(bool wprot)
71
{
72
  if (Virt()) throw Rexception("Rw11UnitTape::SetWProt",
73
                               "not allowed when tape attached");
74
  fWProt = wprot;
75
  return;
76
}
77
 
78
//------------------------------------------+-----------------------------------
79
//! FIXME_docs
80
 
81
void Rw11UnitTape::SetCapacity(size_t nbyte)
82
{
83
  if (Virt()) throw Rexception("Rw11UnitTape::SetCapacity",
84
                               "not allowed when tape attached");
85
  fCapacity = nbyte;
86
  return;
87
}
88
 
89
//------------------------------------------+-----------------------------------
90
//! FIXME_docs
91
 
92
void Rw11UnitTape::SetPosFile(int posfile)
93
{
94
  if (!Virt()) throw Rexception("Rw11UnitTape::SetPosFile",
95
                                "no tape attached");
96
  Virt()->SetPosFile(posfile);
97
  return;
98
}
99
 
100
//------------------------------------------+-----------------------------------
101
//! FIXME_docs
102
 
103
void Rw11UnitTape::SetPosRecord(int posrec)
104
{
105
  if (!Virt()) throw Rexception("Rw11UnitTape::SetPosRecord",
106
                                "no tape attached");
107
  Virt()->SetPosRecord(posrec);
108
  return;
109
}
110
 
111
//------------------------------------------+-----------------------------------
112
//! FIXME_docs
113
 
114
bool Rw11UnitTape::Bot() const
115
{
116
  if (!Virt()) return false;
117
  return Virt()->Bot();
118
}
119
 
120
//------------------------------------------+-----------------------------------
121
//! FIXME_docs
122
 
123
bool Rw11UnitTape::Eot() const
124
{
125
  if (!Virt()) return false;
126
  return Virt()->Eot();
127
}
128
 
129
//------------------------------------------+-----------------------------------
130
//! FIXME_docs
131
 
132
bool Rw11UnitTape::Eom() const
133
{
134
  if (!Virt()) return false;
135
  return Virt()->Eom();
136
}
137
 
138
//------------------------------------------+-----------------------------------
139
//! FIXME_docs
140
 
141
int Rw11UnitTape::PosFile() const
142
{
143
  if (!Virt()) return -1;
144
  return Virt()->PosFile();
145
}
146
 
147
//------------------------------------------+-----------------------------------
148
//! FIXME_docs
149
 
150
int Rw11UnitTape::PosRecord() const
151
{
152
  if (!Virt()) return -1;
153
  return Virt()->PosRecord();
154
}
155
 
156
//------------------------------------------+-----------------------------------
157
//! FIXME_docs
158
 
159
bool Rw11UnitTape::VirtReadRecord(size_t nbyte, uint8_t* data, size_t& ndone,
160
                                  int& opcode, RerrMsg& emsg)
161
{
162
  if (!Virt()) {
163
    emsg.Init("Rw11UnitTape::VirtReadRecord", "no tape attached");
164
    return false;
165
  }
166
  return Virt()->ReadRecord(nbyte, data, ndone, opcode, emsg);
167
}
168
 
169
//------------------------------------------+-----------------------------------
170
//! FIXME_docs
171
 
172
bool Rw11UnitTape::VirtWriteRecord(size_t nbyte, const uint8_t* data,
173
                                   int& opcode, RerrMsg& emsg)
174
{
175
  if (!Virt()) {
176
    emsg.Init("Rw11UnitTape::VirtWriteRecord", "no tape attached");
177
    return false;
178
  }
179
  return Virt()->WriteRecord(nbyte, data, opcode, emsg);
180
}
181
 
182
//------------------------------------------+-----------------------------------
183
//! FIXME_docs
184
 
185
bool Rw11UnitTape::VirtWriteEof(RerrMsg& emsg)
186
{
187
  if (!Virt()) {
188
    emsg.Init("Rw11UnitTape::VirtWriteEof", "no tape attached");
189
    return false;
190
  }
191
  return Virt()->WriteEof(emsg);
192
}
193
 
194
//------------------------------------------+-----------------------------------
195
//! FIXME_docs
196
 
197
bool Rw11UnitTape::VirtSpaceForw(size_t nrec, size_t& ndone,
198
                                 int& opcode, RerrMsg& emsg)
199
{
200
  if (!Virt()) {
201
    emsg.Init("Rw11UnitTape::VirtSpaceForw", "no tape attached");
202
    return false;
203
  }
204
  return Virt()->SpaceForw(nrec, ndone, opcode, emsg);
205
}
206
 
207
//------------------------------------------+-----------------------------------
208
//! FIXME_docs
209
 
210
bool Rw11UnitTape::VirtSpaceBack(size_t nrec, size_t& ndone,
211
                                 int& opcode, RerrMsg& emsg)
212
{
213
  if (!Virt()) {
214
    emsg.Init("Rw11UnitTape::VirtSpaceBack", "no tape attached");
215
    return false;
216
  }
217
  return Virt()->SpaceBack(nrec, ndone, opcode, emsg);
218
}
219
 
220
//------------------------------------------+-----------------------------------
221
//! FIXME_docs
222
 
223
bool Rw11UnitTape::VirtRewind(int& opcode, RerrMsg& emsg)
224
{
225
  if (!Virt()) {
226
    emsg.Init("Rw11UnitTape::VirtRewind", "no tape attached");
227
    return false;
228
  }
229
  return Virt()->Rewind(opcode, emsg);
230
}
231
 
232
//------------------------------------------+-----------------------------------
233
//! FIXME_docs
234
 
235
void Rw11UnitTape::Dump(std::ostream& os, int ind, const char* text) const
236
{
237
  RosFill bl(ind);
238
  os << bl << (text?text:"--") << "Rw11UnitTape @ " << this << endl;
239
  os << bl << "  fType:           " << fType  << endl;
240
  os << bl << "  fEnabled:        " << fEnabled << endl;
241
  os << bl << "  fWProt:          " << fWProt << endl;
242
  os << bl << "  fCapacity:       " << fCapacity << endl;
243
 
244
  Rw11UnitVirt<Rw11VirtTape>::Dump(os, ind, " ^");
245
  return;
246
}
247
 
248
 
249
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.