リビジョン | f35d9c55cda2b3855883b510fdc9c1a0381678a8 (tree) |
---|---|
日時 | 2014-03-03 09:56:06 |
作者 | naruko <naruko@24ea...> |
コミッター | naruko |
vram mirroring の command line mode (v) を追加
git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@415 24ea1065-a21e-4ca1-99c9-f5125deb0858
@@ -18,9 +18,11 @@ | ||
18 | 18 | #ifdef _UNICODE |
19 | 19 | #define PUTS _putws |
20 | 20 | #define PRINTF wprintf |
21 | -#else | |
21 | + #define STRTOUL wcstoul | |
22 | + #else | |
22 | 23 | #define PUTS puts |
23 | 24 | #define PRINTF printf |
25 | + #define STRTOUL strtoul | |
24 | 26 | #endif |
25 | 27 | |
26 | 28 | static void text_append_va(void *obj, const wgChar *format, va_list list) |
@@ -222,6 +224,31 @@ static void dump(int c, wgChar **v, const struct reader_driver *r) | ||
222 | 224 | cui_gauge_destory(&config.ppu.gauge); |
223 | 225 | } |
224 | 226 | |
227 | +static void vram_scan(int c, wgChar **v, const struct reader_driver *r) | |
228 | +{ | |
229 | + const struct reader_handle *h; | |
230 | + struct textcontrol log; | |
231 | + if(c == 3){ | |
232 | + PUTS(wgT("anago F [address] [data]...")); | |
233 | + return; | |
234 | + } | |
235 | + log_set(&log); | |
236 | + h = r->control.open(except, &log); | |
237 | + | |
238 | + if(c == 2){ | |
239 | + PRINTF(wgT("%02x\n"), r->control.vram_connection(h)); | |
240 | + }else{ | |
241 | + const long address = STRTOUL(v[2], NULL, 0x10); | |
242 | + int i; | |
243 | + for(i = 3; i < c; i++){ | |
244 | + const uint8_t d = STRTOUL(v[i], NULL, 0x10); | |
245 | + r->cpu.memory_write(h, address, 1, &d); | |
246 | + PRINTF(wgT("$%04x = 0x%02x->0x%02x\n"), address, (int) d, r->control.vram_connection(h)); | |
247 | + } | |
248 | + } | |
249 | + r->control.close(h); | |
250 | +} | |
251 | + | |
225 | 252 | static void usage(const wgChar *v) |
226 | 253 | { |
227 | 254 | PUTS(wgT("famicom bus simluator 'anago'")); |
@@ -230,6 +257,7 @@ static void usage(const wgChar *v) | ||
230 | 257 | PUTS(wgT("fF- flash program with kazzo")); |
231 | 258 | PUTS(wgT("r - workram read with kazzo")); |
232 | 259 | PUTS(wgT("w - workram write with kazzo")); |
260 | + PUTS(wgT("V - VRAM A10 scan")); | |
233 | 261 | if(DEBUG == 1){ |
234 | 262 | PUTS(wgT("z - ROM dump for test")); |
235 | 263 | PUTS(wgT("xX- flash program for test")); |
@@ -267,7 +295,12 @@ int anago_cui(int c, wgChar **v) | ||
267 | 295 | r = &DRIVER_DUMMY; //though down |
268 | 296 | case wgT('d'): case wgT('D'): |
269 | 297 | case wgT('r'): case wgT('w'): |
270 | - dump(c,v, r); | |
298 | + dump(c, v, r); | |
299 | + break; | |
300 | + case wgT('V'): | |
301 | + r = &DRIVER_DUMMY; | |
302 | + case wgT('v'): | |
303 | + vram_scan(c, v, r); | |
271 | 304 | break; |
272 | 305 | default: |
273 | 306 | usage(v[0]); |