diff options
Diffstat (limited to 'rvcontroller.lua')
| -rw-r--r-- | rvcontroller.lua | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/rvcontroller.lua b/rvcontroller.lua index d804f75..57f458c 100644 --- a/rvcontroller.lua +++ b/rvcontroller.lua @@ -2553,6 +2553,41 @@ elseif event.channel == "monitorkb" then mem.breakpoint = address elseif argv[1] == "clearbreak" then mem.breakpoint = -1 + elseif argv[1] == "rdcsr" then + local address = validateandclamp(argv[2],0,0xfff) + if not address then + digiline_send("monitordisp","Bad CSR address") + return + end + digiline_send("monitordisp",string.format("%03X: %08X",address,readcsr(address))) + elseif argv[1] == "wrcsr" then + local address = validateandclamp(argv[2],0,0xfff) + if not address then + digiline_send("monitordisp","Bad CSR address") + return + end + local data = validateandclamp(argv[3],0,0xfff) + if not data then + digiline_send("monitordisp","Bad data") + return + end + writecsr(address,data) + --Read it back in case the target field was RO or WARL + digiline_send("monitordisp",string.format("%03X: %08X",address,readcsr(address))) + elseif argv[1] == "endian" then + if argc == 1 then + digiline_send("monitordisp",mem.bigendian and "Big-endian" or "Little-endian") + elseif argv[2] == "b" or argv[2] == "big" then + local bits = explodebits(readcsr(0x310),32) --mstatush + bits[5] = true --MBE + writecsr(0x310,implodebits(bits,32)) + digiline_send("monitordisp","Big-endian") + elseif argv[2] == "l" or argv[2] == "little" then + local bits = explodebits(readcsr(0x310),32) --mstatush + bits[5] = false --MBE + writecsr(0x310,implodebits(bits,32)) + digiline_send("monitordisp","Little-endian") + end elseif argv[1] == "help" then if argc == 1 or argv[2] == "1" then digiline_send("monitordisp","Use: help <command>") @@ -2584,13 +2619,19 @@ elseif event.channel == "monitorkb" then elseif argv[2] == "help" then digiline_send("monitordisp","help [command]\nShows information\nabout the specified\ncommand, or a list\nof commands if none\nis supplied") elseif argv[2] == "2" then - digiline_send("monitordisp","Page 2\nreset stop help\nsetbreak clearbreak") + digiline_send("monitordisp","Page 2\nreset stop help\nsetbreak clearbreak\nrdcsr wrcsr endian") elseif argv[2] == "h" then digiline_send("monitordisp","h\nhhhhhhhhhh") elseif argv[2] == "setbreak" then digiline_send("monitordisp","setbreak <address>\nSets a breakpoint\nat the specified\naddress") elseif argv[2] == "clearbreak" then digiline_send("monitordisp","clearbreak\nClears any set\nbreakpoint") + elseif argv[2] == "rdcsr" then + digiline_send("monitordisp","rdcsr <address>\nReads the value of\nthe specified CSR") + elseif argv[2] == "wrcsr" then + digiline_send("monitordisp","wrcsr <addr> <data>\nWrites the specifed\nvalue into the\nspecified CSR") + elseif argv[2] == "endian" then + digiline_send("monitordisp","endian [b | e]\nDisplays or changes\nthe current\nendianness") else digiline_send("monitordisp","No such command or\nno help available") end |
