3
3
#include "machine/rp5h01.h"
4
4
#include "includes/playch10.h"
7
static void pc10_set_mirroring( int mirroring );
8
static WRITE8_HANDLER( pc10_nt_w );
9
static READ8_HANDLER( pc10_nt_r );
10
static WRITE8_HANDLER( pc10_chr_w );
11
static READ8_HANDLER( pc10_chr_r );
12
static void pc10_set_videorom_bank( running_machine *machine, int first, int count, int bank, int size );
13
static void set_videoram_bank( running_machine *machine, int first, int count, int bank, int size );
17
int writable; // 1 for RAM, 0 for ROM
18
UINT8* chr; // direct access to the memory
7
23
int pc10_sdcs; /* ShareD Chip Select */
8
24
int pc10_dispmask; /* Display Mask */
22
38
static int MMC2_bank[4], MMC2_bank_latch[2];
40
static UINT8* vrom; // used for games with cart gfx loaded (a,c,e,f,g,h)
41
static UINT8* vram = NULL; // used for boards h, b, d, i, k (Presumably, 8K. 16K didn't work in MESS)
42
static UINT8* nametable[4]; // For non-mirroring boards, this can be moved to a direct mapping
43
static UINT8* nt_ram = NULL; // Per-board size! Some boards clearly need 4K. Some MAY use 2K. Research needed.
44
static chr_bank chr_page[8]; // Simple wrapper for ROM/RAM, since we could be banking either (Hboard)
24
46
/*************************************
28
50
*************************************/
29
52
MACHINE_RESET( pc10 )
31
const device_config *ppu = devtag_get_device(machine, "ppu");
32
54
const device_config *rp5h01 = devtag_get_device(machine, "rp5h01");
34
56
/* initialize latches and flip-flops */
51
73
rp5h01_reset_w(rp5h01, 0, 1);
52
74
rp5h01_enable_w(rp5h01, 0, 1);
54
ppu2c0x_set_mirroring( ppu, mirroring );
76
pc10_set_mirroring(mirroring);
81
vrom = memory_region(machine, "gfx2");
83
/* allocate 4K of nametable ram here */
84
/* move to individual boards as documentation of actual boards allows */
85
nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
87
memory_install_readwrite8_handler(cpu_get_address_space(cputag_get_cpu(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, pc10_chr_r, pc10_chr_w);
88
memory_install_readwrite8_handler(cpu_get_address_space(cputag_get_cpu(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, pc10_nt_r, pc10_nt_w);
91
set_videoram_bank(machine, 0, 8, 0, 8);
92
else pc10_set_videorom_bank(machine, 0, 8, 0, 8);
96
MACHINE_START( playch10_hboard )
98
vrom = memory_region(machine, "gfx2");
100
/* allocate 4K of nametable ram here */
101
/* move to individual boards as documentation of actual boards allows */
102
nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
105
vram = auto_alloc_array(machine, UINT8, 0x2000);
107
memory_install_readwrite8_handler(cpu_get_address_space(cputag_get_cpu(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, pc10_chr_r, pc10_chr_w);
108
memory_install_readwrite8_handler(cpu_get_address_space(cputag_get_cpu(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, pc10_nt_r, pc10_nt_w);
57
111
/*************************************
233
289
/* get the pixel at the gun position */
234
pix = ppu2c0x_get_pixel( ppu, x, y );
290
pix = ppu2c0x_get_pixel(ppu, x, y);
236
292
/* get the color base from the ppu */
237
color_base = ppu2c0x_get_colorbase( ppu );
293
color_base = ppu2c0x_get_colorbase(ppu);
239
295
/* look at the screen and see if the cursor is over a bright pixel */
240
if ( ( pix == color_base+0x20 ) || ( pix == color_base+0x30 ) ||
241
( pix == color_base+0x33 ) || ( pix == color_base+0x34 ) )
296
if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
297
(pix == color_base + 0x33) || (pix == color_base + 0x34))
243
299
ret &= ~0x08; /* sprite hit */
246
302
/* now, add the trigger if not masked */
249
ret |= ( trigger & 2 ) << 3;
305
ret |= (trigger & 2) << 3;
315
/*************************************
317
* PPU External bus handlers
319
*************************************/
321
static WRITE8_HANDLER( pc10_nt_w )
323
int page = ((offset & 0xc00) >> 10);
324
nametable[page][offset & 0x3ff] = data;
327
static READ8_HANDLER( pc10_nt_r )
329
int page = ((offset & 0xc00) >> 10);
330
return nametable[page][offset & 0x3ff];
333
static WRITE8_HANDLER( pc10_chr_w )
335
int bank = offset >> 10;
336
if (chr_page[bank].writable)
338
chr_page[bank].chr[offset & 0x3ff] = data;
342
static READ8_HANDLER( pc10_chr_r )
344
int bank = offset >> 10;
345
return chr_page[bank].chr[offset & 0x3ff];
348
static void pc10_set_mirroring( int mirroring )
353
nametable[0] = nametable[1] = nametable[2] = nametable[3] = nt_ram;
355
case PPU_MIRROR_HIGH:
356
nametable[0] = nametable[1] = nametable[2] = nametable[3] = nt_ram + 0x400;
358
case PPU_MIRROR_HORZ:
359
nametable[0] = nt_ram;
360
nametable[1] = nt_ram;
361
nametable[2] = nt_ram + 0x400;
362
nametable[3] = nt_ram + 0x400;
364
case PPU_MIRROR_VERT:
365
nametable[0] = nt_ram;
366
nametable[1] = nt_ram + 0x400;
367
nametable[2] = nt_ram;
368
nametable[3] = nt_ram + 0x400;
370
case PPU_MIRROR_NONE:
372
nametable[0] = nt_ram;
373
nametable[1] = nt_ram + 0x400;
374
nametable[2] = nt_ram + 0x800;
375
nametable[3] = nt_ram + 0xc00;
388
static void pc10_set_videorom_bank( running_machine *machine, int first, int count, int bank, int size )
391
/* first = first bank to map */
392
/* count = number of 1K banks to map */
393
/* bank = index of the bank */
394
/* size = size of indexed banks (in KB) */
395
/* note that this follows the original PPU banking and might be overly complex */
397
/* yeah, this is probably a horrible assumption to make.*/
398
/* but the driver is 100% consistant */
400
len = memory_region_length(machine, "gfx2");
401
len /= 0x400; // convert to KB
402
len /= size; // convert to bank resolution
403
len--; // convert to mask
404
bank &= len; // should be the right mask
406
for (i = 0; i < count; i++)
408
chr_page[i + first].writable = 0;
409
chr_page[i + first].chr=vrom + (i * 0x400) + (bank * size * 0x400);
413
static void set_videoram_bank( running_machine *machine, int first, int count, int bank, int size )
416
/* first = first bank to map */
417
/* count = number of 1K banks to map */
418
/* bank = index of the bank */
419
/* size = size of indexed banks (in KB) */
420
/* note that this follows the original PPU banking and might be overly complex */
422
/* assumes 8K of vram */
423
/* need 8K to fill address space */
424
/* only pinbot (8k) banks at all */
426
for (i = 0; i < count; i++)
428
chr_page[i + first].writable = 1;
429
chr_page[i + first].chr = vram + (((i * 0x400) + (bank * size * 0x400)) & 0x1fff);
261
433
/*************************************
263
435
* Common init for all games
265
437
*************************************/
266
439
DRIVER_INIT( playch10 )
268
443
/* set the controller to default */
269
444
pc10_gun_controller = 0;
376
552
/* apply mirroring */
377
ppu2c0x_set_mirroring( ppu, _mirroring );
553
pc10_set_mirroring(_mirroring);
381
557
case 1: /* video rom banking - bank 0 - 4k or 8k */
382
ppu2c0x_set_videorom_bank( ppu, 0, ( vrom4k ) ? 4 : 8, ( mmc1_shiftreg & 0x1f ), 256 );
559
set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
561
pc10_set_videorom_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
385
564
case 2: /* video rom banking - bank 1 - 4k only */
387
ppu2c0x_set_videorom_bank( ppu, 4, 4, ( mmc1_shiftreg & 0x1f ), 256 );
568
set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
570
pc10_set_videorom_bank(space->machine, 4, 4, (mmc1_shiftreg & 0x1f), 4);
390
574
case 3: /* program banking */
392
int bank = ( mmc1_shiftreg & mmc1_rom_mask ) * 0x4000;
393
UINT8 *prg = memory_region( space->machine, "cart" );
576
int bank = (mmc1_shiftreg & mmc1_rom_mask) * 0x4000;
577
UINT8 *prg = memory_region(space->machine, "cart");
398
memcpy( &prg[0x08000], &prg[0x010000+bank], 0x8000 );
582
memcpy(&prg[0x08000], &prg[0x010000 + bank], 0x8000);
406
memcpy( &prg[0x08000], &prg[0x010000+bank], 0x4000 );
590
memcpy(&prg[0x08000], &prg[0x010000 + bank], 0x4000);
411
memcpy( &prg[0x0c000], &prg[0x010000+bank], 0x4000 );
595
memcpy(&prg[0x0c000], &prg[0x010000 + bank], 0x4000);
438
620
/* set the mirroring here */
439
621
mirroring = PPU_MIRROR_VERT;
623
/* we have no vram, make sure switching games doesn't point to an old allocation */
442
627
/**********************************************************************************/
444
628
/* B Board games (Contra, Rush N' Attach, Pro Wrestling) */
446
630
static WRITE8_HANDLER( bboard_rom_switch_w )
448
int bankoffset = 0x10000 + ( ( data & 7 ) * 0x4000 );
449
UINT8 *prg = memory_region( space->machine, "cart" );
632
int bankoffset = 0x10000 + ((data & 7) * 0x4000);
633
UINT8 *prg = memory_region(space->machine, "cart");
451
memcpy( &prg[0x08000], &prg[bankoffset], 0x4000 );
635
memcpy(&prg[0x08000], &prg[bankoffset], 0x4000);
454
638
DRIVER_INIT( pcbboard )
456
UINT8 *prg = memory_region( machine, "cart" );
640
UINT8 *prg = memory_region(machine, "cart");
458
642
/* We do manual banking, in case the code falls through */
459
643
/* Copy the initial banks */
460
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
644
memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
462
646
/* Roms are banked at $8000 to $bfff */
463
647
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, bboard_rom_switch_w );
465
649
/* common init */
466
650
DRIVER_INIT_CALL(playch10);
653
vram = auto_alloc_array(machine, UINT8, 0x2000);
468
655
/* set the mirroring here */
469
656
mirroring = PPU_MIRROR_VERT;
658
set_videoram_bank(machine, 0, 8, 0, 8);
472
661
/**********************************************************************************/
474
662
/* C Board games (The Goonies) */
476
664
static WRITE8_HANDLER( cboard_vrom_switch_w )
478
const device_config *ppu = devtag_get_device(space->machine, "ppu");
479
ppu2c0x_set_videorom_bank( ppu, 0, 8, ( ( data >> 1 ) & 1 ), 512 );
666
pc10_set_videorom_bank(space->machine, 0, 8, ((data >> 1) & 1), 8);
482
669
DRIVER_INIT( pccboard )
484
671
/* switches vrom with writes to $6000 */
485
672
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, cboard_vrom_switch_w );
674
/* we have no vram, make sure switching games doesn't point to an old allocation */
487
677
/* common init */
488
678
DRIVER_INIT_CALL(playch10);
491
681
/**********************************************************************************/
493
682
/* D Board games (Rad Racer) */
495
684
DRIVER_INIT( pcdboard )
497
UINT8 *prg = memory_region( machine, "cart" );
686
UINT8 *prg = memory_region(machine, "cart");
499
688
/* We do manual banking, in case the code falls through */
500
689
/* Copy the initial banks */
501
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
690
memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
503
692
mmc1_rom_mask = 0x07;
505
694
/* MMC mapper at writes to $8000-$ffff */
506
695
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
508
698
/* common init */
509
699
DRIVER_INIT_CALL(playch10);
701
vram = auto_alloc_array(machine, UINT8, 0x2000);
703
set_videoram_bank(machine, 0, 8, 0, 8);
512
706
/* D Board games with extra ram (Metroid) */
520
714
/* common init */
521
715
DRIVER_INIT_CALL(pcdboard);
718
vram = auto_alloc_array(machine, UINT8, 0x2000);
720
set_videoram_bank(machine, 0, 8, 0, 8);
524
723
/**********************************************************************************/
526
724
/* E Board games (Mike Tyson's Punchout) - BROKEN - FIX ME */
528
726
/* callback for the ppu_latch */
529
727
static void mapper9_latch( const device_config *ppu, offs_t offset )
532
if( (offset & 0x1ff0) == 0x0fd0 && MMC2_bank_latch[0] != 0xfd )
730
if((offset & 0x1ff0) == 0x0fd0 && MMC2_bank_latch[0] != 0xfd)
534
732
MMC2_bank_latch[0] = 0xfd;
535
ppu2c0x_set_videorom_bank( ppu, 0, 4, MMC2_bank[0], 256 );
733
pc10_set_videorom_bank(ppu->space[0]->machine, 0, 4, MMC2_bank[0], 4);
537
else if( (offset & 0x1ff0) == 0x0fe0 && MMC2_bank_latch[0] != 0xfe )
735
else if((offset & 0x1ff0) == 0x0fe0 && MMC2_bank_latch[0] != 0xfe)
539
737
MMC2_bank_latch[0] = 0xfe;
540
ppu2c0x_set_videorom_bank( ppu, 0, 4, MMC2_bank[1], 256 );
738
pc10_set_videorom_bank(ppu->space[0]->machine, 0, 4, MMC2_bank[1], 4);
542
else if( (offset & 0x1ff0) == 0x1fd0 && MMC2_bank_latch[1] != 0xfd )
740
else if((offset & 0x1ff0) == 0x1fd0 && MMC2_bank_latch[1] != 0xfd)
544
742
MMC2_bank_latch[1] = 0xfd;
545
ppu2c0x_set_videorom_bank( ppu, 4, 4, MMC2_bank[2], 256 );
743
pc10_set_videorom_bank(ppu->space[0]->machine, 4, 4, MMC2_bank[2], 4);
547
else if( (offset & 0x1ff0) == 0x1fe0 && MMC2_bank_latch[1] != 0xfe )
745
else if((offset & 0x1ff0) == 0x1fe0 && MMC2_bank_latch[1] != 0xfe)
549
747
MMC2_bank_latch[1] = 0xfe;
550
ppu2c0x_set_videorom_bank( ppu, 4, 4, MMC2_bank[3], 256 );
748
pc10_set_videorom_bank(ppu->space[0]->machine, 4, 4, MMC2_bank[3], 4);
554
752
static WRITE8_HANDLER( eboard_rom_switch_w )
556
const device_config *ppu = devtag_get_device(space->machine, "ppu");
558
754
/* a variation of mapper 9 on a nes */
559
switch( offset & 0x7000 )
755
switch (offset & 0x7000)
561
757
case 0x2000: /* code bank switching */
563
int bankoffset = 0x10000 + ( data & 0x0f ) * 0x2000;
564
UINT8 *prg = memory_region( space->machine, "cart" );
565
memcpy( &prg[0x08000], &prg[bankoffset], 0x2000 );
759
int bankoffset = 0x10000 + (data & 0x0f) * 0x2000;
760
UINT8 *prg = memory_region(space->machine, "cart");
761
memcpy(&prg[0x08000], &prg[bankoffset], 0x2000);
569
765
case 0x3000: /* gfx bank 0 - 4k */
570
766
MMC2_bank[0] = data;
571
if( MMC2_bank_latch[0] == 0xfd )
572
ppu2c0x_set_videorom_bank( ppu, 0, 4, data, 256 );
767
if (MMC2_bank_latch[0] == 0xfd)
768
pc10_set_videorom_bank(space->machine, 0, 4, data, 4);
575
771
case 0x4000: /* gfx bank 0 - 4k */
576
772
MMC2_bank[1] = data;
577
if( MMC2_bank_latch[0] == 0xfe )
578
ppu2c0x_set_videorom_bank( ppu, 0, 4, data, 256 );
773
if (MMC2_bank_latch[0] == 0xfe)
774
pc10_set_videorom_bank(space->machine, 0, 4, data, 4);
581
777
case 0x5000: /* gfx bank 1 - 4k */
582
778
MMC2_bank[2] = data;
583
if( MMC2_bank_latch[1] == 0xfd )
584
ppu2c0x_set_videorom_bank( ppu, 4, 4, data, 256 );
779
if (MMC2_bank_latch[1] == 0xfd)
780
pc10_set_videorom_bank(space->machine, 4, 4, data, 4);
587
783
case 0x6000: /* gfx bank 1 - 4k */
588
784
MMC2_bank[3] = data;
589
if( MMC2_bank_latch[1] == 0xfe )
590
ppu2c0x_set_videorom_bank( ppu, 4, 4, data, 256 );
785
if (MMC2_bank_latch[1] == 0xfe)
786
pc10_set_videorom_bank(space->machine, 4, 4, data, 4);
593
789
case 0x7000: /* mirroring */
594
ppu2c0x_set_mirroring( ppu, data ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT );
790
pc10_set_mirroring(data ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
600
796
DRIVER_INIT( pceboard )
602
UINT8 *prg = memory_region( machine, "cart" );
798
UINT8 *prg = memory_region(machine, "cart");
800
/* we have no vram, make sure switching games doesn't point to an old allocation */
604
803
/* We do manual banking, in case the code falls through */
605
804
/* Copy the initial banks */
606
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
805
memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
608
807
/* basically a mapper 9 on a nes */
609
808
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, eboard_rom_switch_w );
682
884
/* basically, a MMC3 mapper from the nes */
684
switch( offset & 0x7001 )
886
switch (offset & 0x7001)
687
889
gboard_command = data;
689
if ( gboard_last_bank != ( data & 0xc0 ) )
891
if (gboard_last_bank != (data & 0xc0))
692
UINT8 *prg = memory_region( space->machine, "cart" );
894
UINT8 *prg = memory_region(space->machine, "cart");
694
896
/* reset the banks */
695
if ( gboard_command & 0x40 )
897
if (gboard_command & 0x40)
698
900
bank = gboard_banks[0] * 0x2000 + 0x10000;
700
memcpy( &prg[0x0c000], &prg[bank], 0x2000 );
701
memcpy( &prg[0x08000], &prg[0x4c000], 0x2000 );
902
memcpy(&prg[0x0c000], &prg[bank], 0x2000);
903
memcpy(&prg[0x08000], &prg[0x4c000], 0x2000);
706
908
bank = gboard_banks[0] * 0x2000 + 0x10000;
708
memcpy( &prg[0x08000], &prg[bank], 0x2000 );
709
memcpy( &prg[0x0c000], &prg[0x4c000], 0x2000 );
910
memcpy(&prg[0x08000], &prg[bank], 0x2000);
911
memcpy(&prg[0x0c000], &prg[0x4c000], 0x2000);
713
915
bank = gboard_banks[1] * 0x2000 + 0x10000;
714
memcpy( &prg[0x0a000], &prg[bank], 0x2000 );
916
memcpy(&prg[0x0a000], &prg[bank], 0x2000);
716
918
gboard_last_bank = data & 0xc0;
737
939
case 4: /* char banking */
738
940
case 5: /* char banking */
740
ppu2c0x_set_videorom_bank( ppu, page, 1, data, 64 );
942
pc10_set_videorom_bank(space->machine, page, 1, data, 1);
743
945
case 6: /* program banking */
745
UINT8 *prg = memory_region( space->machine, "cart" );
746
if ( gboard_command & 0x40 )
947
UINT8 *prg = memory_region(space->machine, "cart");
948
if (gboard_command & 0x40)
749
951
gboard_banks[0] = data & 0x1f;
750
bank = ( gboard_banks[0] ) * 0x2000 + 0x10000;
952
bank = (gboard_banks[0]) * 0x2000 + 0x10000;
752
memcpy( &prg[0x0c000], &prg[bank], 0x2000 );
753
memcpy( &prg[0x08000], &prg[0x4c000], 0x2000 );
954
memcpy(&prg[0x0c000], &prg[bank], 0x2000);
955
memcpy(&prg[0x08000], &prg[0x4c000], 0x2000);
758
960
gboard_banks[0] = data & 0x1f;
759
bank = ( gboard_banks[0] ) * 0x2000 + 0x10000;
961
bank = (gboard_banks[0]) * 0x2000 + 0x10000;
761
memcpy( &prg[0x08000], &prg[bank], 0x2000 );
762
memcpy( &prg[0x0c000], &prg[0x4c000], 0x2000 );
963
memcpy(&prg[0x08000], &prg[bank], 0x2000);
964
memcpy(&prg[0x0c000], &prg[0x4c000], 0x2000);
803
1005
case 0x6000: /* disable irqs */
804
ppu2c0x_set_scanline_callback( ppu, 0 );
1006
ppu2c0x_set_scanline_callback(ppu, 0);
807
1009
case 0x6001: /* enable irqs */
808
ppu2c0x_set_scanline_callback( ppu, gboard_scanline_cb );
1010
ppu2c0x_set_scanline_callback(ppu, gboard_scanline_cb);
813
1015
DRIVER_INIT( pcgboard )
815
UINT8 *prg = memory_region( machine, "cart" );
1017
UINT8 *prg = memory_region(machine, "cart");
817
1020
/* We do manual banking, in case the code falls through */
818
1021
/* Copy the initial banks */
819
memcpy( &prg[0x08000], &prg[0x4c000], 0x4000 );
820
memcpy( &prg[0x0c000], &prg[0x4c000], 0x4000 );
1022
memcpy(&prg[0x08000], &prg[0x4c000], 0x4000);
1023
memcpy(&prg[0x0c000], &prg[0x4c000], 0x4000);
822
1025
/* MMC3 mapper at writes to $8000-$ffff */
823
1026
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, gboard_rom_switch_w );
848
1052
/**********************************************************************************/
850
1053
/* i Board games (Captain Sky Hawk, Solar Jetman) */
852
1055
static WRITE8_HANDLER( iboard_rom_switch_w )
854
1057
int bank = data & 7;
855
const device_config *ppu = devtag_get_device(space->machine, "ppu");
856
UINT8 *prg = memory_region( space->machine, "cart" );
1058
UINT8 *prg = memory_region(space->machine, "cart");
859
ppu2c0x_set_mirroring( ppu, PPU_MIRROR_HIGH );
1061
pc10_set_mirroring(PPU_MIRROR_HIGH);
861
ppu2c0x_set_mirroring( ppu, PPU_MIRROR_LOW );
1063
pc10_set_mirroring(PPU_MIRROR_LOW);
863
memcpy( &prg[0x08000], &prg[bank * 0x8000 + 0x10000], 0x8000 );
1065
memcpy(&prg[0x08000], &prg[bank * 0x8000 + 0x10000], 0x8000);
866
1068
DRIVER_INIT( pciboard )
868
UINT8 *prg = memory_region( machine, "cart" );
1070
UINT8 *prg = memory_region(machine, "cart");
870
1072
/* We do manual banking, in case the code falls through */
871
1073
/* Copy the initial banks */
872
memcpy( &prg[0x08000], &prg[0x10000], 0x8000 );
1074
memcpy(&prg[0x08000], &prg[0x10000], 0x8000);
874
1076
/* Roms are banked at $8000 to $bfff */
875
1077
memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, iboard_rom_switch_w );
877
1079
/* common init */
878
1080
DRIVER_INIT_CALL(playch10);
1083
vram = auto_alloc_array(machine, UINT8, 0x2000);
1085
set_videoram_bank(machine, 0, 8, 0, 8);
881
1088
/**********************************************************************************/
883
1089
/* H Board games (PinBot) */
885
1091
static WRITE8_HANDLER( hboard_rom_switch_w )
887
const device_config *ppu = devtag_get_device(space->machine, "ppu");
889
switch( offset & 0x7001 )
1093
switch (offset & 0x7001)
893
1097
UINT8 cmd = gboard_command & 0x07;
894
int page = ( gboard_command & 0x80 ) >> 5;
1098
int page = (gboard_command & 0x80) >> 5;
898
1102
case 0: /* char banking */
899
1103
case 1: /* char banking */
901
page ^= ( cmd << 1 );
904
ppu2c0x_set_videoram_bank( ppu, page, 2, data, 64 );
1108
set_videoram_bank(space->machine, page, 2, data, 1);
908
ppu2c0x_set_videorom_bank( ppu, page, 2, data, 64 );
1112
pc10_set_videorom_bank(space->machine, page, 2, data, 1);