mirror of
https://github.com/holub/mame
synced 2025-05-21 21:29:15 +03:00
SNES: Added emulation for the DSP-3 and DSP-4 add-on chips, based on latest ZSNES [ZSNES Team, Fabio Priuli]
out of the whatsnew, I hope the way I worded the license exception (at the top of the files) is fine to avoid any issue
This commit is contained in:
parent
740ae26ae6
commit
2bc4056946
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -2881,6 +2881,9 @@ src/mame/machine/slikshot.c svneol=native#text/plain
|
||||
src/mame/machine/snes.c svneol=native#text/plain
|
||||
src/mame/machine/snesdsp1.c svneol=native#text/plain
|
||||
src/mame/machine/snesdsp2.c svneol=native#text/plain
|
||||
src/mame/machine/snesdsp3.c svneol=native#text/plain
|
||||
src/mame/machine/snesdsp4.c svneol=native#text/plain
|
||||
src/mame/machine/snesdsp4.h svneol=native#text/plain
|
||||
src/mame/machine/snesobc1.c svneol=native#text/plain
|
||||
src/mame/machine/snesrtc.c svneol=native#text/plain
|
||||
src/mame/machine/snessdd1.c svneol=native#text/plain
|
||||
|
@ -58,6 +58,8 @@ static struct
|
||||
// add-on chip emulators
|
||||
#include "machine/snesdsp1.c"
|
||||
#include "machine/snesdsp2.c"
|
||||
#include "machine/snesdsp3.c"
|
||||
#include "machine/snesdsp4.c"
|
||||
#include "machine/snesobc1.c"
|
||||
#include "machine/snesrtc.c"
|
||||
#include "machine/snessdd1.c"
|
||||
@ -1475,6 +1477,8 @@ READ8_HANDLER( snes_r_bank1 )
|
||||
value = (address < 0xc000) ? DSP1_getDr() : DSP1_getSr();
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2) && (offset >= 0x200000))
|
||||
value = (address < 0xc000) ? DSP2_read() : 0x00;
|
||||
else if ((snes_has_addon_chip == HAS_DSP3) && (offset >= 0x200000))
|
||||
value = DSP3_read(address);
|
||||
else
|
||||
value = snes_ram[offset];
|
||||
|
||||
@ -1514,6 +1518,10 @@ READ8_HANDLER( snes_r_bank2 )
|
||||
value = (address < 0xc000) ? DSP1_getDr() : DSP1_getSr();
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2))
|
||||
value = (address < 0xc000) ? DSP2_read() : 0x00;
|
||||
else if (snes_has_addon_chip == HAS_DSP3)
|
||||
value = DSP3_read(address);
|
||||
else if (snes_has_addon_chip == HAS_DSP4)
|
||||
value = (address < 0xc000) ? DSP4_read() : 0x80;
|
||||
else
|
||||
value = snes_ram[0x300000 + offset];
|
||||
|
||||
@ -1637,6 +1645,10 @@ READ8_HANDLER( snes_r_bank6 )
|
||||
value = (address < 0xc000) ? DSP1_getDr() : DSP1_getSr();
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2) && (offset >= 0x200000))
|
||||
value = (address < 0xc000) ? DSP2_read() : 0x00;
|
||||
else if ((snes_has_addon_chip == HAS_DSP3) && (offset >= 0x200000))
|
||||
value = DSP3_read(address);
|
||||
else if ((snes_has_addon_chip == HAS_DSP4) && (offset >= 0x300000))
|
||||
value = (address < 0xc000) ? DSP4_read() : 0x80;
|
||||
else
|
||||
value = snes_ram[0x800000 + offset];
|
||||
|
||||
@ -1699,6 +1711,8 @@ WRITE8_HANDLER( snes_w_bank1 )
|
||||
DSP1_setDr(data);
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2) && (offset >= 0x200000) && (address < 0xc000))
|
||||
DSP2_write(data);
|
||||
else if ((snes_has_addon_chip == HAS_DSP3) && (offset >= 0x200000))
|
||||
DSP3_write(address, data);
|
||||
else
|
||||
logerror( "Attempt to write to ROM address: %X\n", offset );
|
||||
}
|
||||
@ -1733,6 +1747,10 @@ WRITE8_HANDLER( snes_w_bank2 )
|
||||
DSP1_setDr(data);
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2) && (address < 0xc000))
|
||||
DSP2_write(data);
|
||||
else if (snes_has_addon_chip == HAS_DSP3)
|
||||
DSP3_write(address, data);
|
||||
else if ((snes_has_addon_chip == HAS_DSP4) && (address < 0xc000))
|
||||
DSP4_write(data);
|
||||
else
|
||||
logerror("Attempt to write to ROM address: %X\n", offset + 0x300000);
|
||||
}
|
||||
@ -1837,6 +1855,10 @@ WRITE8_HANDLER( snes_w_bank6 )
|
||||
DSP1_setDr(data);
|
||||
else if ((snes_cart.mode == SNES_MODE_20) && (snes_has_addon_chip == HAS_DSP2) && (offset >= 0x200000) && (address < 0xc000))
|
||||
DSP2_write(data);
|
||||
else if ((snes_has_addon_chip == HAS_DSP3) && (offset >= 0x200000))
|
||||
DSP3_write(address, data);
|
||||
else if ((snes_has_addon_chip == HAS_DSP4) && (offset >= 0x300000) && (address < 0xc000))
|
||||
DSP4_write(data);
|
||||
else if (snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
|
||||
logerror( "snes_w_bank6 hit (ROM) in Super FX mode, please fix me\n" );
|
||||
else
|
||||
@ -1957,6 +1979,14 @@ static void snes_init_ram(running_machine *machine)
|
||||
DSP2_reset();
|
||||
break;
|
||||
|
||||
case HAS_DSP3:
|
||||
InitDSP3();
|
||||
break;
|
||||
|
||||
case HAS_DSP4:
|
||||
InitDSP4();
|
||||
break;
|
||||
|
||||
case HAS_OBC1:
|
||||
obc1_init();
|
||||
break;
|
||||
|
1154
src/mame/machine/snesdsp3.c
Normal file
1154
src/mame/machine/snesdsp3.c
Normal file
File diff suppressed because it is too large
Load Diff
2179
src/mame/machine/snesdsp4.c
Normal file
2179
src/mame/machine/snesdsp4.c
Normal file
File diff suppressed because it is too large
Load Diff
104
src/mame/machine/snesdsp4.h
Normal file
104
src/mame/machine/snesdsp4.h
Normal file
@ -0,0 +1,104 @@
|
||||
#ifndef SNESDSP4_H
|
||||
#define SNESDSP4_H
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
|
||||
struct DSP4_t
|
||||
{
|
||||
UINT8 waiting4command;
|
||||
UINT8 half_command;
|
||||
UINT16 command;
|
||||
UINT32 in_count;
|
||||
UINT32 in_index;
|
||||
UINT32 out_count;
|
||||
UINT32 out_index;
|
||||
UINT8 parameters[512];
|
||||
UINT8 output[512];
|
||||
};
|
||||
|
||||
extern struct DSP4_t DSP4;
|
||||
|
||||
struct DSP4_vars_t
|
||||
{
|
||||
// op control
|
||||
INT8 DSP4_Logic; // controls op flow
|
||||
|
||||
|
||||
// projection format
|
||||
INT16 lcv; // loop-control variable
|
||||
INT16 distance; // z-position INTo virtual world
|
||||
INT16 raster; // current raster line
|
||||
INT16 segments; // number of raster lines drawn
|
||||
|
||||
// 1.15.16 or 1.15.0 [sign, INTeger, fraction]
|
||||
INT32 world_x; // line of x-projection in world
|
||||
INT32 world_y; // line of y-projection in world
|
||||
INT32 world_dx; // projection line x-delta
|
||||
INT32 world_dy; // projection line y-delta
|
||||
INT16 world_ddx; // x-delta increment
|
||||
INT16 world_ddy; // y-delta increment
|
||||
INT32 world_xenv; // world x-shaping factor
|
||||
INT16 world_yofs; // world y-vertical scroll
|
||||
|
||||
INT16 view_x1; // current viewer-x
|
||||
INT16 view_y1; // current viewer-y
|
||||
INT16 view_x2; // future viewer-x
|
||||
INT16 view_y2; // future viewer-y
|
||||
INT16 view_dx; // view x-delta factor
|
||||
INT16 view_dy; // view y-delta factor
|
||||
INT16 view_xofs1; // current viewer x-vertical scroll
|
||||
INT16 view_yofs1; // current viewer y-vertical scroll
|
||||
INT16 view_xofs2; // future viewer x-vertical scroll
|
||||
INT16 view_yofs2; // future viewer y-vertical scroll
|
||||
INT16 view_yofsenv; // y-scroll shaping factor
|
||||
INT16 view_turnoff_x; // road turnoff data
|
||||
INT16 view_turnoff_dx; // road turnoff delta factor
|
||||
|
||||
|
||||
// drawing area
|
||||
|
||||
INT16 viewport_cx; // x-center of viewport window
|
||||
INT16 viewport_cy; // y-center of render window
|
||||
INT16 viewport_left; // x-left of viewport
|
||||
INT16 viewport_right; // x-right of viewport
|
||||
INT16 viewport_top; // y-top of viewport
|
||||
INT16 viewport_bottom; // y-bottom of viewport
|
||||
|
||||
|
||||
// sprite structure
|
||||
|
||||
INT16 sprite_x; // projected x-pos of sprite
|
||||
INT16 sprite_y; // projected y-pos of sprite
|
||||
INT16 sprite_attr; // obj attributes
|
||||
UINT8 sprite_size; // sprite size: 8x8 or 16x16
|
||||
INT16 sprite_clipy; // visible line to clip pixels off
|
||||
INT16 sprite_count;
|
||||
|
||||
// generic projection variables designed for
|
||||
// two solid polygons + two polygon sides
|
||||
|
||||
INT16 poly_clipLf[2][2]; // left clip boundary
|
||||
INT16 poly_clipRt[2][2]; // right clip boundary
|
||||
INT16 poly_ptr[2][2]; // HDMA structure poINTers
|
||||
INT16 poly_raster[2][2]; // current raster line below horizon
|
||||
INT16 poly_top[2][2]; // top clip boundary
|
||||
INT16 poly_bottom[2][2]; // bottom clip boundary
|
||||
INT16 poly_cx[2][2]; // center for left/right poINTs
|
||||
INT16 poly_start[2]; // current projection poINTs
|
||||
INT16 poly_plane[2]; // previous z-plane distance
|
||||
|
||||
|
||||
// OAM
|
||||
INT16 OAM_attr[16]; // OAM (size,MSB) data
|
||||
INT16 OAM_index; // index INTo OAM table
|
||||
INT16 OAM_bits; // offset INTo OAM table
|
||||
|
||||
INT16 OAM_RowMax; // maximum number of tiles per 8 aligned pixels (row)
|
||||
INT16 OAM_Row[32]; // current number of tiles per row
|
||||
};
|
||||
|
||||
extern struct DSP4_vars_t DSP4_vars;
|
||||
|
||||
#endif
|
@ -1849,6 +1849,8 @@ $(DRIVERS)/mpu4.o: $(MAMESRC)/drivers/mpu4drvr.c
|
||||
$(DRIVERS)/neogeo.o: $(MAMESRC)/drivers/neodrvr.c
|
||||
$(MACHINE)/snes.o: $(MAMESRC)/machine/snesdsp1.c \
|
||||
$(MAMESRC)/machine/snesdsp2.c \
|
||||
$(MAMESRC)/machine/snesdsp3.c \
|
||||
$(MAMESRC)/machine/snesdsp4.c \
|
||||
$(MAMESRC)/machine/snesobc1.c \
|
||||
$(MAMESRC)/machine/snesrtc.c \
|
||||
$(MAMESRC)/machine/snessdd1.c
|
||||
|
Loading…
Reference in New Issue
Block a user