Skip to content

Commit

Permalink
[TMS7000] Support TMS7000
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Jun 12, 2024
1 parent 2cc8f12 commit 9ed2e61
Show file tree
Hide file tree
Showing 40 changed files with 5,394 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debugger/tms7000/compile_flags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-O
-Wall
-std=c++14
-I..
-I../.pio/libdeps/teensy41/libcli/src
-I../.pio/libdeps/teensy41/libasm/src
58 changes: 58 additions & 0 deletions debugger/tms7000/devs_tms7000.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include "devs_tms7000.h"
#include <string.h>
#include "debugger.h"
#include "mc6850.h"

namespace debugger {
namespace tms7000 {

DevsTms7000 Devs;

void DevsTms7000::reset() {
ACIA.reset();
ACIA.setBaseAddr(ACIA_BASE);
}

void DevsTms7000::begin() {
enableDevice(ACIA);
}

void DevsTms7000::loop() {
ACIA.loop();
}

bool DevsTms7000::isSelected(uint32_t addr) const {
return ACIA.isSelected(addr);
}

uint16_t DevsTms7000::read(uint32_t addr) const {
return ACIA.read(addr);
}

void DevsTms7000::write(uint32_t addr, uint16_t data) const {
ACIA.write(addr, data);
}

Device &DevsTms7000::parseDevice(const char *name) const {
if (strcasecmp(name, ACIA.name()) == 0)
return ACIA;
return Devs::nullDevice();
}

void DevsTms7000::enableDevice(Device &dev) {
ACIA.enable(&dev == &ACIA);
}

void DevsTms7000::printDevices() const {
printDevice(ACIA);
}

} // namespace tms7000
} // namespace debugger

// Local Variables:
// mode: c++
// c-basic-offset: 4
// tab-width: 4
// End:
// vim: set ft=cpp et ts=4 sw=4:
35 changes: 35 additions & 0 deletions debugger/tms7000/devs_tms7000.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef __DEVS_TMS7000_H__
#define __DEVS_TMS7000_H__

#include "devs.h"

#define ACIA_BASE 0x01F0 // P240

namespace debugger {
namespace tms7000 {

struct DevsTms7000 : Devs {
void begin() override;
void reset() override;
void loop() override;
bool isSelected(uint32_t addr) const override;
uint16_t read(uint32_t addr) const override;
void write(uint32_t addr, uint16_t data) const override;

Device &parseDevice(const char *name) const override;
void enableDevice(Device &dev) override;
void printDevices() const override;
};

extern struct DevsTms7000 Devs;

} // namespace tms7000
} // namespace debugger
#endif /* __DEVS_TMS7000H__ */

// Local Variables:
// mode: c++
// c-basic-offset: 4
// tab-width: 4
// End:
// vim: set ft=cpp et ts=4 sw=4:
54 changes: 54 additions & 0 deletions debugger/tms7000/inst_tms7000.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/gawk -f
# -*- mode: awk; -*-

BEGIN {
PRETTY_PRINT = 0;
GENERATE_TABLE = 1;
}

BEGIN {
if (PRETTY_PRINT) {
pretty_print("op", "mnemo", "operand", "#", "bus");
pretty_print("--", "-----", "----------", "-", "-");
}
if (GENERATE_TABLE) {
printf("constexpr uint8_t INST_TABLE[] = {\n");
}
}

function pretty_print(opc, mnemo, operand, len, bus) {
if (PRETTY_PRINT == 0)
return;
printf("%-2s %-5s %-10s %s %s\n",
opc, mnemo, operand, len, bus);
}

function generate_ENTRY(opc, mnemo, operand, len, bus) {
if (GENERATE_TABLE == 0)
return;
if (bus == "-")
bus = "0";
if (len == "-") {
printf(" 0, // %s\n", opc);
} else {
printf(" E(%d, %d), // %s: %-5s %s\n",
len, bus, opc, mnemo, operand);
}
}

END {
if (GENERATE_TABLE)
printf("};\n");
}

$1 !~ /[0-9A-F][0-9A-F]/ { next; }
$1 ~ /[0-9A-F][0-9A-F]/ {
opc = $1;
mne = $2;
opr = $3;
len = $4;
bus = $5;

pretty_print(opc, mne, opr, len, bus);
generate_ENTRY(opc, mne, opr, len, bus);
}
Loading

0 comments on commit 9ed2e61

Please sign in to comment.