summaryrefslogtreecommitdiffstatshomepage
path: root/docs/source/debugger/cheats.rst
blob: 1b6764c8e797c11c51f507514a25a6ca6ce8cef8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888 } /* Comment */
.highlight .err { color: #A61717; background-color: #E3D2D2 } /* Error */
.highlight .k { color: #080; font-weight: bold } /* Keyword */
.highlight .ch { color: #888 } /* Comment.Hashbang */
.highlight .cm { color: #888 } /* Comment.Multiline */
.highlight .cp { color: #C00; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888 } /* Comment.Single */
.highlight .cs { color: #C00; font-weight: bold; background-color: #FFF0F0 } /* Comment.Special */
.highlight .gd { color: #000; background-color: #FDD } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #A00 } /* Generic.Error */
.highlight .gh { color: #333 } /* Generic.Heading */
.highlight .gi { color: #000; background-color: #DFD } /* Generic.Inserted */
.highlight .go 
.. _debugger-cheats-list:

Cheat Debugger Commands
=======================


You can also type **help <command>** for further details on each command in the MAME Debugger interface.

| :ref:`debugger-command-cheatinit` -- initialize the cheat search to the selected memory area
| :ref:`debugger-command-cheatrange` -- add to the cheat search the selected memory area
| :ref:`debugger-command-cheatnext` -- continue cheat search comparing with the last value
| :ref:`debugger-command-cheatnextf` -- continue cheat search comparing with the first value
| :ref:`debugger-command-cheatlist` -- show the list of cheat search matches or save them to <filename>
| :ref:`debugger-command-cheatundo` -- undo the last cheat search (state only)

 .. _debugger-command-cheatinit:

cheatinit
---------

|  **cheatinit [<sign><width><swap>,[<address>,<length>[,<cpu>]]]**
|
| The cheatinit command initializes the cheat search to the selected memory area.
|
| If no parameter is specified the cheat search is initialized to all changeable memory of the main CPU.
|
| <sign> can be s(signed) or u(unsigned)
| <width> can be b(8 bit), w(16 bit), d(32 bit) or q(64 bit)
| <swap> append s for swapped search
|
| Examples:
|
|  cheatinit ub,0x1000,0x10
|
| Initialize the cheat search from 0x1000 to 0x1010 of the first CPU.
|
|  cheatinit sw,0x2000,0x1000,1
|
| Initialize the cheat search with width of 2 byte in signed mode from 0x2000 to 0x3000 of the second CPU.
|
|  cheatinit uds,0x0000,0x1000
|
| Initialize the cheat search with width of 4 byte swapped from 0x0000 to 0x1000.
|
| Back to :ref:`debugger-cheats-list`


 .. _debugger-command-cheatrange:

cheatrange
----------

|  **cheatrange <address>,<length>**
|
| The cheatrange command adds the selected memory area to the cheat search.
|
| Before using cheatrange it is necessary to initialize the cheat search with cheatinit.
|
| Examples:
|
|  cheatrange 0x1000,0x10
|
| Add the bytes from 0x1000 to 0x1010 to the cheat search.
|
| Back to :ref:`debugger-cheats-list`


 .. _debugger-command-cheatnext:

cheatnext
---------

|  **cheatnext <condition>[,<comparisonvalue>]**
|
| The cheatnext command will make comparisons with the last search matches.
|
| Possible <condition>:
|
|  **all**
|
| No <comparisonvalue> needed.
|
| Use to update the last value without changing the current matches.
|
|  **equal [eq]**
|
| Without <comparisonvalue> search for all bytes that are equal to the last search.
| With <comparisonvalue> search for all bytes that are equal to the <comparisonvalue>.
|
|  **notequal [ne]**
|
| Without <comparisonvalue> search for all bytes that are not equal to the last search.
| With <comparisonvalue> search for all bytes that are not equal to the <comparisonvalue>.
|
|  **decrease [de, +]**
|
| Without <comparisonvalue> search for all bytes that have decreased since the last search.
| With <comparisonvalue> search for all bytes that have decreased by the <comparisonvalue> since the last search.
|
|  **increase [in, -]**
|
| Without <comparisonvalue> search for all bytes that have increased since the last search.
| With <comparisonvalue> search for all bytes that have increased by the <comparisonvalue> since the last search.
|
|  **decreaseorequal [deeq]**
|
| No <comparisonvalue> needed.
|
| Search for all bytes that have decreased or have same value since the last search.
|
|  **increaseorequal [ineq]**
|
| No <comparisonvalue> needed.
|
| Search for all bytes that have decreased or have same value since the last search.
|
|  **smallerof [lt]**
|
| Without <comparisonvalue> this condition is invalid
| With <comparisonvalue> search for all bytes that are smaller than the <comparisonvalue>.
|
|  **greaterof [gt]**
|
| Without <comparisonvalue> this condition is invalid
| With <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.
|
|  **changedby [ch, ~]**
|
| Without <comparisonvalue> this condition is invalid
| With <comparisonvalue> search for all bytes that have changed by the <comparisonvalue> since the last search.
|
|
| Examples:
|
|  cheatnext increase
|
| Search for all bytes that have increased since the last search.
|
|  cheatnext decrease, 1
|
| Search for all bytes that have decreased by 1 since the last search.
|
| Back to :ref:`debugger-cheats-list`


 .. _debugger-command-cheatnextf:

cheatnextf
----------

|  **cheatnextf <condition>[,<comparisonvalue>]**
|
| The cheatnextf command will make comparisons with the initial search.
|
| Possible <condition>:
|
|  **all**
|
| No <comparisonvalue> needed.
|
| Use to update the last value without changing the current matches.
|
|  **equal [eq]**
|
| Without <comparisonvalue> search for all bytes that are equal to the initial search.
| With <comparisonvalue> search for all bytes that are equal to the <comparisonvalue>.
|
|  **notequal [ne]**
|
| Without <comparisonvalue> search for all bytes that are not equal to the initial search.
| With <comparisonvalue> search for all bytes that are not equal to the <comparisonvalue>.
|
|  **decrease [de, +]**
|
| Without <comparisonvalue> search for all bytes that have decreased since the initial search.
| With <comparisonvalue> search for all bytes that have decreased by the <comparisonvalue> since the initial search.
|
|  **increase [in, -]**
|
| Without <comparisonvalue> search for all bytes that have increased since the initial search.
|
| With <comparisonvalue> search for all bytes that have increased by the <comparisonvalue> since the initial search.
|
|  **decreaseorequal [deeq]**
|
| No <comparisonvalue> needed.
|
| Search for all bytes that have decreased or have same value since the initial search.
|
|  **increaseorequal [ineq]**
|
| No <comparisonvalue> needed.
|
| Search for all bytes that have decreased or have same value since the initial search.
|
|  **smallerof [lt]**
|
| Without <comparisonvalue> this condition is invalid.
| With <comparisonvalue> search for all bytes that are smaller than the <comparisonvalue>.
|
|  **greaterof [gt]**
|
| Without <comparisonvalue> this condition is invalid.
| With <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.
|
|  **changedby [ch, ~]**
|
| Without <comparisonvalue> this condition is invalid
| With <comparisonvalue> search for all bytes that have changed by the <comparisonvalue> since the initial search.
|
|
| Examples:
|
|  cheatnextf increase
|
| Search for all bytes that have increased since the initial search.
|
|  cheatnextf decrease, 1
|
| Search for all bytes that have decreased by 1 since the initial search.
|
| Back to :ref:`debugger-cheats-list`


 .. _debugger-command-cheatlist:

cheatlist
---------

|  **cheatlist [<filename>]**
|
| Without <filename> show the list of matches in the debug console.
| With <filename> save the list of matches in basic XML format to <filename>.
|
| Examples:
|
|  cheatlist
|
| Show the current matches in the debug console.
|
|  cheatlist cheat.txt
|
| Save the current matches in XML format to cheat.txt.
|
| Back to :ref:`debugger-cheats-list`


 .. _debugger-command-cheatundo:

cheatundo
---------

|  **cheatundo**
|
| Undo the results of the last search.
|
| The undo command has no effect on the last value.
|
|
| Examples:
|
|  cheatundo
|
| Undo the last search (state only).
|
| Back to :ref:`debugger-cheats-list`
lass="p">{ {ill, inh,7},{nop, inh,0},{ill, inh,7},{ill, inh,7},/* 00 */ {lsrd,inh,1},{asld,inh,1},{tap, inh,0},{tpa, inh,0}, {inx, inh,0},{dex, inh,0},{clv, inh,0},{sev, inh,0}, {clc, inh,0},{sec, inh,0},{cli, inh,0},{sei, inh,0}, {sba, inh,0},{cba, inh,0},{asx1,sx1,0},{asx2,sx1,0},/* 10 */ {ill, inh,7},{ill, inh,7},{tab, inh,0},{tba, inh,0}, {xgdx,inh,3},{daa, inh,0},{ill, inh,7},{aba, inh,0}, {ill, inh,7},{ill, inh,7},{ill, inh,7},{ill, inh,7}, {bra, rel,0},{brn, rel,0},{bhi, rel,0},{bls, rel,0},/* 20 */ {bcc, rel,0},{bcs, rel,0},{bne, rel,0},{beq, rel,0}, {bvc, rel,0},{bvs, rel,0},{bpl, rel,0},{bmi, rel,0}, {bge, rel,0},{blt, rel,0},{bgt, rel,0},{ble, rel,0}, {tsx, inh,0},{ins, inh,0},{pula,inh,0},{pulb,inh,0},/* 30 */ {des, inh,0},{txs, inh,0},{psha,inh,0},{pshb,inh,0}, {pulx,inh,1},{rts, inh,0},{abx, inh,1},{rti, inh,0}, {pshx,inh,1},{mul, inh,1},{wai, inh,0},{swi, inh,0}, {nega,inh,0},{ill, inh,7},{ill, inh,7},{coma,inh,0},/* 40 */ {lsra,inh,0},{ill, inh,7},{rora,inh,0},{asra,inh,0}, {asla,inh,0},{rola,inh,0},{deca,inh,0},{ill, inh,7}, {inca,inh,0},{tsta,inh,0},{ill, inh,7},{clra,inh,0}, {negb,inh,0},{ill, inh,7},{ill, inh,7},{comb,inh,0},/* 50 */ {lsrb,inh,0},{ill, inh,7},{rorb,inh,0},{asrb,inh,0}, {aslb,inh,0},{rolb,inh,0},{decb,inh,0},{ill, inh,7}, {incb,inh,0},{tstb,inh,0},{ill, inh,7},{clrb,inh,0}, {neg, idx,0},{aim, imx,3},{oim, imx,3},{com, idx,0},/* 60 */ {lsr, idx,0},{eim, imx,3},{ror, idx,0},{asr, idx,0}, {asl, idx,0},{rol, idx,0},{dec, idx,0},{tim, imx,3}, {inc, idx,0},{tst, idx,0},{jmp, idx,0},{clr, idx,0}, {neg, ext,0},{aim, imd,3},{oim, imd,3},{com, ext,0},/* 70 */ {lsr, ext,0},{eim, imd,3},{ror, ext,0},{asr, ext,0}, {asl, ext,0},{rol, ext,0},{dec, ext,0},{tim, imd,3}, {inc, ext,0},{tst, ext,0},{jmp, ext,0},{clr, ext,0}, {suba,imb,0},{cmpa,imb,0},{sbca,imb,0},{subd,imw,1},/* 80 */ {anda,imb,0},{bita,imb,0},{lda, imb,0},{sta, imb,0}, {eora,imb,0},{adca,imb,0},{ora, imb,0},{adda,imb,0}, {cmpx,imw,0},{bsr, rel,0},{lds, imw,0},{sts, imw,0}, {suba,dir,0},{cmpa,dir,0},{sbca,dir,0},{subd,dir,1},/* 90 */ {anda,dir,0},{bita,dir,0},{lda, dir,0},{sta, dir,0}, {eora,dir,0},{adca,dir,0},{ora, dir,0},{adda,dir,0}, {cmpx,dir,0},{jsr, dir,0},{lds, dir,0},{sts, dir,0}, {suba,idx,0},{cmpa,idx,0},{sbca,idx,0},{subd,idx,1},/* a0 */ {anda,idx,0},{bita,idx,0},{lda, idx,0},{sta, idx,0}, {eora,idx,0},{adca,idx,0},{ora, idx,0},{adda,idx,0}, {cmpx,idx,0},{jsr, idx,0},{lds, idx,0},{sts, idx,0}, {suba,ext,0},{cmpa,ext,0},{sbca,ext,0},{subd,ext,1},/* b0 */ {anda,ext,0},{bita,ext,0},{lda, ext,0},{sta, ext,0}, {eora,ext,0},{adca,ext,0},{ora, ext,0},{adda,ext,0}, {cmpx,ext,0},{jsr, ext,0},{lds, ext,0},{sts, ext,0}, {subb,imb,0},{cmpb,imb,0},{sbcb,imb,0},{addd,imw,1},/* c0 */ {andb,imb,0},{bitb,imb,0},{ldb, imb,0},{stb, imb,0}, {eorb,imb,0},{adcb,imb,0},{orb, imb,0},{addb,imb,0}, {ldd, imw,1},{_std,imw,1},{ldx, imw,0},{stx, imw,0}, {subb,dir,0},{cmpb,dir,0},{sbcb,dir,0},{addd,dir,1},/* d0 */ {andb,dir,0},{bitb,dir,0},{ldb, dir,0},{stb, dir,0}, {eorb,dir,0},{adcb,dir,0},{orb, dir,0},{addb,dir,0}, {ldd, dir,1},{_std,dir,1},{ldx, dir,0},{stx, dir,0}, {subb,idx,0},{cmpb,idx,0},{sbcb,idx,0},{addd,idx,1},/* e0 */ {andb,idx,0},{bitb,idx,0},{ldb, idx,0},{stb, idx,0}, {eorb,idx,0},{adcb,idx,0},{orb, idx,0},{addb,idx,0}, {ldd, idx,1},{_std,idx,1},{ldx, idx,0},{stx, idx,0}, {subb,ext,0},{cmpb,ext,0},{sbcb,ext,0},{addd,ext,1},/* f0 */ {andb,ext,0},{bitb,ext,0},{ldb, ext,0},{stb, ext,0}, {eorb,ext,0},{adcb,ext,0},{orb, ext,0},{addb,ext,0}, {ldd, ext,1},{_std,ext,1},{ldx, ext,0},{stx, ext,0}, /* extra instruction $fc for NSC-8105 */ {addx,ext,0}, /* extra instruction $ec for NSC-8105 */ {adcx,imb,0}, /* extra instruction $bb for NSC-8105 */ {bitx,imx,0}, /* extra instruction $b2 for NSC-8105 */ {stx,imx,0} }; m680x_disassembler::m680x_disassembler(int subtype) : m_subtype(subtype) { } u32 m680x_disassembler::opcode_alignment() const { return 1; } offs_t m680x_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) { offs_t flags = 0; int invalid_mask; int code = opcodes.r8(pc); uint8_t opcode, args, invalid; switch( m_subtype ) { case 6800: case 6802: case 6808: case 8105: invalid_mask = 1; break; case 6801: case 6803: invalid_mask = 2; break; default: invalid_mask = 4; } /* NSC-8105 is a special case */ if (m_subtype == 8105) { /* swap bits */ code = (code & 0x3c) | ((code & 0x41) << 1) | ((code & 0x82) >> 1); /* and check for extra instruction */ if (code == 0xfc) code = 0x0100; if (code == 0xec) code = 0x0101; if (code == 0x7b) code = 0x0102; if (code == 0x71) code = 0x0103; } opcode = table[code][0]; args = table[code][1]; invalid = table[code][2]; if (opcode == bsr || opcode == jsr) flags = STEP_OVER; else if (opcode == rti || opcode == rts) flags = STEP_OUT; if ( invalid & invalid_mask ) /* invalid for this cpu type ? */ { stream << "illegal"; return 1 | flags | SUPPORTED; } util::stream_format(stream, "%-5s", op_name_str[opcode]); switch( args ) { case rel: /* relative */ util::stream_format(stream, "$%04X", pc + (int8_t)params.r8(pc+1) + 2); return 2 | flags | SUPPORTED; case imb: /* immediate (byte) */ util::stream_format(stream, "#$%02X", params.r8(pc+1)); return 2 | flags | SUPPORTED; case imw: /* immediate (word) */ util::stream_format(stream, "#$%04X", params.r16(pc+1)); return 3 | flags | SUPPORTED; case idx: /* indexed + byte offset */ util::stream_format(stream, "(x+$%02X)", params.r8(pc+1)); return 2 | flags | SUPPORTED; case imx: /* immediate, indexed + byte offset */ util::stream_format(stream, "#$%02X,(x+$%02x)", params.r8(pc+1), params.r8(pc+2)); return 3 | flags | SUPPORTED; case dir: /* direct address */ util::stream_format(stream, "$%02X", params.r8(pc+1)); return 2 | flags | SUPPORTED; case imd: /* immediate, direct address */ util::stream_format(stream, "#$%02X,$%02X", params.r8(pc+1), params.r8(pc+2)); return 3 | flags | SUPPORTED; case ext: /* extended address */ util::stream_format(stream, "$%04X", params.r16(pc+1)); return 3 | flags | SUPPORTED; case sx1: /* byte from address (s + 1) */ util::stream_format(stream, "(s+1)"); return 1 | flags | SUPPORTED; default: return 1 | flags | SUPPORTED; } }