summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2008-11-07 17:20:54 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2008-11-07 17:20:54 +0000
commit109198d018b82c442354aabeb4477043bfdd1675 (patch)
treec8f64c8d3dd2dd87e185ceb31f3b28a0aac7b279 /src
parente1aca15f22b9ec699087174466b5ae358a140f71 (diff)
Various improvements in the ST-V driver:
* Fixed bitmap zooming in Virtual Mahjong 2 - My Fair Lady; * Worked around a major graphic bug in ElanDoree; * Added some missing alpha blending effects,Pro Mahjong Kiwame S title screen needs it but it doesn't work yet due to other problems (still investigating) * Fixed a crash bug with Astra Super Stars when the debugger is active. (this is to sync with svn tree,ST-V will be further improved on a later stage)
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/stv.c73
-rw-r--r--src/mame/drivers/stvinit.c5
-rw-r--r--src/mame/video/stvvdp2.c136
3 files changed, 121 insertions, 93 deletions
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index bca98bf84eb..54cb98393a4 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -86,15 +86,12 @@ ToDo / Notes:
-To enter into an Advanced Test Mode,keep pressed the Test Button (F2) on the start-up.
(Main issues)
--complete the Master/Slave communication.
--clean up the IC13 rom loading.
-Clean-ups and split the various chips(SCU,SMPC)into their respective files.
--CD block:complete it & add proper CD image support into MAME.
--the Cart-Dev mode...we need the proper ST-V Cart-Dev bios to be dumped in order to
- make this work,but probably this will never be done...
--fix some strange sound cpu memory accesses,there are various issues about this.
+-CD block:complete it.
+-The Cart-Dev mode hangs even with the -dev bios,I would like to see what it does on the real HW.
+-IC13 games on the bios dev doesn't even load the cartridge / crashes the emulation at start-up,
+ rom rearrange needed?
-finish the DSP core.
--Complete the window system in VDP2 (Still in progress).
-Add the RS232c interface (serial port),needed by fhboxers.
-(PCB owners) check if the clocks documented in the manuals are really right for ST-V.
-SCSP to master irq: see if there is a sound cpu mask bit.
@@ -112,57 +109,44 @@ ToDo / Notes:
It rotates clockwise IIRC.Also the ST-V logo when the game is in Multi mode rotates too.
-The MIDI communication check fails even on a ST-V board,somebody needs to check if there
is a MIDI port on the real PCB...
+-All games except shienryu: add default eeprom if necessary (1P/3P games for example).
+-Video emulation bugs: check stvvdp2.c file.
(per-game issues)
-groovef: hangs soon after loaded,caused by two memory addresses in the Work RAM-H range.
Kludged for now to work.
-various: find idle skip if possible.
--suikoenb/shanhigw + others: why do we get 2 credits on startup with sound enabled?
+-suikoenb/shanhigw + others: why do we get 2 credits on startup? Cause should be by a communication with the M68k
-colmns97/puyosun/mausuke/cotton2/cottonbm: interrupt issues? we can't check the SCU mask
on SMPC or controls fail
-mausuke/bakubaku/grdforce: need to sort out transparency on the colour mapped sprites
--bakubaku: no sound? Caused by missing irq?
+-bakubaku: sound part is largely incomplete,caused by a tight loop at location PC=1048 of the sound cpu part.
-myfairld: Apparently this game gives a black screen (either test mode and in-game mode),but let it wait for about
10 seconds and the game will load everything.This is because of a hellishly slow m68k sub-routine located at 54c2.
Likely to not be a bug but an in-game design issue.
-myfairld: Micronet programmers had the "great" idea to *not* use the ST-V input standards,infact
joystick panel is mapped with input_port(10) instead of input_port(2),so for now use
the mahjong panel instead.
--kiwames: the VDP1 sprites refresh is too slow,causing the "Draw by request" mode to
- flicker.Moved back to default ATM...
--pblbeach: Sprites are offset, because it doesn't clear vdp1 local coordinates set by bios,
- I guess that they are cleared when some vdp1 register is written (kludged for now)
+-danchih: hanafuda panel doesn't work.
-decathlt: Is currently using a strange protection DMA abus control,and it uses some sort of RLE
compression/encryption that serves as a gfxdecode.
--vmahjong: the vdp1 textures are too dark(women).
--findlove: controls doesn't work?
--Weird design choices:
- introdon: has the working button as BUTTON2 and not BUTTON1
- batmanfr: BUTTON1 isn't used at all.
--seabass: Player sprite is corrupt/missing during movements,caused
- by incomplete framebuffer switching.
--sss: Missing backgrounds during gameplay. <- seems just too dark (night),probably
- just the positioning isn't correct...
--elandore: Polygons structures/textures aren't right in gameplay,known as protection
- for the humans structures,imperfect VDP1 emulation for the dragons.
--hanagumi: ending screens have corrupt graphics. (*untested*)
+-findlove: controls doesn't work? Playing with the debugger at location $6063720 it makes it get furter,but controls
+ still doesn't work,missing irq?
-batmanfr: Missing sound,caused by an extra ADSP chip which is on the cart.The CPU is a
ADSP-2181,and it's the same used by NBA Jam Extreme (ZN game).
--twcup98: missing Tecmo logo
-vfremix: when you play Akira, there is a problem with third match: game doesn't upload all textures
and tiles and doesn't enable display, although gameplay is normal - wait a while to get back
- to title screen after loosing a match
+ to title screen after losing a match
-sokyugrt: gameplay seems to be not smooth, timing?
--kiwames: hangs on title screen
-seabass: crashes in stvcd.c - there is no CD and we report than we have one, and game tries
to read something, however it doesn't do it after nvram is deleted?
--Here's the list of unmapped read/writes:
-*<all games>
-cpu #0 (PC=0000365C): unmapped program memory dword write to 057FFFFC = 000D0000 & FFFF0000
-cpu #0 (PC=00003654): unmapped program memory dword write to 057FFFFC = 000C0000 & FFFF0000
-*bakubaku:
-cpu #0 (PC=0601022E): unmapped program memory dword write to 02000000 = 00000000 & FFFFFFFF
-cpu #0 (PC=0601023A): unmapped program memory dword write to 02000000 = 00000000 & FFFFFFFF
+-Protection issues:
+ \-ffreveng: boot vectors;
+ \-decathlt: in-game graphics;
+ \-elandore: human textures;
+ \-twcup98: tecmo logo / sprite movements;
+ \-astrass: text layer (kludged for now);
+
*/
@@ -463,7 +447,7 @@ static UINT8 stv_SMPC_r8 (running_machine *machine, int offset)
return_data = smpc_ram[offset];
- if ((offset == 0x61)) // ?? many games need this or the controls don't work
+ if (offset == 0x61) // ?? many games need this or the controls don't work
return_data = 0x20 ^ 0xff;
if (offset == 0x75)//PDR1 read
@@ -698,7 +682,6 @@ static void stv_SMPC_w8 (running_machine *machine, int offset, UINT8 data)
smpc_ram[0x5f]=0x1a;
NMI_reset = 1;
smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
-
break;
default:
if(LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: undocumented Command %02x\n", cpu_getactivecpu(), activecpu_get_pc(), data);
@@ -888,7 +871,8 @@ static int port_i;
static READ32_HANDLER ( stv_io_r32 )
{
- //if(LOG_IOGA) logerror("(PC=%08X): I/O r %08X & %08X\n", activecpu_get_pc(), offset*4, mem_mask);
+// if(LOG_IOGA) logerror("(PC=%08X): I/O r %08X & %08X\n", activecpu_get_pc(), offset*4, mem_mask);
+// popmessage("SEL: %02x MUX: %02x %02x %02x %02x %02x",port_sel,mux_data,ioga[1],ioga[2],ioga[3],ioga[5]);
switch(offset)
{
@@ -936,13 +920,10 @@ static READ32_HANDLER ( stv_io_r32 )
}
case 1:
if ( strcmp(machine->gamedrv->name,"critcrsh") == 0 )
- {
return ((input_port_read(machine, "SYSTEM") << 16) & ((input_port_read(machine, "P1") & 1) ? 0xffef0000 : 0xffff0000)) | (ioga[1]);
- }
else
- {
return (input_port_read(machine, "SYSTEM") << 16) | (ioga[1]);
- }
+
case 2:
switch(port_sel)
{
@@ -952,7 +933,6 @@ static READ32_HANDLER ( stv_io_r32 )
case 0x10: return ((ioga[2] & 0xffff) << 16) | 0xffff;
case 0x60: return 0xffffffff;/**/
default:
- //popmessage("offs: 2 %02x",port_sel);
return 0xffffffff;
}
break;
@@ -1007,7 +987,7 @@ static READ32_HANDLER ( stv_io_r32 )
static WRITE32_HANDLER ( stv_io_w32 )
{
- //if(LOG_IOGA) logerror("(PC=%08X): I/O w %08X = %08X & %08X\n", activecpu_get_pc(), offset*4, data, mem_mask);
+// if(LOG_IOGA) logerror("(PC=%08X): I/O w %08X = %08X & %08X\n", activecpu_get_pc(), offset*4, data, mem_mask);
switch(offset)
{
@@ -2952,6 +2932,7 @@ ROM_START( finlarch )
ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */
ROM_LOAD16_BYTE( "finlarch.13", 0x0000001, 0x0100000, CRC(4505fa9e) SHA1(96c6399146cf9c8f1d27a8fb6a265f937258004a) )
+ ROM_RELOAD ( 0x0100001, 0x0080000 )
ROM_LOAD16_WORD_SWAP( "mpr18257.2", 0x0400000, 0x0400000, CRC(137fdf55) SHA1(07a02fe531b3707e063498f5bc9749bd1b4cadb3) ) // good
ROM_RELOAD( 0x1400000, 0x0400000 )
@@ -3684,6 +3665,7 @@ GAME( 1996, introdon, stvbios, stv, stv, stv, ROT0, "Sunsoft / Succ
GAME( 1995, kiwames, stvbios, stv, stvmp, stv, ROT0, "Athena", "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1997, maruchan, stvbios, stv, stv, maruchan, ROT0, "Sega / Toyosuisan", "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1996, mausuke, stvbios, stv, stv, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
+GAME( 1998, myfairld, stvbios, stv, stvmp, stv, ROT0, "Micronet", "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1998, othellos, stvbios, stv, stv, othellos, ROT0, "Success", "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1995, pblbeach, stvbios, stv, stv, pblbeach, ROT0, "T&E Soft", "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1996, prikura, stvbios, stv, stv, prikura, ROT0, "Atlus", "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
@@ -3709,14 +3691,13 @@ GAME( 1997, nclubv3, stvbios, stv, stv, nameclv3, ROT0, "Sega",
/* Almost */
GAME( 1997, vmahjong, stvbios, stv, stvmp, stv, ROT0, "Micronet", "Virtual Mahjong (J 961214 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
-GAME( 1998, myfairld, stvbios, stv, stvmp, stv, ROT0, "Micronet", "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
GAME( 1998, twcup98, stvbios, stv, stv, twcup98, ROT0, "Tecmo", "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // player movement
GAME( 1998, stress, stvbios, stv, stv, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", GAME_NOT_WORKING ) // needs printer
/* Doing Something.. but not enough yet */
GAME( 1998, elandore, stvbios, stv, stv, elandore, ROT0, "Sai-Mate", "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
GAME( 1995, vfremix, stvbios, stv, stv, vfremix, ROT0, "Sega", "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
-GAME( 1997, findlove, stvbios, stv, stv, stv, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
+GAME( 1997, findlove, stvbios, stv, stv, stv, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
GAME( 1996, decathlt, stvbios, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
GAME( 1996, decathlo, decathlt,stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
diff --git a/src/mame/drivers/stvinit.c b/src/mame/drivers/stvinit.c
index ab43c707fdb..6df279c9aac 100644
--- a/src/mame/drivers/stvinit.c
+++ b/src/mame/drivers/stvinit.c
@@ -792,7 +792,8 @@ TODO: understand where it gets 0x02020000,it must be 0x0000000
static READ32_HANDLER( astrass_hack_r )
{
- if(activecpu_get_pc()==0x60011b8) return 0x00000000;
+ /*PC reads at 0x60011ba if -debug is active?*/
+ if(activecpu_get_pc()==0x60011b8 || activecpu_get_pc() == 0x60011ba) return 0x00000000;
return stv_workram_h[0x000770/4];
}
@@ -812,7 +813,7 @@ DRIVER_INIT( astrass )
cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605b9da);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000770, 0x6000773, 0, 0, astrass_hack_r );
+ memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06000770, 0x06000773, 0, 0, astrass_hack_r );
memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0608e4d8, 0x0608e4db, 0, 0, astrass_speedup_r );
diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c
index 51bc4252abb..a530513912d 100644
--- a/src/mame/video/stvvdp2.c
+++ b/src/mame/video/stvvdp2.c
@@ -1,5 +1,8 @@
/* Sega Saturn VDP2 */
+/*Debug features,remember to zero it if you publish this file.*/
+#define DEBUG_MODE 0
+
/*
the dirty marking stuff and tile decoding will probably be removed in the end anyway as we'll need custom
@@ -26,21 +29,43 @@ EXBG (external)
------------------------------------------------------------------------------------------
+Video emulation TODO:
+-all games:
+ \-priorities (check myfairld,thunt)
+ \-complete windows effects
+ \-mosaic effect
+ \-ODD bit/H/V Counter not yet emulated.
+ \-Missing
+-batmanfr:
+ \-If you reset the game after the character selection screen,when you get again to it there's garbage
+ floating behind Batman.
+-hanagumi:
+ \-ending screens have corrupt graphics. (*untested*)
+-kiwames:
+ \-incorrect color emulation for the alpha blended flames on the title screen,it's caused by a bit
+ that writes 1 to the NBG1 bitmap color bank.It should be 0 but I don't know what is going on,
+ might be a SH-2 / irq issue.
+ \-the VDP1 sprites refresh is too slow,causing the "Draw by request" mode to
+ flicker.Moved back to default ATM...
+-pblbeach:
+ \-Sprites are offset, because it doesn't clear vdp1 local coordinates set by bios,
+ I guess that they are cleared when some vdp1 register is written (kludged for now)
+-prikura:
+ \-Attract mode presentation has corrupted graphics in various places,probably caused by incomplete
+ framebuffer data delete.
+-seabass:
+ \-Player sprite is corrupt/missing during movements,caused by incomplete framebuffer switching.
+
Notes of Interest:
--the test mode / bios is drawn with layer NBG3
+-the test mode / bios is drawn with layer NBG3;
-hanagumi Puts a 'RED' dragon logo in tileram (base 0x64000, 4bpp, 8x8 tiles) but
its not displayed in gurus video.Update:It's actually not drawn because its
-priority value is 0.
+priority value is 0;
-scrolling is screen display wise,meaning that a scrolling value is masked with the
-screen resolution size values.
-
--VDP1 priorities aren't taken into account yet,for now we fix the priority value to six...
-
--AFAIK Suikoenbu & Winter Heat are the only ST-V games that use Mode 2 as the Color RAM
-format.
+screen resolution size values;
-Bitmaps USES transparency pens,examples are:
elandore's energy bars;
@@ -64,16 +89,13 @@ Update: some games uses transparent windows,others uses a transparency pen table
In other words,the first three types uses the offset and not the color allocated...
--Debug key list(only on a debug build):
+-Debug key list(only if you enable the debug mode on top of this file):
\-T: NBG3 layer toggle
\-Y: NBG2 layer toggle
\-U: NBG1 layer toggle
\-I: NBG0 layer toggle
\-O: SPRITE toggle
\-K: RBG0 layer toggle
- \-Z: Enables Window processing debug screen
- \-C: Window 0 toggle
- \-V: Window 1 toggle
\-W Decodes the graphics for F4 menu.
\-M Stores VDP1 ram contents from a file.
\-N Stores VDP1 ram contents into a file.
@@ -111,7 +133,7 @@ enum
STV_TRANSPARENCY_ADD_BLEND = TRANSPARENCY_MODES
};
-#ifdef MAME_DEBUG
+#if DEBUG_MODE
#define LOG_VDP2 1
#define LOG_ROZ 0
#else
@@ -1264,11 +1286,18 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09
/* 180098 - Reduction Enable
bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
- | -- | -- | -- | -- | -- | -- | -- | -- |
+ | -- | -- | -- | -- | -- | -- | N1ZMQT | N1ZMHF |
|----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----|
- | -- | -- | -- | -- | -- | -- | -- | -- |
+ | -- | -- | -- | -- | -- | -- | N0ZMQT | N0ZMHF |
\----------|----------|----------|----------|----------|----------|----------|---------*/
+ #define STV_VDP2_ZMCTL ((stv_vdp2_regs[0x098/4] >> 16)&0x0000ffff)
+
+ #define STV_VDP2_N1ZMQT ((STV_VDP2_ZMCTL & 0x0200) >> 9)
+ #define STV_VDP2_N1ZMHF ((STV_VDP2_ZMCTL & 0x0100) >> 8)
+ #define STV_VDP2_N0ZMQT ((STV_VDP2_ZMCTL & 0x0002) >> 1)
+ #define STV_VDP2_N0ZMHF ((STV_VDP2_ZMCTL & 0x0001) >> 0)
+
/* 18009a - Line and Vertical Cell Scroll Control (NBG0, NBG1)
bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
| -- | -- | -- | -- | -- | -- | -- | -- |
@@ -1310,7 +1339,8 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09
| -- | -- | -- | -- | -- | -- | -- | -- |
\----------|----------|----------|----------|----------|----------|----------|---------*/
- #define STV_VDP2_LSTA0U ((stv_vdp2_regs[0x0a0/4] >> 16)&0x00000007)
+ /*bit 2 unused when VRAM = 4 Mbits*/
+ #define STV_VDP2_LSTA0U ((stv_vdp2_regs[0x0a0/4] >> 16)&0x00000003)
/* 1800a2 - LSTA0L - Line Scroll Table Address (NBG0)
bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
@@ -1328,7 +1358,8 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09
| -- | -- | -- | -- | -- | -- | -- | -- |
\----------|----------|----------|----------|----------|----------|----------|---------*/
- #define STV_VDP2_LSTA1U ((stv_vdp2_regs[0x0a4/4] >> 16)&0x00000007)
+ /*bit 2 unused when VRAM = 4 Mbits*/
+ #define STV_VDP2_LSTA1U ((stv_vdp2_regs[0x0a4/4] >> 16)&0x00000003)
/* 1800a6 - LSTA1L - Line Scroll Table Address (NBG1)
bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\
@@ -2827,10 +2858,8 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
static UINT16 *destline;
UINT16 pal_color_offset = 0;
UINT8* gfxdatalow, *gfxdatahigh;
-
/*Window effect 1=no draw*/
- int tw;
-
+ int tw = 0;
/*Transparency code 1=opaque,0=transparent*/
int t_pen;
if (!stv2_current_tilemap.enabled) return;
@@ -2912,7 +2941,7 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
*BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
else
- *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]);
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]);
}
}
gfxdata++;
@@ -2936,10 +2965,16 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
tw = stv_vdp2_window_process(xcnt,ycnt);
if(tw == 0)
{
+ //60aee2c = $0013 at @605d838
t_pen = ((gfxdata[xs] & 0xff) != 0) ? (1) : (0);
if(stv2_current_tilemap.transparency == TRANSPARENCY_NONE) t_pen = 1;
if(t_pen)
- *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
+ {
+ if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
+ else
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]);
+ }
}
if ( (gfxdata + xs) >= gfxdatahigh )
{
@@ -2977,7 +3012,12 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
t_pen = ((gfxdata[xs] & 0xff) != 0) ? 1 : 0;
if(stv2_current_tilemap.transparency == TRANSPARENCY_NONE) t_pen = 1;
if(t_pen)
- *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
+ {
+ if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
+ else
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]);
+ }
}
if ( (gfxdata + xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
@@ -2997,7 +3037,12 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
t_pen = ((((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff)) != 0) ? (1) : (0);
if(stv2_current_tilemap.transparency == TRANSPARENCY_NONE) t_pen = 1;
if(t_pen)
- *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset];
+ {
+ if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset];
+ else
+ *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset]);
+ }
}
gfxdata+=2;
@@ -3054,6 +3099,7 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
else
{
int xx, xs, yy=0;
+
for (ycnt = cliprect->min_y; ycnt <= cliprect->max_y; yy+=stv2_current_tilemap.incy, ycnt++ )
{
gfxdata += xlinesize*(yy>>16);
@@ -3087,7 +3133,9 @@ static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitma
if ( (gfxdata + 2*xs) >= gfxdatahigh ) gfxdata = gfxdatalow;
}
- gfxdata += xlinesize;
+ /*Guess: myfairlady needs that the vertical resolution is doubled because it's using the double density mode.*/
+ if(STV_VDP2_LSMD == 3) { gfxdata += xlinesize*(yy>>16); }
+ else { gfxdata += xlinesize; }
if ( gfxdata >= gfxdatahigh ) gfxdata = gfxdatalow + (gfxdata - gfxdatahigh);
}
}
@@ -3943,12 +3991,14 @@ static void stv_vdp2_check_tilemap(running_machine *machine, bitmap_t *bitmap, c
if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap
{
- if ( window_applied )
+ /*elandore doesn't like current cliprect code,will be worked on...*/
+ if ( window_applied && stv2_current_tilemap.colour_depth != 0)
stv2_current_tilemap.window_control = 0;
stv_vdp2_draw_basic_bitmap(machine, bitmap, &mycliprect);
}
else
{
+
stv_vdp2_draw_basic_tilemap(machine, bitmap, &mycliprect);
if((stv2_current_tilemap.window_control & 6) != 0 && VDP2_ERR(1))
@@ -4395,7 +4445,7 @@ static void stv_vdp2_draw_NBG0(running_machine *machine, bitmap_t *bitmap, const
stv2_current_tilemap.incy = STV_VDP2_ZMYN0;
stv2_current_tilemap.linescroll_enable = STV_VDP2_N0LSCX;
- stv2_current_tilemap.linescroll_interval = 1 << (STV_VDP2_N0LSS);
+ stv2_current_tilemap.linescroll_interval = (((STV_VDP2_LSMD & 3) == 2) ? (2) : (1)) << (STV_VDP2_N0LSS);
stv2_current_tilemap.linescroll_table_address = ((STV_VDP2_LSTA0U << 16) | STV_VDP2_LSTA0L) * 2;
stv2_current_tilemap.vertical_linescroll_enable = STV_VDP2_N0LSCY;
stv2_current_tilemap.linezoom_enable = STV_VDP2_N0LZMX;
@@ -4485,7 +4535,7 @@ static void stv_vdp2_draw_NBG1(running_machine *machine, bitmap_t *bitmap, const
stv2_current_tilemap.incy = STV_VDP2_ZMYN1;
stv2_current_tilemap.linescroll_enable = STV_VDP2_N1LSCX;
- stv2_current_tilemap.linescroll_interval = 1 << (STV_VDP2_N1LSS);
+ stv2_current_tilemap.linescroll_interval = (((STV_VDP2_LSMD & 3) == 2) ? (2) : (1)) << (STV_VDP2_N1LSS);
stv2_current_tilemap.linescroll_table_address = ((STV_VDP2_LSTA1U << 16) | STV_VDP2_LSTA1L) * 2;
stv2_current_tilemap.vertical_linescroll_enable = STV_VDP2_N1LSCY;
stv2_current_tilemap.linezoom_enable = STV_VDP2_N1LZMX;
@@ -5008,7 +5058,7 @@ static void stv_vdp2_draw_back(running_machine *machine, bitmap_t *bitmap, const
fillbitmap(bitmap, get_black_pen(machine), cliprect);
else
{
- #ifdef MAME_DEBUG
+ #if DEBUG_MODE
//popmessage("Back screen enabled %08x",STV_VDP2_BKTA);
#endif
gfxdata+=((STV_VDP2_BKTA)<<1);
@@ -5096,7 +5146,7 @@ WRITE32_HANDLER ( stv_vdp2_cram_w )
int r,g,b;
COMBINE_DATA(&stv_vdp2_cram[offset]);
-// popmessage("%01x",STV_VDP2_CRMD);
+// popmessage("%01x\n",STV_VDP2_CRMD);
switch( STV_VDP2_CRMD )
{
@@ -5389,7 +5439,7 @@ static void stv_vdp2_fade_effects(running_machine *machine)
/******************************************************************************************
-ST-V VDP2 window effect function version 0.03
+ST-V VDP2 window effect function version 0.04
How it works: returns 0 if the requested pixel is drawnable,1 if it isn't.
For tilemap and sprite layer, clipping rectangle is changed.
@@ -5399,12 +5449,12 @@ Done:
-W0 (outside) for tilemaps and sprite layer.
Not Done:
--Windows on cells.Requires that the tilemap are converted to bitmap AFAIK...
+-Complete Windows on cells.A split between cells and bitmaps is in progress...
-w0 & w1 at the same time.
-Window logic.
-Line window.
-Color Calculation.
--Rotation parameter Window.
+-Rotation parameter Window (already done?).
Window Registers are hooked up like this ATM:
x--- ---- UNUSED
@@ -5515,9 +5565,6 @@ static int stv_vdp2_window_process(int x,int y)
{
UINT16 s_x=0,e_x=0,s_y=0,e_y=0;
- if ((stv2_current_tilemap.window_control & 6) == 0)
- return 0;
-
stv_vdp2_get_window0_coordinates(&s_x, &e_x, &s_y, &e_y);
if(stv2_current_tilemap.window_control & 2)
@@ -6058,7 +6105,6 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( stv_vdp2 )
{
static UINT8 pri;
-
stv_vdp2_dynamic_res_change(screen->machine);
video_update_vdp1(screen->machine);
@@ -6067,7 +6113,7 @@ VIDEO_UPDATE( stv_vdp2 )
stv_vdp2_draw_back(screen->machine, bitmap,cliprect);
- #ifdef MAME_DEBUG
+ #if DEBUG_MODE
if(input_code_pressed_once(KEYCODE_T))
{
debug.l_en^=1;
@@ -6109,16 +6155,16 @@ VIDEO_UPDATE( stv_vdp2 )
/*If a plane has a priority value of zero it isn't shown at all.*/
for(pri=1;pri<8;pri++)
{
- if (debug.l_en & 1) {if(pri==STV_VDP2_N3PRIN) stv_vdp2_draw_NBG3(screen->machine, bitmap,cliprect);}
- if (debug.l_en & 2) {if(pri==STV_VDP2_N2PRIN) stv_vdp2_draw_NBG2(screen->machine, bitmap,cliprect);}
- if (debug.l_en & 4) {if(pri==STV_VDP2_N1PRIN) stv_vdp2_draw_NBG1(screen->machine, bitmap,cliprect);}
- if (debug.l_en & 8) {if(pri==STV_VDP2_N0PRIN) stv_vdp2_draw_NBG0(screen->machine, bitmap,cliprect);}
- if (debug.l_en & 0x10) {if(pri==STV_VDP2_R0PRIN) stv_vdp2_draw_RBG0(screen->machine, bitmap,cliprect);}
- if (debug.l_en & 0x20) {draw_sprites(screen->machine,bitmap,cliprect,pri);}
+ if (debug.l_en & 1) { if(pri==STV_VDP2_N3PRIN) stv_vdp2_draw_NBG3(screen->machine, bitmap,cliprect); }
+ if (debug.l_en & 2) { if(pri==STV_VDP2_N2PRIN) stv_vdp2_draw_NBG2(screen->machine, bitmap,cliprect); }
+ if (debug.l_en & 4) { if(pri==STV_VDP2_N1PRIN) stv_vdp2_draw_NBG1(screen->machine, bitmap,cliprect); }
+ if (debug.l_en & 8) { if(pri==STV_VDP2_N0PRIN) stv_vdp2_draw_NBG0(screen->machine, bitmap,cliprect); }
+ if (debug.l_en & 0x10) { if(pri==STV_VDP2_R0PRIN) stv_vdp2_draw_RBG0(screen->machine, bitmap,cliprect); }
+ if (debug.l_en & 0x20) { draw_sprites(screen->machine,bitmap,cliprect,pri); }
}
}
-#ifdef MAME_DEBUG
+#if DEBUG_MODE
if(STV_VDP2_VRAMSZ && VDP2_ERR(0x80000000))
{
VDP2_CHK(0x80000000);