#Sega Saturn
1 messages · Page 82 of 1
always managed to get to the root of the problem and eliminate it. E.g. the dualsdram version did not work for me , just because I used de10 nano alone without io 😄( it was related to changes for framework)
I might have to try it
#1046941029296779344 message
Thanks Kuba
Here are the steps: #1046941029296779344 message and you’ll want to grab the updated MRAs here: #1046941029296779344 message
oh nice, kuba linked to the steps (I should have checked)
At least Princess Clara, Shienryuu and Groove on Fight work on my end (and the others who tested them).
You ruined my bug kuba... I won't forget this...
😭
Love you guys ❤️
I get the "Cart #1" screen, patent screen, then a brief "System checking" flash and black screen after... what am I missing?
not all games work
I would say more games are broken than actually work
lots of start protection etc
does anyone know if that protection chip is on each cart or is it on the MB?
what game definitely works?
Princess Clara, Shienryuu and Groove on Fight
If you like the colour green the Die Hard Arcade could be the one for you
@mortal mist With my bad eyesight, the black spots in the original artwork are not an issue on the core.
So, something is off with @polar mountain screen.
I work with a old 14" PVM generally, sometimes I can't see very precisely.
With the 75" OLED screen at home in the living room, I can see much better.
Indeed, those start, so it was just incompatible games
thanks for checking
And sorry from my part.
I'm closing the ticket (at the moment).
@polar mountain Could you sometimes check on your side with another screen? Thanks in advance.
I've played a lot of Virtua Cop 1, more with a control pad than with a Stunner. There is a button that accelerates the crosshair, it helps in many scenarios, and you need to press the reload button twice to actually reload. Sometimes you need to be mindfull of the sequence of enemies that appear and shoot each once. The last stage is hard, for both controller and Stunner.
I need to fix the trigger on my stunner though. I fixed it before, but it is starting to have issues again.
Yes must be on my end. At least we all got to hear that chilled out background music 🎶
There's always https://www.ebay.com/itm/333156221134 !
I put the MRAs on github, with a release zip. https://github.com/zakk4223/STV-MRA
it’s a great mod, ** be prepared ** the plastic of the gun might shatter thru literally no fault of your own
That's the most stunning part
what type of file does the sega stv reads
MAME set + MRA
(Or combined set, but Zakk have done all the work for getting the MRA set).
which specific mame?
After MAME 0.262, for the STV Bios.
Games could be from an earlier MAME Set.
@mortal mist I'll let you continue with the STV games, because we are in the process of collapsing each other on the list.
I'm continuing on the Saturn games.
nah. i'm sorry , i forgot to move on 😄
For Columns '97, I have a message "Operation of this cartridge is disallowed in this country".
use the JP Bios mra
Thank you for the great work with the core and the MRAs!
I hope the support for Die hard come soon ^^
If it helps, this is where I sourced them:
The stvbios.zip file from the MAME 0.273 ROMs (merged) set.
The stv folder containing the games from the MAME 0.273 Software List ROMs (merged) set.
(The version is not terribly critical. I only include it to show where those files are located in the sets I have.)
Back now.
That last Quartus compile... didn't boot. lol
Not sure why. Seemed like the SH2 crashed, like it couldn't read a BIOS.
(this was for the light gun emulation stuff, btw. Nothing to do with ST-V)
Might need to load a Saturn RBF first, then load the SOF via JTAG.
Not sure why that would be, as main MiSTer normally reads the core CONF_STR (or filename), and knows which BIOS to load.
OK, it does try to do something, after loading the Saturn BIOS manually.
But then a black screen.
Can only really be due to core instability, because I've added more stuff to SignalTap now.
And / or the new tiny amount of logic I added, has somehow confused the BIOS.
Code stuck in a loop.
OK, maybe it really does trigger an interrupt, every time the light gun Latch thing happens.
I'll have to add that as a menu option, so it's not running constantly.
So... another compile.
.EMU_LG_ENA( status[17:15]==3'd1 ),
.JOY1_X1( joy0_x0 ),
.JOY1_Y1( joy0_y0 )
"P2OFH,Pad 1,Digital,Off,Wheel,Mission Stick,3D Pad,Dual Mission,Mouse;",
That should only allow the new logic, when Joypad 1 is set to the "Off" type.
I'll remove some stuff from SignalTap as well. Sometimes that helps with the marginal timings thing.
99% of the FPGA used, too.
From now on I cannot play Bio Miracle Bokutte Upa anymore without seeing that face
Core refuses to boot.
Don't get it.
I'll try again tomorrow.
Oh, that's interesting...
So the core doesn't boot the Saturn BIOS now, when the Cartridge is set to STV.
Maybe it was trying to read some garbage header, left over in DDR3.
no
(on the old core stuff, it used to always boot the Saturn BIOS by default, regardless of the setting)
remember, that causes a byte swap
Ahh. That would make more sense.
wire [15:0] IO_DATA = cart_type == 3'h5 ? ioctl_data : {ioctl_data[7:0],ioctl_data[15:8]};
It's just, I wasn't used to it, as it's not like the old core. Fair enough. lol
Could swear I tried that setting earlier, but maybe not.
Oww. I don't have the CD BIOS.
OK, was just set to the wrong region.
Man, I need to be using these cores more often.
Virtua Cop running now.
It won't even allow the Gun Adjust option to be selected.
No matter what I set the Joypad 1 type to.
So yeah, needs more magic stuff.
And when I tried checking the MD_ID for each joypad type, it never changes from 0xB.
And as soon as you scroll past the "Wheel" option, it resets to the BIOS menu.
So that makes it quite awkward to debug. I'll have to add the light gun emu stuff as a separate menu option.
Haven't even really started to debug anything yet, as it often takes a few compiles to get to that point.
i think its fine to have to select lightgun in the OSD, thats what all the other cores are like too
its usually an option in the controller carousel
Yeah. I just need to figure out how it's actually detected. lol
Like blue1 said, it does set a value in the SMPC when the Stunner is plugged in, I'm just not sure how that whole mechanism works yet.
I'll have to absorb this for a while.
OK, yep. So needs to see MD_ID == 0xA.
That will end up with 0xA0, after doing the concat with 4'b0000.
PS_ID1_3: begin
JOY_DATA[15:12] <= PDR_I[PORT_NUM][3:0];
PORT_ST <= PS_ID1_4;
end
PS_ID1_4: begin
MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
PS_TYPE_SEL: begin
if (MD_ID == 4'hB)
PORT_ST <= PS_DPAD_0;
// else if (MD_ID == 4'hD)
// PORT_ST <= PS_MD_0;
else if (MD_ID == 4'h3)
PORT_ST <= PS_MOUSE_0;
else if (MD_ID == 4'h5)
PORT_ST <= PS_ID5_0;
else if (MD_ID == 4'hF || 4'hA)
PORT_ST <= PS_NOTHING_STUNNER;
else
PORT_ST <= PS_END;
end
OK, I see now.
I was hoping that setting the Joypad type in the menu, would automatically set this stuff.
But I believe JOY_DATA comes direct from the HPS2PAD module.
Nope, it literally gets read via PDR_I.
it was a good evening for ST-V testing , @ripe valley thanks! https://docs.google.com/spreadsheets/d/1BpCRjALSAAe4lQGfaJgoiDZu6aLFrVOLdSEJqN4EgIg/edit?gid=1391758124#gid=1391758124 , good night!
OREG_DATA is how the SH2 usually reads responses back from some of the SMPC stuff.
input [ 6: 0] PDR1I,
output reg [ 6: 0] PDR1O,
output reg [ 6: 0] DDR1,
input [ 6: 0] PDR2I,
output reg [ 6: 0] PDR2O,
output reg [ 6: 0] DDR2
wire [6 : 0] PDR_I[2] = '{PDR1I,PDR2I};
.SMPC_PDR1I(snac ? USERJOYSTICK : SMPC_PDR1I),
.SMPC_PDR1O(SMPC_PDR1O),
.SMPC_DDR1(SMPC_DDR1),
.SMPC_PDR2I(SMPC_PDR2I),
Yep, comes from HPS2PAD.
HPS2PAD PAD
(
.CLK(clk_sys),
.RST_N(~rst_sys),
.SMPC_CE(SMPC_CE),
.PDR1I(SMPC_PDR1I),
And that module mostly relates to the logic for the Wheel, Mouse, and Dual Mission controllers.
For a standard Digital pad, it has to do a whole run of clocking in four bits at a time.
//Standart PAD
PS_DPAD_0: begin
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b10;
PORT_DELAY <= 16'd60;
PORT_ST <= PS_DPAD_1;
end
PS_DPAD_1: begin
JOY_DATA[11:8] <= PDR_I[PORT_NUM][3:0];
PORT_ST <= PS_DPAD_2;
end
PS_DPAD_2: begin
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b00;
PORT_DELAY <= 16'd60;
PORT_ST <= PS_DPAD_3;
end
DDR regs set the direction of the signals.
Then it messes with the TH / TR signals.
`define THTR 6:5
`define TH 6
`define TR 5
So yeah, Stunner emu needs to force MD_ID to 0xA0 first.
Then the games presumably just do the Direct read for the Start and Trigger button inputs.
And obviously read the latched HV data from VDP2.
I'll try forcing the MD_ID thing first, and add a menu option for it.
"P2OS,LightGun Emu,OFF,ON;",
status[28]
Or the much more obvious method, which I'm sure main MiSTer will be fine with...
"P2O[28],LightGun Emu,OFF,ON;",
ie. Actually stating the bit (or bits) of status that you want to toggle. lol
The evil override...
PS_ID1_4: begin
if (EMU_LG_ENA) MD_ID <= 4'hA;
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
(EMU_LG_ENA signal also gets fed to VDP2, to tell it to shove the coords into the H/V counter regs.)
Getting the buttons working at the same time is going to be very annoying. lol
INTBACK command is often used by games to auto-fetch the joypad input stuff, IIRC.
The light gun doesn't use that.
I don't get how it's even reading an "ID" from the light gun.
If it has barely any signals hooked up.
oic, very similar to the MD/Gen.
Four bits of Data.
And another two bits, which are generally used as outputs.
So it can clock in data, from the more advanced controllers.
Or use basic MD mode.
3. Peripheral specifications of Virtual Gun
● About SMPC operation mode
Since the virtual gun uses the HV counter to detect the position on the screen, the SMPC must be used by
switching to S "H-2 direct mode".
● Initialization method (SMPC control mode → SH-2 direct mode)
1. Set the external latch enable bit (EXTLEN: bit 9) of the external signal enable register
(EXTEN: 180002H offset) of VDP2 to [1].
2. Set the SMPC to SH-2 direct mode.
Set the IOSEL bit of the parallel I / O register (2010007DH) to [1].
1P terminal: IOSEL1 (bit0)
2P terminal: IOSEL2 (bit1)
3. Set the port I / O setting to "Input".
Set all DDR bits (bit0 to bit6) of the parallel I / O register to [0].
1P terminal: DDR1 (20100079H) All bits (bit6 to bit0) [0]
2P terminal: DDR2 (2010007BH) All bits (bit6 to bit0) [0]
Set all bits of the input set PDR to [1].
1P terminal: PDR1 (20100075H) All bits (bit6 to bit0) [1]
2P terminal: PDR2 (20100077H) All bits (bit6 to bit0) [1]
4. Bit 6 of the port is used as the external latch input for VDP2.
Set the EXLE bit of address 2010007FH to [1]. (Usually [0])
1P terminal: EXLE 1 bit (2010007FH: bit0) [1]
2P terminal: EXLE 2 bit (2010007FH: bit1) [1]
Slightly clearer version, from another site.
Yep. Most of the "controller" peripherals - including crazy stuff like the Dual Mission Stick! - can provide data via SMPC, and the format is quite consistent between all of them - it's just a question of how many analog axes they have
so it was relatively easy to get in initial support for controllers like the Arcade Racer wheel, the 3D Pad, and the Mission Stick
Looks like that above stuff, is pretty much just for setting SH2 Direct mode, then setting up the routing of the "Latch" signal through to the VDP.
But I need to confirm the ID thing for the light gun.
That probably needs a few extra states in the SMPC state machine, to let it read the Gun's ID.
(which is separate from the 0xA0 thing)
Port 1 (PDR1) port address (20100075H)
Port 2 (PDR2) port address (20100077H)
ID3=(BIT3 or BIT2) and (BIT6=1) ; equation for ID3 through ID0
ID2=(BIT1 or BIT0) and (BIT6=1)
ID1=(BIT3 or BIT2) and (BIT6=0)
ID0=(BIT1 or BIT0) and (BIT6=1)
Clear as mud. lol
Why would it need to read from both Joyport 1 AND from Joyport 2?
Is it even possible for a peripheral to put data on both ports, on a physical Saturn?
Dunno. I'm probably missing something.
input [ 6: 0] PDR1I,
output reg [ 6: 0] PDR1O,
output reg [ 6: 0] DDR1,
input [ 6: 0] PDR2I,
output reg [ 6: 0] PDR2O,
output reg [ 6: 0] DDR2,
input EMU_LG_ENA
);
wire [6 : 0] PDR_I[2] = '{PDR1I,PDR2I};
PDI_I is a sort of array, which combines both PDR1 and PDR2 input ports.
For a standard Digital pad, it tweaks the TH/TR signals, then latches four bits of data at a time, into JOY_DATA, then eventually shoves the result into OREG, so the SH2 can read it.
The character code for the Stunner is "G".
Enter "G" as a compatible peripheral character code in the System ID (start
address: 50H).
Nope. The explanation in the PDF is nonsense. lol
PDR1[5] = Start.
PDR1[4] = Trigger
should probably add an entry to the osd options, then add code in hps2pad.sv to make that option do the id.
and bit 6(PDR1[6]) is the sensor used for the latch.
PDR1 = port 1, PDR2 is 2 obviously
or just write A0, F0 as the first bytes in OREG to temporarily fake it
I don't get how it reads the ID. lol
I would imagine, by toggling TR, or something, then latching a nibble at a time.
Just the way the PDF explains it, it's terrible.
It doesn't say which bits of PDR1 and PDR2 it's referring to, but I guess it means either/or.
ie. whichever port the thing is plugged into.
When I first read that page, it made it seem like you had to read the Periph ID from both PDR1 and PDR2, but I see that doesn't make sense now.
The char code "G" confused me, too.
I think that's a higher-level thing in the sw/BIOS.
DDR[PORT_NUM][`THTR] <= 2'b10;
around there is where it tries to figure out id
I'm bypassing part of that, so it always sees MD_ID = 0xA.
PS_ID1_4: begin
if (EMU_LG_ENA) MD_ID <= 4'hA;
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
Then it will always do the jump...
PS_TYPE_SEL: begin
if (MD_ID == 4'hB)
PORT_ST <= PS_DPAD_0;
// else if (MD_ID == 4'hD)
// PORT_ST <= PS_MD_0;
else if (MD_ID == 4'h3)
PORT_ST <= PS_MOUSE_0;
else if (MD_ID == 4'h5)
PORT_ST <= PS_ID5_0;
else if (MD_ID == 4'hF || 4'hA)
PORT_ST <= PS_NOTHING_STUNNER;
else
PORT_ST <= PS_END;
end
//Nothing Detected or Stunner
PS_NOTHING_STUNNER: begin
OREG_DATA <= {MD_ID,4'b0000};
OREG_WRITE <= 1;
PORT_ST <= PS_NEXT;
end
But after the ID 0xA0 thing gets put into OREG_DATA, it jumps to the PS_NEXT state.
PS_NEXT: begin
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b11;
PORT_DELAY <= 16'd60;
PORT_NUM <= ~PORT_NUM;
if (!PORT_NUM) begin
PORT_ST <= PS_START;
end else begin
OREG_DATA <= 8'hF0;
OREG_WRITE <= 1;
PORT_ST <= PS_END;
end
end
PS_END: begin
OREG_END <= 1;
PORT_ST <= PS_IDLE;
end
Which I guess is where the 0xF0 comes in, to denote an "end of packet", sort of?
For a Standard digital pad, it sets the TR/TH bits, reads a nibble from PDR1, changes TR/TH, reads 0xF1, reads 0x02, toggles, reads some other Joydata / ID stuff from earlier?
Man, the Saturn was SO overcomplex. lol
Ok, from the start...
I'm not sure real hw does the extra F0 thing, if the code above is writing an extra F0 at the end.
it would work either way, like if 2 stunners were connected it would be A0,A0 and that's it.
pads give F102FFFF
DDR[PORT_NUM][`THTR] <= 2'b10;
PDR_O[PORT_NUM][`THTR] <= 2'b11;
JOY_DATA[3:0] <= PDR_I[PORT_NUM][3:0];
DDR[PORT_NUM][`THTR] <= 2'b10;
PDR_O[PORT_NUM][`THTR] <= 2'b01;
JOY_DATA[15:12] <= PDR_I[PORT_NUM][3:0];
MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
if (MD_ID == 4'hB) PORT_ST <= PS_DPAD_0; // Digital pad...
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b10;
JOY_DATA[11:8] <= PDR_I[PORT_NUM][3:0];
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b00;
JOY_DATA[7:4] <= PDR_I[PORT_NUM][3:0];
OREG_DATA <= 8'hF1;
OREG_WRITE <= 1;
OREG_DATA <= 8'h02;
OREG_WRITE <= 1;
OREG_DATA <= JOY_DATA[15:8];
OREG_WRITE <= 1;
OREG_DATA <= {JOY_DATA[7:3],3'b111};
OREG_WRITE <= 1;
PS_NEXT: begin
DDR[PORT_NUM][`THTR] <= 2'b11;
PDR_O[PORT_NUM][`THTR] <= 2'b11;
PORT_DELAY <= 16'd60;
PORT_NUM <= ~PORT_NUM;
if (!PORT_NUM) begin
PORT_ST <= PS_START;
end else begin
OREG_DATA <= 8'hF0;
OREG_WRITE <= 1;
PORT_ST <= PS_END;
end
end
PS_END: begin
OREG_END <= 1;
PORT_ST <= PS_IDLE;
end
Sorry, had to post the whole thing. Only way to wrap my brain around it.
I'll just try forcing the 0xA0 ID first, then see how Virtua Cop reacts.
I could really have been compiling all this time. Oops.
Should be able to ignore all of the weird bit OR stuff it's doing...
PS_ID1_4: begin
if (EMU_LG_ENA) MD_ID <= 4'hA;
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
'cos I've shoving the 0xA into MD_ID directly.
It does the check for that in the next state.
else if (MD_ID == 4'hF || 4'hA)
PORT_ST <= PS_NOTHING_STUNNER;
That should at least let it read back the 0xA0 from the OREG.
//Nothing Detected or Stunner
PS_NOTHING_STUNNER: begin
OREG_DATA <= {MD_ID,4'b0000};
OREG_WRITE <= 1;
PORT_ST <= PS_NEXT;
end
Getting quite tired, but I'll post here if the next compile does anything.
Ahh, yep...
OREG_WRITE <= 1;
Every time that signal (reg) pulses high, it increments a counter.
Then it writes the OREG_DATA erm, data, to a small chunk of RAM.
So the response stuff can be read back from the SMPC after.
It might be enough for the light gun, to just send back that 0xA0 response (MD_ID thing), but we'll see.
I think that's what the PDF meant by the Peripheral ID earlier, but I could be wrong.
It just has a convoluted way of encoding the bits.
For a standard Digital pad, the first value stored via OREG_DATA is the 0xF1...
OREG_DATA <= 8'hF1;
Then the 0x02, then two bytes of actual Joypad data.
But I don't think the light gun is read via the OREG / table thing.
It just reads the PDR1 port directly.
the games check the OREG FOR A0. then it will use PDR directly.
Ok, that's good.
with nothing connected you get a 0xF0,for that port.
24-minutes into the compile, and it's only 36% along the Fitter stage. lol
I still think there is a much faster way to do dev...
By using a smaller FPGA with the part you're mainly doing work on, hooked up to the larger FPGA via many pins.
So you have enough pins to bus data, clocks, and flag signals around.
Then you can very quickly recompile the logic on the small FPGA.
yeah compiling sucks, really dampens the mood if it's 1/2 an hour every time you hit compile
there's the file where I think you should add your option eventually.
I've sure I've wasted at least six years of my life, simply waiting for Quartus compiles.
Since about 2006, I think I got my first FPGA board.
(the Pluto-II, from fpga4fun / knjn)
Sometimes I used to sit and watch the progress bar, because I was trying to remember all of the info, and all of the code changes. lol
A 15-minute compile isn't too bad. But once it gets over 20 minutes, it's a killer.
While you are in saturn mode someone needs to fix the OSD pad option that messes up the core if that's still broken. you said after wheel so that's PAD_MISSION I think.
Srg changed the controller code at one point and never fixed that
Actually it's as soon as you change to Wheel.
It didn't do it the first time, when I tried just now, as I was changing the option more slowly.
But changing it a bit faster, and it immediately goes back to the BIOS CD Player screen thing.
I didn't even know it was possible to do a kind of IGR on Saturn. lol
maybe I was doing it fast, I know it happened to me before
case (JOY1_TYPE)
PAD_WHEEL: begin
case (STATE1)
5'd0,
5'd1: if (PDR1O[6:5] == 2'b01) begin OUT1 <= 4'hB; TL1 <= 1; STATE1 <= 5'd2; end
5'd2: if (PDR1O[6:5] == 2'b00) begin OUT1 <= 4'hF; TL1 <= 0; STATE1 <= 5'd3; end
5'd3: if (PDR1O[6:5] == 2'b01) begin OUT1 <= 4'hF; TL1 <= 1; STATE1 <= 5'd4; end
5'd4: if (PDR1O[6:5] == 2'b00) begin OUT1 <= JOY1[15:12]; TL1 <= 0; STATE1 <= 5'd5; end
5'd5: if (PDR1O[6:5] == 2'b01) begin OUT1 <= JOY1[11: 8]; TL1 <= 1; STATE1 <= 5'd6; end
5'd6: if (PDR1O[6:5] == 2'b00) begin OUT1 <= {1'b1,JOY1[ 6: 4]}; TL1 <= 0; STATE1 <= 5'd7; end
5'd7: if (PDR1O[6:5] == 2'b01) begin OUT1 <= 4'b1111; TL1 <= 1; STATE1 <= 5'd8; end
5'd8: if (PDR1O[6:5] == 2'b00) begin OUT1 <= JOY1_X1[7:4]^4'h8; TL1 <= 0; STATE1 <= 5'd9; end
5'd9: if (PDR1O[6:5] == 2'b01) begin OUT1 <= JOY1_X1[3:0]; TL1 <= 1; STATE1 <= 5'd10; end
endcase
if (PDR1O[6:5] == 2'b11) begin OUT1 <= 4'h0; TL1 <= 1; STATE1 <= 5'd0; end
end
That does give a bit of a better overview of the controller protocol, at the lower level.
It's still batshit, though.
JOY1 bits will be the actuall button states, from HPS_IO.
Core is still alive.
Took 38 minutes, 45 seconds to compile.
Is it weird, that I still get a slight kick, out of seeing a new menu option?
nope it’s neat
Optional ones are neat too - like, I could imagine eventually putting in a "show crosshair" option that's only enabled if you're using a lightgun
Didn't work. I'm not surprised.
For some reason, even the MD_ID stays at 0xB.
Oh, ffs.
.EMU_LG_ENA( status[17:15]==3'd1 ),
Thought I'd fixed that. sigh
fgnarrr
I think it should probably be in the pad 1,2 options that's where the other usb things are. then maybe you can have hidden options like crosshairs on/off that show up if you pick LG for either pad
another 1/2 hour
So, it did force the MD_ID to 0xA, but only when setting the controller type to "Off", because I'm dumb.
So then I couldn't even move the cursor to use the menu. lol
And the stupid Wheel option quit out again.
Crosshairs etc. look relatively straightforward. I just need to spoof the lightgun first.
Thanks.
I really would love to see more comments in core code.
CS_N_OLD <= CS_N;
if (!CS_N && CS_N_OLD && RW_N) begin
if ({A,1'b1} <= 7'h5F)
REG_DO <= OREG_RAM_Q;
else
case ({A,1'b1})
7'h61: REG_DO <= SR;
7'h63: REG_DO <= {7'b1111000,SF};
7'h75: REG_DO <= {PDR_O[0][7],PDR1I};
7'h77: REG_DO <= {PDR_O[1][7],PDR2I};
default: REG_DO <= '0;
endcase
end
Looks like that's where the SH2 can do the direct reads from PDR1 or PDR2.
i love y’all so much for working on this tonight. i’m gonna coma out for a few hours
But there is no comment/label for the addresses.
np at all, I'm very tired tonight, especially after the Dominos. lol
Plus, I repaired the tweeter on a speaker for my nephew.
Mordaunt Short MS-814 floorstanders.
The speakers, not the nephew.
Gonna go for one more compile, but it's quite likely I won't be able to move the cursors to get to the Gun Calib option.
always_comb begin
PDR1I = (PDR1O & DDR1) | ~DDR1;
case (JOY1_TYPE)
PAD_DIGITAL: begin
if (DDR1[6:5] == 2'b10) begin
case (PDR1O[6])
1'b0: PDR1I[3:0] = JOY1[15:12];
1'b1: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end else if (DDR1[6:5] == 2'b11) begin
case (PDR1O[6:5])
2'b00: PDR1I[3:0] = JOY1[ 7: 4];
2'b01: PDR1I[3:0] = JOY1[15:12];
2'b10: PDR1I[3:0] = JOY1[11: 8];
2'b11: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end
end
Digital pad reading, from HPS2PAD. ^
Using combo logic.
So it does just check the TR/TH bits, to decide which data to shove into the lower nibble.
Not... quite as bad as I thought.
If Virtua Cop doesn't allow you to use the Trigger to move the menu cursor, then I might have to try mapping the keyb to Player 2.
I think one of the games you pick options with trigger and then press start.
If it even lets you use a joypad on P2 ?
Nice, which pack are you using?
One note, might want to freeze the top row of the sheet so when you scroll you still see what the column titles are
Yeah, I'm hoping most games do that, when they detect the light gun.
How do you usually enable Light Gun emulation mode on MiSTer, btw? lol
One of the function keys?
Like, mapping the Mouse to the light gun?
I thought there was a way to just map a Mouse or Joystick to the lightgun.
But I guess it's whatever main MiSTer maps to "joystick analog".
Never thought of just having the Light Gun emu, on Joyport 2.
Most games would then let you use a Digital pad on Joyport 1, to control the menu ?
yeah think that might work
Some cores have logic to use the mouse coordinates, but it's inconsistent. If you can use the left stick's x/y, then that'll work with most peripherals.
It's also easy to test even if you don't have a lightgun
OK, so that works now, as soon as I enable the new menu option.
But, as expected - I can't use any of the buttons, to actually go into the menu option. lol
If I turn off the LightGun Emu option, the cursor around Gun Adjust immediately stops flashing.
A bit of progress, at least.
I'll try to map the buttons tomorrow.
Tried using Scroll Lock, to map the keyb to Joystick 2, but no luck.
2) SH-2 direct mode.
In SH-2 direct mode, there are three protocols:
- TH control method (Mega Drive pads).
- TH and TR control method (Saturn digital pad, TL tied to +5V).
- 3-Line handshake method (which is the one that uses the TL line as acknowledgment).
case (JOY1_TYPE)
PAD_DIGITAL: begin
if (DDR1[6:5] == 2'b10) begin
case (PDR1O[6])
1'b0: PDR1I[3:0] = JOY1[15:12];
1'b1: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end
else if (DDR1[6:5] == 2'b11) begin
case (PDR1O[6:5])
2'b00: PDR1I[3:0] = JOY1[ 7: 4];
2'b01: PDR1I[3:0] = JOY1[15:12];
2'b10: PDR1I[3:0] = JOY1[11: 8];
2'b11: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end
end
Don't get why it wouldn't be able to read some button inputs from PDR1I, if the controller type is set to Digital.
Even if the MD_ID is forced to 0xA, for emulated Light Gun.
7'h75: if (IOSEL[0]) PDR_O[0] <= DI;
7'h77: if (IOSEL[1]) PDR_O[1] <= DI;
Gonna try with the LG on port 2.
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
So is there a separate jpn bios for STV? I'm noticing that some of the games that are listed as bootable do not boot on my end. Some do, some don't. And it always tells me I'm missing some epr-2360 file.
So when PORT_NUM is High, it's reading Joyport 2.
When it's low, Port 1, so should continue reading that as normal.
If the game allows the use of a joypad for controlling the menus, but the lightgun on Port 2, it should let me get into the Gun Adjust menu.
But I get what blue1 was saying, about adding the eventual logic in the HPS2PAD module.
'cos that's really what emulates each type of controller, at the lower level.
AFAIK, the first nibble read, is the actual Periph ID.
@inner token It's probably a bit late where you are now, but - I'm not sure which file to use, from pskai files?
I built a few Pseudo Saturn Kai carts years ago.
Not sure if you meant to load the ISO (flasher), or an actual cart image from the zip?
I should probably get some sleep soon. Can't think clearly.
I need to read some more about the controller protocol stuff, so I understand it better, before trying these tweaks.
It's not very productive, using my usual method of "throwing sh*t at the wall, to see what sticks".
Okay, yeah there is a separate jpn bios. That was way more difficult to track down than usual since it's named the same thing.
Sorry, @pearl harbor I wasn't sure what you meant earlier...
the iso in tools labeled sdm
I had the same issue, finding the stvbios.zip which contained the 23603 BIOS.
Ahh, OK.
MAME never really had a filename convention, which lets you know the version of the zip, at a glance. It would have been helpful. lol
It's a bit like having a core RBF, without the date and time in the filename.
Brain hurts.
I didn't realize an ISO needs a CUE file, but kinda makes sense.
Else the core (well, main MiSTer) doesn't know the TOC.
the test menu is hidden so you have to enter a button combo, so I'd use a usb pad first then turn on your option
I said how to do the combo in the link
Oh great. lol
I don't have a USB joypad hooked up atm, believe it or not.
With a usb controller. use that it has a hidden "smpc pad test". hit a L or R sholder button then press UDLR then z to unlock the "extra stuff" menu, then choose "smpc pad test".
turn snac on and then look at the OREG values shown , when the gun is connected the first byte should be A0
this may help you figure out if you got a connection problem.
that would show you if you got the A0 written to oreg correctly
and you can switch osd options and see the other controllers types bytes
Oh yeah, might be due to the LG Emu option being On.
Actually, it's off. If it were on, the controls wouldn't have worked.
go to extra stuff
then pad test
Got it, thanks.
No idea what happened there.
Digital Pad top.
LG Emu On, bottom.
(Digital pad still enabled on both ports, but the LG Emu thing overrides the ID)
pic 2 looks like stunner in port 1,2
I just don't get how the games read the Trigger and Start button, if they are meant to be using the Direct mode on the SMPC, by just reading the 0x77 reg, for PDR1I ?
I'm thinking having the LG on port 2 is going to help.
So it won't block the normal Digital Pad reading on port 1.
In theory, this next compile might do that.
the system uses pdr to get the buttons, then the smpc puts the data in oreg. There is one homebrew game I know of that uses the sh2 direct mode for controllers. So it just uses PDR iirc. kind of like genesis where software controls polling, but with saturn the smpc just does it so games can just read the oreg. is my understanding
that's the short version
Oh, I think I see what might be blocking that...
case (JOY1_TYPE)
PAD_DIGITAL: begin
if (DDR1[6:5] == 2'b10) begin
case (PDR1O[6])
1'b0: PDR1I[3:0] = JOY1[15:12];
1'b1: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end
else if (DDR1[6:5] == 2'b11) begin
case (PDR1O[6:5])
2'b00: PDR1I[3:0] = JOY1[ 7: 4];
2'b01: PDR1I[3:0] = JOY1[15:12];
2'b10: PDR1I[3:0] = JOY1[11: 8];
2'b11: PDR1I[3:0] = {JOY1[3],3'b100};
endcase
end
end
The logic above, only shoves the button data into PDR1I, if the DDR1 bits are set a certain way.
I don't think it sets them that way, if the game detects the ID for the light gun.
So yeah, I need to add a specific type for the LG, in there.
Then just shove some buttons into PDR1I, for Trigger and Start.
JOY1 / JOY2 mapping, on Saturn core...
bit
[0] = 1'b1 (unused)
[1] = 1'b1 (unused)
[2] = 1'b1 (unused)
[3] = L
[4] = Z
[5] = Y
[6] = X
[7] = R
[8] = B
[9] = C
[10] = A
[11] = Start
[12] = Up
[13] = Down
[14] = Left
[15] = Right
case (JOY2_TYPE)
PAD_LG_EMU: begin
PDR2I[3:0] <= JOY1[
end
Was gonna do that, but then PDR2I only has four bits there.
I think Start and Trigger do go direct to bits 5 and 4.
Yep, must be...
output [ 6: 0] PDR2I,
Strange that it's always sent 4 bits at a time otherwise
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY1[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
I think that must just work.
Yeah, I'm realizing now - that's how it communicates with most standard controllers.
By toggling the output bits [6:5], then reading a nibble at a time on bits [3:0].
So it has support for Gen/MD joypads, too.
For the more complex controllers, it clocks in multiple nibbles.
But the light gun is weird, as it directly maps the buttons to two of the bits.
I'm already spoofing the light gun ID in the SMPC, so might not need too much else.
might work if you fake A0 elsewhere, else you have to do the 4 bits read a couple times to get the id.
I'm using the JOY1 buttons to map to PDR2, btw, because MiSTer makes it hard to use Player 2, unless you have two physical controllers.
And I don't want to mess with the remapping function, as it sounds like a nightmare. lol
Yep, it's doing the A0 thing in the SMPC.
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
PS_TYPE_SEL: begin
if (MD_ID == 4'hB)
PORT_ST <= PS_DPAD_0;
// else if (MD_ID == 4'hD)
// PORT_ST <= PS_MD_0;
else if (MD_ID == 4'h3)
PORT_ST <= PS_MOUSE_0;
else if (MD_ID == 4'h5)
PORT_ST <= PS_ID5_0;
else if (MD_ID == 4'hF || 4'hA)
PORT_ST <= PS_NOTHING_STUNNER;
else
PORT_ST <= PS_END;
end
There is an ini option to bind specific USB ports to specific player indices
Core compiled. With just the thing for enabling the LG Emu on Port 2, but allowing Digital Pad on port 1.
Yeah. I try not to mess with too much remapping stuff, after spending so many months ironing out issues for previous projects.
That "wheel" option is super annoying. lol
yeah that needs fixed. someone did the usb stuff early on. was it you Nolbin?
Didn't know the small cursor arrows, relate to which players it detects the Light Gun on.
So now it's only showing for Player 2, when the menu option is enabled
But of COURSE, I still can't get into the menu. lol
So yeah, it probably is forcing it to use the buttons on the gun now, which I haven't mapped yet.
Getting there, though.
Srg would have had all of this working, between snacks.
"P2OFH,Pad 1,Digital,Off,Wheel,Mission Stick,3D Pad,Dual Mission,Mouse;",
"P2OIK,Pad 2,Digital,LightGun Emu,Wheel,Mission Stick,3D Pad,Dual Mission,Mouse;",
Yeah, but I don't recall that issue existing at the time
so either it was introduced when he reworked SMPC, or we both just missed it initially
it's from the rework i think
pad 1 may not have worked if you had A0,A0. needed it for just port 2.
Oh, OK, so the debug thing really was showing for both ports.
I thought it was only showing the OREG stuff for one port at a time.
oic now.
Both displayed at once.
0xF1 is the joyport1 half
0xA0 joyport 2.
So now it's only mapped to joyport 2, which I think will be easier in the long-run.
But simple enough (later) to choose to map to either port.
Which will just replace the "Off" option on the Input menu.
Presumably, none of the other bits in the OREG regs for Joyport 2 should change, when in Light Gun mode.
It just reads direct from PDR2I, bits [5:4].
No idea if the actual H/V counter stuff will work yet.
Can you get a USB mouse to map as the Analog stick on a joyport ?
Actually, might just work via the Scroll Lock thing.
F1 is the port status. the 2 in 02 is the data size iirc
not sure you can replace "off" option. One game might not boot with something in port 2 or something weird like that. Does anyone remember something like that?
Possibly.
I'll change it back to a separate option, then.
Which will state whether it's for port 1 or port 2.
Mouse mode works in Virtua Cop.
ie. USB Mouse -> Saturn Mouse.
But there's no fun in that.
there is if that's how your light guns work. There is a guy in england that sells mame guns with IR bars that work like a mouse input
Currently looking to get USB light guns etc., working on the Saturn core, as if they are the original gun.
So it should make it the most compatible, with all Saturn light gun games, in theory.
I have no idea how many of the games support using a Saturn mouse, though. Maybe quite a few / most?
The Shuttle Mouse is usually compatible with FMV and Point-and-click type adventure games and RTS titles like Z. it was also used as a substitute for the Virtua Gun in Virtua Cop or in games with no light gun support at all, such as Revolution X.
The European PAL version of Myst advertises as being compatible with the Shuttle Mouse, despite th...
Wow.
Way more than I thought. lol
I forgot the Saturn was the system of RPGs.
And probably a hell of a lot of Mahjong.
US was working on 32x while Japan was working on Saturn. The libraries reflect that.
Man, that reload system sucks, on V Cop.
And I'm usually quite fast using a mouse. lol
Oh, this is the broken mouse. sigh
I literally just replaced it with a new mouse, a few weeks ago, as the buttons were wearing out.
@regal holly was the LG module guy maybe he'd bee interested in trying it after you get it working or have some tips
Yeah, would be good to get his input on it, excuse the pun.
Like adding the crosshairs stuff, etc.
That kind of thing is quite fun in Verilog, usually.
Doesn't say that the DDR bits, nor TH/TR need to be set a certain way, to read the buttons.
So might work, on this next compile.
It only says to set the DDR stuff, to route the External Latch input to VDP2.
But we won't be doing that either.
It will just continually latch the H/V values from the joystick X/Y thing, during Vblank.
Only 18 minutes into the compile.
Expect it not to work. lol
Anyone know how I managed to change the menu to that format?
you hit select/back
I added crosshairs to PSX. When I did it, my initial implementation used two 8- or 9-bit adders to check whether the pixel being drawn was close enough to the gun location to draw the crosshair.
Robert and friends informed me that there wasn't enough logic space to go wasting it on adders, and helped me do it more efficiently
One of the first things I wrote in Verilog, was a crappo version of the Quantel Paintbox.
But it was a really fun way to learn about drawing things on-screen, just using pure logic, and no CPU.
@clear condor I really need to chat with Robert or somebody, about making the logic/maths more efficient, for the DC PVR2 thing.
I'm sure a maths person would know a better method right away.
Instead of this ridiculous mess.
I based it on the reicast code, but with quite a few tweaks.
Including suggestions from Claude AI, and ChatGippity.
struct PlaneStepper3
{
float ddx, ddy;
float c;
void Setup(float FX1, float FX2, float FX3, float FY1, float FY2, float FY3, float FZ1, float FZ2, float FZ3)
{
float Aa = (FZ3 - FZ1) * (FY2 - FY1) - (FZ2 - FZ1) * (FY3 - FY1);
float Ba = (FX3 - FX1) * (FZ2 - FZ1) - (FX2 - FX1) * (FZ3 - FZ1);
float C = (FX2 - FX1) * (FY3 - FY1) - (FX3 - FX1) * (FY2 - FY1); // Cross Product?
ddx = -Aa / C;
ddy = -Ba / C;
c = (FZ1 - ddx * FX1 - ddy * FY1);
}
__forceinline float Ip(float x, float y) const { return x * ddx + y * ddy + c; }
}
The negatives before the Aa and Ba terms really threw me. I have no idea if Verilog even handles that correctly. lol
That's a lotta multiplies! How wide is each FZ value?
I even tried using ChatGippity, to try to combine some of the terms, then share those results between interp blocks.
That's the problem - I haven't yet characterized the typical range of values used in games.
But most of the time, Z is between 0.0 and 1.0.
Other times, it can go up to +500, or more. It's so weird.
Like, for hud elements close to the camera, some games use massive Z values.
I'm using 19 bits of fraction for Z atm.
I have to do everything using fixed-point, too.
There's no way I'd ever figure out how to do it all directly on the incoming float values.
The the X,Y,Z values, and UV values, all start life as 32-bit floats. Almost IEEE 754 standard, but not quite.
Is this feature planned for SEGA Saturn core?
So my first challenge was doing float-to-fixed conversion.
module float_to_fixed (
input wire [31:0] float_in,
input wire [7:0] FRAC_BITS,
output wire signed [47:0] fixed
);
wire float_sign = float_in[31];
wire [7:0] exp = float_in[30:23]; // Sign bit not included here.
wire [23:0] man = {1'b1, float_in[22:0]}; // Prepend the implied 1.
wire [63:0] float_shifted = (exp >= 8'd127) ? ((man<<FRAC_BITS) << (exp - 8'd127)) : // Exponent is pos.
((man<<FRAC_BITS) >> (8'd127 - exp)); // Exponent is neg.
// Intermediate wire for the converted value
assign fixed = float_sign ? $signed({1'b1, (~(float_shifted>>6'd23))+1'd1}) :
$signed({1'b0, ( float_shifted>>6'd23)});
endmodule
I'm sure I'm probably ditching some fractional bits there.
Even if FRAC_BITS is set quite high.
I guess with FRAC_BITS set to 23, that would always give the highest precision, for numbers between 0.0 and 1.0.
But then the integer part often overflows, and it all goes haywire.
It wouldn't be too hard to add, and I don't think it would use much logic.
IIRC, the Composite Blend thing is pretty much a LERP.
(Linear Interpolation)
Or just "Current Pixel / New Pixel"
I added the original Adaptive Blur thing to the MD core.
So it detects when a tile has the checkerboard dithering pattern.
Kitrinx did the Composite Blur logic, IIRC.
I thought this WAS "the thread".
this is the sega saturn channel
I was talking about Saturn light gun stuff, for about the past four hours.
yes, I can see that
Where's the issue?
It was removed to make room on the fpga for other stuff. It may come back one the core gets closer to “done”
Was trying to debug STV stuff for the first part of the day.
People talk about pancakes, kittens, movies, and all sorts.
But it's always a problem when I post a lot, about dev, mostly about the system related to the channel?
This is technically the Sega Saturn forum post in the mister-cores channel - and thanks to Discord's mindblowing competence, you can't make a thread in a forum post
only in a top-level channel
Light gun buttons thing doesn't work.
Shows the flashing cursor next to Gun Adjust, with the option enabled in the OSD.
Can't get it to enter that menu, whether I use Joypad 1 buttons, or hit Scroll Lock, to use Joypad 2.
Anyway, leaving it there for tonight.
Trying for a "wall of pics" instead.
It warms my heart to see the Saturn thread this lively again!
Also thank you everyone who is working on getting usb lightgun support! It's been the "big" feature that I've been waiting for for a long time on the Saturn core.

Can the mister support a usb gamepad with the same inputs as the 3d pad?
Not yet since there is no support for analog triggers.
But a usb controller analog stick does work.
I was mistaken about the triggers anyway. I am still looking for a six face button pad with analog triggers.
Yeah, that Retrobit Saturn pad pro or whatever it's called bizarrely didn't include analog triggers.
Nah, I was looking at the Victrix pro
It’s just like the hori pad though- 6 face buttons, single analog stick, but the triggers are digital.
Did someone say lightguns?
Sadly, I didn't get to do the virtual lightgun support on Saturn so not sure about the details.
Nobody has implemented Virtual Lightguns on the Saturn core, would be great if someone could get that working. House Of The Dead alone would be amazing
I’m eagerly awaiting to test my guncon2. Thank you @untold cloud and @clear condor even if this is a WIP I am so thankful this is being explored. I was literally looking at buying a snac adapter and virtua gun tonight. Not anymore 🙂
No flickering for me with latest unstable : Dual / Single (Original Timing)
Thanks for checking. That confirms it. An issue that affects only the illustrations in sfa 2, and only on my MiSTer! A MiSTery indeed!
when you turn off the VDP2 NBG0 you still see the flashing pixels ?
So, these saturn arcade titles, just load faster or have anything else different from the console versions?
Hi all, Having finally got myself a ST-V and a multi-cart I was wondering what games are significantly different or better on the ST-V compared to Saturn and which games are exclusive to it? Re
Whole screen goes black when I do that. It does make me wonder if the Steep Slope Sliders bug that I joke about sometimes is also a my MiSTer problem.
ok that means no layer leaves errors , the more strange it is
can you describe the problem again ? is it related to interlace on crt ?
Effect 03 and 04 don't display properly on the crt. I think they are supposed to look like a tunnel but on mine its an unwatchable flashing strobe.
And, weirdly enough, it looks normal when I video it
Yeah, tried that too
Unfortunately, I have no way to verify this on Saturn right now
flicker like crazy on real hardware
God that hurts to look at
yes , strobo
Wow! I was so sure it wasn't supposed to be like that
Just go outside and poke at an ant hill.
Sorry, all. Need a break for a while.
Feeling quite disheartened about a few things recently.
I still have total burnout from building PCB stuff, hence the new GD Emu, DC mobo, and other stuff hasn't been done.
And then I see some STUPID comments from certain people on other servers yesterday.
I don't understand what their mindset is? They do realize half the stuff I work on, is to hopefully inspire others (or the original dev) to finish it? lol
So yeah, I'm not too sure why I bother. Sorry. Just being honest.
Reminds me of when I got a USB CD drive working on ao486 years ago.
But I never bothered doing a PR for it, because "Everyone uses SD card or NAS these days".
And it only required a small tweak to the main MiSTer code, without affecting the core itself.
I'll probably look into the LightGun emu stuff again, once the actual lightgun arrives, which I can use for testing / reference.
OK, I'd better stop ranting now, before it gets worse. lol
What's the lightgun angle ? I have a real lightgun and I have a new Retroshooter gun and I love that thing
my guy, you must learn the art of JOMO, the joy of missing out. block ‘em and and enjoy seeing that their words are blocked
Was attempting to get LightGun "emulation" working on the Saturn core yesterday, so people can use USB lightguns with it.
That would include the Retroshooter then!
But I don't know if the Retroshooter works with mister af all
i’d drive myself mad seeing their words without a chance to have it covered by default
So that's the first question
This is on a Patreon-only server, thankfully. I only found out about it through some friends.
It wasn't the worse comment in the World, by far, it just really bugged me, as I don't get their mindset at all.
Oh I just unceremoniously leave communities that make me feel some kind of way
But if it's random people then you just can't let them get to you
I'm pretty sure I'm hated by half the Shmup community
I'm probably just oversensitive (again) atm, it was just a very weird thing to say.
Do you know the reason why? Because I was encouraging people to clear games with multiple credits instead of always going for a 1CC
🤣
it’s not wrong to care, it’s just wrong to let that be exploited
Yeah exactly
Can't let people take advantage of your generosity
But you should also do things that make you feel good, not for the credit
I probably shouldn't post the screenshot on here. It was quite a mild throw-away remark by two people, just super weird.
It's not worth trying to figure out their mindset. They are irrelevant. They are inconsequential. They are not worth your time.
your happiness, doing what matters to you, for no other reason than that is your mission in life
Doing things for any sort of credit and recognition is a great way to fuck yourself.
Exactly
It was basically somebody saying about Srg releasing the core tweak, with the initial STV support.
And somebody saying "That'll show ElectronAsh!".
And then another person (who I used to talk to) repeating it.
Hey ash, thanks for setting the ground work on the Jag core. That core brings me a lot of stupid joy, and that’s partially because of the work you did - so thanks.
Like, what do they think I'm doing this for? A competition? LOL
That doesn't sound worth engaging
That's just drama
That or it's just friendly competition
i’ve spent a year failing to figure out how to even start with a simple rom hack
It's not that I even do it for that, as such. But when an offical PR is done, and it's 90% my code, I'd just like a simple credit / mention, out of principle.
I've always strived to mention the OG devs, wherever possible.
Life became so much simpler for me many years ago when I simply decided to stop giving a shit about what others (except for those closest to me that I care about) thought about me.
in one day you probed and layed out that yes it can be done within the already 98% full chip
I thought I'd got WAY better at that in recent years, but some things can still get to me. lol
I mean that's obvious that they don't care about who did the ground work
It might have even been meant as a kind of in-joke, but it didn't come across that way.
Well, this is also true. lol
tbf, most people don't care too much who did what, as long as they get their free cores, at the end of the day.
(and I'm not saying that as somebody who has ever finished writing a whole core, btw.)
I got Arkanoid about 85% done, but then helped another dev to finish his version.
That's the only time I attempted to write most of a core.
Definitely don't want to be attempting another arcade core any time soon. lol
And now I'm probably off-topic again. sigh
Hey, what's with all this drama?
Get back to work on my free stuff! 😏 🤣
Time to get happy as a silent invisible force of nature who gets no credit
(kidding!) 😛
Retroshooter is pretty sick btw
so I dont have to doom scroll...where is the STV core with left enabled?
I did that for about four years, after working on JAMMIX. It was... quite good, actually. lol
Helps keep the trolls at bay, if you just appear online as an "anonymous" company.
(with help, of course. Two very good friends, whom I've yet to meet IRL.)
@mortal mist or someone get us back on track
@untold cloud did you post the "left works" core here? I cant remember now
Yep, just sent the RBF to a friend, so I actually know where it is, for once. lol...
SingleSDRAM though.
awesome thanks
The only thing I changed, was the Direction button fix thing.
// PORTs A, B, E, F. (Player 1, 2, 3, 4)...
//
// b7 = Left
// b6 = Right
// b5 = Up
// b4 = Down
// b3 = Button 4 (P3/P4 use this for Start)
// b2 = Button 3
// b1 = Button 2
// b0 = Button 1
//
//assign IN[0] = {1'b1,JOY1[15:12],JOY1[9],JOY1[8],JOY1[10]}; // Srg's original mapping.
//assign IN[1] = {1'b1,JOY2[15:12],JOY2[9],JOY2[8],JOY2[10]};
assign IN[0] = {JOY1[14], JOY1[15], JOY1[12], JOY1[13], 1'b1, JOY1[9], JOY1[8], JOY1[10]}; // PORT-A (P1). Fix by EA.
assign IN[1] = {JOY2[14], JOY2[15], JOY2[12], JOY2[13], 1'b1, JOY2[9], JOY2[8], JOY2[10]}; // PORT-B (P2). Fix by EA.
See - comments. ^ lol
It's like "comment tumbleweed" in some cores.
No fix for Start on games like Cotton yet.
Srg did do some related tweak to the SMPC.
He might know how to fix the Cotton issue.
No idea why Die Hard still crashes. Like, REALLY crashes.
The poor SH2 reads some garbage code, then just keeps running until the Address wraps, then freezes.
Not even a Reset helps. You have to reload the MRA/RBF.
Rant over, btw. For now.
Feeling a lot better already. lol
Gotta let off some steam, Bennet.
it does, you need the latest unstable main
Gun sends a mix of keyboard presses, mouse button presses and EV_ABS position data.
Added a QUIRK_LIGHTGUN_MOUSE quirk which passes the mouse button presses through the input system like other EV_...
all hail @past ice
I mean to be fair my mister is connected to a CRT right now with real lightguns
mine just arrived today i need to check it out myself
And also I don't think there's many lightgun games on mister that I REALLY want to get deep into. But get you could play time crisis PS1 with a pedal!
That's damn nice!
i am shocked how nice the pedals are
I'm shocked at the whole build quality
i was 100% expecting to toss them lol
Like completely
yeah it feels premium all over
The guns are legit like holy shit level of build
the recoil is violent too lol
However the slide I do feel over time will need some lube or something
Yeah it's snap snap that's for sure lol
yeah idk if they just need to wear in
Nah that's just how it is, I've put maybe 5 hours of solid ply into mine
Which brand is this?
they have a discord somehwhere i think i should probably go ask if its worth opening to lubricate anywhere or if its done in factory
The sad thing is I haven't gone mame hooked so I manually flip to the autofire mode for certain games or weapons lmao
where would i get one? i have my gun4ir for the big screen, technically I could set it up to work on the tube as well. Just add some LEDs around the screen.
Exactly
Yes it has to be the reaper rs3
i might buy the SMG they make now though cos god-damn
day 1 video. i have since calibrated it snd cleared point blank with it WITHOUT the aiming reticle. i have that turned completely off.
This is literally zero calibration. Just pulled up mame and setup controls and went in
But since then I got the software to calibrate which is easy to use and honestly it's fire.
I'm a little shocked.
nice nice nice
Probably could use the Mouse mode for lightgun games on Saturn, btw.
I just thought it would be nice to get the more "direct" mode working.
ie. emulating the Stunner gun thingy.
Ah wait so
yeah for sure and not all lightguns present as mice
it will but not for saturn yet
The translation layer is mouse
saturn doesn't currently support any virtual lightguns
One of the coolest parts about using one of these infrared guns could be patching the games to remove the bright flash every time you shoot, as it’s no longer needed
Like RS is a mouse and a mouse can then be a guncon
Only if you could use Mouse mode on MiSTer, to use a lightgun as a "Mouse" on the Saturn, if that makes sense. lol
eg. Virtua Cop supports the Saturn mouse, and that works with a USB mouse.
Yeah aware sorry was just talking generally
I really enjoy real Saturn lightguns btw
But I have no idea how well that would work with an actual USB lightgun, emulating a mouse.
No calibration no nothing no cables
the way wickerwaka implemented it mister understands it as a lightgun, even though it talks like a mouse
Yeah that's different
You know what - if it's almost always a full white screen, that could probably be detected in the core, and blanked.
Perfect @past ice you beautiful genius
Would be very hard to repeat the previous frame, though, unless it could be done via ASCAL somehow.
Ohhhh but isn't that killing the vibe tho
making it a black or grey frame instead might go a long way
my gf likes the guns but the flash eventually sets off a migraine
This is genuinely the first time I've ever thought about lightgun games... and people with photosensitive epilepsy.
I'm also the same migraine person btw
lol
It's actually even more of an issue when watching than when playing
Like I don't want to throw up lightgun videos
there is a romhack around for a few games to remove the white flashes, this is a thing
Cuz it's just flash central
i think there's one for time crisis2
Yeah I should get a few and try them
I used to get migranes very often, for about 25 years. For some reason, it rarely happens now, and I don't know why.
But I'm not complaining.
Time crisis 2 is not finished anyways emulation wise but at least it's completable now!!!
Those audio janks are a little oof
But it's still super fun
Anyways Sega Saturn. Hope you feel better Ash. Peace y'all!

I have exactly the same, it used to be terrible , now it happens rarely
Cheers!
I do tend to drink more water these days, but then I tried that many times years ago, for weeks / months at a time, but it didn't help.
2025 is gonna be peak y’all
odd Groove on Fight says it cant find the proper bios but its in the zip
2025 is gonna be peek "No Dreamcast core", at this rate. lol
anyone encounter that?
Or 2025 is gonna be peek "Alejandro got arrested".
Virtua Cop on the big screen, 3DO, maybe just maybe Winds of Winter in my hands too
Which BIOS file is it asking for? Many of the older stvbios.zip files were missing the "default" Japan 23603 BIOS.
must be missing from my zip
<misterromdescription>
<rbf>Saturn</rbf>
<setname>saturnstv</setname>
<rom index="2" md5="" zip="stvbios.zip" address="0x30000000">
<interleave output="64">
<part crc="d1be2adf" name="epr-17952a.ic8" map="21436587" />
</interleave>
</rom>
<rom index="3" md5="" zip="groovef.zip" address="0x34000000">
I can probably side load it in core. We shall see
lol
I think I had 236 as a solo file from a day or so ago
I did; it was in the Saturn games folder as just a .bin so it wasn't in my zip. Perfect
into Groove on Fight now
doing a follow up vid for the weekend
tbh, I don't know how or which folders/files MiSTer will scan, for the MRA / arcade stuff.
It still confuses me, about where to put the zips and MRAs.
I was copying the BIOS into the wrong folder, at first.
I think this is correct, though?...
Saturn_unstable_SingleSDRAM_ButtonFix_EA_20250127.rbf -> /media/fat/_Arcade/cores/Saturn.rbf
stvbios.zip -> /media/fat/games/mame
prikura.zip -> /media/fat/games/mame
prikura.mra -> /media/fat/_Arcade
But apparently don't need to rename the RBF to Saturn. rbf.
yes thats what worked for me
I had the 236 bios sitting as a .bin in the sautnr folder
Probably make sure there is only ever one Saturn****.rbf ?
Ahh, OK.
23603 is the one MAME generally defaults to, for most of the Japan games.
Sorry, was too tired to read through posts from the ping last night. So @untold cloud you're implementing virtual lightguns in Saturn or is this something else?
17952 for US, 17954 for Euro. Something like that.
Yep, virtual. So USB -> Saturn LG, etc.
It's... quite convoluted, even to get it to recognize the Stunner is hooked up.
Right, I've done that for a few cores, it's fun.
I'm not sure I'd call it fun. haha
I don't have the changes on a fork yet.
I just git cloned from Mr Devil.
Don't know how to do a fork after the fact, then add the changes.
Unless I just make a backup. git clone, then copy the changes in. I'll do that.
What were the changes from Mr Devil compared to main?
I'll do the fork thing...
Yeah, it's kind of funky to rebase your source and reapply changes but I've done it
Whenever it hits that level of git I'm just following instructions off stack overflow hehe
following directions is what separates the intelligent from the stupid haha
"P2OFH,Pad 1,Digital,Off,Wheel,Mission Stick,3D Pad,Dual Mission,Mouse;",
"P2OIK,Pad 2,Digital,LightGun Emu,Wheel,Mission Stick,3D Pad,Dual Mission,Mouse;",
"P2OR,SNAC,OFF,ON;",
Enabling the LightGun thing basically breaks the normal joypad input atm.
The change in SMPC.v, is to force the MD_ID for the Stunner thing.
Which does let Virtua Cop detect the gun (on Joyport 2 only, atm).
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
See, now I'm worried about posting too much again. sigh
Plus the fix for the Directions.
//assign IN[0] = {1'b1,JOY1[15:12],JOY1[9],JOY1[8],JOY1[10]}; // Srg's original mapping.
//assign IN[1] = {1'b1,JOY2[15:12],JOY2[9],JOY2[8],JOY2[10]};
assign IN[0] = {JOY1[14], JOY1[15], JOY1[12], JOY1[13], 1'b1, JOY1[9], JOY1[8], JOY1[10]}; // PORT-A (P1). Fix by EA.
assign IN[1] = {JOY2[14], JOY2[15], JOY2[12], JOY2[13], 1'b1, JOY2[9], JOY2[8], JOY2[10]}; // PORT-B (P2). Fix by EA.
Srg just skipped a bit there, and had the 1'b1 at the MSB.
I'd pull this all up a to top level, have the EMU look like SNAC to the rest of the system maybe. Have an EMU module doing video timings to know when to send the right stuff.
I have to remind myself how Saturn lightguns work
In HPS2PAD, I tried shoving some button inputs into PDR2I, for Start and Trigger.
But not working yet.
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
haha Elan Doree forgot to bring its textures
And in VDP2, it basically shoves the Joystick X/Y stuff into HCT and VCT, on every Vblank.
Not sure how best to do that, when there's no actual "trigger" involved?
I guess it could do the latch when the Trigger is... triggered.
Which would be almost how the old code worked, for real lightguns via SNAC, just using the X/Y values from joystick_xy instead.
well the games are much better with left @untold cloud
That's essentially what the HPS2PAD module does, emulating the controller responses at the lower level.
But the Lightgun is unique, in that it doesn't really return much, other than the first ID code.
Would be similar to the existing stuff, I guess, but with the first nibble as 0xA.
Like Bernie Sanders?
Latch happens when the external interrupt happens from the photodiode when the right register is set I assume
If it's anything like Genesis.
Yep, old-people style CRT lightgun.
But it's super weird how it gets set up.
PDF page 123.
This stuff essentially just tells the SMPC to route bit 6 on the Joyport, through to VDP2, to do the latch thing.
Then the VDP2 stuff, which I've added a rough approx for...
Yeah, external latch sounds just like Genesis
But I'm just shoving the joystick XY stuff into HCT and VCT on every Vblank atm, as long as the EMU_LG_ENA input is High.
"LightGun Emu" on CONF_STR = status[20:18]==3'd1 -> EMU_LG_ENA on the top-level saturn.sv.
Sorry, I know I'm speaking in core-speak, but I know you'll understand. lol
So, the SMPC is set up, to route bit 6 from the PDR (1 or 2) joyport thingy, into VDP2.
Then the two buttons are read directly via the PDR regs, on bits [5:4].
I tried to do that as a combo assign, in hps2pad.v.
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
But no... Joy.
Oh, and in the SMPC, I'm forcing it to only detect the LG on joyport 2, by checking the PORT_NUM flag...
I'd go the route of setting bit 6 when the HTC/VCT are around the right location based on the joystick/mouse/whatever
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
Yep, could do.
The first thing, was just trying to get it to detect the LG, which it seems to now, in Virtua Cop.
But with the LG option enabled in the OSD, I can't then get any buttons to work, to try the Gun Adjust menu on V Cop. lol
Actually, I think Joypad on port 1 is allowed to work now.
It's just, it won't enter the Gun Adjust menu on V Cop when you hit Start on Joypad1.
It just drops down to the "EXIT" menu option on the game.
And neither Start or Trigger on the LG Emu (player 2) seems to work yet.
If that makes any sense at all? 😛
Oh, and there are two ways the games can read the HCT / VCT stuff for the Light Gun, because of COURSE there is - it's the Saturn.
!REGS.EXTEN.EXLTEN
It can do a direct read of the H/V counters, when that EXLTEN bit (VDP2 regs) is Low.
god damn i love how the Saturn was such a sandbox. many ways to approach a problem
Or, it does the auto-grabby thing, via the actual LightGun trigger input...
Quite clearly, I didn't attempt to get the X/Y stuff from the HPS in the correct range it needs either. lol
The original LG code (for SNAC) looks for the falling edge of the EXLAT_N input, routed from the SMPC / Joyport.
else if (!EXLAT_N && EXLAT_N_OLD && REGS.EXTEN.EXLTEN) begin //EXTEN
// Real (SNAC) light gun support. Srg320.
REGS.HCNT.HCT = {H_CNT,DOTCLK_DIV[1]};
REGS.VCNT.VCT = LSMD == 2'b11 ? {VCT,~ODD} : {1'b0,VCT};
REGS.TVSTAT.EXLTFG <= 1;
end
That EXLTFG then gets cleared, if the TVSTAT reg is read.
Yeah, once per VBLANK it gets set
Anything in VDP2 with the if (EMU_LG_ENA) begin is the stuff I added, btw.
The else-if stuff after that, is the original Srg / SNAC LG code.
Sorry, been busy getting my kid ready for the doctors
I'm assuming the Start and Trigger bits on PDR are active-low.
We're both sick with convention crud
As are the JOY1 and JOY2 inputs to hps2pad, IIRC.
Sorry to hear that. 😦
I haven't had a bad flu since about November, and I'm still not 100% now.
I'm doing okay with it but I had my flu shot. I'm only realizing now she didn't get hers this year.
Don't think I've had an actual flu shot since about 1986.
I probably should think about that soon. Dunno.
I've been listening a lot to RFK Jr. (joking. lol)
OK, probably should avoid that talk on here, sorry.
Just a thought, but...
If hps2pad is handling most of the controller type stuff at a low-level.
Then surely the SMPC stuff could be made more generic, without the specific states for each controller type?
Or maybe it really does need support for each controller type?
Would have to know how the OREGs stuff is mapped, for each of them.
Looking at the change, I'd avoid changing VDP2 as much as possible. You could probably get away with changing it completely except maybe where pin6 is read for the external latch, where you'd have a second signal when virtual guns are enabled
I'd get the gun buttons working first before anything to rule out that
I'd do the signal check at an upper Saturn level so you don't need to plumb mouse/gamepad coordinates through the whole system, although I guess if they're already there in some capacity maybe it's less of an issue.
With Genesis they weren't so I only added an additional GUN_EN and GUN_LIGHT signal (names might not be what they were)
those fed into what would be hps2pad, who would then output the correct pins
but the whole calculating when the light signal would trigger happened in a new upper level module that would translate mouse/gamepad/etc into when the lightbeam should be detected
You should also get an idea of the actual light diodes behavior since you might not want to just set the signal at the exact location
An easy trick to visualize this is just to set the red channel to max when the signal is low (high?) when using SNAC
I see what you mean - don't actually need to use the joystick XY values directly.
I would use them directly, just at a higher level and turn them into a single signal
Just add your usual external module, to emulate when the Latch signal gets triggered.
Yeah.
right exactly
I didn't think of it like that - I was trying the lazy way. lol
Was just hoping to get some activity from it first, then tidy it up later.
That way you don't have to deal with potential edge cases and VDP weirdness you're not aware if. If SNAC works this SHOULD work without additional VDP support
Well to make it easy, just send a signal when the H/V cound is near the center of the screen
and go from there
ignoring gamepads for now to rule them out
I like stuff like that. I've done similar before, when trying to figure out when a signal happens during a frame, by shorting an RGB channel to it. lol
Some stuff in the SMPC manual, which probably helps.
The TH/TR stuff in the core isn't especially well-explained.
But in theory, the LG games don't use the usual INTBACK method to read the controller data.
Just not sure why the LG button inputs aren't working atm, but we really need a LightGun test prog.
Surprised there isn't one
How many buttons are ont he gun besides trigger?
I don't have it in front of me
Apparently just Trigger and Start?
I don't have a light gun yet, btw, I just bought one for £15 yesterday. lol
So I can try it via SNAC first, and use it for reference.
And yeah, I guess it would make a lot more sense to just do virtual LG at the higher level.
USERJOYSTICK <= {USER_IN[4], USER_IN[6], USER_IN[2], USER_IN[3], USER_IN[5], USER_IN[0], USER_IN[1]};//TH, C(TR), B(TL), R, L, D, U
.SMPC_PDR1I(snac ? USERJOYSTICK : SMPC_PDR1I),
.SMPC_PDR1O(SMPC_PDR1O),
.SMPC_DDR1(SMPC_DDR1),
.SMPC_PDR2I(SMPC_PDR2I),
.SMPC_PDR2O(SMPC_PDR2O),
PAD_LG_EMU: begin
case (STATE1)
5'd0,
5'd1: if (PDR1O[6:5] == 2'b01) begin OUT1 <= 4'hA; TL1 <= 1; /*STATE1 <= 5'd2;*/ end
endcase
if (PDR1O[6:5] == 2'b11) begin OUT1 <= 4'h0; TL1 <= 1; STATE1 <= 5'd0; end
end
Maybe only needs something like that in hps2pad?
Then the override for PDR2I, for the buttons, but I don't know what it expects TH and TR to be set to, whilst reading the button inputs?
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
Yeah, trying to find some example code of reading lightguns for Saturn
I think it just differs entirely
I didn't have much luck even finding forum posts for example apps.
Seems like it's not using the same TR/TH method to select bits
First thing that might be worth doing - making a test game
Yeah
PAD_WHEEL,
PAD_MOUSE,
PAD_MISSION,
PAD_3D: begin
PDR1I[4:0] = {TL1,OUT1};
end
I didn't spot that before.
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
I'm not adding TL1 to the "output".
Seems to be used as an Acknowledge signal, for many controller types.
Oh, can't be. Else it would clash with the Trigger signal, on PDR bit 4.
(OUT1 / OUT2 are four bits)
Are you the developer for the gdemu also?
A version of a GD Emu, yep.
I didn't dev any of the existing ones.
gotcha, just love that thing. thanks for working on all this for the Saturn core, it's been great watching y'all figure this stuff out
np. 😉
There is a thread on the Simulant discord, about the new GD Emu, and my other ramblings.
#1289484764973240433 message
I'll check it out!
I used a lot of the code from Marcus Comstedt (zeldin) for the GD Emu.
But got it loading quite a bit faster, just by changing the SD card clock freq.
Then I, for some reason, decided to design a whole new board after, with an STM32 and USB 2.0 on it.
Which I haven't built yet. I've had the parts sat here for about three months, but I just can't face it. lol
Also started some work on designing a "new" CD / GD / DVD drive, for the DC.
But that's not too high up, on the todo list.
Oh, it doesn't look like the joengine supports lightguns
it just has a comment for it heh
I did make something with joengine a few years ago... I wonder if it's on this PC though I think it's on a desktop I have packed away.
I could add lightgun support to the SDK
Looking at other SDKs first
I think I see now.
It needs this, so it can still read the ID, when the SMPC is in SH2 direct mode...
Probably.
Although, that whole ID calc thing makes NO sense. lol
MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]}
I kinda get how the ID is normally read, based on if either pair of bits are set, in the lower nibble of the Joyport.
But the way that PDF explains things looks wrong.
I could understand it, if BIT6 was toggling on and off each time, but it's not.
In theory, the Stunner would just have BIT3 and BIT2 pulled High.
So it would always return 0xA.
Should be 0xFA right?
I thought it was 0xA, as the resulting nibble?
But looks like maybe read like a standard controller, by toggling Bit 6 (TH) ?
It's just, when using the LG, you can't use the normal INTBACK method to read the ID (nor buttons), once IOSEL is set to SH2 Direct mode.
Do they read it before setting SH2 direct?
at the very beginning
'cos that's the only way I'm forcing it atm,
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
Put it this way, as soon as I enable the new LG Emu option in the OSD, Virtua Cop shows a flashing cursor next to the Gun Adjust option.
And as soon as I disable it, the cursor disappears.
No idea if it also needs the "direct" way of reading the ID, but I would assume so.
May be as simple as fixing this, in hps2pad...
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
Found these in an SDK
#define ID_DIGITAL 0x02
#define ID_RACING 0x13
#define ID_ANALOG 0x16
#define ID_MOUSE 0x23
#define ID_KEYBOARD 0x34
#define ID_MD3B 0xE1
#define ID_MD6B 0xE2
#define ID_MDMOUSE 0xE3
#define ID_GUN 0xFA
#define ID_UNCONNECTED 0xFF
So it pulls bits [3:2] High, based on what bit 6 is set to.
Don't know where the 0xF part comes from?
Yeah let me see where it reads them
Hrm just
#define PC_GET_ID(x) (OREG_GET((x)) & 0xFF)
Oh, OK.
PS_DPAD_4: begin
OREG_DATA <= 8'hF1;
OREG_WRITE <= 1;
PORT_ST <= PS_DPAD_5;
end
PS_DPAD_5: begin
OREG_DATA <= 8'h02;
OREG_WRITE <= 1;
PORT_ST <= PS_DPAD_6;
end
See, the LG doesn't seem to do that...
It gets detected earlier-on, like an MD style pad.
So a simpler protocol.
With only the "first" ID thing, as 0xA.
Very hard to explain, without posting more code chunks.
PS_ID1_4: begin
if (EMU_LG_ENA && PORT_NUM) MD_ID <= 4'hA; // Emulated LightGun, on Joyport Port 2.
else MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
PORT_ST <= PS_TYPE_SEL;
end
PS_TYPE_SEL: begin
if (MD_ID == 4'hB)
PORT_ST <= PS_DPAD_0;
// else if (MD_ID == 4'hD)
// PORT_ST <= PS_MD_0;
else if (MD_ID == 4'h3)
PORT_ST <= PS_MOUSE_0;
else if (MD_ID == 4'h5)
PORT_ST <= PS_ID5_0;
else if (MD_ID == 4'hF || 4'hA)
PORT_ST <= PS_NOTHING_STUNNER;
else
PORT_ST <= PS_END;
end
//Nothing Detected or Stunner
PS_NOTHING_STUNNER: begin
OREG_DATA <= {MD_ID,4'b0000};
OREG_WRITE <= 1;
PORT_ST <= PS_NEXT;
end
So it just skips all of the usual extra ID stuff that a Digital pad would have.
JOY_DATA etc. comes from when it toggles TH, before that.
The Saturn is SO overcomplex. lol
This stuff...
So the light gun only has the simple "MD style" ID.
Probably just pulls bits [3:2] of joyport [3:0] High, regardless of what TH is set to.
So it ends up merging those two reads as 0xA.
Then it can also read the ID later on, after setting IOSEL to direct mode, by bit-banging the DDR/PDR port regs.
Yep, I honestly think just changing this would be enough for it to detect...
PAD_LG_EMU: begin
PDR2I[5:4] <= JOY2[11:10]; // PDR2I[5]=Start. PDR2I[4]=Trigger.
end
In hps2pad.
Since that overrides any other logic in that file, to assign to PDR2I.
But it needs bits [3:2] set High as well. Not sure if all the time would work, or only if TH (bit 6?) is also set High on PDRO.
Actually, I'll do a compile to test that now, but comment out the 0xA thing in the SMPC.
The Plutiedev discord might be worth consulting.
I have to go for a bit but I'm curious about looking at this from the software side.
PAD_LG_EMU: begin
PDR2I[5:0] <= {JOY2[11:10],4'hA}; // PDR2I[5]=Start. PDR2I[4]=Trigger. PDR2I[3:0]=ID Nibble?
end
That's probably a good idea. lol
I do think that they likely made the LG as cheaply as possible. So not much else going on with the joyport pins, other than pulling some bits High for the "ID".
So they wouldn't even need a mux chip, then.
What I don't get atm, is why they would mess with setting Bit 6 (TH?) of the port, to read the ID.
When that same bit is used for the External Latch input?
Oh, you sneaky sneaky Sergiy.
PDR2I = (PDR2O & DDR2) | ~DDR2;
PAD_LG_EMU: begin
PDR2I[5:0] <= {JOY2[11:10],4'hA}; // PDR2I[5]=Start. PDR2I[4]=Trigger. PDR2I[3:0]=ID Nibble?
end
The combo assign is done as an override thing.
So if you (don't) assign to certain bits, it assigns (PDR2O & DDR2) to those bits.
Gonna try a compile, and have a break.
DDR[PORT_NUM][`THTR] <= 2'b10;
PDR_O[PORT_NUM][`THTR] <= 2'b11;
JOY_DATA[3:0] <= PDR_I[PORT_NUM][3:0];
DDR[PORT_NUM][`THTR] <= 2'b10;
PDR_O[PORT_NUM][`THTR] <= 2'b01;
JOY_DATA[15:12] <= PDR_I[PORT_NUM][3:0];
MD_ID <= {|JOY_DATA[3:2], |JOY_DATA[1:0], |JOY_DATA[15:14], |JOY_DATA[13:12]};
See, normally the "simple" ID is read by toggling TH, then reading bits [3:0] from the port.
On the LG, I reckon bits [3:2] are simply pulled high.
So it would read the same regardless of what TH is set to.
And would still end up with an MD_ID of 0xA, because of the way it merges the bits.