Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/quicknes/nes_emu/Nes_Emu.cpp
2 views
1
2
// Nes_Emu 0.7.0. http://www.slack.net/~ant/
3
4
#include "Nes_Emu.h"
5
6
#include <string.h>
7
#include "Nes_State.h"
8
#include "Nes_Mapper.h"
9
10
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
11
can redistribute it and/or modify it under the terms of the GNU Lesser
12
General Public License as published by the Free Software Foundation; either
13
version 2.1 of the License, or (at your option) any later version. This
14
module is distributed in the hope that it will be useful, but WITHOUT ANY
15
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
17
more details. You should have received a copy of the GNU Lesser General
18
Public License along with this module; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20
21
#include "blargg_source.h"
22
23
int const sound_fade_size = 384;
24
25
// Constants are manually duplicated in Nes_Emu so their value can be seen
26
// directly, rather than having to look in Nes_Ppu.h. "0 +" converts to int.
27
BOOST_STATIC_ASSERT( Nes_Emu::image_width == 0 + Nes_Ppu::image_width );
28
BOOST_STATIC_ASSERT( Nes_Emu::image_height == 0 + Nes_Ppu::image_height );
29
30
Nes_Emu::equalizer_t const Nes_Emu::nes_eq = { -1.0, 80 };
31
Nes_Emu::equalizer_t const Nes_Emu::famicom_eq = { -15.0, 80 };
32
Nes_Emu::equalizer_t const Nes_Emu::tv_eq = { -12.0, 180 };
33
34
Nes_Emu::Nes_Emu()
35
{
36
frame_ = &single_frame;
37
buffer_height_ = Nes_Ppu::buffer_height + 2;
38
default_sound_buf = NULL;
39
sound_buf = &silent_buffer;
40
sound_buf_changed_count = 0;
41
equalizer_ = nes_eq;
42
channel_count_ = 0;
43
sound_enabled = false;
44
host_pixels = NULL;
45
single_frame.pixels = 0;
46
single_frame.top = 0;
47
init_called = false;
48
set_palette_range( 0 );
49
memset( single_frame.palette, 0, sizeof single_frame.palette );
50
host_pixel_buff = new char[buffer_width * buffer_height()];
51
set_pixels(host_pixel_buff, buffer_width);
52
}
53
54
Nes_Emu::~Nes_Emu()
55
{
56
delete default_sound_buf;
57
delete[] host_pixel_buff;
58
}
59
60
blargg_err_t Nes_Emu::init_()
61
{
62
return emu.init();
63
}
64
65
inline blargg_err_t Nes_Emu::auto_init()
66
{
67
if ( !init_called )
68
{
69
RETURN_ERR( init_() );
70
init_called = true;
71
}
72
return 0;
73
}
74
75
inline void Nes_Emu::clear_sound_buf()
76
{
77
fade_sound_out = false;
78
fade_sound_in = true;
79
sound_buf->clear();
80
}
81
82
// Emulation
83
84
void Nes_Emu::close()
85
{
86
if ( cart() )
87
{
88
emu.close();
89
private_cart.clear();
90
}
91
}
92
93
blargg_err_t Nes_Emu::set_cart( Nes_Cart const* new_cart )
94
{
95
close();
96
RETURN_ERR( auto_init() );
97
RETURN_ERR( emu.open( new_cart ) );
98
99
channel_count_ = Nes_Apu::osc_count + emu.mapper->channel_count();
100
RETURN_ERR( sound_buf->set_channel_count( channel_count() ) );
101
set_equalizer( equalizer_ );
102
enable_sound( true );
103
104
reset();
105
106
return 0;
107
}
108
109
void Nes_Emu::reset( bool full_reset, bool erase_battery_ram )
110
{
111
require( cart() );
112
113
clear_sound_buf();
114
set_timestamp( 0 );
115
emu.reset( full_reset, erase_battery_ram );
116
}
117
118
void Nes_Emu::set_palette_range( int begin, int end )
119
{
120
require( (unsigned) end <= 0x100 );
121
// round up to alignment
122
emu.ppu.palette_begin = (begin + palette_alignment - 1) & ~(palette_alignment - 1);
123
host_palette_size = end - emu.ppu.palette_begin;
124
require( host_palette_size >= palette_alignment );
125
}
126
127
blargg_err_t Nes_Emu::emulate_frame( const uint32_t joypad1, const uint32_t joypad2 )
128
{
129
emu.current_joypad [0] = joypad1;
130
emu.current_joypad [1] = joypad2;
131
132
emu.ppu.host_pixels = NULL;
133
134
unsigned changed_count = sound_buf->channels_changed_count();
135
bool new_enabled = (frame_ != NULL);
136
if ( sound_buf_changed_count != changed_count || sound_enabled != new_enabled )
137
{
138
sound_buf_changed_count = changed_count;
139
sound_enabled = new_enabled;
140
enable_sound( sound_enabled );
141
}
142
143
frame_t* f = frame_;
144
if ( f )
145
{
146
emu.ppu.max_palette_size = host_palette_size;
147
emu.ppu.host_palette = f->palette + emu.ppu.palette_begin;
148
// add black and white for emulator to use (unless emulator uses entire
149
// palette for frame)
150
f->palette [252] = 0x0F;
151
f->palette [254] = 0x30;
152
f->palette [255] = 0x0F;
153
if ( host_pixels )
154
emu.ppu.host_pixels = (BOOST::uint8_t*) host_pixels +
155
emu.ppu.host_row_bytes * f->top;
156
157
if ( sound_buf->samples_avail() )
158
clear_sound_buf();
159
160
nes_time_t frame_len = emu.emulate_frame();
161
sound_buf->end_frame( frame_len, false );
162
163
f = frame_;
164
f->sample_count = sound_buf->samples_avail();
165
f->chan_count = sound_buf->samples_per_frame();
166
f->palette_begin = emu.ppu.palette_begin;
167
f->palette_size = emu.ppu.palette_size;
168
f->joypad_read_count = emu.joypad_read_count;
169
f->burst_phase = emu.ppu.burst_phase;
170
f->pitch = emu.ppu.host_row_bytes;
171
f->pixels = emu.ppu.host_pixels + f->left;
172
}
173
else
174
{
175
emu.ppu.max_palette_size = 0;
176
emu.emulate_frame();
177
}
178
179
return 0;
180
}
181
182
// Extras
183
184
blargg_err_t Nes_Emu::load_ines( Auto_File_Reader in )
185
{
186
close();
187
RETURN_ERR( private_cart.load_ines( in ) );
188
return set_cart( &private_cart );
189
}
190
191
blargg_err_t Nes_Emu::save_battery_ram( Auto_File_Writer out )
192
{
193
RETURN_ERR( out.open() );
194
return out->write( emu.impl->sram, emu.impl->sram_size );
195
}
196
197
blargg_err_t Nes_Emu::load_battery_ram( Auto_File_Reader in )
198
{
199
RETURN_ERR( in.open() );
200
emu.sram_present = true;
201
return in->read( emu.impl->sram, emu.impl->sram_size );
202
}
203
204
void Nes_Emu::load_state( Nes_State_ const& in )
205
{
206
clear_sound_buf();
207
emu.load_state( in );
208
}
209
210
void Nes_Emu::load_state( Nes_State const& in )
211
{
212
loading_state( in );
213
load_state( STATIC_CAST(Nes_State_ const&,in) );
214
}
215
216
blargg_err_t Nes_Emu::load_state( Auto_File_Reader in )
217
{
218
Nes_State* state = BLARGG_NEW Nes_State;
219
CHECK_ALLOC( state );
220
blargg_err_t err = state->read( in );
221
if ( !err )
222
load_state( *state );
223
delete state;
224
return err;
225
}
226
227
blargg_err_t Nes_Emu::save_state( Auto_File_Writer out ) const
228
{
229
Nes_State* state = BLARGG_NEW Nes_State;
230
CHECK_ALLOC( state );
231
save_state( state );
232
blargg_err_t err = state->write( out );
233
delete state;
234
return err;
235
}
236
237
void Nes_Emu::write_chr( void const* p, long count, long offset )
238
{
239
require( (unsigned long) offset <= (unsigned long) chr_size() );
240
long end = offset + count;
241
require( (unsigned long) end <= (unsigned long) chr_size() );
242
memcpy( (byte*) chr_mem() + offset, p, count );
243
emu.ppu.rebuild_chr( offset, end );
244
}
245
246
blargg_err_t Nes_Emu::set_sample_rate( long rate, class Nes_Buffer* buf )
247
{
248
extern Multi_Buffer* set_apu( class Nes_Buffer*, Nes_Apu* );
249
RETURN_ERR( auto_init() );
250
return set_sample_rate( rate, set_apu( buf, &emu.impl->apu ) );
251
}
252
253
blargg_err_t Nes_Emu::set_sample_rate( long rate, class Nes_Effects_Buffer* buf )
254
{
255
extern Multi_Buffer* set_apu( class Nes_Effects_Buffer*, Nes_Apu* );
256
RETURN_ERR( auto_init() );
257
return set_sample_rate( rate, set_apu( buf, &emu.impl->apu ) );
258
}
259
260
// Sound
261
262
void Nes_Emu::set_frame_rate( double rate )
263
{
264
sound_buf->clock_rate( (long) (1789773 / 60.0 * rate) );
265
}
266
267
blargg_err_t Nes_Emu::set_sample_rate( long rate, Multi_Buffer* new_buf )
268
{
269
require( new_buf );
270
RETURN_ERR( auto_init() );
271
emu.impl->apu.volume( 1.0 ); // cancel any previous non-linearity
272
RETURN_ERR( new_buf->set_sample_rate( rate, 1200 / frame_rate ) );
273
sound_buf = new_buf;
274
sound_buf_changed_count = 0;
275
if ( new_buf != default_sound_buf )
276
{
277
delete default_sound_buf;
278
default_sound_buf = NULL;
279
}
280
set_frame_rate( frame_rate );
281
return 0;
282
}
283
284
blargg_err_t Nes_Emu::set_sample_rate( long rate )
285
{
286
if ( !default_sound_buf )
287
CHECK_ALLOC( default_sound_buf = BLARGG_NEW Mono_Buffer );
288
return set_sample_rate( rate, default_sound_buf );
289
}
290
291
void Nes_Emu::set_equalizer( equalizer_t const& eq )
292
{
293
equalizer_ = eq;
294
if ( cart() )
295
{
296
blip_eq_t blip_eq( eq.treble, 0, sound_buf->sample_rate() );
297
emu.impl->apu.treble_eq( blip_eq );
298
emu.mapper->set_treble( blip_eq );
299
sound_buf->bass_freq( equalizer_.bass );
300
}
301
}
302
303
void Nes_Emu::enable_sound( bool enabled )
304
{
305
if ( enabled )
306
{
307
for ( int i = channel_count(); i-- > 0; )
308
{
309
Blip_Buffer* buf = sound_buf->channel( i ).center;
310
int mapper_index = i - Nes_Apu::osc_count;
311
if ( mapper_index < 0 )
312
emu.impl->apu.osc_output( i, buf );
313
else
314
emu.mapper->set_channel_buf( mapper_index, buf );
315
}
316
}
317
else
318
{
319
emu.impl->apu.output( NULL );
320
for ( int i = channel_count() - Nes_Apu::osc_count; i-- > 0; )
321
emu.mapper->set_channel_buf( i, NULL );
322
}
323
}
324
325
void Nes_Emu::fade_samples( blip_sample_t* p, int size, int step )
326
{
327
if ( size >= sound_fade_size )
328
{
329
if ( step < 0 )
330
p += size - sound_fade_size;
331
332
int const shift = 15;
333
int mul = (1 - step) << (shift - 1);
334
step *= (1 << shift) / sound_fade_size;
335
336
for ( int n = sound_fade_size; n--; )
337
{
338
*p = (*p * mul) >> 15;
339
++p;
340
mul += step;
341
}
342
}
343
}
344
345
long Nes_Emu::read_samples( short* out, long out_size )
346
{
347
require( out_size >= sound_buf->samples_avail() );
348
long count = sound_buf->read_samples( out, out_size );
349
if ( fade_sound_in )
350
{
351
fade_sound_in = false;
352
fade_samples( out, count, 1 );
353
}
354
355
if ( fade_sound_out )
356
{
357
fade_sound_out = false;
358
fade_sound_in = true; // next buffer should be faded in
359
fade_samples( out, count, -1 );
360
}
361
return count;
362
}
363
364
Nes_Emu::rgb_t const Nes_Emu::nes_colors [color_table_size] =
365
{
366
// generated with nes_ntsc default settings
367
{102,102,102},{ 0, 42,136},{ 20, 18,168},{ 59, 0,164},
368
{ 92, 0,126},{110, 0, 64},{108, 7, 0},{ 87, 29, 0},
369
{ 52, 53, 0},{ 12, 73, 0},{ 0, 82, 0},{ 0, 79, 8},
370
{ 0, 64, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
371
{174,174,174},{ 21, 95,218},{ 66, 64,254},{118, 39,255},
372
{161, 27,205},{184, 30,124},{181, 50, 32},{153, 79, 0},
373
{108,110, 0},{ 56,135, 0},{ 13,148, 0},{ 0,144, 50},
374
{ 0,124,142},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
375
{254,254,254},{100,176,254},{147,144,254},{199,119,254},
376
{243,106,254},{254,110,205},{254,130,112},{235,159, 35},
377
{189,191, 0},{137,217, 0},{ 93,229, 48},{ 69,225,130},
378
{ 72,206,223},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
379
{254,254,254},{193,224,254},{212,211,254},{233,200,254},
380
{251,195,254},{254,197,235},{254,205,198},{247,217,166},
381
{229,230,149},{208,240,151},{190,245,171},{180,243,205},
382
{181,236,243},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
383
384
{114, 83, 79},{ 0, 23,113},{ 32, 0,145},{ 71, 0,141},
385
{104, 0,103},{122, 0, 41},{120, 0, 0},{ 99, 10, 0},
386
{ 64, 34, 0},{ 24, 54, 0},{ 0, 63, 0},{ 0, 60, 0},
387
{ 0, 45, 54},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
388
{190,148,143},{ 37, 69,187},{ 83, 38,228},{134, 13,224},
389
{177, 1,174},{200, 4, 92},{198, 24, 1},{170, 53, 0},
390
{124, 84, 0},{ 73,109, 0},{ 30,122, 0},{ 6,118, 19},
391
{ 9, 98,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
392
{254,222,215},{122,142,254},{168,110,254},{220, 85,254},
393
{254, 72,247},{254, 76,164},{254, 96, 71},{254,125, 0},
394
{210,157, 0},{158,183, 0},{114,195, 7},{ 90,191, 89},
395
{ 93,172,182},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
396
{254,222,215},{214,190,233},{233,177,250},{254,166,248},
397
{254,161,228},{254,163,194},{254,171,157},{254,183,125},
398
{250,196,108},{229,206,110},{211,211,130},{201,210,164},
399
{203,202,202},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
400
{ 75,106, 64},{ 0, 46, 98},{ 0, 22,130},{ 32, 3,126},
401
{ 65, 0, 88},{ 82, 0, 26},{ 80, 11, 0},{ 59, 34, 0},
402
{ 24, 58, 0},{ 0, 77, 0},{ 0, 86, 0},{ 0, 83, 0},
403
{ 0, 68, 39},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
404
{136,180,122},{ 0,101,166},{ 29, 69,208},{ 80, 44,203},
405
{123, 32,153},{146, 36, 72},{144, 55, 0},{116, 84, 0},
406
{ 70,116, 0},{ 19,141, 0},{ 0,153, 0},{ 0,149, 0},
407
{ 0,130, 90},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
408
{207,254,188},{ 51,183,233},{ 98,151,254},{150,126,254},
409
{193,113,220},{217,117,137},{214,137, 45},{186,166, 0},
410
{140,198, 0},{ 88,224, 0},{ 44,236, 0},{ 20,232, 63},
411
{ 23,213,155},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
412
{207,254,188},{144,231,207},{163,218,224},{184,207,222},
413
{201,202,201},{211,204,168},{210,212,130},{198,224, 99},
414
{180,237, 81},{159,247, 83},{141,252,104},{131,251,137},
415
{132,243,175},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
416
{ 83, 83, 55},{ 0, 23, 89},{ 0, 0,121},{ 40, 0,117},
417
{ 73, 0, 79},{ 90, 0, 17},{ 88, 0, 0},{ 67, 10, 0},
418
{ 32, 34, 0},{ 0, 53, 0},{ 0, 63, 0},{ 0, 60, 0},
419
{ 0, 45, 30},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
420
{147,148,110},{ 0, 69,154},{ 40, 38,196},{ 91, 12,191},
421
{134, 0,141},{157, 4, 60},{155, 23, 0},{127, 52, 0},
422
{ 81, 84, 0},{ 30,109, 0},{ 0,121, 0},{ 0,117, 0},
423
{ 0, 98, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
424
{221,222,173},{ 65,142,217},{112,110,254},{164, 84,255},
425
{208, 72,204},{231, 76,122},{229, 95, 29},{200,125, 0},
426
{154,157, 0},{102,182, 0},{ 58,195, 0},{ 34,191, 47},
427
{ 37,171,140},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
428
{221,222,173},{158,189,191},{177,176,208},{198,166,206},
429
{216,161,185},{225,163,152},{224,171,114},{213,183, 83},
430
{194,195, 66},{173,206, 68},{155,211, 88},{145,209,122},
431
{146,201,159},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
432
{ 87, 87,133},{ 0, 26,167},{ 5, 2,198},{ 44, 0,195},
433
{ 77, 0,157},{ 95, 0, 94},{ 93, 0, 25},{ 71, 14, 0},
434
{ 36, 38, 0},{ 0, 57, 0},{ 0, 66, 0},{ 0, 63, 38},
435
{ 0, 49,108},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
436
{153,153,216},{ 0, 74,254},{ 46, 43,254},{ 97, 17,254},
437
{140, 5,247},{164, 9,165},{161, 28, 74},{133, 57, 0},
438
{ 87, 89, 0},{ 36,114, 0},{ 0,126, 10},{ 0,122, 92},
439
{ 0,103,183},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
440
{229,228,254},{ 74,148,254},{120,116,254},{172, 91,254},
441
{216, 78,254},{239, 82,254},{237,102,166},{208,131, 89},
442
{162,163, 46},{110,189, 51},{ 66,201,102},{ 42,197,184},
443
{ 45,178,254},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
444
{229,228,254},{166,196,254},{185,183,254},{206,172,254},
445
{224,167,254},{233,169,254},{232,177,252},{221,189,220},
446
{202,202,203},{181,212,205},{163,217,226},{153,216,254},
447
{154,208,254},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
448
{ 90, 71, 97},{ 0, 11,130},{ 8, 0,162},{ 47, 0,158},
449
{ 80, 0,120},{ 98, 0, 58},{ 96, 0, 0},{ 74, 0, 0},
450
{ 39, 22, 0},{ 0, 42, 0},{ 0, 51, 0},{ 0, 48, 2},
451
{ 0, 33, 72},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
452
{158,132,166},{ 4, 53,210},{ 50, 22,252},{101, 0,247},
453
{144, 0,197},{168, 0,116},{165, 7, 25},{137, 36, 0},
454
{ 91, 68, 0},{ 40, 93, 0},{ 0,105, 0},{ 0,101, 42},
455
{ 0, 82,134},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
456
{234,201,246},{ 79,121,254},{125, 89,254},{177, 63,254},
457
{221, 51,254},{245, 55,195},{242, 74,102},{214,104, 24},
458
{167,136, 0},{115,161, 0},{ 71,174, 37},{ 48,170,120},
459
{ 50,150,213},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
460
{234,201,246},{171,168,254},{190,155,254},{211,145,254},
461
{229,140,254},{239,142,225},{237,150,187},{226,162,156},
462
{207,174,139},{186,185,141},{168,190,161},{159,188,195},
463
{160,180,232},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
464
{ 66, 85, 88},{ 0, 25,121},{ 0, 1,153},{ 23, 0,149},
465
{ 56, 0,111},{ 74, 0, 49},{ 72, 0, 0},{ 51, 12, 0},
466
{ 16, 36, 0},{ 0, 55, 0},{ 0, 65, 0},{ 0, 62, 0},
467
{ 0, 47, 63},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
468
{125,151,154},{ 0, 72,198},{ 17, 40,240},{ 69, 15,235},
469
{112, 3,185},{135, 7,104},{132, 26, 12},{104, 55, 0},
470
{ 59, 87, 0},{ 7,112, 0},{ 0,124, 0},{ 0,120, 30},
471
{ 0,101,121},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
472
{192,225,230},{ 37,145,254},{ 83,114,254},{135, 88,254},
473
{179, 76,254},{202, 80,179},{200, 99, 86},{171,129, 8},
474
{125,160, 0},{ 73,186, 0},{ 29,198, 21},{ 5,194,104},
475
{ 8,175,197},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
476
{192,225,230},{129,193,248},{148,180,254},{169,170,254},
477
{187,165,242},{196,166,209},{195,174,171},{184,186,140},
478
{165,199,123},{144,209,125},{126,214,145},{116,213,179},
479
{118,205,216},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
480
{ 69, 69, 69},{ 0, 16,110},{ 0, 0,142},{ 33, 0,138},
481
{ 66, 0,100},{ 84, 0, 38},{ 82, 0, 0},{ 60, 3, 0},
482
{ 25, 27, 0},{ 0, 46, 0},{ 0, 56, 0},{ 0, 53, 0},
483
{ 0, 38, 51},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
484
{134,134,134},{ 0, 64,187},{ 35, 32,228},{ 86, 7,223},
485
{129, 0,174},{153, 0, 92},{150, 18, 1},{122, 47, 0},
486
{ 76, 79, 0},{ 25,104, 0},{ 0,116, 0},{ 0,112, 19},
487
{ 0, 93,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
488
{207,207,207},{ 60,136,254},{107,104,254},{159, 79,254},
489
{203, 66,248},{226, 70,165},{224, 90, 72},{195,119, 0},
490
{149,151, 0},{ 97,177, 0},{ 53,189, 8},{ 29,185, 91},
491
{ 32,166,183},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
492
{207,207,207},{148,178,229},{166,165,246},{188,155,244},
493
{205,150,224},{215,152,190},{214,159,152},{202,171,121},
494
{183,184,104},{162,195,106},{145,200,126},{135,198,160},
495
{136,190,197},{184,184,184},{ 0, 0, 0},{ 0, 0, 0}
496
};
497
498
void Nes_Emu::get_regs(unsigned int *dest) const
499
{
500
dest[0] = emu.r.a;
501
dest[1] = emu.r.x;
502
dest[2] = emu.r.y;
503
dest[3] = emu.r.sp;
504
dest[4] = emu.r.pc;
505
dest[5] = emu.r.status;
506
}
507
508