Skip to content

Commit

Permalink
casing
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Apr 29, 2024
1 parent ae0672d commit d5aeb46
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 91 deletions.
32 changes: 16 additions & 16 deletions bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
}

if (a == ADDR_LFC) // line frequency clock and status register
return kw11_l_->readWord(a);
return kw11_l_->read_word(a);

if (a == ADDR_LP11CSR) { // printer, CSR register, LP11
uint16_t temp = 0x80;
Expand All @@ -339,9 +339,9 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
(a >= ADDR_PDR_U_START && a < ADDR_PDR_U_END) ||
(a >= ADDR_PAR_U_START && a < ADDR_PAR_U_END)) {
if (word_mode == wm_word)
return mmu_->readWord(a);
return mmu_->read_word(a);

return mmu_->readByte(a);
return mmu_->read_byte(a);
}
///////////

Expand Down Expand Up @@ -460,25 +460,25 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
if (tm11 && a >= TM_11_BASE && a < TM_11_END && !peek_only) {
DOLOG(debug, false, "READ-I/O TM11 register %d", (a - TM_11_BASE) / 2);

return word_mode == wm_byte ? tm11->readByte(a) : tm11->readWord(a);
return word_mode == wm_byte ? tm11->read_byte(a) : tm11->read_word(a);
}

if (rk05_ && a >= RK05_BASE && a < RK05_END && !peek_only) {
DOLOG(debug, false, "READ-I/O RK05 register %d", (a - RK05_BASE) / 2);

return word_mode == wm_byte ? rk05_->readByte(a) : rk05_->readWord(a);
return word_mode == wm_byte ? rk05_->read_byte(a) : rk05_->read_word(a);
}

if (rl02_ && a >= RL02_BASE && a < RL02_END && !peek_only) {
DOLOG(debug, false, "READ-I/O RL02 register %d", (a - RL02_BASE) / 2);

return word_mode == wm_byte ? rl02_->readByte(a) : rl02_->readWord(a);
return word_mode == wm_byte ? rl02_->read_byte(a) : rl02_->read_word(a);
}

if (tty_ && a >= PDP11TTY_BASE && a < PDP11TTY_END && !peek_only) {
DOLOG(debug, false, "READ-I/O TTY register %d", (a - PDP11TTY_BASE) / 2);

return word_mode == wm_byte ? tty_->readByte(a) : tty_->readWord(a);
return word_mode == wm_byte ? tty_->read_byte(a) : tty_->read_word(a);
}

// LO size register field must be all 1s, so subtract 1
Expand Down Expand Up @@ -936,32 +936,32 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1
}

if (a == ADDR_LFC) { // line frequency clock and status register
kw11_l_->writeWord(a, value);
kw11_l_->write_word(a, value);

return { false };
}

if (tm11 && a >= TM_11_BASE && a < TM_11_END) {
DOLOG(debug, false, "WRITE-I/O TM11 register %d: %06o", (a - TM_11_BASE) / 2, value);
word_mode == wm_byte ? tm11->writeByte(a, value) : tm11->writeWord(a, value);
word_mode == wm_byte ? tm11->write_byte(a, value) : tm11->write_word(a, value);
return { false };
}

if (rk05_ && a >= RK05_BASE && a < RK05_END) {
DOLOG(debug, false, "WRITE-I/O RK05 register %d: %06o", (a - RK05_BASE) / 2, value);
word_mode == wm_byte ? rk05_->writeByte(a, value) : rk05_->writeWord(a, value);
word_mode == wm_byte ? rk05_->write_byte(a, value) : rk05_->write_word(a, value);
return { false };
}

if (rl02_ && a >= RL02_BASE && a < RL02_END) {
DOLOG(debug, false, "WRITE-I/O RL02 register %d: %06o", (a - RL02_BASE) / 2, value);
word_mode == wm_byte ? rl02_->writeByte(a, value) : rl02_->writeWord(a, value);
word_mode == wm_byte ? rl02_->write_byte(a, value) : rl02_->write_word(a, value);
return { false };
}

if (tty_ && a >= PDP11TTY_BASE && a < PDP11TTY_END) {
DOLOG(debug, false, "WRITE-I/O TTY register %d: %06o", (a - PDP11TTY_BASE) / 2, value);
word_mode == wm_byte ? tty_->writeByte(a, value) : tty_->writeWord(a, value);
word_mode == wm_byte ? tty_->write_byte(a, value) : tty_->write_word(a, value);
return { false };
}

