summaryrefslogtreecommitdiff
path: root/rvcontroller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rvcontroller.lua')
-rw-r--r--rvcontroller.lua31
1 files changed, 30 insertions, 1 deletions
diff --git a/rvcontroller.lua b/rvcontroller.lua
index 9daabcf..c994a70 100644
--- a/rvcontroller.lua
+++ b/rvcontroller.lua
@@ -3859,6 +3859,11 @@ if event.type == "program" or event.iid == "reset" then
mem.rnmi = false
mem.romaccess = nil
mem.romindex = nil
+ mem.autoload = "inhibit"
+ if event.type == "program" then
+ mem.autoload = "probing"
+ digiline_send("rom",{command="read",address=0})
+ end
elseif event.type == "on" or event.type == "off" then
local pname = string.lower(event.pin.name)
local pstate = pin[pname]
@@ -3885,6 +3890,9 @@ elseif event.channel == "reset" then
digiline_send("monitordisp","\n\n\n\n\n\n\n")
digiline_send("stdout","\n\n\n\n\n\n\n")
interrupt(0.5,"reset")
+elseif event.channel == "monitorkb" and mem.autoload == "waiting" then
+ digiline_send("monitordisp","Load cancelled\n\nRVController Monitor\n\nType 'help' for help\nReady")
+ mem.autoload = "inhibit"
elseif event.channel == "monitorkb" then
digiline_send("monitordisp","> "..event.msg)
local function validateandclamp(value,min,max,base)
@@ -4000,7 +4008,7 @@ elseif event.channel == "monitorkb" then
mem.starttime = os.time()
mem.running = true
digiline_send("monitordisp","CPU started\n\n")
- run(50)
+ run(INSTRUCTIONS_PER_CLOCK)
interrupt(0.1,"tick")
elseif argv[1] == "stop" then
mem.running = false
@@ -4215,7 +4223,15 @@ elseif event.channel == "load" then
writeram(thisaddress,thisdata,1)
end
end
+elseif event.channel == "rom" and mem.autoload == "probing" then
+ digiline_send("monitordisp","ROM Detected\nLoading in\n5 seconds\n\nPress any key\nto cancel")
+ mem.autoload = "waiting"
+ interrupt(5,"autoload")
elseif event.channel == "rom" and mem.romaccess == "read" then
+ if string.len(event.msg) < 512 then
+ local diff = 512-string.len(event.msg)
+ event.msg = event.msg..string.rep(string.char(0),diff)
+ end
local data1 = string.sub(event.msg,1,256)
local data2 = string.sub(event.msg,257,512)
mem.ram[mem.romindex*2] = data1
@@ -4224,6 +4240,14 @@ elseif event.channel == "rom" and mem.romaccess == "read" then
interrupt(0.1,"romtick")
else
digiline_send("monitordisp","Read complete")
+ if mem.autoload == "loading" then
+ mem.autoload = "inhibit"
+ mem.starttime = os.time()
+ mem.running = true
+ digiline_send("monitordisp","CPU started\n\n")
+ run(INSTRUCTIONS_PER_CLOCK)
+ interrupt(0.1,"tick")
+ end
end
elseif event.type == "digiline" then
if not mem.mcountinhibit[5] then
@@ -4285,6 +4309,11 @@ elseif event.iid == "romtick" then
mem.romaccess = nil
end
end
+elseif event.iid == "autoload" and mem.autoload == "waiting" then
+ mem.autoload = "loading"
+ mem.romaccess = "read"
+ mem.romindex = -1
+ interrupt(0.1,"romtick")
end
if stdoutdirty then