62 return Open(url,
"file", emsg);
71 if (!
fUrl.
Set(url,
"|wpro|noboot|pat=|", scheme, emsg))
return false;
80 }
else if (pat ==
"ones") {
82 }
else if (pat ==
"dead") {
84 }
else if (pat ==
"test") {
87 emsg.
Init(
"Rw11VirtDiskRam::Open()",
88 string(
"invalid pattern name '") + pat +
"'");
105 for (
size_t i=0; i<nblk; i++) {
127 for (
size_t i=0; i<nblk; i++) {
149 uint32_t lbabeg =
fBlkMap.begin()->first;
152 nwrite += (it->second).NWrite();
153 auto itnext = next(it);
154 if (itnext ==
fBlkMap.end() || itnext->first != (it->first)+1) {
157 <<
" : nb=" <<
RosPrintf(it->first-lbabeg+1,
"d",8)
158 <<
" nw=" <<
RosPrintf(nwrite,
"d",8) << endl;
159 if (itnext !=
fBlkMap.end()) lbabeg = itnext->first;
174 os << bl << (text?text:
"--") <<
"Rw11VirtDiskRam @ " <<
this << endl;
176 os << bl <<
" fNoBoot: " <<
fNoBoot << endl;
177 os << bl <<
" fPatTyp: " <<
fPatTyp << endl;
178 os << bl <<
" fBlkMap.size: " <<
fBlkMap.size() << endl;
190 uint16_t bootcode[] = {
202 uint16_t* pdata =
reinterpret_cast<uint16_t*
>(data);
203 for (uint16_t& o : bootcode) *pdata++ = o;
205 ostringstream boottext;
207 boottext <<
"++======================================++\r\n";
208 boottext <<
"|| This is not a hardware bootable disk ||\r\n";
209 boottext <<
"++======================================++\r\n";
211 boottext <<
"Virtual disk: CHS="
214 boottext <<
" name=" <<
fUrl.
Path();
216 boottext <<
"CPU WILL HALT\r\n";
219 char* pchar =
reinterpret_cast<char*
>(pdata);
220 char* pend =
reinterpret_cast<char*
>(data+
fBlkSize);
221 for (
char& o : boottext.str()) {
223 if (pchar >= pend)
break;
225 while (pchar < pend) { *pchar++ =
'\0'; }
231 uint16_t* p =
reinterpret_cast<uint16_t*
>(data);
232 uint16_t* pend =
reinterpret_cast<uint16_t*
>(data+
fBlkSize);
237 while (p < pend) { *p++ = 0x0000; }
240 while (p < pend) { *p++ = 0xffff; }
243 while (p < pend) { *p++ = 0xdead; *p++ = 0xbeaf; }
247 *p++ = addr & 0xffff;
248 *p++ = (addr>>16) & 0xffff;
void Init(const std::string &meth, const std::string &text)
FIXME_docs.
I/O appicator to generate fill characters.
bool FindOpt(const std::string &name) const
FIXME_docs.
bool Set(const std::string &url, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
const std::string & Path() const
FIXME_docs.
void Inc(size_t ind, double val=1.)
FIXME_docs.
void Define(size_t ind, const std::string &name, const std::string &text)
FIXME_docs.
virtual bool Read(size_t lba, size_t nblk, uint8_t *data, RerrMsg &emsg)
FIXME_docs.
virtual bool Open(const std::string &url, RerrMsg &emsg)
FIXME_docs.
virtual bool Write(size_t lba, size_t nblk, const uint8_t *data, RerrMsg &emsg)
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
void ReadPattern(size_t lba, uint8_t *data)
FIXME_doc.
Rw11VirtDiskRam(Rw11Unit *punit)
Default constructor.
~Rw11VirtDiskRam()
Destructor.
void List(std::ostream &os) const
FIXME_docs.
pattyp fPatTyp
pattern type
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
size_t fNBlock
disk size in blocks
size_t fBlkSize
block size in byte
bool fWProt
write protected
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Declaration of class ReventLoop.