undeadmechanic Posted September 6, 2017 Author Share Posted September 6, 2017 This is what I wound up with last night before I went to bed. Genesis VS 800 XL... 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. 1 Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 6, 2017 Author Share Posted September 6, 2017 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. Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 7, 2017 Author Share Posted September 7, 2017 (edited) 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 September 7, 2017 by undeadmechanic Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 11, 2017 Author Share Posted September 11, 2017 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 2 Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 11, 2017 Author Share Posted September 11, 2017 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. 6 Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 13, 2017 Author Share Posted September 13, 2017 (edited) 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. 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. 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 September 13, 2017 by undeadmechanic 2 Quote Link to comment Share on other sites More sharing options...
mykgerard Posted September 13, 2017 Share Posted September 13, 2017 now to create hacks for every game that ever used a spacebar for a second button.. lol 2 Quote Link to comment Share on other sites More sharing options...
undeadmechanic Posted September 13, 2017 Author Share Posted September 13, 2017 now to create hacks for every game that ever used a spacebar for a second button.. lolNot 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... 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.