TTT: generate an interrupt when the character has been transmitted.
This commit is contained in:
parent
9bba033dbc
commit
17237e7eed
3 changed files with 16 additions and 6 deletions
2
main.cpp
2
main.cpp
|
@ -255,7 +255,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
running = cnsl->get_running_flag();
|
running = cnsl->get_running_flag();
|
||||||
|
|
||||||
tty *tty_ = new tty(cnsl);
|
tty *tty_ = new tty(cnsl, b);
|
||||||
|
|
||||||
b->add_tty(tty_);
|
b->add_tty(tty_);
|
||||||
|
|
||||||
|
|
14
tty.cpp
14
tty.cpp
|
@ -1,10 +1,11 @@
|
||||||
// (C) 2018 by Folkert van Heusden
|
// (C) 2018-2023 by Folkert van Heusden
|
||||||
// // Released under Apache License v2.0
|
// // Released under Apache License v2.0
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
|
#include "cpu.h"
|
||||||
#include "gen.h"
|
#include "gen.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
@ -18,7 +19,9 @@ const char * const regnames[] = {
|
||||||
"puncher buffer"
|
"puncher buffer"
|
||||||
};
|
};
|
||||||
|
|
||||||
tty::tty(console *const c) : c(c)
|
tty::tty(console *const c, bus *const b) :
|
||||||
|
c(c),
|
||||||
|
b(b)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +68,7 @@ uint16_t tty::readWord(const uint16_t addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (addr == PDP11TTY_TPS) {
|
else if (addr == PDP11TTY_TPS) {
|
||||||
vtemp = 128;
|
vtemp |= 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
DOLOG(debug, true, "PDP11TTY read addr %o (%s): %d, 7bit: %d", addr, regnames[reg], vtemp, vtemp & 127);
|
DOLOG(debug, true, "PDP11TTY read addr %o (%s): %d, 7bit: %d", addr, regnames[reg], vtemp, vtemp & 127);
|
||||||
|
@ -103,6 +106,11 @@ void tty::writeWord(const uint16_t addr, uint16_t v)
|
||||||
DOLOG(debug, true, "PDP11TTY print '%c'", ch);
|
DOLOG(debug, true, "PDP11TTY print '%c'", ch);
|
||||||
|
|
||||||
c->put_char(ch);
|
c->put_char(ch);
|
||||||
|
|
||||||
|
registers[(PDP11TTY_TPS - PDP11TTY_BASE) / 2] |= 128;
|
||||||
|
|
||||||
|
if (registers[(PDP11TTY_TPS - PDP11TTY_BASE) / 2] & 64)
|
||||||
|
b->getCpu()->queue_interrupt(4, 064);
|
||||||
}
|
}
|
||||||
|
|
||||||
DOLOG(debug, true, "set register %o to %o", addr, v);
|
DOLOG(debug, true, "set register %o to %o", addr, v);
|
||||||
|
|
6
tty.h
6
tty.h
|
@ -1,4 +1,4 @@
|
||||||
// (C) 2018-2022 by Folkert van Heusden
|
// (C) 2018-2023 by Folkert van Heusden
|
||||||
// Released under Apache License v2.0
|
// Released under Apache License v2.0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "bus.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,12 +23,13 @@ class tty
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
console *const c { nullptr };
|
console *const c { nullptr };
|
||||||
|
bus *const b { nullptr };
|
||||||
bool have_char_1 { false }; // RCVR BUSY bit high (11)
|
bool have_char_1 { false }; // RCVR BUSY bit high (11)
|
||||||
bool have_char_2 { false }; // RCVR DONE bit high (7)
|
bool have_char_2 { false }; // RCVR DONE bit high (7)
|
||||||
uint16_t registers[4] { 0 };
|
uint16_t registers[4] { 0 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tty(console *const c);
|
tty(console *const c, bus *const b);
|
||||||
virtual ~tty();
|
virtual ~tty();
|
||||||
|
|
||||||
uint8_t readByte(const uint16_t addr);
|
uint8_t readByte(const uint16_t addr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue