TTT: generate an interrupt when the character has been transmitted.

This commit is contained in:
folkert van heusden 2023-03-26 13:43:35 +02:00
parent 9bba033dbc
commit 17237e7eed
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 16 additions and 6 deletions

View file

@ -255,7 +255,7 @@ int main(int argc, char *argv[])
running = cnsl->get_running_flag();
tty *tty_ = new tty(cnsl);
tty *tty_ = new tty(cnsl, b);
b->add_tty(tty_);

14
tty.cpp
View file

@ -1,10 +1,11 @@
// (C) 2018 by Folkert van Heusden
// (C) 2018-2023 by Folkert van Heusden
// // Released under Apache License v2.0
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "tty.h"
#include "cpu.h"
#include "gen.h"
#include "log.h"
#include "memory.h"
@ -18,7 +19,9 @@ const char * const regnames[] = {
"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) {
vtemp = 128;
vtemp |= 128;
}
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);
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);

6
tty.h
View file

@ -1,4 +1,4 @@
// (C) 2018-2022 by Folkert van Heusden
// (C) 2018-2023 by Folkert van Heusden
// Released under Apache License v2.0
#pragma once
@ -6,6 +6,7 @@
#include <stdio.h>
#include <string>
#include "bus.h"
#include "console.h"
@ -22,12 +23,13 @@ class tty
{
private:
console *const c { nullptr };
bus *const b { nullptr };
bool have_char_1 { false }; // RCVR BUSY bit high (11)
bool have_char_2 { false }; // RCVR DONE bit high (7)
uint16_t registers[4] { 0 };
public:
tty(console *const c);
tty(console *const c, bus *const b);
virtual ~tty();
uint8_t readByte(const uint16_t addr);