.BIC processing
This commit is contained in:
parent
f9ff9b24ba
commit
0300738cbd
7 changed files with 55 additions and 11 deletions
BIN
BIC/EKBAD0.BIC
Normal file
BIN
BIC/EKBAD0.BIC
Normal file
Binary file not shown.
19
debugger.cpp
19
debugger.cpp
|
@ -3,6 +3,7 @@
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "gen.h"
|
#include "gen.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "tty.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -497,3 +498,21 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run_bic(console *const cnsl, bus *const b, std::atomic_uint32_t *const stop_event, const bool tracing, const uint16_t start_addr)
|
||||||
|
{
|
||||||
|
cpu *const c = b->getCpu();
|
||||||
|
|
||||||
|
c->setRegister(7, start_addr);
|
||||||
|
|
||||||
|
tty *const t = b->getTty();
|
||||||
|
|
||||||
|
while(*stop_event == EVENT_NONE && t->get_reset_0x0a() == false) {
|
||||||
|
c->step_a();
|
||||||
|
|
||||||
|
if (tracing)
|
||||||
|
disassemble(c, cnsl, c->getPC(), false);
|
||||||
|
|
||||||
|
c->step_b();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const stop_event, const bool tracing);
|
void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const stop_event, const bool tracing);
|
||||||
|
void run_bic(console *const cnsl, bus *const b, std::atomic_uint32_t *const stop_event, const bool tracing, const uint16_t bic_start);
|
||||||
|
|
|
@ -145,7 +145,7 @@ std::optional<uint16_t> loadTape(bus *const b, const std::string & file)
|
||||||
return { };
|
return { };
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t start = 0, end = 0;
|
std::optional<uint16_t> start;
|
||||||
|
|
||||||
for(;!feof(fh);) {
|
for(;!feof(fh);) {
|
||||||
uint8_t buffer[6];
|
uint8_t buffer[6];
|
||||||
|
@ -181,9 +181,6 @@ std::optional<uint16_t> loadTape(bus *const b, const std::string & file)
|
||||||
|
|
||||||
csum += c;
|
csum += c;
|
||||||
b -> writeByte(p++, c);
|
b -> writeByte(p++, c);
|
||||||
|
|
||||||
if (p > end)
|
|
||||||
end = p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int fcs = fgetc(fh);
|
int fcs = fgetc(fh);
|
||||||
|
@ -195,6 +192,9 @@ std::optional<uint16_t> loadTape(bus *const b, const std::string & file)
|
||||||
|
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
|
|
||||||
|
if (start.has_value() == false)
|
||||||
|
start = 0200; // assume BIC file
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
main.cpp
24
main.cpp
|
@ -45,7 +45,8 @@ void sw_handler(int s)
|
||||||
void help()
|
void help()
|
||||||
{
|
{
|
||||||
printf("-h this help\n");
|
printf("-h this help\n");
|
||||||
printf("-T t.bin load file as a binary tape file (like simh \"load\" command)\n");
|
printf("-T t.bin load file as a binary tape file (like simh \"load\" command), also for .BIC files\n");
|
||||||
|
printf("-B run tape file as a unit test (for .BIC files)\n");
|
||||||
printf("-R d.rk load file as a RK05 disk device\n");
|
printf("-R d.rk load file as a RK05 disk device\n");
|
||||||
printf("-r d.rl load file as a RL02 disk device\n");
|
printf("-r d.rl load file as a RL02 disk device\n");
|
||||||
printf("-N host:port:type use NBD-server as disk device, type being either \"rk05\" or \"rl02\"\n");
|
printf("-N host:port:type use NBD-server as disk device, type being either \"rk05\" or \"rl02\"\n");
|
||||||
|
@ -79,6 +80,7 @@ int main(int argc, char *argv[])
|
||||||
bool sa_set = false;
|
bool sa_set = false;
|
||||||
|
|
||||||
std::string tape;
|
std::string tape;
|
||||||
|
bool is_bic = false;
|
||||||
|
|
||||||
uint16_t console_switches = 0;
|
uint16_t console_switches = 0;
|
||||||
|
|
||||||
|
@ -87,7 +89,7 @@ int main(int argc, char *argv[])
|
||||||
disk_backend *temp_d = nullptr;
|
disk_backend *temp_d = nullptr;
|
||||||
|
|
||||||
int opt = -1;
|
int opt = -1;
|
||||||
while((opt = getopt(argc, argv, "hm:T:r:R:p:ndtL:b:l:s:Q:N:")) != -1)
|
while((opt = getopt(argc, argv, "hm:T:Br:R:p:ndtL:b:l:s:Q:N:")) != -1)
|
||||||
{
|
{
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -137,6 +139,10 @@ int main(int argc, char *argv[])
|
||||||
tape = optarg;
|
tape = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
is_bic = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
temp_d = new disk_backend_file(optarg);
|
temp_d = new disk_backend_file(optarg);
|
||||||
if (!temp_d->begin())
|
if (!temp_d->begin())
|
||||||
|
@ -206,13 +212,15 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
std::atomic_bool interrupt_emulation { false };
|
std::atomic_bool interrupt_emulation { false };
|
||||||
|
|
||||||
if (tape.empty() == false) {
|
std::optional<uint16_t> bic_start;
|
||||||
auto addr = loadTape(b, tape);
|
|
||||||
|
|
||||||
if (addr.has_value() == false)
|
if (tape.empty() == false) {
|
||||||
|
bic_start = loadTape(b, tape);
|
||||||
|
|
||||||
|
if (bic_start.has_value() == false)
|
||||||
return 1; // fail
|
return 1; // fail
|
||||||
|
|
||||||
c->setRegister(7, addr.value());
|
c->setRegister(7, bic_start.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa_set)
|
if (sa_set)
|
||||||
|
@ -271,7 +279,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
cnsl->start_thread();
|
cnsl->start_thread();
|
||||||
|
|
||||||
if (run_debugger || (bootloader == BL_NONE && test.empty()))
|
if (is_bic)
|
||||||
|
run_bic(cnsl, b, &event, tracing, bic_start.value());
|
||||||
|
else if (run_debugger || (bootloader == BL_NONE && test.empty()))
|
||||||
debugger(cnsl, b, &event, tracing);
|
debugger(cnsl, b, &event, tracing);
|
||||||
else {
|
else {
|
||||||
c->emulation_start(); // for statistics
|
c->emulation_start(); // for statistics
|
||||||
|
|
11
tty.cpp
11
tty.cpp
|
@ -26,6 +26,15 @@ tty::~tty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool tty::get_reset_0x0a()
|
||||||
|
{
|
||||||
|
bool temp = had_0x0a;
|
||||||
|
|
||||||
|
had_0x0a = false;
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t tty::readByte(const uint16_t addr)
|
uint8_t tty::readByte(const uint16_t addr)
|
||||||
{
|
{
|
||||||
uint16_t v = readWord(addr & ~1);
|
uint16_t v = readWord(addr & ~1);
|
||||||
|
@ -103,6 +112,8 @@ 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);
|
||||||
|
|
||||||
|
had_0x0a |= ch == 0x0a; // for diagnostics
|
||||||
}
|
}
|
||||||
|
|
||||||
DOLOG(debug, true, "set register %o to %o", addr, v);
|
DOLOG(debug, true, "set register %o to %o", addr, v);
|
||||||
|
|
3
tty.h
3
tty.h
|
@ -25,11 +25,14 @@ private:
|
||||||
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 };
|
||||||
|
bool had_0x0a { false }; // used for diagnostics
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tty(console *const c);
|
tty(console *const c);
|
||||||
virtual ~tty();
|
virtual ~tty();
|
||||||
|
|
||||||
|
bool get_reset_0x0a();
|
||||||
|
|
||||||
uint8_t readByte(const uint16_t addr);
|
uint8_t readByte(const uint16_t addr);
|
||||||
uint16_t readWord(const uint16_t addr);
|
uint16_t readWord(const uint16_t addr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue