Jump to content
IGNORED

Sega Genesis 3 and 6 button controller project.


undeadmechanic

Recommended Posts

This is what I wound up with last night before I went to bed.

 

Genesis VS 800 XL...

 

post-13069-0-50454400-1504657739_thumb.png

 

post-13069-0-77758000-1504657745_thumb.png

 

Aside from a 1.4 volt difference due to some trickery with a resistor, it's pretty dang close. I got it to within 0.5 microseconds of the Genesis timing.

 

Here's the code thus far:

 

10 ; Sega Genesis 6 Button Controller

20 ; Driver v0.1

30 .OPT OBJ

40 PACTL = $D302

50 PORTA = $D300

60 *= $0600

70 INIT PLA

80 LDY # <VBI

90 LDX # >VBI

0100 LDA #$07

0110 JSR $E45C

0120 LDA #$38

0130 STA PACTL

0140 LDA #$FF

0150 STA PORTA

0160 LDA #$3C

0170 STA PACTL

0180 RTS

0190 VBI

0200 LDX #$00

0210 LDY #$FF

0220 STX PORTA

0230 JSR WAIT

0240 STY PORTA

0250 NOP

0260 NOP

0270 NOP

0280 NOP

0290 STX PORTA

0300 JSR WAIT2

0310 STY PORTA

0320 NOP

0330 NOP

0340 NOP

0350 NOP

0360 STX PORTA

0370 JSR WAIT2

0380 STY PORTA

0390 NOP

0400 NOP

0410 NOP

0420 NOP

0430 STX PORTA

0440 JSR WAIT

0450 STY PORTA

0460 JMP $E462

0470 WAIT LDA DELAY

0480 STA LOOP

0490 COUNT DEC LOOP

0500 BNE COUNT

0510 RTS

0520 WAIT2 RTS

0550 LOOP

0560 *= *+1

0570 DELAY .BYTE $01

It's ugly and unrefined, but it was only to get the timing as close as possible to the Genesis.

I don't know what happened to it, but I had a more advanced driver than this somewhere and misplaced the ATR file since I worked on this last.

Oh well, not the first time I've started over. :(

  • Like 1
Link to comment
Share on other sites

Tonight's' progress report: Rewrote the section that gets the status of the Start and A buttons. I decided that instead of using a memory location somewhere inside my program space, I would just stuff the values into the shadow registers for STRIG2 and PADDL4 since they are unused on the XL/XE, and it has the added bonus of working with STRIG(2) and PADDLE(4) commands in BASIC for quick testing.

 

And I remember now why I said this....

 

I tweaked the handler just a tad and now instead of reading the start button 30x/sec (every other vblank), it reads it every single one. But, if it *thinks* the start button is pressed, it waits an extra vbi cycle to verify that it is indeed the start button before it updates the register.

 

I need to draw out the circuit so other people can build it if interested. The whole thing is about $10.00 worth of parts, depending on where you purchase them.

 

I'll have to redo that part tomorrow. Time for bed.

Link to comment
Share on other sites

My mom made a surprise visit tonight, so didn't get very much done. I restored full 3btn function to my driver and realized that I'm an idiot in the process. No point in using PADDL4 as a register for the start button when I can use PADDL1, since it's on the same damn joystick port... :/

 

Cleaned up the code a bit & temporarily removed 6btn polling from the PWM output driver until I polish the 3btn function to perfection. Sadly, my AspeQt machine seems to have died this evening. Was going to post the current code until that happened.

 

Also, I acquired an MIO and SCSI2SD since the last time I was messing with this and I absolutely love it. Soooooo much faster.

Edited by undeadmechanic
Link to comment
Share on other sites

Ok, here is the first version that is 100% functional with 3 btn controllers. It does not have any functions in it for 6 btn though. That's still to come.

 

This ATR has MyDOS, the Mac/65 Source and binary, and "BTNREAD.BAS". The BASIC program just displays the button values for testing purposes.

 

Now I've got to draw up the circuit diagrams to share.

 

I'm getting there, guys! :)

 

Genesis Controller.atr

Genesis Controller Driver Source.txt

  • Like 2
Link to comment
Share on other sites

Here is the basic diagram for 3 button controllers. The only things in this circuit are a 74LS32 OR gate, 4 diodes, and a male and female DB9 jack.

 

This will also work with a 6 btn, but it will only be able to read it as a 3 btn.

 

Feel free to laugh at my diagram, this is my first attempt at drawing out a circuit. I laid this out in a mental image when I built the first one. I've got to draw out the V2 interface, but I'm not done with the driver yet, so no hurry.

 

Also, please remember that I am a mechanic with LOADS of experience with electronics (and releasing magic smoke), but I am most definitely not an engineer. :( I've just been tinkering with Ataris since I was about 6 years old.

 

post-13069-0-26375500-1505099528_thumb.png

  • Like 6
Link to comment
Share on other sites

Just had my eureka moment with the oscilloscope! I finally found my second lead for it and was able to monitor the select line and the UP/Z line at the same time to see exactly what was happening.

 

This is with nothing pressed.

 

post-13069-0-87542700-1505266154_thumb.png

 

One long low pulse gets the state of the A and Start buttons, followed by two quick low pulses. On the third low pulse, the UP line goes low as the controller acknowledges the "secret knock". Then, the select line is set high. Since nothing is pressed, the UP line goes high the instant the select line goes high.

 

Now, this is with Z pressed.

 

post-13069-0-05358400-1505266186_thumb.png

 

Same thing as before, but on the third low pulse, the UP line stays low when the select line goes high. It stays low until the select line is pulled low one last time to return the controller to it's normal state. THAT is the instant the controller reports the state of X/Y/Z/M!

 

Now to bang it out.

Edited by undeadmechanic
  • Like 2
Link to comment
Share on other sites

now to create hacks for every game that ever used a spacebar for a second button.. lol

Not quite, lol. I have some ideas regarding that.

 

While I was playing around with it last night, I discovered that I'm still facing the same problem as before... my select pulses perfectly match the output of a real Genesis, but original 6btns refuse to respond. I have a cheap YOBO knockoff that works perfectly for some reason. This requires more investigation.

 

So close...

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...