write in 512 bytes blocks
This commit is contained in:
parent
285316fd9b
commit
a386e9aa03
2 changed files with 28 additions and 21 deletions
26
rk05.cpp
26
rk05.cpp
|
@ -138,20 +138,29 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
|
|
||||||
DOLOG(debug, false, "RK05 drive %d position sec %d surf %d cyl %d, reclen %zo, WRITE to %o, mem: %o", device, sector, surface, cylinder, reclen, diskoffb, memoff);
|
DOLOG(debug, false, "RK05 drive %d position sec %d surf %d cyl %d, reclen %zo, WRITE to %o, mem: %o", device, sector, surface, cylinder, reclen, diskoffb, memoff);
|
||||||
|
|
||||||
uint8_t *xfer_buffer = new uint8_t[reclen]();
|
uint32_t work_reclen = reclen;
|
||||||
|
uint32_t work_memoff = memoff;
|
||||||
|
uint32_t work_diskoffb = diskoffb;
|
||||||
|
|
||||||
for(size_t i=0; i<reclen; i++)
|
assert(sizeof(xfer_buffer) == 512);
|
||||||
xfer_buffer[i] = b->readUnibusByte(memoff + i);
|
|
||||||
|
|
||||||
if (!fhs.at(device)->write(diskoffb, reclen, xfer_buffer))
|
while(work_reclen > 0) {
|
||||||
|
uint32_t cur = std::min(uint32_t(sizeof xfer_buffer), work_reclen);
|
||||||
|
work_reclen -= cur;
|
||||||
|
|
||||||
|
for(size_t i=0; i<cur; i++)
|
||||||
|
xfer_buffer[i] = b->readUnibusByte(work_memoff++);
|
||||||
|
|
||||||
|
if (!fhs.at(device)->write(work_diskoffb, cur, xfer_buffer))
|
||||||
DOLOG(ll_error, true, "RK05(%d) write error %s", device, strerror(errno));
|
DOLOG(ll_error, true, "RK05(%d) write error %s", device, strerror(errno));
|
||||||
|
|
||||||
|
work_diskoffb += cur;
|
||||||
|
|
||||||
if (v & 2048)
|
if (v & 2048)
|
||||||
DOLOG(debug, false, "RK05 inhibit BA increase");
|
DOLOG(debug, false, "RK05 inhibit BA increase");
|
||||||
else
|
else
|
||||||
update_bus_address(reclen);
|
update_bus_address(cur);
|
||||||
|
|
||||||
// TODO ^ in blocks of 512 bytes to keep this admin correct:
|
|
||||||
if (++sector >= 12) {
|
if (++sector >= 12) {
|
||||||
sector = 0;
|
sector = 0;
|
||||||
if (++surface >= 2) {
|
if (++surface >= 2) {
|
||||||
|
@ -159,11 +168,10 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
cylinder++;
|
cylinder++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registers[(RK05_DA - RK05_BASE) / 2] = sector | (surface << 4) | (cylinder << 5);
|
registers[(RK05_DA - RK05_BASE) / 2] = sector | (surface << 4) | (cylinder << 5);
|
||||||
|
|
||||||
delete [] xfer_buffer;
|
|
||||||
|
|
||||||
*disk_write_acitivity = false;
|
*disk_write_acitivity = false;
|
||||||
}
|
}
|
||||||
else if (func == 2) { // read
|
else if (func == 2) { // read
|
||||||
|
@ -171,8 +179,6 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
|
|
||||||
DOLOG(debug, false, "RK05 drive %d position sec %d surf %d cyl %d, reclen %zo, READ from %o, mem: %o", device, sector, surface, cylinder, reclen, diskoffb, memoff);
|
DOLOG(debug, false, "RK05 drive %d position sec %d surf %d cyl %d, reclen %zo, READ from %o, mem: %o", device, sector, surface, cylinder, reclen, diskoffb, memoff);
|
||||||
|
|
||||||
uint8_t xfer_buffer[512] { 0 };
|
|
||||||
|
|
||||||
uint32_t temp_diskoffb = diskoffb;
|
uint32_t temp_diskoffb = diskoffb;
|
||||||
|
|
||||||
uint32_t temp = reclen;
|
uint32_t temp = reclen;
|
||||||
|
|
3
rk05.h
3
rk05.h
|
@ -28,8 +28,9 @@ class rk05
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bus *const b { nullptr };
|
bus *const b { nullptr };
|
||||||
uint16_t registers [7];
|
uint16_t registers [7] { 0 };
|
||||||
std::vector<disk_backend *> fhs;
|
std::vector<disk_backend *> fhs;
|
||||||
|
uint8_t xfer_buffer[512] { 0 };
|
||||||
|
|
||||||
std::atomic_bool *const disk_read_acitivity { nullptr };
|
std::atomic_bool *const disk_read_acitivity { nullptr };
|
||||||
std::atomic_bool *const disk_write_acitivity { nullptr };
|
std::atomic_bool *const disk_write_acitivity { nullptr };
|
||||||
|
|
Loading…
Add table
Reference in a new issue