diff --git a/bus.cpp b/bus.cpp index afd6d92..20add72 100644 --- a/bus.cpp +++ b/bus.cpp @@ -428,8 +428,12 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm return 0; } - uint16_t temp = 0; + if (m_offset >= n_pages * 8192) { + c->trap(004); // no such RAM + throw 1; + } + uint16_t temp = 0; if (word_mode == wm_byte) temp = m->readByte(m_offset); else @@ -1026,6 +1030,11 @@ void bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint16_t va DOLOG(debug, true, "WRITE to %06o/%07o %c %c: %06o", addr_in, m_offset, space == d_space ? 'D' : 'I', word_mode ? 'B' : 'W', value); + if (m_offset >= n_pages * 8192) { + c->trap(004); // no such RAM + throw 1; + } + if (word_mode == wm_byte) m->writeByte(m_offset, value); else diff --git a/bus.h b/bus.h index ae1808c..07e548f 100644 --- a/bus.h +++ b/bus.h @@ -1,10 +1,8 @@ -// (C) 2018-2023 by Folkert van Heusden +// (C) 2018-2024 by Folkert van Heusden // Released under MIT license #pragma once -// #define SYSTEM_11_44 - #include #include #include