WIP
This commit is contained in:
parent
b2190b97c0
commit
f2ac06b9db
14 changed files with 37 additions and 25 deletions
24
bus.cpp
24
bus.cpp
|
@ -1,13 +1,13 @@
|
||||||
// (C) 2018-2024 by Folkert van Heusden
|
// (C) 2018-2024 by Folkert van Heusden
|
||||||
// Released under MIT license
|
// Released under MIT license
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
#include "gen.h"
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "dc11.h"
|
#include "dc11.h"
|
||||||
#include "kw11-l.h"
|
#include "kw11-l.h"
|
||||||
|
@ -45,34 +45,48 @@ bus::~bus()
|
||||||
delete dc11_;
|
delete dc11_;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonVariant bus::serialize() const
|
void dump(JsonVariantConst j)
|
||||||
{
|
{
|
||||||
JsonVariant j_out;
|
std::string temp;
|
||||||
|
printf("%zu\n", serializeJson(j, temp));
|
||||||
|
|
||||||
|
printf("%s\r\n", temp.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonDocument bus::serialize() const
|
||||||
|
{
|
||||||
|
JsonDocument doc;
|
||||||
|
JsonVariant j_out = doc.to<JsonVariant>();
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
j_out["memory"] = m->serialize();
|
j_out["memory"] = m->serialize();
|
||||||
|
|
||||||
if (kw11_l_)
|
if (kw11_l_)
|
||||||
j_out["kw11-l"] = kw11_l_->serialize();
|
j_out["kw11-l"] = kw11_l_->serialize();
|
||||||
|
dump(kw11_l_->serialize());
|
||||||
|
|
||||||
if (tty_)
|
if (tty_)
|
||||||
j_out["tty"] = tty_->serialize();
|
j_out["tty"] = tty_->serialize();
|
||||||
|
dump(tty_->serialize());
|
||||||
|
|
||||||
if (mmu_)
|
if (mmu_)
|
||||||
j_out["mmu"] = mmu_->serialize();
|
j_out["mmu"] = mmu_->serialize();
|
||||||
|
dump(mmu_->serialize());
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
j_out["cpu"] = c->serialize();
|
c->serialize(j_out["cpu"]);
|
||||||
|
|
||||||
if (rl02_)
|
if (rl02_)
|
||||||
j_out["rl02"] = rl02_->serialize();
|
j_out["rl02"] = rl02_->serialize();
|
||||||
|
dump(rl02_->serialize());
|
||||||
|
|
||||||
if (rk05_)
|
if (rk05_)
|
||||||
j_out["rk05"] = rk05_->serialize();
|
j_out["rk05"] = rk05_->serialize();
|
||||||
|
dump(rk05_->serialize());
|
||||||
|
|
||||||
// TODO: tm11, dc11
|
// TODO: tm11, dc11
|
||||||
|
|
||||||
return j_out;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bus *bus::deserialize(const JsonDocument j, console *const cnsl, std::atomic_uint32_t *const event)
|
bus *bus::deserialize(const JsonDocument j, console *const cnsl, std::atomic_uint32_t *const event)
|
||||||
|
|
4
bus.h
4
bus.h
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "gen.h"
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "dc11.h"
|
#include "dc11.h"
|
||||||
#include "mmu.h"
|
#include "mmu.h"
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
bus();
|
bus();
|
||||||
~bus();
|
~bus();
|
||||||
|
|
||||||
JsonVariant serialize() const;
|
JsonDocument serialize() const;
|
||||||
static bus *deserialize(const JsonDocument j, console *const cnsl, std::atomic_uint32_t *const event);
|
static bus *deserialize(const JsonDocument j, console *const cnsl, std::atomic_uint32_t *const event);
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
|
|
6
cpu.cpp
6
cpu.cpp
|
@ -2434,9 +2434,9 @@ void cpu::step()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonVariant cpu::serialize()
|
void cpu::serialize(JsonVariant j_in)
|
||||||
{
|
{
|
||||||
JsonVariant j;
|
JsonVariant j = j_in["cpu"].to<JsonVariant>();
|
||||||
|
|
||||||
for(int set=0; set<2; set++) {
|
for(int set=0; set<2; set++) {
|
||||||
for(int regnr=0; regnr<6; regnr++)
|
for(int regnr=0; regnr<6; regnr++)
|
||||||
|
@ -2473,8 +2473,6 @@ JsonVariant cpu::serialize()
|
||||||
j["queued_interrupts"] = j_queued_interrupts;
|
j["queued_interrupts"] = j_queued_interrupts;
|
||||||
|
|
||||||
j["any_queued_interrupts"] = bool(any_queued_interrupts);
|
j["any_queued_interrupts"] = bool(any_queued_interrupts);
|
||||||
|
|
||||||
return j;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu *cpu::deserialize(const JsonVariantConst j, bus *const b, std::atomic_uint32_t *const event)
|
cpu *cpu::deserialize(const JsonVariantConst j, bus *const b, std::atomic_uint32_t *const event)
|
||||||
|
|
5
cpu.h
5
cpu.h
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -14,8 +15,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
class breakpoint;
|
class breakpoint;
|
||||||
class bus;
|
class bus;
|
||||||
|
@ -115,7 +114,7 @@ public:
|
||||||
explicit cpu(bus *const b, std::atomic_uint32_t *const event);
|
explicit cpu(bus *const b, std::atomic_uint32_t *const event);
|
||||||
~cpu();
|
~cpu();
|
||||||
|
|
||||||
JsonVariant serialize();
|
void serialize(JsonVariant j);
|
||||||
static cpu *deserialize(const JsonVariantConst j, bus *const b, std::atomic_uint32_t *const event);
|
static cpu *deserialize(const JsonVariantConst j, bus *const b, std::atomic_uint32_t *const event);
|
||||||
|
|
||||||
std::optional<std::string> check_breakpoint();
|
std::optional<std::string> check_breakpoint();
|
||||||
|
|
|
@ -550,7 +550,7 @@ struct state_writer {
|
||||||
|
|
||||||
void serialize_state(console *const cnsl, const bus *const b, const std::string & filename)
|
void serialize_state(console *const cnsl, const bus *const b, const std::string & filename)
|
||||||
{
|
{
|
||||||
JsonVariant j = b->serialize();
|
JsonDocument j = b->serialize();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
@ -11,8 +12,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
class disk_backend
|
class disk_backend
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// (C) 2018-2024 by Folkert van Heusden
|
// (C) 2018-2024 by Folkert van Heusden
|
||||||
// Released under MIT license
|
// Released under MIT license
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
2
gen.h
2
gen.h
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define ARDUINOJSON_DEBUG 1
|
||||||
|
|
||||||
// #define TURBO
|
// #define TURBO
|
||||||
|
|
||||||
typedef enum { EVENT_NONE = 0, EVENT_HALT, EVENT_INTERRUPT, EVENT_TERMINATE } stop_event_t;
|
typedef enum { EVENT_NONE = 0, EVENT_HALT, EVENT_INTERRUPT, EVENT_TERMINATE } stop_event_t;
|
||||||
|
|
2
kw11-l.h
2
kw11-l.h
|
@ -1,6 +1,7 @@
|
||||||
// (C) 2018-2024 by Folkert van Heusden
|
// (C) 2018-2024 by Folkert van Heusden
|
||||||
// Released under MIT license
|
// Released under MIT license
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -8,7 +9,6 @@
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
class kw11_l: public device
|
class kw11_l: public device
|
||||||
|
|
4
memory.h
4
memory.h
|
@ -2,10 +2,10 @@
|
||||||
// Released under MIT license
|
// Released under MIT license
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <ArduinoJson.h>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "gen.h"
|
#include "gen.h"
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
class memory
|
class memory
|
||||||
|
|
3
mmu.h
3
mmu.h
|
@ -1,10 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gen.h"
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
2
rk05.h
2
rk05.h
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -12,7 +13,6 @@
|
||||||
|
|
||||||
#include "disk_device.h"
|
#include "disk_device.h"
|
||||||
#include "disk_backend.h"
|
#include "disk_backend.h"
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define RK05_DS 0177400 // drive status
|
#define RK05_DS 0177400 // drive status
|
||||||
|
|
2
rl02.h
2
rl02.h
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -12,7 +13,6 @@
|
||||||
|
|
||||||
#include "disk_device.h"
|
#include "disk_device.h"
|
||||||
#include "disk_backend.h"
|
#include "disk_backend.h"
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define RL02_CSR 0174400 // control status register
|
#define RL02_CSR 0174400 // control status register
|
||||||
|
|
2
tty.h
2
tty.h
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gen.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -14,7 +15,6 @@
|
||||||
|
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "gen.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define PDP11TTY_TKS 0177560 // reader status
|
#define PDP11TTY_TKS 0177560 // reader status
|
||||||
|
|
Loading…
Add table
Reference in a new issue