mirror of
https://github.com/wfjm/w11.git
synced 2026-02-18 13:47:24 +00:00
add mcodes bootw11,noboot; add ram:&noboot
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// $Id: Rw11VirtDiskRam.cpp 1063 2018-10-29 18:37:42Z mueller $
|
||||
// $Id: Rw11VirtDiskRam.cpp 1143 2019-05-01 13:25:51Z mueller $
|
||||
//
|
||||
// Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2018-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2019-05-01 1143 1.1 add noboot option
|
||||
// 2018-10-28 1063 1.0 Initial version
|
||||
// 2018-10-27 1061 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -27,6 +28,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "librtools/RosFill.hpp"
|
||||
#include "librtools/RosPrintf.hpp"
|
||||
|
||||
@@ -47,6 +50,7 @@ namespace Retro {
|
||||
|
||||
Rw11VirtDiskRam::Rw11VirtDiskRam(Rw11Unit* punit)
|
||||
: Rw11VirtDisk(punit),
|
||||
fNoBoot(false),
|
||||
fPatTyp(kPatZero),
|
||||
fBlkMap()
|
||||
{
|
||||
@@ -74,8 +78,9 @@ bool Rw11VirtDiskRam::Open(const std::string& url, RerrMsg& emsg)
|
||||
bool Rw11VirtDiskRam::Open(const std::string& url, const std::string& scheme,
|
||||
RerrMsg& emsg)
|
||||
{
|
||||
if (!fUrl.Set(url, "|wpro|pat=|", scheme, emsg)) return false;
|
||||
fWProt = fUrl.FindOpt("wpro");
|
||||
if (!fUrl.Set(url, "|wpro|noboot|pat=|", scheme, emsg)) return false;
|
||||
fWProt = fUrl.FindOpt("wpro");
|
||||
fNoBoot = fUrl.FindOpt("noboot");
|
||||
|
||||
string pat;
|
||||
fPatTyp = kPatZero;
|
||||
@@ -178,6 +183,7 @@ void Rw11VirtDiskRam::Dump(std::ostream& os, int ind, const char* text,
|
||||
RosFill bl(ind);
|
||||
os << bl << (text?text:"--") << "Rw11VirtDiskRam @ " << this << endl;
|
||||
|
||||
os << bl << " fNoBoot: " << fNoBoot << endl;
|
||||
os << bl << " fPatTyp: " << fPatTyp << endl;
|
||||
os << bl << " fBlkMap.size: " << fBlkMap.size() << endl;
|
||||
Rw11VirtDisk::Dump(os, ind, " ^", detail);
|
||||
@@ -189,10 +195,53 @@ void Rw11VirtDiskRam::Dump(std::ostream& os, int ind, const char* text,
|
||||
|
||||
void Rw11VirtDiskRam::ReadPattern(size_t lba, uint8_t* data)
|
||||
{
|
||||
|
||||
if (lba == 0 && fNoBoot) { // block 0 with 'not bootable' msg
|
||||
uint16_t bootcode[] = {
|
||||
0012700, 0000026, // start: mov #text, r0
|
||||
0105710, // 1$: tstb (r0)
|
||||
0001406, // beq 3$
|
||||
0105737, 0177564, // 2$: tstb @#to.csr
|
||||
0100375, // bpl 2$
|
||||
0112037, 0177566, // movb (r0)+,@#to.buf
|
||||
0000770, // br 1$
|
||||
0000000 // 3$: halt
|
||||
// text: .ascii ....
|
||||
};
|
||||
|
||||
uint16_t* pdata = reinterpret_cast<uint16_t*>(data);
|
||||
for (uint16_t& o : bootcode) *pdata++ = o;
|
||||
|
||||
ostringstream boottext;
|
||||
boottext << "\r\n";
|
||||
boottext << "++======================================++\r\n";
|
||||
boottext << "|| This is not a hardware bootable disk ||\r\n";
|
||||
boottext << "++======================================++\r\n";
|
||||
boottext << "\r\n";
|
||||
boottext << "Virtual disk: CHS="
|
||||
<< fNCyl << "," << fNHead << "," << fNSect;
|
||||
boottext << " blocks=" << fNBlock << "(" << fBlkSize << ")";
|
||||
boottext << " name=" << fUrl.Path();
|
||||
boottext << "\r\n";
|
||||
boottext << "CPU WILL HALT\r\n";
|
||||
boottext << "\r\n";
|
||||
|
||||
char* pchar = reinterpret_cast<char*>(pdata);
|
||||
char* pend = reinterpret_cast<char*>(data+fBlkSize);
|
||||
for (char& o : boottext.str()) { // append boot text
|
||||
*pchar++ = o;
|
||||
if (pchar >= pend) break; // ensure block isn't overrrun
|
||||
}
|
||||
while (pchar < pend) { *pchar++ = '\0'; } // zero fill rest
|
||||
pend[-1] = '\0'; // ensure text 0 terminated
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t* p = reinterpret_cast<uint16_t*>(data);
|
||||
uint16_t* pend = reinterpret_cast<uint16_t*>(data+fBlkSize);
|
||||
size_t addr = lba*fBlkSize;
|
||||
|
||||
|
||||
switch (fPatTyp) {
|
||||
case kPatZero:
|
||||
while (p < pend) { *p++ = 0x0000; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// $Id: Rw11VirtDiskRam.hpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
// $Id: Rw11VirtDiskRam.hpp 1143 2019-05-01 13:25:51Z mueller $
|
||||
//
|
||||
// Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2018-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2019-05-01 1143 1.1 add noboot option
|
||||
// 2018-10-28 1063 1.0 Initial version
|
||||
// 2018-10-27 1061 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -74,6 +75,7 @@ namespace Retro {
|
||||
kPatTest
|
||||
};
|
||||
|
||||
bool fNoBoot;
|
||||
pattyp fPatTyp; //!< pattern type
|
||||
bmap_t fBlkMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user