RK05: statically sized read-buffer is not always large enough
This commit is contained in:
parent
69b2651bf7
commit
9eb9254c6e
3 changed files with 11 additions and 7 deletions
|
@ -34,9 +34,9 @@ add_executable(
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT supported)
|
check_ipo_supported(RESULT supported)
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
#set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||||
#set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||||
|
|
11
rk05.cpp
11
rk05.cpp
|
@ -27,8 +27,7 @@ rk05::rk05(const std::vector<disk_backend *> & files, bus *const b, std::atomic_
|
||||||
disk_read_acitivity(disk_read_acitivity),
|
disk_read_acitivity(disk_read_acitivity),
|
||||||
disk_write_acitivity(disk_write_acitivity)
|
disk_write_acitivity(disk_write_acitivity)
|
||||||
{
|
{
|
||||||
memset(registers, 0x00, sizeof registers );
|
memset(registers, 0x00, sizeof registers);
|
||||||
memset(xfer_buffer, 0x00, sizeof xfer_buffer);
|
|
||||||
|
|
||||||
fhs = files;
|
fhs = files;
|
||||||
}
|
}
|
||||||
|
@ -129,12 +128,14 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
|
|
||||||
DOLOG(debug, true, "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, true, "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 p = reclen;
|
uint32_t p = reclen;
|
||||||
for(size_t i=0; i<reclen; i++)
|
for(size_t i=0; i<reclen; i++)
|
||||||
xfer_buffer[i] = b->readUnibusByte(memoff + i);
|
xfer_buffer[i] = b->readUnibusByte(memoff + i);
|
||||||
|
|
||||||
if (!fhs.at(device)->write(diskoffb, reclen, xfer_buffer))
|
if (!fhs.at(device)->write(diskoffb, reclen, xfer_buffer))
|
||||||
DOLOG(ll_error, true, "RK05 pwrite error %s", strerror(errno));
|
DOLOG(ll_error, true, "RK05(%d) write error %s", device, strerror(errno));
|
||||||
|
|
||||||
if (v & 2048)
|
if (v & 2048)
|
||||||
DOLOG(debug, true, "RK05 inhibit BA increase");
|
DOLOG(debug, true, "RK05 inhibit BA increase");
|
||||||
|
@ -151,6 +152,8 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
|
|
||||||
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
|
||||||
|
@ -158,6 +161,8 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
||||||
|
|
||||||
DOLOG(debug, true, "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, true, "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];
|
||||||
|
|
||||||
int temp_diskoffb = diskoffb;
|
int temp_diskoffb = diskoffb;
|
||||||
|
|
||||||
uint32_t temp = reclen;
|
uint32_t temp = reclen;
|
||||||
|
|
1
rk05.h
1
rk05.h
|
@ -28,7 +28,6 @@ class rk05
|
||||||
private:
|
private:
|
||||||
bus *const b { nullptr };
|
bus *const b { nullptr };
|
||||||
uint16_t registers [ 7];
|
uint16_t registers [ 7];
|
||||||
uint8_t xfer_buffer[512];
|
|
||||||
std::vector<disk_backend *> fhs;
|
std::vector<disk_backend *> fhs;
|
||||||
|
|
||||||
std::atomic_bool *const disk_read_acitivity { nullptr };
|
std::atomic_bool *const disk_read_acitivity { nullptr };
|
||||||
|
|
Loading…
Add table
Reference in a new issue