You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: emulator/lua-common.lua
+50-78Lines changed: 50 additions & 78 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,52 @@
1
+
functionhelp()
2
+
print([[
3
+
The supported functions are:
4
+
printf() Print with format.
5
+
ins() Log all register values to the screen.
6
+
break_at(addr,fn) Set breakpoint. If input not specified, break at current address. Second argument (optional) is a function that is executed whenever this breakpoint hits.
7
+
unbreak_at(addr) Delete breakpoint. If input not specified, delete breakpoint at current address. Have no effect if there is no breakpoint at specified position.
8
+
cont() Continue program execution.
9
+
pst()/pst(rad) Print 48 or rad bytes of the stack before and after SP.
10
+
emu:set_paused(-) Pause/unpause emulator.
11
+
emu:tick() Execute one command.
12
+
emu:shutdown() Shutdown the emulator.
13
+
cpu.xxx Get register value.
14
+
cpu.bt Current stack trace.
15
+
code[-] Access code. (By bytes)
16
+
data[-] Access data. (By bytes)
17
+
data:watch(addr,fn) Set write watchpoint.
18
+
data:rwatch(addr,fn) Set read watchpoint.
19
+
help() Print this help message.
20
+
addposttick(fn) Add a function as post-tick handler. (wrapper over emu:post_tick)
21
+
rmposttick(fn) Remove a post-tick handler. If called without argument, delete the most-recently added handler.
22
+
er(x) Value of register ERx.
23
+
24
+
GDB-style functions:
25
+
(the long functions are intended to be used in code, the short functions are intended to be used interactively so they prints debug info/etc.)
26
+
p(...) Shorthand for `print`.
27
+
pn(addr) Print calculator number at address
28
+
ps/gets(addr) Print/get calculator string (0-terminated) at address
29
+
pi/geti(addr) Print/get 2-byte unsigned integer at address
30
+
h() help()
31
+
n()/nexti() Go to next instruction.
32
+
c() cont
33
+
s() emu:tick()
34
+
tr(filename) Start tracing (record all executed instructions)
35
+
trs() Stop tracing.
36
+
q() emu:shutdown()
37
+
b(addr,fn) break/pause (breakpoint set with b should not be deleted with unbreak_at)
38
+
ib() info breakpoints/watchpoints
39
+
del(num) Delete breakpoint or watchpoint.
40
+
bt() print(cpu.bt)
41
+
rwa(offset,fn) Set read watchpoint at location (watchpoints set with rwa(-,-) should be deleted with del(-))
42
+
wa(offset,fn) Set watchpoint at location (watchpoints set with wa(-,-) should be deleted with del(-))
43
+
u0/until0() Run until address is hit and sp is <= original sp. Not as fully-functional as gdb's `until` command, so `u0`.
44
+
ppc() Print current PC address.
45
+
calll(addr,before,after) Call log.
46
+
nrop() Next "ROP instruction".
47
+
]])
48
+
end
49
+
1
50
localhwid=emu:model().hardware_id
2
51
localstack_end=hwid==3and0x8e00or0xf000
3
52
localscreen_nrow=hwid==3and32or64
@@ -38,7 +87,6 @@ function rmposttick(fn)
38
87
end
39
88
print('Posttick handler not found')
40
89
end
41
-
42
90
ifnotnext(posttickfns) then
43
91
emu:post_tick(nil)
44
92
end
@@ -60,12 +108,10 @@ function break_at(addr, commands)
60
108
else
61
109
commands=function() end
62
110
end
63
-
64
111
ifnotnext(break_targets) then
65
112
-- if break_targets is initially empty and later non-empty
0 commit comments