2
CRYSTAL SYSTEM by Brezzasoft (2001)
3
using VRender0 System on a Chip
5
The VRender0 (info at archive.org for http://www.mesdigital.com) chip contains:
6
- CPU Core SE3208 (info at www.adc.co.kr) @ 43Mhz
11
- 32 channels wavetable synth (8bit linear, 16bit linear and 8bit ulaw sample format)
12
- Custom 2D video rendering device (texture mapping, alphablend, roz)
14
The protection is a PIC deviced labeled SMART-IC in the rom board, I'm not sure how
15
it exactly works, but it supplies some opcodes that have been replaced with garbage
16
in the main program. I don't know if it traps reads and returns the correct ones when
17
reading from flash, or if it's interfaced by the main program after copying the program
18
from flash to ram and it provides the addresses and values to patch. I patch the flash
19
program with the correct data
24
Brezza Soft Corporation (Japan), 2001
26
This game runs on a small cartridge-based PCB known as the 'Crystal System'
27
There are only two known games running on this system, Crystal of Kings and Evolution Soccer.
28
The main PCB is small (approx 6" square) and contains only a few components. All of the processing
29
work is done by the large IC in the middle of the PCB. The system looks a bit like IGS's PGM System, in
30
that it's housed in a plastic case and has a single slot for insertion of a game cart. However this
31
system and the game carts are approx. half the size of the PGM carts.
32
On bootup, the screen is black and the system outputs a vertical white line on the right side of the screen.
33
The HSync is approx 20kHz, the screen is out of sync on a standard 15kHz arcade monitor.
34
After approx. 15-20 seconds, the screen changes to white and has some vertical stripes on it and the HSync
35
changes to 15kHz. After a few more seconds the game boots to a white screen and a blue 'Brezza Soft' logo.
36
Without a cart plugged in, the screen stays at the first vertical line screen.
41
Brezza Soft MAGIC EYES AMG0110B
42
|----------------------------------------------------|
43
|TDA1519 VOL 3.6V_BATT SW1 SW2 SW3 |
48
| DA1133A |-----| | | |
49
| HY57V651620 32.768kHz |MX27L| | | |
50
| DS1302 |1000 | | | |
51
|J |-------------| |-----| | | |
54
|M HY57V651620 | VRENDERZERO | | | |
57
| |-------------| HY57V651620 | | |
63
| |---------------| DSW(8) |
64
|-| CN2 |----------------------------------|
68
GM76C256 : Hyundai GM76C256 32k x8 SRAM (SOP28)
69
MX27L1000 : Macronix MX27L1000QC-12 128k x8 EEPROM (BIOS, PLCC32)
70
PAL : Atmel ATF16V8-10PC PAL (DIP20)
71
HY57V651620: Hyundai HY57V651620 4M x16 SDRAM (SSOP54)
72
DA1311A : Philips DA1311A DAC (SOIC8)
73
DS1233 : Dallas DS1233 master reset IC (SOIC4)
74
DS1302 : Dallas DS1302 real time clock IC (DIP8)
75
VRENDERZERO: MESGraphics VRenderZERO (all-in-one main CPU/graphics/sound, QFP240)
76
SW1 : Push button reset switch
77
SW2 : Push button service switch
78
SW3 : Push button test switch
79
TDA1519 : Philips TDA1519 dual 6W stereo power amplifier (SIP9)
80
VOL : Master volume potentiometer
81
3.6V_BATT : 3.6 Volt NiCad battery 65mAh (for RTC)
82
TD62003 : Toshiba TD62003 PNP 50V 0.5A quad darlington switch, for driving coin meters (DIP16)
83
CN1 : PCI-type slot for extension riser board (for game cart connection at 90 degrees to the main PCB)
84
CN2 : IDC 34-way flat cable connector (purpose unknown)
90
Cart sticker: 'THE CRYSTAL OF KINGS BCSV0000'
91
PCB printing: Brezza Soft MAGIC EYES AMG0111B
92
|------------------------------|
107
|--------------------------|
110
The cart PCB is single sided and contains only...
111
1x 3.579545MHz crystal
112
1x 74HC138 logic chip
113
1x 18 pin unknown chip (DIP18, surface scratched but it's probably a PIC16xxx, labelled 'dgSMART-PR3 MAGIC EYES')
114
3x Intel E28F128J3A 128MBit surface mounted FlashROMs (TSOP56, labelled 'BREZZASOFT BCSV0004Fxx', xx=01, 02, 03)
115
Note: there are 8 spaces total for FlashROMs. Only U1, U2 & U3 are populated in this cart.
120
#include "cpu/se3208/se3208.h"
121
#include "video/vrender0.h"
122
#include "machine/ds1302.h"
123
#include "sound/vrender0.h"
124
#include "machine/nvram.h"
126
#define IDLE_LOOP_SPEEDUP
128
class crystal_state : public driver_device
131
crystal_state(const machine_config &mconfig, device_type type, const char *tag)
132
: driver_device(mconfig, type, tag) { }
134
/* memory pointers */
136
UINT32 * m_textureram;
140
// UINT32 * m_nvram; // currently this uses generic nvram handling
142
#ifdef IDLE_LOOP_SPEEDUP
149
UINT32 m_Timerctrl[4];
150
emu_timer *m_Timer[4];
155
UINT32 *m_ResetPatch;
159
device_t *m_vr0video;
162
static void IntReq( running_machine &machine, int num )
164
crystal_state *state = machine.driver_data<crystal_state>();
165
address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
166
UINT32 IntEn = space->read_dword(0x01800c08);
167
UINT32 IntPend = space->read_dword(0x01800c0c);
168
if (IntEn & (1 << num))
170
IntPend |= (1 << num);
171
space->write_dword(0x01800c0c, IntPend);
172
device_set_input_line(state->m_maincpu, SE3208_INT, ASSERT_LINE);
174
#ifdef IDLE_LOOP_SPEEDUP
175
state->m_FlipCntRead = 0;
176
device_resume(state->m_maincpu, SUSPEND_REASON_SPIN);
180
static READ32_HANDLER( FlipCount_r )
182
crystal_state *state = space->machine().driver_data<crystal_state>();
184
#ifdef IDLE_LOOP_SPEEDUP
185
UINT32 IntPend = space->read_dword(0x01800c0c);
186
state->m_FlipCntRead++;
187
if (state->m_FlipCntRead >= 16 && !IntPend && state->m_FlipCount != 0)
188
device_suspend(state->m_maincpu, SUSPEND_REASON_SPIN, 1);
190
return ((UINT32) state->m_FlipCount) << 16;
193
static WRITE32_HANDLER( FlipCount_w )
195
crystal_state *state = space->machine().driver_data<crystal_state>();
197
if (mem_mask & 0x00ff0000)
199
int fc = (data >> 16) & 0xff;
201
state->m_FlipCount++;
203
state->m_FlipCount = 0;
207
static READ32_HANDLER( Input_r )
209
crystal_state *state = space->machine().driver_data<crystal_state>();
212
return input_port_read(space->machine(), "P1_P2");
213
else if (offset == 1)
214
return input_port_read(space->machine(), "P3_P4");
215
else if( offset == 2)
217
UINT8 Port4 = input_port_read(space->machine(), "SYSTEM");
218
if (!(Port4 & 0x10) && ((state->m_OldPort4 ^ Port4) & 0x10)) //coin buttons trigger IRQs
219
IntReq(space->machine(), 12);
220
if (!(Port4 & 0x20) && ((state->m_OldPort4 ^ Port4) & 0x20))
221
IntReq(space->machine(), 19);
222
state->m_OldPort4 = Port4;
223
return /*dips*/input_port_read(space->machine(), "DSW") | (Port4 << 16);
228
static WRITE32_HANDLER( IntAck_w )
230
crystal_state *state = space->machine().driver_data<crystal_state>();
231
UINT32 IntPend = space->read_dword(0x01800c0c);
235
IntPend &= ~(1 << (data & 0x1f));
236
space->write_dword(0x01800c0c, IntPend);
238
device_set_input_line(state->m_maincpu, SE3208_INT, CLEAR_LINE);
240
if (mem_mask & 0xff00)
241
state->m_IntHigh = (data >> 8) & 7;
244
static IRQ_CALLBACK( icallback )
246
crystal_state *state = device->machine().driver_data<crystal_state>();
247
address_space *space = device->memory().space(AS_PROGRAM);
248
UINT32 IntPend = space->read_dword(0x01800c0c);
251
for (i = 0; i < 32; ++i)
255
return (state->m_IntHigh << 5) | i;
258
return 0; //This should never happen
261
static WRITE32_HANDLER( Banksw_w )
263
crystal_state *state = space->machine().driver_data<crystal_state>();
265
state->m_Bank = (data >> 1) & 7;
266
if (state->m_Bank <= 2)
267
memory_set_bankptr(space->machine(), "bank1", space->machine().region("user1")->base() + state->m_Bank * 0x1000000);
269
memory_set_bankptr(space->machine(), "bank1", space->machine().region("user2")->base());
272
static TIMER_CALLBACK( Timercb )
274
crystal_state *state = machine.driver_data<crystal_state>();
275
int which = (int)(FPTR)ptr;
276
static const int num[] = { 0, 1, 9, 10 };
278
if (!(state->m_Timerctrl[which] & 2))
279
state->m_Timerctrl[which] &= ~1;
281
IntReq(machine, num[which]);
284
INLINE void Timer_w( address_space *space, int which, UINT32 data, UINT32 mem_mask )
286
crystal_state *state = space->machine().driver_data<crystal_state>();
288
if (((data ^ state->m_Timerctrl[which]) & 1) && (data & 1)) //Timer activate
290
int PD = (data >> 8) & 0xff;
291
int TCV = space->read_dword(0x01801404 + which * 8);
292
attotime period = attotime::from_hz(43000000) * ((PD + 1) * (TCV + 1));
294
if (state->m_Timerctrl[which] & 2)
295
state->m_Timer[which]->adjust(period, 0, period);
297
state->m_Timer[which]->adjust(period);
299
COMBINE_DATA(&state->m_Timerctrl[which]);
302
static WRITE32_HANDLER( Timer0_w )
304
Timer_w(space, 0, data, mem_mask);
307
static READ32_HANDLER( Timer0_r )
309
crystal_state *state = space->machine().driver_data<crystal_state>();
310
return state->m_Timerctrl[0];
313
static WRITE32_HANDLER( Timer1_w )
315
Timer_w(space, 1, data, mem_mask);
318
static READ32_HANDLER( Timer1_r )
320
crystal_state *state = space->machine().driver_data<crystal_state>();
321
return state->m_Timerctrl[1];
324
static WRITE32_HANDLER( Timer2_w )
326
Timer_w(space, 2, data, mem_mask);
329
static READ32_HANDLER( Timer2_r )
331
crystal_state *state = space->machine().driver_data<crystal_state>();
332
return state->m_Timerctrl[2];
335
static WRITE32_HANDLER( Timer3_w )
337
Timer_w(space, 3, data, mem_mask);
340
static READ32_HANDLER( Timer3_r )
342
crystal_state *state = space->machine().driver_data<crystal_state>();
343
return state->m_Timerctrl[3];
346
static READ32_HANDLER( FlashCmd_r )
348
crystal_state *state = space->machine().driver_data<crystal_state>();
350
if ((state->m_FlashCmd & 0xff) == 0xff)
352
if (state->m_Bank <= 2)
354
UINT32 *ptr = (UINT32*)(space->machine().region("user1")->base() + state->m_Bank * 0x1000000);
360
if ((state->m_FlashCmd & 0xff) == 0x90)
362
if (state->m_Bank <= 2)
363
return 0x00180089; //Intel 128MBit
370
static WRITE32_HANDLER( FlashCmd_w )
372
crystal_state *state = space->machine().driver_data<crystal_state>();
373
state->m_FlashCmd = data;
376
static READ32_HANDLER( PIO_r )
378
crystal_state *state = space->machine().driver_data<crystal_state>();
382
static WRITE32_HANDLER( PIO_w )
384
crystal_state *state = space->machine().driver_data<crystal_state>();
385
UINT32 RST = data & 0x01000000;
386
UINT32 CLK = data & 0x02000000;
387
UINT32 DAT = data & 0x10000000;
390
state->m_ds1302->reset();
392
ds1302_dat_w(state->m_ds1302, 0, DAT ? 1 : 0);
393
ds1302_clk_w(state->m_ds1302, 0, CLK ? 1 : 0);
395
if (ds1302_read(state->m_ds1302, 0))
396
space->write_dword(0x01802008, space->read_dword(0x01802008) | 0x10000000);
398
space->write_dword(0x01802008, space->read_dword(0x01802008) & (~0x10000000));
400
COMBINE_DATA(&state->m_PIO);
403
INLINE void DMA_w( address_space *space, int which, UINT32 data, UINT32 mem_mask )
405
crystal_state *state = space->machine().driver_data<crystal_state>();
407
if (((data ^ state->m_DMActrl[which]) & (1 << 10)) && (data & (1 << 10))) //DMAOn
410
UINT32 SRC = space->read_dword(0x01800804 + which * 0x10);
411
UINT32 DST = space->read_dword(0x01800808 + which * 0x10);
412
UINT32 CNT = space->read_dword(0x0180080C + which * 0x10);
415
if (CTR & 0x2) //32 bits
417
for (i = 0; i < CNT; ++i)
419
UINT32 v = space->read_dword(SRC + i * 4);
420
space->write_dword(DST + i * 4, v);
423
else if (CTR & 0x1) //16 bits
425
for (i = 0; i < CNT; ++i)
427
UINT16 v = space->read_word(SRC + i * 2);
428
space->write_word(DST + i * 2, v);
433
for (i = 0; i < CNT; ++i)
435
UINT8 v = space->read_byte(SRC + i);
436
space->write_byte(DST + i, v);
440
space->write_dword(0x0180080C + which * 0x10, 0);
441
IntReq(space->machine(), 7 + which);
443
COMBINE_DATA(&state->m_DMActrl[which]);
446
static READ32_HANDLER( DMA0_r )
448
crystal_state *state = space->machine().driver_data<crystal_state>();
449
return state->m_DMActrl[0];
452
static WRITE32_HANDLER( DMA0_w )
454
DMA_w(space, 0, data, mem_mask);
457
static READ32_HANDLER( DMA1_r )
459
crystal_state *state = space->machine().driver_data<crystal_state>();
460
return state->m_DMActrl[1];
463
static WRITE32_HANDLER( DMA1_w )
465
DMA_w(space, 1, data, mem_mask);
469
static ADDRESS_MAP_START( crystal_mem, AS_PROGRAM, 32 )
470
AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_WRITENOP
472
AM_RANGE(0x01200000, 0x0120000f) AM_READ(Input_r)
473
AM_RANGE(0x01280000, 0x01280003) AM_WRITE(Banksw_w)
474
AM_RANGE(0x01400000, 0x0140ffff) AM_RAM AM_SHARE("nvram")
476
AM_RANGE(0x01801400, 0x01801403) AM_READWRITE(Timer0_r, Timer0_w)
477
AM_RANGE(0x01801408, 0x0180140b) AM_READWRITE(Timer1_r, Timer1_w)
478
AM_RANGE(0x01801410, 0x01801413) AM_READWRITE(Timer2_r, Timer2_w)
479
AM_RANGE(0x01801418, 0x0180141b) AM_READWRITE(Timer3_r, Timer3_w)
480
AM_RANGE(0x01802004, 0x01802007) AM_READWRITE(PIO_r, PIO_w)
482
AM_RANGE(0x01800800, 0x01800803) AM_READWRITE(DMA0_r, DMA0_w)
483
AM_RANGE(0x01800810, 0x01800813) AM_READWRITE(DMA1_r, DMA1_w)
485
AM_RANGE(0x01800c04, 0x01800c07) AM_WRITE(IntAck_w)
486
AM_RANGE(0x01800000, 0x0180ffff) AM_RAM AM_BASE_MEMBER(crystal_state, m_sysregs)
487
AM_RANGE(0x02000000, 0x027fffff) AM_RAM AM_BASE_MEMBER(crystal_state, m_workram)
489
AM_RANGE(0x030000a4, 0x030000a7) AM_READWRITE(FlipCount_r, FlipCount_w)
491
AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_BASE_MEMBER(crystal_state, m_vidregs)
492
AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_BASE_MEMBER(crystal_state, m_textureram)
493
AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_BASE_MEMBER(crystal_state, m_frameram)
494
AM_RANGE(0x04800000, 0x04800fff) AM_DEVREADWRITE("vrender", vr0_snd_read, vr0_snd_write)
496
AM_RANGE(0x05000000, 0x05000003) AM_READWRITE(FlashCmd_r, FlashCmd_w)
497
AM_RANGE(0x05000000, 0x05ffffff) AM_ROMBANK("bank1")
499
AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_BASE_MEMBER(crystal_state, m_ResetPatch)
503
static void PatchReset( running_machine &machine )
505
//The test menu reset routine seems buggy
506
//it reads the reset vector from 0x02000000 but it should be
507
//read from 0x00000000. At 0x2000000 there is the bios signature
508
//"LOADED VER....", so it jumps to "LOAD" in hex (0x44414F4C)
509
//I'll add some code there that makes the game stay in a loop
510
//reading the flip register so the idle skip works
527
crystal_state *state = machine.driver_data<crystal_state>();
530
static const UINT32 Patch[] =
540
memcpy(state->m_ResetPatch, Patch, sizeof(Patch));
542
static const UINT8 Patch[] =
544
0x01,0xEA,0xC0,0x40,0x0A,0x40,0x06,0xE9,
545
0x20,0x2A,0xC0,0x40,0x0A,0x40,0x06,0xE9,
546
0x20,0x3A,0xD0,0xA1,0xFA,0xD4,0xF4,0xDE
549
memcpy(state->m_ResetPatch, Patch, sizeof(Patch));
553
static void crystal_banksw_postload(running_machine &machine)
555
crystal_state *state = machine.driver_data<crystal_state>();
557
if (state->m_Bank <= 2)
558
memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + state->m_Bank * 0x1000000);
560
memory_set_bankptr(machine, "bank1", machine.region("user2")->base());
563
static MACHINE_START( crystal )
565
crystal_state *state = machine.driver_data<crystal_state>();
568
state->m_maincpu = machine.device("maincpu");
569
state->m_ds1302 = machine.device("rtc");
570
state->m_vr0video = machine.device("vr0");
572
device_set_irq_callback(machine.device("maincpu"), icallback);
573
for (i = 0; i < 4; i++)
574
state->m_Timer[i] = machine.scheduler().timer_alloc(FUNC(Timercb), (void*)(FPTR)i);
578
#ifdef IDLE_LOOP_SPEEDUP
579
state->save_item(NAME(state->m_FlipCntRead));
582
state->save_item(NAME(state->m_Bank));
583
state->save_item(NAME(state->m_FlipCount));
584
state->save_item(NAME(state->m_IntHigh));
585
state->save_item(NAME(state->m_Timerctrl));
586
state->save_item(NAME(state->m_FlashCmd));
587
state->save_item(NAME(state->m_PIO));
588
state->save_item(NAME(state->m_DMActrl));
589
state->save_item(NAME(state->m_OldPort4));
590
machine.save().register_postload(save_prepost_delegate(FUNC(crystal_banksw_postload), &machine));
593
static MACHINE_RESET( crystal )
595
crystal_state *state = machine.driver_data<crystal_state>();
598
memset(state->m_sysregs, 0, 0x10000);
599
memset(state->m_vidregs, 0, 0x10000);
600
state->m_FlipCount = 0;
601
state->m_IntHigh = 0;
602
device_set_irq_callback(machine.device("maincpu"), icallback);
604
memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + 0);
605
state->m_FlashCmd = 0xff;
606
state->m_OldPort4 = 0;
608
state->m_DMActrl[0] = 0;
609
state->m_DMActrl[1] = 0;
611
for (i = 0; i < 4; i++)
613
state->m_Timerctrl[i] = 0;
614
state->m_Timer[i]->adjust(attotime::never);
617
vr0_snd_set_areas(machine.device("vrender"), state->m_textureram, state->m_frameram);
618
#ifdef IDLE_LOOP_SPEEDUP
619
state->m_FlipCntRead = 0;
625
static UINT16 GetVidReg( address_space *space, UINT16 reg )
627
return space->read_word(0x03000000 + reg);
630
static void SetVidReg( address_space *space, UINT16 reg, UINT16 val )
632
space->write_word(0x03000000 + reg, val);
636
static SCREEN_UPDATE( crystal )
638
crystal_state *state = screen->machine().driver_data<crystal_state>();
639
address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM);
643
UINT32 B1 = (GetVidReg(space, 0x90) & 0x8000) ? 0x400000 : 0x100000;
644
UINT16 *Front, *Back;
645
UINT16 *Visible, *DrawDest;
649
UINT32 width = screen->width();
651
if (GetVidReg(space, 0x8e) & 1)
653
Front = (UINT16*) (state->m_frameram + B1 / 4);
654
Back = (UINT16*) (state->m_frameram + B0 / 4);
658
Front = (UINT16*) (state->m_frameram + B0 / 4);
659
Back = (UINT16*) (state->m_frameram + B1 / 4);
662
Visible = (UINT16*) Front;
663
DrawDest = (UINT16 *) state->m_frameram;
666
if (GetVidReg(space, 0x8c) & 0x80)
671
// DrawDest = Visible;
673
srcline = (UINT16 *) DrawDest;
676
head = GetVidReg(space, 0x82);
677
tail = GetVidReg(space, 0x80);
678
while ((head & 0x7ff) != (tail & 0x7ff))
680
DoFlip = vrender0_ProcessPacket(state->m_vr0video, 0x03800000 + head * 64, DrawDest, (UINT8*)state->m_textureram);
688
SetVidReg(space, 0x8e, GetVidReg(space, 0x8e) ^ 1);
690
srcline = (UINT16 *) Visible;
691
for (y = 0; y < 240; y++)
692
memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y * 512], width * 2);
697
static SCREEN_EOF(crystal)
699
crystal_state *state = machine.driver_data<crystal_state>();
700
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
704
head = GetVidReg(space, 0x82);
705
tail = GetVidReg(space, 0x80);
706
while ((head & 0x7ff) != (tail & 0x7ff))
708
UINT16 Packet0 = space->read_word(0x03800000 + head * 64);
716
SetVidReg(space, 0x82, head);
719
if (state->m_FlipCount)
720
state->m_FlipCount--;
725
static INTERRUPT_GEN(crystal_interrupt)
727
IntReq(device->machine(), 24); //VRender0 VBlank
730
static INPUT_PORTS_START(crystal)
732
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
733
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
734
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
735
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
736
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
737
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
738
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
739
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
740
PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
742
PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
743
PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
744
PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
745
PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
746
PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
747
PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
748
PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
749
PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
750
PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
753
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
754
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
755
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
756
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
757
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
758
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
759
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
760
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
761
PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
763
PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
764
PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
765
PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
766
PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
767
PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
768
PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
769
PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
770
PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
771
PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
774
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
775
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
776
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
777
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
778
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
779
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
780
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
781
PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
784
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Pause ) )
785
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
786
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
787
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play ) )
788
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
789
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
790
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
791
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
792
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
793
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
794
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
795
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
796
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
797
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
798
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
799
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
800
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
801
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
802
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
803
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
804
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
805
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) )
806
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
807
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
810
static const vr0_interface vr0_config =
815
static const vr0video_interface vr0video_config =
820
static MACHINE_CONFIG_START( crystal, crystal_state )
822
MCFG_CPU_ADD("maincpu", SE3208, 43000000)
823
MCFG_CPU_PROGRAM_MAP(crystal_mem)
824
MCFG_CPU_VBLANK_INT("screen", crystal_interrupt)
826
MCFG_MACHINE_START(crystal)
827
MCFG_MACHINE_RESET(crystal)
829
MCFG_NVRAM_ADD_0FILL("nvram")
831
MCFG_SCREEN_ADD("screen", RASTER)
832
MCFG_SCREEN_REFRESH_RATE(60)
833
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
834
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
835
MCFG_SCREEN_SIZE(320, 240)
836
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
837
MCFG_SCREEN_UPDATE(crystal)
838
MCFG_SCREEN_EOF(crystal)
840
MCFG_VIDEO_VRENDER0_ADD("vr0", vr0video_config)
842
MCFG_PALETTE_INIT(RRRRR_GGGGGG_BBBBB)
843
MCFG_PALETTE_LENGTH(65536)
845
MCFG_DS1302_ADD("rtc")
847
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
849
MCFG_SOUND_ADD("vrender", VRENDER0, 0)
850
MCFG_SOUND_CONFIG(vr0_config)
851
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
852
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
856
Top blade screen is 32 pixels wider
858
static MACHINE_CONFIG_DERIVED( topbladv, crystal )
860
MCFG_SCREEN_MODIFY("screen")
861
MCFG_SCREEN_SIZE(320+32, 240)
862
MCFG_SCREEN_VISIBLE_AREA(0, 319+32, 0, 239)
866
ROM_START( crysbios )
867
ROM_REGION( 0x20000, "maincpu", 0 ) // bios
868
ROM_LOAD("mx27l1000.u14", 0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb) )
870
ROM_REGION32_LE( 0x3000000, "user1", ROMREGION_ERASEFF ) // Flash
872
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
875
ROM_START( crysking )
876
ROM_REGION( 0x20000, "maincpu", 0 ) // bios
877
ROM_LOAD("mx27l1000.u14", 0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb))
879
ROM_REGION32_LE( 0x3000000, "user1", 0 ) // Flash
880
ROM_LOAD("bcsv0004f01.u1", 0x0000000, 0x1000000, CRC(8FEFF120) SHA1(2ea42fa893bff845b5b855e2556789f8354e9066) )
881
ROM_LOAD("bcsv0004f02.u2", 0x1000000, 0x1000000, CRC(0E799845) SHA1(419674ce043cb1efb18303f4cb7fdbbae642ee39) )
882
ROM_LOAD("bcsv0004f03.u3", 0x2000000, 0x1000000, CRC(659E2D17) SHA1(342c98f3f695ef4dea8b533612451c4d2fb58809) )
884
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
888
ROM_REGION( 0x20000, "maincpu", 0 ) // bios
889
ROM_LOAD("mx27l1000.u14", 0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb))
891
ROM_REGION32_LE( 0x3000000, "user1", 0 ) // Flash
892
ROM_LOAD("bcsv0001u01", 0x0000000, 0x1000000, CRC(2581A0EA) SHA1(ee483ac60a3ed00a21cb515974cec4af19916a7d) )
893
ROM_LOAD("bcsv0001u02", 0x1000000, 0x1000000, CRC(47EF1794) SHA1(f573706c17d1342b9b7aed9b40b8b648f0bf58db) )
894
ROM_LOAD("bcsv0001u03", 0x2000000, 0x1000000, CRC(F396A2EC) SHA1(f305eb10856fb5d4c229a6b09d6a2fb21b24ce66) )
896
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
899
ROM_START( topbladv )
900
ROM_REGION( 0x20000, "maincpu", 0 ) // bios
901
ROM_LOAD("mx27l1000.u14", 0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb))
903
ROM_REGION( 0x4300, "pic", 0 ) // pic16c727 - we don't have a core for this
904
ROM_LOAD("top_blade_v_pic16c727.bin", 0x000000, 0x4300, CRC(9cdea57b) SHA1(884156085f9e780cdf719aedc2e8a0fd5983613b) )
907
ROM_REGION32_LE( 0x1000000, "user1", 0 ) // Flash
908
ROM_LOAD("flash.u1", 0x0000000, 0x1000000, CRC(bd23f640) SHA1(1d22aa2c828642bb7c1dfea4e13f777f95acc701) )
910
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
914
ROM_START( officeye )
915
ROM_REGION( 0x20000, "maincpu", 0 ) // bios (not the standard one)
916
ROM_LOAD("bios.u14", 0x000000, 0x020000, CRC(ffc57e90) SHA1(6b6a17fd4798dea9c7b880f3063be8494e7db302) )
918
ROM_REGION( 0x4280, "pic", 0 ) // pic16f84a - we don't have a core for this
919
ROM_LOAD("office_yeo_in_cheon_ha_pic16f84a.bin", 0x000000, 0x4280, CRC(7561cdf5) SHA1(eade592823a110019b4af81a7dc56d01f7d6589f) )
922
ROM_REGION32_LE( 0x2000000, "user1", 0 ) // Flash
923
ROM_LOAD("flash.u1", 0x0000000, 0x1000000, CRC(d3f3eec4) SHA1(ea728415bd4906964b7d37f4379a8a3bd42a1c2d) )
924
ROM_LOAD("flash.u2", 0x1000000, 0x1000000, CRC(e4f85d0a) SHA1(2ddfa6b3a30e69754aa9d96434ff3d37784bfa57) )
926
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
930
ROM_START( donghaer )
931
ROM_REGION( 0x20000, "maincpu", 0 ) // bios
932
ROM_LOAD("mx27l1000.u14", 0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb))
934
ROM_REGION( 0x4280, "pic", 0 ) // pic16f84a - we don't have a core for this (or the dump in this case)
935
ROM_LOAD("donghaer_pic16f84a.bin", 0x000000, 0x4280, NO_DUMP )
937
ROM_REGION32_LE( 0x2000000, "user1", 0 ) // Flash
938
ROM_LOAD( "u1", 0x0000000, 0x1000000, CRC(61217ad7) SHA1(2593f1356aa850f4f9aa5d00bec822aa59c59224) )
939
ROM_LOAD( "u2", 0x1000000, 0x1000000, CRC(6d82f1a5) SHA1(036bd45f0daac1ffeaa5ad9774fc1b56e3c75ff9) )
941
ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF ) //Unmapped flash
944
static DRIVER_INIT(crysking)
946
UINT16 *Rom = (UINT16*) machine.region("user1")->base();
948
//patch the data feed by the protection
950
Rom[WORD_XOR_LE(0x7bb6/2)] = 0xDF01;
951
Rom[WORD_XOR_LE(0x7bb8/2)] = 0x9C00;
953
Rom[WORD_XOR_LE(0x976a/2)] = 0x901C;
954
Rom[WORD_XOR_LE(0x976c/2)] = 0x9001;
956
Rom[WORD_XOR_LE(0x8096/2)] = 0x90FC;
957
Rom[WORD_XOR_LE(0x8098/2)] = 0x9001;
959
Rom[WORD_XOR_LE(0x8a52/2)] = 0x4000; //NOP
960
Rom[WORD_XOR_LE(0x8a54/2)] = 0x403c; //NOP
963
static DRIVER_INIT(evosocc)
965
UINT16 *Rom = (UINT16*) machine.region("user1")->base();
966
Rom += 0x1000000 * 2 / 2;
968
Rom[WORD_XOR_LE(0x97388E/2)] = 0x90FC; //PUSH R2..R7
969
Rom[WORD_XOR_LE(0x973890/2)] = 0x9001; //PUSH R0
971
Rom[WORD_XOR_LE(0x971058/2)] = 0x907C; //PUSH R2..R6
972
Rom[WORD_XOR_LE(0x971060/2)] = 0x9001; //PUSH R0
974
Rom[WORD_XOR_LE(0x978036/2)] = 0x900C; //PUSH R2-R3
975
Rom[WORD_XOR_LE(0x978038/2)] = 0x8303; //LD (%SP,0xC),R3
977
Rom[WORD_XOR_LE(0x974ED0/2)] = 0x90FC; //PUSH R7-R6-R5-R4-R3-R2
978
Rom[WORD_XOR_LE(0x974ED2/2)] = 0x9001; //PUSH R0
981
static DRIVER_INIT(topbladv)
983
UINT16 *Rom = (UINT16*) machine.region("user1")->base();
985
Rom[WORD_XOR_LE(0x12d7a/2)] = 0x90FC; //PUSH R7-R6-R5-R4-R3-R2
986
Rom[WORD_XOR_LE(0x12d7c/2)] = 0x9001; //PUSH R0
988
Rom[WORD_XOR_LE(0x2fe18/2)] = 0x9001; //PUSH R0
989
Rom[WORD_XOR_LE(0x2fe1a/2)] = 0x9200; //PUSH SR
991
Rom[WORD_XOR_LE(0x18880/2)] = 0x9001; //PUSH R0
992
Rom[WORD_XOR_LE(0x18882/2)] = 0x9200; //PUSH SR
994
Rom[WORD_XOR_LE(0xDACE/2)] = 0x901C; //PUSH R4-R3-R2
995
Rom[WORD_XOR_LE(0xDAD0/2)] = 0x9001; //PUSH R0
999
static DRIVER_INIT(officeye)
1001
UINT16 *Rom = (UINT16*) machine.region("user1")->base();
1003
Rom[WORD_XOR_LE(0x9c9e/2)] = 0x901C; //PUSH R4-R3-R2
1004
Rom[WORD_XOR_LE(0x9ca0/2)] = 0x9001; //PUSH R0
1006
Rom[WORD_XOR_LE(0x9EE4/2)] = 0x907C; //PUSH R6-R5-R4-R3-R2
1007
Rom[WORD_XOR_LE(0x9EE6/2)] = 0x9001; //PUSH R0
1009
Rom[WORD_XOR_LE(0x4B2E0/2)] = 0x9004; //PUSH R2
1010
Rom[WORD_XOR_LE(0x4B2E2/2)] = 0x9001; //PUSH R0
1013
Rom[WORD_XOR_LE(0x18880/2)] = 0x9001; //PUSH R0
1014
Rom[WORD_XOR_LE(0x18882/2)] = 0x9200; //PUSH SR
1020
GAME( 2001, crysbios, 0, crystal, crystal, 0, ROT0, "BrezzaSoft", "Crystal System BIOS", GAME_IS_BIOS_ROOT )
1021
GAME( 2001, crysking, crysbios, crystal, crystal, crysking, ROT0, "BrezzaSoft", "The Crystal of Kings", 0 )
1022
GAME( 2001, evosocc, crysbios, crystal, crystal, evosocc, ROT0, "Evoga", "Evolution Soccer", 0 )
1023
GAME( 2003, topbladv, crysbios, topbladv, crystal, topbladv, ROT0, "SonoKong / Expotato", "Top Blade V", GAME_NOT_WORKING ) // protection
1024
GAME( 2001, officeye, 0, crystal, crystal, officeye, ROT0, "Danbi", "Office Yeo In Cheon Ha (version 1.2)", GAME_NOT_WORKING ) // protection
1025
GAME( 2001, donghaer, 0, crystal, crystal, officeye, ROT0, "Danbi", "Donggul Donggul Haerong", GAME_NOT_WORKING )