Expand All @@ -979,9 +979,9 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1
(a >= ADDR_PDR_U_START && a < ADDR_PDR_U_END) ||
(a >= ADDR_PAR_U_START && a < ADDR_PAR_U_END)) {
if (word_mode == wm_word)
mmu_->writeWord(a, value);
mmu_->write_word(a, value);
else
mmu_->writeByte(a, value);
mmu_->write_byte(a, value);

return { false };
}
Expand Down Expand Up @@ -1075,7 +1075,7 @@ uint16_t bus::readPhysical(const uint32_t a)
return value;
}

uint16_t bus::readWord(const uint16_t a, const d_i_space_t s)
uint16_t bus::read_word(const uint16_t a, const d_i_space_t s)
{
return read(a, wm_word, rm_cur, false, s);
}
Expand All @@ -1085,7 +1085,7 @@ uint16_t bus::peekWord(const uint16_t a)
return read(a, wm_word, rm_cur, true);
}

void bus::writeWord(const uint16_t a, const uint16_t value, const d_i_space_t s)
void bus::write_word(const uint16_t a, const uint16_t value, const d_i_space_t s)
{
write(a, wm_word, value, rm_cur, s);
}
Expand Down
8 changes: 4 additions & 4 deletions bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ class bus
rl02 *getRL02() { return rl02_; }

uint16_t read (const uint16_t a, const word_mode_t word_mode, const rm_selection_t mode_selection, const bool peek_only=false, const d_i_space_t s = i_space);
uint16_t readByte(const uint16_t a) { return read(a, wm_byte, rm_cur); }
uint16_t readWord(const uint16_t a, const d_i_space_t s = i_space);
uint16_t read_byte(const uint16_t a) { return read(a, wm_byte, rm_cur); }
uint16_t read_word(const uint16_t a, const d_i_space_t s = i_space);
uint16_t peekWord(const uint16_t a);

uint8_t readUnibusByte(const uint32_t a);
void writeUnibusByte(const uint32_t a, const uint8_t value);

write_rc_t write (const uint16_t a, const word_mode_t word_mode, uint16_t value, const rm_selection_t mode_selection, const d_i_space_t s = i_space);
void writeByte(const uint16_t a, const uint8_t value) { write(a, wm_byte, value, rm_cur); }
void writeWord(const uint16_t a, const uint16_t value, const d_i_space_t s = i_space);
void write_byte(const uint16_t a, const uint8_t value) { write(a, wm_byte, value, rm_cur); }
void write_word(const uint16_t a, const uint16_t value, const d_i_space_t s = i_space);

uint16_t readPhysical(const uint32_t a);
void writePhysical(const uint32_t a, const uint16_t value);
Expand Down
2 changes: 1 addition & 1 deletion console_ncurses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void console_ncurses::panel_update_thread()
uint16_t current_PC = c->getPC();
uint32_t full_addr = b->calculate_physical_address(run_mode, current_PC, false, false, true, i_space);

uint16_t current_instr = b->readWord(current_PC);
uint16_t current_instr = b->read_word(current_PC);

auto data = c->disassemble(current_PC);

Expand Down
12 changes: 6 additions & 6 deletions cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,14 +1613,14 @@ void cpu::pushStack(const uint16_t v)
else {
uint16_t a = addRegister(6, rm_cur, -2);

b->writeWord(a, v, d_space);
b->write_word(a, v, d_space);
}
}

