wip
This commit is contained in:
parent
5ac576a0ac
commit
b44c6ffa31
3 changed files with 19 additions and 15 deletions
19
cpu.cpp
19
cpu.cpp
|
@ -1104,18 +1104,17 @@ void cpu::busError()
|
|||
{
|
||||
fprintf(stderr, "BUS ERROR\n");
|
||||
|
||||
// PSW = 177776
|
||||
// mov @#PSW, -(sp)
|
||||
trap(4);
|
||||
}
|
||||
|
||||
void cpu::trap(const uint16_t vector)
|
||||
{
|
||||
fprintf(stderr, "TRAP %o\n", vector);
|
||||
|
||||
pushStack(getPSW());
|
||||
|
||||
// mov pc, -(sp)
|
||||
pushStack(getPC());
|
||||
|
||||
// mov @#VEC+2, @#PSW
|
||||
setPSW(b -> readWord(6));
|
||||
|
||||
// mov @#VEC, pc
|
||||
setPC(b -> readWord(4));
|
||||
setPSW(b -> readWord(vector + 2));
|
||||
setPC(b -> readWord(vector + 0));
|
||||
}
|
||||
|
||||
std::pair<std::string, int> cpu::addressing_to_string(const uint8_t mode_register, const uint16_t pc)
|
||||
|
|
1
cpu.h
1
cpu.h
|
@ -58,6 +58,7 @@ public:
|
|||
uint16_t popStack();
|
||||
|
||||
void busError();
|
||||
void trap(const uint16_t vector);
|
||||
|
||||
void setEmulateMFPT(const bool v) { emulateMFPT = v; }
|
||||
|
||||
|
|
14
rk05.cpp
14
rk05.cpp
|
@ -4,6 +4,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "bus.h"
|
||||
#include "cpu.h"
|
||||
#include "error.h"
|
||||
#include "gen.h"
|
||||
#include "rk05.h"
|
||||
|
@ -222,9 +223,9 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
|||
while(temp > 0) {
|
||||
uint32_t cur = std::min(uint32_t(sizeof xfer_buffer), temp);
|
||||
|
||||
#if defined(ESP32)
|
||||
yield();
|
||||
|
||||
#if defined(ESP32)
|
||||
if (fh.read(xfer_buffer, cur) != size_t(cur))
|
||||
D(fprintf(stderr, "RK05 fread error: %s\n", strerror(errno));)
|
||||
#else
|
||||
|
@ -265,11 +266,14 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
|||
fprintf(stderr, "RK05 command %d UNHANDLED\n", func);
|
||||
}
|
||||
|
||||
if (v & 64) { // bit 6, invoke interrupt when done vector address 220, see http://www.pdp-11.nl/peripherals/disk/rk05-info.html
|
||||
fprintf(stderr, "RK05 HIER\n"); // FIXME
|
||||
}
|
||||
|
||||
registers[(RK05_WC - RK05_BASE) / 2] = 0;
|
||||
|
||||
registers[(RK05_DS - RK05_BASE) / 2] |= 64; // drive ready
|
||||
registers[(RK05_CS - RK05_BASE) / 2] |= 128; // control ready
|
||||
|
||||
if (v & 64) { // bit 6, invoke interrupt when done vector address 220, see http://www.pdp-11.nl/peripherals/disk/rk05-info.html
|
||||
b->getCpu()->trap(0220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue