constants removal
This commit is contained in:
parent
07bacd026b
commit
21b2f0c61b
4 changed files with 11 additions and 14 deletions
16
bus.cpp
16
bus.cpp
|
@ -120,8 +120,6 @@ bus *bus::deserialize(const json_t *const j, console *const cnsl, std::atomic_ui
|
|||
|
||||
void bus::set_memory_size(const int n_pages)
|
||||
{
|
||||
this->n_pages = n_pages;
|
||||
|
||||
uint32_t n_bytes = n_pages * 8192l;
|
||||
|
||||
delete m;
|
||||
|
@ -474,7 +472,7 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
|
|||
}
|
||||
|
||||
// LO size register field must be all 1s, so subtract 1
|
||||
uint32_t system_size = n_pages * 8192l / 64 - 1;
|
||||
uint32_t system_size = m->get_memory_size() / 64 - 1;
|
||||
|
||||
if (a == ADDR_SYSSIZE + 2) { // system size HI
|
||||
uint16_t temp = system_size >> 16;
|
||||
|
@ -505,7 +503,7 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (m_offset >= uint32_t(n_pages * 8192)) {
|
||||
if (m_offset >= m->get_memory_size()) {
|
||||
if (peek_only) {
|
||||
DOLOG(debug, false, "READ from %06o - out of range!", addr_in);
|
||||
return 0;
|
||||
|
@ -696,8 +694,8 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
|||
}
|
||||
}
|
||||
|
||||
if (m_offset >= n_pages * 8192l && !is_io) [[unlikely]] {
|
||||
DOLOG(debug, !peek_only, "bus::calculate_physical_address %o >= %o", m_offset, n_pages * 8192l);
|
||||
if (m_offset >= m->get_memory_size() && !is_io) [[unlikely]] {
|
||||
DOLOG(debug, !peek_only, "bus::calculate_physical_address %o >= %o", m_offset, m->get_memory_size());
|
||||
DOLOG(debug, false, "TRAP(04) (throw 6) on address %06o", a);
|
||||
|
||||
if (mmu_->is_locked() == false) {
|
||||
|
@ -1025,7 +1023,7 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1
|
|||
|
||||
DOLOG(debug, false, "WRITE to %06o/%07o %c %c: %06o", addr_in, m_offset, space == d_space ? 'D' : 'I', word_mode == wm_byte ? 'B' : 'W', value);
|
||||
|
||||
if (m_offset >= uint32_t(n_pages * 8192)) {
|
||||
if (m_offset >= m->get_memory_size()) {
|
||||
c->trap(004); // no such RAM
|
||||
throw 1;
|
||||
}
|
||||
|
@ -1042,7 +1040,7 @@ void bus::writePhysical(const uint32_t a, const uint16_t value)
|
|||
{
|
||||
DOLOG(debug, false, "physicalWRITE %06o to %o", value, a);
|
||||
|
||||
if (a >= n_pages * 8192l) {
|
||||
if (a >= m->get_memory_size()) {
|
||||
DOLOG(debug, false, "physicalWRITE to %o: trap 004", a);
|
||||
c->trap(004);
|
||||
throw 12;
|
||||
|
@ -1054,7 +1052,7 @@ void bus::writePhysical(const uint32_t a, const uint16_t value)
|
|||
|
||||
uint16_t bus::readPhysical(const uint32_t a)
|
||||
{
|
||||
if (a >= n_pages * 8192l) {
|
||||
if (a >= m->get_memory_size()) {
|
||||
DOLOG(debug, false, "physicalREAD from %o: trap 004", a);
|
||||
c->trap(004);
|
||||
throw 13;
|
||||
|
|
4
bus.h
4
bus.h
|
@ -75,10 +75,7 @@ private:
|
|||
rl02 *rl02_ { nullptr };
|
||||
tty *tty_ { nullptr };
|
||||
kw11_l *kw11_l_ { nullptr };
|
||||
|
||||
mmu *mmu_ { nullptr };
|
||||
|
||||
int n_pages { DEFAULT_N_PAGES };
|
||||
memory *m { nullptr };
|
||||
|
||||
uint16_t microprogram_break_register { 0 };
|
||||
|
@ -104,7 +101,6 @@ public:
|
|||
void set_debug_mode() { console_switches |= 128; }
|
||||
uint16_t get_console_leds() { return console_leds; }
|
||||
|
||||
int get_memory_size() const { return n_pages; }
|
||||
void set_memory_size(const int n_pages);
|
||||
|
||||
void mmudebug(const uint16_t a);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "disk_backend_nbd.h"
|
||||
#include "loaders.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "tty.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -1018,7 +1019,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
|||
if (parts.size() == 2)
|
||||
b->set_memory_size(std::stoi(parts.at(1)));
|
||||
else {
|
||||
int n_pages = b->get_memory_size();
|
||||
int n_pages = b->getRAM()->get_memory_size();
|
||||
|
||||
cnsl->put_string_lf(format("Memory size: %u pages or %u kB (decimal)", n_pages, n_pages * 8192 / 1024));
|
||||
}
|
||||
|
|
2
memory.h
2
memory.h
|
@ -18,6 +18,8 @@ public:
|
|||
memory(const uint32_t size);
|
||||
~memory();
|
||||
|
||||
uint32_t get_memory_size() const { return size; }
|
||||
|
||||
void reset();
|
||||
#if IS_POSIX
|
||||
json_t *serialize() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue