mirror of
https://github.com/holub/mame
synced 2025-04-26 10:13:37 +03:00
After much playing with screen refresh stuff, the only thing to come of
it is a few spacing fixes. Sorry for the many commits. (nw)
This commit is contained in:
parent
1d9f47281d
commit
63c636ccb2
@ -593,7 +593,7 @@ WRITE32_MEMBER(hng64_state::hng64_sysregs_w)
|
||||
break;
|
||||
//0x110c global irq mask?
|
||||
/* irq ack */
|
||||
case 0x111c: m_irq_pending &= ~m_sysregs[offset]; m_set_irq(0x0000); break;
|
||||
case 0x111c: m_irq_pending &= ~m_sysregs[offset]; set_irq(0x0000); break;
|
||||
case 0x1204: m_dma_start = m_sysregs[offset]; break;
|
||||
case 0x1214: m_dma_dst = m_sysregs[offset]; break;
|
||||
case 0x1224:
|
||||
@ -1353,9 +1353,7 @@ static const gfx_layout hng64_texlayout =
|
||||
texlayout_yoffset
|
||||
};
|
||||
|
||||
|
||||
static GFXDECODE_START( hng64 )
|
||||
|
||||
/* tilemap tiles */
|
||||
GFXDECODE_ENTRY( "scrtile", 0, hng64_8x8x4_tilelayout, 0x0, 0x100 )
|
||||
GFXDECODE_ENTRY( "scrtile", 0, hng64_8x8x8_tilelayout, 0x0, 0x10 )
|
||||
@ -1373,12 +1371,11 @@ static void hng64_reorder( UINT8* gfxregion, size_t gfxregionsize)
|
||||
{
|
||||
// by default 2 4bpp tiles are stored in each 8bpp tile, this makes decoding in MAME harder than it needs to be
|
||||
// reorder them
|
||||
int i;
|
||||
UINT8 tilesize = 4*8; // 4 bytes per line, 8 lines
|
||||
|
||||
dynamic_buffer buffer(gfxregionsize);
|
||||
|
||||
for (i=0;i<gfxregionsize/2;i+=tilesize)
|
||||
for (int i = 0; i < gfxregionsize/2; i += tilesize)
|
||||
{
|
||||
memcpy(&buffer[i*2+tilesize], gfxregion+i, tilesize);
|
||||
memcpy(&buffer[i*2], gfxregion+i+(gfxregionsize/2), tilesize);
|
||||
@ -1392,7 +1389,6 @@ DRIVER_INIT_MEMBER(hng64_state,hng64_reorder_gfx)
|
||||
hng64_reorder(memregion("scrtile")->base(), memregion("scrtile")->bytes());
|
||||
}
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(hng64_state,hng64)
|
||||
{
|
||||
/* 1 meg of virtual address space for the com cpu */
|
||||
@ -1444,8 +1440,7 @@ DRIVER_INIT_MEMBER(hng64_state,hng64_shoot)
|
||||
DRIVER_INIT_CALL(hng64);
|
||||
}
|
||||
|
||||
|
||||
void hng64_state::m_set_irq(UINT32 irq_vector)
|
||||
void hng64_state::set_irq(UINT32 irq_vector)
|
||||
{
|
||||
/*
|
||||
TODO:
|
||||
@ -1473,8 +1468,7 @@ void hng64_state::m_set_irq(UINT32 irq_vector)
|
||||
|
||||
if(m_irq_pending)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<31;i++)
|
||||
for(int i = 0; i < 31; i++)
|
||||
{
|
||||
if(m_irq_pending & 1 << i)
|
||||
{
|
||||
@ -1495,15 +1489,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(hng64_state::hng64_irq)
|
||||
|
||||
switch(scanline)
|
||||
{
|
||||
case 224*2: m_set_irq(0x0001); break; // lv 0 vblank irq
|
||||
// case 0*2: m_set_irq(0x0002); break; // lv 1
|
||||
// case 32*2: m_set_irq(0x0008); break; // lv 2
|
||||
// case 64*2: m_set_irq(0x0008); break; // lv 2
|
||||
case 128*2: m_set_irq(0x0800); break; // lv 11 network irq?
|
||||
case 224*2: set_irq(0x0001); break; // lv 0 vblank irq
|
||||
// case 0*2: set_irq(0x0002); break; // lv 1
|
||||
// case 32*2: set_irq(0x0008); break; // lv 2
|
||||
// case 64*2: set_irq(0x0008); break; // lv 2
|
||||
case 128*2: set_irq(0x0800); break; // lv 11 network irq?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void hng64_state::machine_start()
|
||||
{
|
||||
/* set the fastest DRC options */
|
||||
@ -1517,20 +1510,14 @@ void hng64_state::machine_start()
|
||||
m_comm_rom = memregion("user2")->base();
|
||||
m_comm_ram = auto_alloc_array(machine(),UINT8,0x10000);
|
||||
|
||||
|
||||
for (int i = 0; i < 0x38 / 4; i++)
|
||||
{
|
||||
m_videoregs[i] = 0xdeadbeef;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void hng64_state::machine_reset()
|
||||
{
|
||||
// "Display List" init - ugly
|
||||
// m_activeBuffer = 0;
|
||||
|
||||
/* For simulate MCU stepping */
|
||||
m_mcu_fake_time = 0;
|
||||
m_mcu_en = 0;
|
||||
@ -1566,9 +1553,9 @@ static MACHINE_CONFIG_START(hng64, hng64_state)
|
||||
|
||||
MCFG_FRAGMENT_ADD( hng64_audio )
|
||||
MCFG_FRAGMENT_ADD( hng64_network )
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
#define ROM_LOAD_HNG64_BIOS(bios,name,offset,length,hash) \
|
||||
ROMX_LOAD(name, offset, length, hash, ROM_BIOS(bios+1)) /* Note '+1' */
|
||||
|
||||
@ -1578,11 +1565,11 @@ MACHINE_CONFIG_END
|
||||
ROM_SYSTEM_BIOS( 0, "japan", "Japan" ) \
|
||||
ROM_LOAD_HNG64_BIOS( 0, "brom1.bin", 0x00000, 0x080000, CRC(a30dd3de) SHA1(3e2fd0a56214e6f5dcb93687e409af13d065ea30) ) \
|
||||
ROM_SYSTEM_BIOS( 1, "us", "USA" ) \
|
||||
ROM_LOAD_HNG64_BIOS( 1, "bios_us.bin", 0x00000, 0x080000, CRC(ab5948d6) SHA1(f8b940c1ae5ce2d3b2cd0c9bfaf6e5b063cec06e) ) \
|
||||
ROM_LOAD_HNG64_BIOS( 1, "bios_us.bin", 0x00000, 0x080000, CRC(ab5948d6) SHA1(f8b940c1ae5ce2d3b2cd0c9bfaf6e5b063cec06e) ) \
|
||||
ROM_SYSTEM_BIOS( 2, "export", "Export" ) \
|
||||
ROM_LOAD_HNG64_BIOS( 2, "bios_export.bin", 0x00000, 0x080000, CRC(bbf07ec6) SHA1(5656aa077f6a6d43953f15b5123eea102a9d5313) ) \
|
||||
ROM_LOAD_HNG64_BIOS( 2, "bios_export.bin", 0x00000, 0x080000, CRC(bbf07ec6) SHA1(5656aa077f6a6d43953f15b5123eea102a9d5313) ) \
|
||||
ROM_SYSTEM_BIOS( 3, "korea", "Korea" ) \
|
||||
ROM_LOAD_HNG64_BIOS( 3, "bios_korea.bin", 0x00000, 0x080000, CRC(ac953e2e) SHA1(f502188ef252b7c9d04934c4b525730a116de48b) ) \
|
||||
ROM_LOAD_HNG64_BIOS( 3, "bios_korea.bin", 0x00000, 0x080000, CRC(ac953e2e) SHA1(f502188ef252b7c9d04934c4b525730a116de48b) ) \
|
||||
ROM_REGION( 0x0100000, "user2", 0 ) /* KL5C80 BIOS */ \
|
||||
ROM_LOAD ( "from1.bin", 0x000000, 0x080000, CRC(6b933005) SHA1(e992747f46c48b66e5509fe0adf19c91250b00c7) ) \
|
||||
ROM_REGION( 0x0100000, "fpga", 0 ) /* FPGA data */ \
|
||||
|
@ -203,7 +203,7 @@ public:
|
||||
UINT32 m_mcu_fake_time;
|
||||
UINT16 m_mcu_en;
|
||||
|
||||
UINT32 m_activeBuffer;
|
||||
UINT32 m_activeDisplayList;
|
||||
UINT32 m_no_machine_error_code;
|
||||
|
||||
UINT32 m_unk_vreg_toggle;
|
||||
@ -292,7 +292,7 @@ public:
|
||||
DECLARE_DRIVER_INIT(hng64_fght);
|
||||
DECLARE_DRIVER_INIT(hng64_reorder_gfx);
|
||||
|
||||
void m_set_irq(UINT32 irq_vector);
|
||||
void set_irq(UINT32 irq_vector);
|
||||
UINT32 m_irq_pending;
|
||||
UINT8 *m_comm_rom;
|
||||
UINT8 *m_comm_ram;
|
||||
|
@ -1303,7 +1303,7 @@ void hng64_state::video_start()
|
||||
m_poly_renderer = auto_alloc(machine(), hng64_poly_renderer(*this));
|
||||
|
||||
// 3d information
|
||||
m_dl = auto_alloc_array(machine(), UINT16, 0x200/2);
|
||||
m_dl = auto_alloc_array(machine(), UINT16, 0x100);
|
||||
m_polys.resize(HNG64_MAX_POLYGONS);
|
||||
|
||||
m_texturerom = memregion("textures")->base();
|
||||
|
@ -56,44 +56,53 @@ WRITE16_MEMBER(hng64_state::dl_w)
|
||||
|
||||
|
||||
|
||||
// TODO: different param for both Samurai games, less FIFO to process?
|
||||
WRITE32_MEMBER(hng64_state::dl_upload_w)
|
||||
{
|
||||
// this is written after the game uploads 16 packets, each 32 bytes long (2x 16 words?)
|
||||
// we're assuming it to be a 'send to 3d hardware' trigger.
|
||||
// this can be called multiple times per frame (at least 2, as long as it gets the expected interrupt / status flags)
|
||||
// Data is:
|
||||
// 00000f00 for everything else
|
||||
// 00000b50 for the sams64 games
|
||||
// TODO: different param for both Samurai games, less FIFO to process?
|
||||
|
||||
// This is written after the game uploads 16 packets, each 16 words long
|
||||
// We're assuming it to be a 'send to 3d hardware' trigger.
|
||||
// This can be called multiple times per frame (at least 2, as long as it gets the expected interrupt / status flags)
|
||||
g_profiler.start(PROFILER_USER1);
|
||||
for(int packetStart=0;packetStart<0x200;packetStart+=32)
|
||||
for(int packetStart = 0; packetStart < 0x100; packetStart += 16)
|
||||
{
|
||||
// Send it off to the 3d subsystem.
|
||||
hng64_command3d(&m_dl[packetStart/2]);
|
||||
hng64_command3d(&m_dl[packetStart]);
|
||||
}
|
||||
|
||||
machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(0x200*8), timer_expired_delegate(FUNC(hng64_state::hng64_3dfifo_processed),this));
|
||||
// Schedule a small amount of time to let the 3d hardware rasterize the display buffer
|
||||
machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(0x200*8), timer_expired_delegate(FUNC(hng64_state::hng64_3dfifo_processed), this));
|
||||
g_profiler.stop();
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(hng64_state::hng64_3dfifo_processed)
|
||||
{
|
||||
// ...
|
||||
m_set_irq(0x0008);
|
||||
set_irq(0x0008);
|
||||
}
|
||||
|
||||
|
||||
// Note: Samurai Shodown games never calls bit 1, so it can't be framebuffer clear. It also calls bit 3 at start-up, meaning unknown
|
||||
WRITE32_MEMBER(hng64_state::dl_control_w) // This handles framebuffers
|
||||
WRITE32_MEMBER(hng64_state::dl_control_w)
|
||||
{
|
||||
// This could be a multiple display list thing, but the palette seems to be lost between lists?
|
||||
// Many games briefly set this to 0x4 on startup. Maybe there are 3 display lists?
|
||||
// The sams64 games briefly set this value to 0x0c00 on boot. Maybe there are 4 lists and they can be combined?
|
||||
if (data & 0x01)
|
||||
m_activeDisplayList = 0;
|
||||
else if (data & 0x02)
|
||||
m_activeDisplayList = 1;
|
||||
|
||||
// printf("dl_control_w %08x %08x\n", data, mem_mask);
|
||||
|
||||
//if(data & 2) // swap buffers
|
||||
//{
|
||||
// clear3d();
|
||||
//}
|
||||
|
||||
//
|
||||
// if(data & 2) // swap buffers
|
||||
// {
|
||||
// clear3d();
|
||||
// }
|
||||
//
|
||||
// printf("%02x\n",data);
|
||||
|
||||
//
|
||||
// if(data & 1) // process DMA from 3d FIFO to framebuffer
|
||||
|
||||
// if(data & 4) // reset buffer count
|
||||
}
|
||||
|
||||
@ -1001,12 +1010,10 @@ void hng64_state::hng64_command3d(const UINT16* packet)
|
||||
|
||||
void hng64_state::clear3d()
|
||||
{
|
||||
int i;
|
||||
|
||||
const rectangle &visarea = m_screen->visible_area();
|
||||
|
||||
// Reset the buffers...
|
||||
for (i = 0; i < (visarea.max_x)*(visarea.max_y); i++)
|
||||
for (int i = 0; i < (visarea.max_x)*(visarea.max_y); i++)
|
||||
{
|
||||
m_poly_renderer->depthBuffer3d()[i] = 100.0f;
|
||||
}
|
||||
@ -1044,8 +1051,7 @@ void hng64_state::clear3d()
|
||||
// 4x4 matrix multiplication
|
||||
void hng64_state::matmul4(float *product, const float *a, const float *b)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
const float ai0 = a[0 + i];
|
||||
const float ai1 = a[4 + i];
|
||||
@ -1080,9 +1086,7 @@ float hng64_state::vecDotProduct(const float *a, const float *b)
|
||||
|
||||
void hng64_state::setIdentity(float *matrix)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
matrix[i] = 0.0f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user