uint16_t cpu::popStack()
{
uint16_t a = getRegister(6);
uint16_t temp = b->readWord(a, d_space);
uint16_t temp = b->read_word(a, d_space);

addRegister(6, rm_cur, 2);

Expand Down Expand Up @@ -1762,7 +1762,7 @@ bool cpu::misc_operations(const uint16_t instr)
setPC(getRegister(link_reg));

// POP link
uint16_t word_on_stack = b->readWord(getRegister(6), d_space);
uint16_t word_on_stack = b->read_word(getRegister(6), d_space);

setRegister(link_reg, word_on_stack);

Expand Down Expand Up @@ -1821,10 +1821,10 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
// make sure the trap vector is retrieved from kernel space
psw &= 037777; // mask off 14/15 to make it into kernel-space

setPC(b->readWord(vector + 0, d_space));
setPC(b->read_word(vector + 0, d_space));

// switch to kernel mode & update 'previous mode'
uint16_t new_psw = b->readWord(vector + 2, d_space) & 0147777; // mask off old 'previous mode'
uint16_t new_psw = b->read_word(vector + 2, d_space) & 0147777; // mask off old 'previous mode'
if (new_ipl != -1)
new_psw = (new_psw & ~0xe0) | (new_ipl << 5);
new_psw |= (before_psw >> 2) & 030000; // apply new 'previous mode'
Expand Down Expand Up @@ -2371,7 +2371,7 @@ void cpu::step()
if (!b->getMMU()->isMMR1Locked())
b->getMMU()->setMMR2(instruction_start);

uint16_t instr = b->readWord(instruction_start);
uint16_t instr = b->read_word(instruction_start);

addRegister(7, rm_cur, 2);

Expand Down
2 changes: 1 addition & 1 deletion debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
uint16_t a = std::stoi(a_it->second, nullptr, 8);
uint8_t v = std::stoi(v_it->second, nullptr, 8);

c->getBus()->writeByte(a, v);
c->getBus()->write_byte(a, v);

cnsl->put_string_lf(format("Set %06o to %03o", a, v));
}
Expand Down
8 changes: 4 additions & 4 deletions device.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class device

virtual void reset() = 0;

virtual uint8_t readByte(const uint16_t addr) = 0;
virtual uint16_t readWord(const uint16_t addr) = 0;
virtual uint8_t read_byte(const uint16_t addr) = 0;
virtual uint16_t read_word(const uint16_t addr) = 0;

virtual void writeByte(const uint16_t addr, const uint8_t v) = 0;
virtual void writeWord(const uint16_t addr, const uint16_t v) = 0;
virtual void write_byte(const uint16_t addr, const uint8_t v) = 0;
virtual void write_word(const uint16_t addr, const uint16_t v) = 0;
};
8 changes: 4 additions & 4 deletions kw11-l.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ void kw11_l::operator()()
DOLOG(debug, true, "KW11-L thread terminating");
}

uint16_t kw11_l::readWord(const uint16_t a)
uint16_t kw11_l::read_word(const uint16_t a)
{
if (a != ADDR_LFC) {
DOLOG(debug, true, "KW11-L readWord not for us (%06o)", a);
DOLOG(debug, true, "KW11-L read_word not for us (%06o)", a);
return 0;
}

Expand All @@ -108,10 +108,10 @@ uint16_t kw11_l::readWord(const uint16_t a)
return temp;
}

void kw11_l::writeWord(const uint16_t a, const uint16_t value)
void kw11_l::write_word(const uint16_t a, const uint16_t value)
{
if (a != ADDR_LFC) {
DOLOG(debug, true, "KW11-L writeWord not for us (%06o to %06o)", value, a);
DOLOG(debug, true, "KW11-L write_word not for us (%06o to %06o)", value, a);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions kw11-l.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ class kw11_l
void begin(console *const cnsl);
void operator()();

uint16_t readWord (const uint16_t a);
void writeWord(const uint16_t a, const uint16_t v);
uint16_t read_word (const uint16_t a);
void write_word(const uint16_t a, const uint16_t v);
};
8 changes: 4 additions & 4 deletions loaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void loadbin(bus *const b, uint16_t base, const char *const file)
FILE *fh = fopen(file, "rb");

while(!feof(fh))
b->writeByte(base++, fgetc(fh));
b->write_byte(base++, fgetc(fh));

fclose(fh);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ void set_boot_loader(bus *const b, const bootloader_t which)
}

for(int i=0; i<size; i++)
b->writeWord(offset + i * 2, bl[i]);
b->write_word(offset + i * 2, bl[i]);

c->setRegister(7, start);
}
Expand Down Expand Up @@ -215,7 +215,7 @@ std::optional<uint16_t> load_tape(bus *const b, const std::string & file)
#endif

csum += c;
b->writeByte(p++, c);
b->write_byte(p++, c);
}

