Add Space Harrier Core - #1506
Conversation
|
working on enduro and hang-on, @asturur made me aware of duping the whole of mc8051 was not the best idea. Agreed I should have picked that up. I only needed two extra ports - the FSM state, and a separate clock enable so the timer/serial units aren't retimed. I'll tidy it. |
Added new VHDL files for mc8051 and updated file retrieval conditions.
| // Clock enables | ||
| jtframe_frac_cen u_cpu_cen( | ||
| .clk ( clk ), .n( 10'd57 ), .m( 10'd287 ), | ||
| .cen ( { cc_nc, cpu_cen } ), | ||
| .cenb( { ccb_nc, cpu_cenb } ) | ||
| ); | ||
| jtframe_frac_cen u_snd_cen( | ||
| .clk ( clk ), .n( 10'd25 ), .m( 10'd315 ), | ||
| .cen ( { sc_nc, snd_cen } ), .cenb( ) | ||
| ); | ||
| jtframe_frac_cen u_mcu_cen( | ||
| .clk ( clk ), .n( 10'd39 ), .m( 10'd245 ), | ||
| .cen ( { mc_nc, mcu_cen } ), .cenb( ) | ||
| ); |
There was a problem hiding this comment.
unless you know a reason for those cen to be created like this, those just go in mem.yaml under the clocks section with the other that you put there.
There was a problem hiding this comment.
Tried it, had to revert. Moving the MCU and Z80 cens broke the audio and bought back a very old regression: a sound effect cuts out if you credit after leaving it in attract for a while.
It isn't the frequency. I reproduced the exact ratios with mul: 39, div: 245 and mul: 25, div: 315 and it still happened. jtframe_gated_cen and jtframe_frac_cen are different implementations gated_cen has its own accumulator (NUM2 = NUM<<1), toggle registers and glitch handling so at the same average rate the enable pulses land differently, and something in my sound path is sensitive to that.
Also worth noting the 68000 pair can't move regardless: it needs cenb so main and sub interleave on shared RAM, and gated_cen only outputs cen, fave, fworst.
Leaving it as-is for now. Happy to revisit if gated_cen can be made pulse-equivalent, or if the yaml could instantiate frac_cen directly.
| jtframe_dual_ram16 #(.AW(11)) u_objram( | ||
| .clk0 ( clk ), | ||
| .data0( main_dout ), | ||
| .addr0( main_a[11:1] ), | ||
| .we0 ( {2{m_objram_cs & main_we}} & ~main_dsn ), | ||
| .q0 ( objram_q ), | ||
| .clk1 ( clk ), | ||
| .data1( objtbl_din ), | ||
| .addr1( objtbl_addr), | ||
| .we1 ({2{objtbl_we}}), | ||
| .q1 ( objtbl_dout ) | ||
| ); |
There was a problem hiding this comment.
this could go into bram section in mem.yaml i m not able to tell you the exact equivalent for this. Always if know why this is not in the bram section say it replaying on my comment
There was a problem hiding this comment.
might have to do this when back from vac.
|
|
||
| assign gfx_cs = 1'b1; | ||
|
|
||
| endmodule |
There was a problem hiding this comment.
every time i made a new game file, always loops and bits of logic were better placed in submodules instantiated here rather than right on the game file. I see 3 always loop here that maybe are out of place, but this core is incredibly complex for me, so i m telling you just the obvious things i already seen on my cores
There was a problem hiding this comment.
Yup, will look at that. Cheers A!
|
Enduro is running, but i'll hang back on the PR until this is done. |
|
Thanks for taking the time for this. This is going to require a ton of changes before merging. And that is even before checking the schematics.
Required integration and validation work
Other Big Problems
|
|
@niknakniknak , if you run into problems with mc5081, you could have a look at the new "nu5081" module by wickerwaka. It's on his GitHub. |
|
The problem is that Claude is spitting out new 8051 cores everyday. A different one for each game that used that MCU. We have been using Oregano's one for a long time. It has not created problems and the license let us use it. So we should stick for it. Creating new ones for each game goes against the modularity principle that guides all engineering. |
Space Harrier. it plays perfectly and matches my cabinet pretty accurately
Sega Hang-On hardware: two 68000s, i8751 MCU, Z80, YM2203 and the discrete
SegaPCM, plus the tilemap, sprite and road generators.
Subsystem Source
68000 x2, i8255, YM2203, mixer JTFRAME
Tilemap, palette, priority jts16
SegaPCM forked from jtoutrun
i8751 MCU Oregano mc8051, retimed in the wrapper
Road generator transcribed from segaic16_road.cpp
Sprite scan and draw transcribed from sega16sp.cpp
Memory map, I/O, ADC, sound, video new
The road and sprite routines are derived works of MAME source (BSD-3-Clause,
Aaron Giles); attribution is in those module headers. Sega's SH customs have never
been decapped, so MAME's implementation is the best description of what they do that I can find.
Outstanding things maybe.
Space harrier. A certain later sound effect can stick for a while until retriggered
(short) under heavy activity. I think this is original behaviour;
to be checked on my cabinet.
Extra options for QOL
Space harrier: Three MRA dips, all defaulting to arcade behaviour so loading the
MRA unchanged gives the original machine:
Stick Direction Normal / Arcade Arcade: aircraft stick, up goes down. Normal: up goes up.
D-Pad Control Console / Arcade arcade:spring back to centre. console: stay where you are.
V Glyph Fix On / Off corrects a glyph drawn wrong in the ROM (bugged me since 1986)
Notes
MCU is flagged BAD_DUMP in MAME.