diff --git a/devices/common/viacuda.cpp b/devices/common/viacuda.cpp index ea2cb8c..69232d1 100644 --- a/devices/common/viacuda.cpp +++ b/devices/common/viacuda.cpp @@ -356,7 +356,7 @@ void ViaCuda::write(uint8_t new_state) { schedule_sr_int(USECS_TO_NSECS(61)); } else { if (this->via_regs[VIA_ACR] & 0x10) { /* data transfer: Host --> Cuda */ - if (this->in_count < 16) { + if (this->in_count < sizeof(this->in_buf)) { this->in_buf[this->in_count++] = this->via_regs[VIA_SR]; // tell the system we've read the byte after 71 usecs schedule_sr_int(USECS_TO_NSECS(71)); diff --git a/devices/common/viacuda.h b/devices/common/viacuda.h index 9945ddd..d76fede 100644 --- a/devices/common/viacuda.h +++ b/devices/common/viacuda.h @@ -140,6 +140,8 @@ enum { CUDA_ERR_I2C = 5 /* invalid I2C data or no acknowledge */ }; +#define CUDA_IN_BUF_SIZE 256 + /** PRAM addresses within Cuda's internal memory */ #define CUDA_PRAM_START 0x100 // starting address of PRAM #define CUDA_PRAM_END 0x1FF // last byte of PRAM @@ -195,7 +197,7 @@ private: uint8_t old_tip; uint8_t old_byteack; uint8_t treq; - uint8_t in_buf[16]; + uint8_t in_buf[CUDA_IN_BUF_SIZE]; int32_t in_count; uint8_t out_buf[16]; int32_t out_count;