summaryrefslogtreecommitdiff
path: root/rvcontroller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rvcontroller.lua')
-rw-r--r--rvcontroller.lua33
1 files changed, 24 insertions, 9 deletions
diff --git a/rvcontroller.lua b/rvcontroller.lua
index 13e4c24..1b787da 100644
--- a/rvcontroller.lua
+++ b/rvcontroller.lua
@@ -36,20 +36,25 @@ local traptypes = {
[0x12] = "Software check",
[0x13] = "Hardware error",
--0x14-0x80000000 = reserved/custom
- [0x8000001] = "Supv soft interrupt",
+ [0x80000001] = "Supv soft interrupt",
--0x80000002 = reserved
- [0x8000003] = "Mach soft interrupt",
+ [0x80000003] = "Mach soft interrupt",
--0x80000004 = reserved
- [0x8000005] = "Supv timer interrupt",
+ [0x80000005] = "Supv timer interrupt",
--0x80000006 = reserved
- [0x8000007] = "Mach timer interrupt",
+ [0x80000007] = "Mach timer interrupt",
--0x80000008 = reserved
- [0x8000009] = "Supv ext interrupt",
+ [0x80000009] = "Supv ext interrupt",
--0x8000000a = reserved
- [0x800000b] = "Mach ext interrupt",
+ [0x8000000b] = "Mach ext interrupt",
--0x8000000c = reserved
- [0x800000d] = "Count over interrupt",
- --0x8000000e-0xffffffff = reserved/platform
+ [0x8000000d] = "Count over interrupt",
+ --0x8000000e = reserved
+ --0x8000000f = reserved
+ [0x80000010] = "Mach mesec interrupt",
+ [0x80000011] = "Mach dglne interrupt",
+ [0x80000012] = "Mach cons interrupt",
+ --0x80000013-0xffffffff = reserved/platform
}
local fault --non-nil values are for deferred faults that will trap after the instruction finishes
@@ -709,7 +714,7 @@ local function checkinterrupts()
end
mem.csr[0x344] = implodebits(mipbits,32)
if not mem.mie then return end
- local order = {11,3,7,9,1,5,13,16,17}
+ local order = {11,3,7,9,1,5,13,16,17,18}
for _,i in ipairs(order) do
if miebits[i] and mipbits[i] then
return trap(0x80000000+i)
@@ -3293,6 +3298,16 @@ elseif event.channel == "stdin" then
else
--No blocking read in progress, buffer the data for nonblocking reads later
mem.inputbuf = string.sub(mem.inputbuf..event.msg,1,256)
+ local mipbits = explodebits(mem.csr[0x344],32)
+ mipbits[18] = true
+ mem.csr[0x344] = implodebits(mipbits,32)
+ local miebits = explodebits(mem.csr[0x304],32)
+ if miebits[18] and mem.interruptwaiting then
+ mem.interruptwaiting = false
+ mem.running = true
+ digiline_send("monitordisp","CPU started")
+ interrupt(1/CLOCK_SPEED,"tick")
+ end
end
elseif event.channel == "load" then
if event.msg.done then