summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/hng64.c
diff options
context:
space:
mode:
author Andrew Gardner <andrew-gardner@users.noreply.github.com>2009-12-17 05:05:10 +0000
committer Andrew Gardner <andrew-gardner@users.noreply.github.com>2009-12-17 05:05:10 +0000
commit1a8d95b3de1813892888ff222e557debc3fc838e (patch)
tree2fb769747881c6e11b49f56b9cacf888a7666f3b /src/mame/drivers/hng64.c
parent002508ee0cae0b4db380fbce0e6228871f6df579 (diff)
Re-implemented 3d rasterization in the hng64 driver as a FIFO system.
(This unfortunately didn't solve the flicker problem, but there are other theories as to why that happens. They will be tested soon.) (But first I'm going to try to get the 3d rendering in games other than fatfurwa and buriki)
Diffstat (limited to 'src/mame/drivers/hng64.c')
-rw-r--r--src/mame/drivers/hng64.c53
1 files changed, 41 insertions, 12 deletions
diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c
index 2ae717b55d8..ad1a5480804 100644
--- a/src/mame/drivers/hng64.c
+++ b/src/mame/drivers/hng64.c
@@ -472,7 +472,7 @@ extern UINT32 *hng64_videoram;
extern UINT32 *hng64_tcram;
extern UINT32 *hng64_3dregs;
-extern UINT32 hng64_dls[2][0x81];
+extern void hng64_command3d(running_machine* machine, const UINT16* packet);
extern UINT8 hng64_screen_dis;
@@ -659,6 +659,9 @@ static WRITE32_HANDLER( hng64_sysregs_w )
switch(offset*4)
{
+ //case 0x100c: Extremely likely to be involved with the ROZ groundplane.
+ // Probably tells the groundplane which scanline to start drawing at.
+
case 0x1084: //MIPS->MCU latch port
hng_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such?
//printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, hng64_sysregs[offset], cpu_get_pc(space->cpu));
@@ -869,19 +872,42 @@ static WRITE32_HANDLER( hng64_3d_2_w )
-// The 3d 'display list'
-// is it a fifo?
+// The 3d 'display list' - is it a fifo?
// sams64 / sams64_2 access it in a very different way to fatal fury...
static WRITE32_HANDLER( dl_w )
{
- COMBINE_DATA (&hng64_dl[offset]);
+ int i;
+ UINT16 packet3d[16];
+
+ COMBINE_DATA(&hng64_dl[offset]);
+
+ if (offset == 0x08 || offset == 0x7f || // Special buggers.
+ offset == 0x10 || offset == 0x18 ||
+ offset == 0x20 || offset == 0x28 ||
+ offset == 0x30 || offset == 0x38 ||
+ offset == 0x40 || offset == 0x48 ||
+ offset == 0x50 || offset == 0x58 ||
+ offset == 0x60 || offset == 0x68 ||
+ offset == 0x70 || offset == 0x78)
+ {
+ // Create a 3d packet
+ UINT16 packetStart = offset - 0x08;
+ if (offset == 0x7f) packetStart += 1;
+
+ for (i = 0; i < 0x08; i++)
+ {
+ packet3d[i*2+0] = (hng64_dl[packetStart+i] & 0xffff0000) >> 16;
+ packet3d[i*2+1] = (hng64_dl[packetStart+i] & 0x0000ffff);
+ }
+
+ // Send it off to the 3d subsystem.
+ hng64_command3d(space->machine, packet3d);
+ }
}
#if 0
static READ32_HANDLER( dl_r )
{
-
-
// mame_printf_debug("dl R (%08x) : %x %x\n", cpu_get_pc(space->cpu), offset, hng64_dl[offset]);
// usrintf_showmessage("dl R (%08x) : %x %x", cpu_get_pc(space->cpu), offset, hng64_dl[offset]);
return hng64_dl[offset];
@@ -894,6 +920,8 @@ static READ32_HANDLER( dl_r )
// Some kind of buffering of the display lists, or 'render current buffer' write?
static WRITE32_HANDLER( dl_control_w )
{
+ // TODO: put this back in.
+ /*
if (activeBuffer==0 || activeBuffer==1)
memcpy(&hng64_dls[activeBuffer][0],&hng64_dl[0],0x200);
@@ -901,7 +929,8 @@ static WRITE32_HANDLER( dl_control_w )
if (data & 1)
activeBuffer = 0;
if (data & 2)
- activeBuffer = 1;
+ activeBuffer = 1;
+ */
}
#ifdef UNUSED_FUNCTION
@@ -1070,11 +1099,12 @@ static ADDRESS_MAP_START( hng_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x2000d800, 0x2000e3ff) AM_WRITE(hng64_sprite_clear_even_w)
AM_RANGE(0x2000e400, 0x2000efff) AM_WRITE(hng64_sprite_clear_odd_w)
AM_RANGE(0x20010000, 0x20010013) AM_RAM AM_BASE(&hng64_spriteregs)
- AM_RANGE(0x20100000, 0x2017ffff) AM_RAM_WRITE(hng64_videoram_w) AM_BASE(&hng64_videoram)// Tilemap
+ AM_RANGE(0x20100000, 0x2017ffff) AM_RAM_WRITE(hng64_videoram_w) AM_BASE(&hng64_videoram) // Tilemap
AM_RANGE(0x20190000, 0x20190037) AM_RAM AM_BASE(&hng64_videoregs)
AM_RANGE(0x20200000, 0x20203fff) AM_RAM_WRITE(hng64_pal_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x20208000, 0x2020805f) AM_READWRITE(tcram_r, tcram_w) AM_BASE(&hng64_tcram) // Transition Control
- AM_RANGE(0x20300000, 0x203001ff) AM_RAM_WRITE(dl_w) AM_BASE(&hng64_dl) // 3d Display List
+ AM_RANGE(0x20300000, 0x203001ff) AM_RAM_WRITE(dl_w) AM_BASE(&hng64_dl) // 3d Display List
+// AM_RANGE(0x20300200, 0x20300213) AM_RAM_WRITE(xxxx) AM_BASE(&xxxxxxxx) // 3d Display List Upload?
AM_RANGE(0x20300214, 0x20300217) AM_WRITE(dl_control_w)
AM_RANGE(0x20300218, 0x2030021b) AM_READ(unk_vreg_r)
@@ -1861,6 +1891,7 @@ MACHINE_DRIVER_END
ROM_START( hng64 )
+ /* BIOS */
ROM_REGION32_BE( 0x0100000, "user1", 0 ) /* 512k for R4300 BIOS code */
ROM_LOAD ( "brom1.bin", 0x000000, 0x080000, CRC(a30dd3de) SHA1(3e2fd0a56214e6f5dcb93687e409af13d065ea30) )
ROM_REGION( 0x0100000, "user2", 0 ) /* KL5C80 BIOS and unknown ROM */
@@ -1876,9 +1907,9 @@ ROM_START( hng64 )
ROM_REGION( 0x1000000, "samples", ROMREGION_ERASEFF ) /* Sound Samples? */
ROM_END
+
/* roads edge might need a different bios (driving board bios?) */
ROM_START( roadedge )
-
/* BIOS */
ROM_REGION32_BE( 0x0100000, "user1", 0 ) /* 512k for R4300 BIOS code */
ROM_LOAD ( "brom1.bin", 0x000000, 0x080000, CRC(a30dd3de) SHA1(3e2fd0a56214e6f5dcb93687e409af13d065ea30) )
@@ -1937,7 +1968,6 @@ ROM_START( roadedge )
ROM_END
-
ROM_START( sams64 )
/* BIOS */
ROM_REGION32_BE( 0x0100000, "user1", 0 ) /* 512k for R4300 BIOS code */
@@ -2181,7 +2211,6 @@ ROM_END
ROM_START( fatfurwa )
-
/* BIOS */
ROM_REGION32_BE( 0x0100000, "user1", 0 ) /* 512k for R4300 BIOS code */
ROM_LOAD ( "brom1.bin", 0x000000, 0x080000, CRC(a30dd3de) SHA1(3e2fd0a56214e6f5dcb93687e409af13d065ea30) )