#if defined(ESP32)
Expand Down Expand Up @@ -259,7 +259,7 @@ void load_p11_x11(bus *const b, const std::string & file)
if (n) {
uint8_t byte = strtol(buffer, nullptr, 16);

b->writeByte(addr, byte);
b->write_byte(addr, byte);

n--;

Expand Down
10 changes: 5 additions & 5 deletions mmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void mmu::write_par(const uint32_t a, const int run_mode, const uint16_t value,
DOLOG(debug, false, "mmu WRITE-I/O PAR run-mode %d: %c for %d: %o (%07o)", run_mode, is_d ? 'D' : 'I', page, word_mode == wm_byte ? value & 0xff : value, pages[run_mode][is_d][page].par * 64);
}

uint16_t mmu::readWord(const uint16_t a)
uint16_t mmu::read_word(const uint16_t a)
{
uint16_t v = 0;

Expand All @@ -165,17 +165,17 @@ uint16_t mmu::readWord(const uint16_t a)
return v;
}

uint8_t mmu::readByte(const uint16_t addr)
uint8_t mmu::read_byte(const uint16_t addr)
{
uint16_t v = readWord(addr);
uint16_t v = read_word(addr);

if (addr & 1)
return v >> 8;

return v;
}

void mmu::writeWord(const uint16_t a, const uint16_t value)
void mmu::write_word(const uint16_t a, const uint16_t value)
{
// supervisor
if (a >= ADDR_PDR_SV_START && a < ADDR_PDR_SV_END)
Expand All @@ -194,7 +194,7 @@ void mmu::writeWord(const uint16_t a, const uint16_t value)
write_par(a, 3, value, wm_word);
}

void mmu::writeByte(const uint16_t a, const uint8_t value)
void mmu::write_byte(const uint16_t a, const uint8_t value)
{
// supervisor
if (a >= ADDR_PDR_SV_START && a < ADDR_PDR_SV_END)
Expand Down
8 changes: 4 additions & 4 deletions mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ class mmu : public device
void write_pdr(const uint32_t a, const int run_mode, const uint16_t value, const word_mode_t word_mode);
void write_par(const uint32_t a, const int run_mode, const uint16_t value, const word_mode_t word_mode);

uint8_t readByte(const uint16_t addr) override;
uint16_t readWord(const uint16_t addr) override;
uint8_t read_byte(const uint16_t addr) override;
uint16_t read_word(const uint16_t addr) override;

void writeByte(const uint16_t addr, const uint8_t v) override;
void writeWord(const uint16_t addr, uint16_t v) override;
void write_byte(const uint16_t addr, const uint8_t v) override;
void write_word(const uint16_t addr, uint16_t v) override;
};
12 changes: 6 additions & 6 deletions rk05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ void rk05::reset()
memset(registers, 0x00, sizeof registers);
}

uint8_t rk05::readByte(const uint16_t addr)
uint8_t rk05::read_byte(const uint16_t addr)
{
uint16_t v = readWord(addr & ~1);
uint16_t v = read_word(addr & ~1);

if (addr & 1)
return v >> 8;

return v;
}

uint16_t rk05::readWord(const uint16_t addr)
uint16_t rk05::read_word(const uint16_t addr)
{
const int reg = (addr - RK05_BASE) / 2;

Expand Down Expand Up @@ -102,16 +102,16 @@ void rk05::update_bus_address(const uint16_t v)
registers[(RK05_CS - RK05_BASE) / 2] |= ((org_v >> 16) & 3) << 4;
}

void rk05::writeByte(const uint16_t addr, const uint8_t v)
void rk05::write_byte(const uint16_t addr, const uint8_t v)
{
uint16_t vtemp = registers[(addr - RK05_BASE) / 2];

update_word(&vtemp, addr & 1, v);

writeWord(addr, vtemp);
write_word(addr, vtemp);
}

void rk05::writeWord(const uint16_t addr, const uint16_t v)
void rk05::write_word(const uint16_t addr, const uint16_t v)
{
const int reg = (addr - RK05_BASE) / 2;

Expand Down
8 changes: 4 additions & 4 deletions rk05.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class rk05: public disk_device
static rk05 *deserialize(const json_t *const j, bus *const b);
#endif

uint8_t readByte(const uint16_t addr) override;
uint16_t readWord(const uint16_t addr) override;
uint8_t read_byte(const uint16_t addr) override;
uint16_t read_word(const uint16_t addr) override;

void writeByte(const uint16_t addr, const uint8_t v) override;
void writeWord(const uint16_t addr, const uint16_t v) override;
void write_byte(const uint16_t addr, const uint8_t v) override;
void write_word(const uint16_t addr, const uint16_t v) override;
};
Loading

0 comments on commit d5aeb46

Please sign in to comment.