if not ram nor i/o, then trap 4

This commit is contained in:
folkert van heusden 2024-04-01 22:40:41 +02:00
parent 31f1af4a7b
commit 4ecf4d0de2
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 11 additions and 4 deletions

11
bus.cpp
View file

@ -428,8 +428,12 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
return 0; 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) if (word_mode == wm_byte)
temp = m->readByte(m_offset); temp = m->readByte(m_offset);
else 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); 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) if (word_mode == wm_byte)
m->writeByte(m_offset, value); m->writeByte(m_offset, value);
else else

4
bus.h
View file

@ -1,10 +1,8 @@
// (C) 2018-2023 by Folkert van Heusden // (C) 2018-2024 by Folkert van Heusden
// Released under MIT license // Released under MIT license
#pragma once #pragma once
// #define SYSTEM_11_44
#include <assert.h> #include <assert.h>
#include <mutex> #include <mutex>
#include <stdint.h> #include <stdint.h>