I'm confused.... shouldn't it be a db9 female connector to plug the joystick into?
On Thu, 25 Sept 2025 at 09:21, Mike Stein <[email protected]> wrote: > How often are you going to need the printer port when you're using the > joystick? > > Here's one approach from way back when: > > >*From Kim Holviala kim at holviala.com <http://holviala.com> > *Wed Feb 23 2011 > > Yup, got my side project, the Atari/Commodore joystick interface for > M100 working reliably. > > This is a simple passive interface only requiring two connectors, some > cable and five diodes. Total cost is under $10 including a case for the > Sub-D9 connector. > > Schematic: > > LPT port D9 male > 3 PD0 ------|<------- 1 UP > 5 PD1 ------|<------- 2 DOWN > 7 PD2 ------|<------- 3 LEFT > 9 PD3 ------|<------- 4 RIGHT > 11 PD4 ------|<------- 6 BUTTON > 21 BUSY -------------- 8 GROUND > > Parts: > > 1 2x13 pin female flat cable connector (0.1" spacing) > 1 D9 male connector (solder type) > 1 D9 connector case > 6" 26-pin flat cable (or at least 4 inches) > 5 1N4148 (or similar) > > I used 1N4007 for the diodes, but using something physically smaller > like 1N4148 is easier if you want to fit everything into the D9 case. > > Theory of operation: > > We're doing it all backwards. Instead of feeding ground through joystick > port pin 8 and reading the directions from pins 1-4 and 6, we're feeding > signals through 1-4 and 6 and reading the result from pin 8 (which is > connected to BUSY in LPT port). > > Using with 100% Basic: > > This works (even though it shouldn't) but isn't very reliable. We're > fighting with the keyboard interrupt, and quite often it hits between > our OUT and IN messing up the readings. > > OUT 185,254:U=INP(187) AND 4 > OUT 185,253:D=INP(187) AND 4 > OUT 185,251:L=INP(187) AND 4 > OUT 185,247:R=INP(187) AND 4 > OUT 185,239:B=INP(187) AND 4 > > Variables U/D/L/R and B now contain 0 if that particular direction is > selected and 4 if the direction is not selected. > > Mostly Basic, but some assembly required: > > This version seems to be 100% reliable even though it doesn't disable > interrupts between the assembler out and in. > > 10 CLS > 20 A$=CHR$(211)+CHR$(185)+CHR$(219)+CHR$(187)+CHR$(119)+CHR$(201) > 30 AS=PEEK(VARPTR(A$)+1)+(256*PEEK(VARPTR(A$)+2)) > 40 U%=0:D%=0:L%=0:R%=0:B%=0 > 50 CALL AS,254,VARPTR(U%):U%=U% AND 4 > 60 CALL AS,253,VARPTR(D%):D%=D% AND 4 > 70 CALL AS,251,VARPTR(L%):L%=L% AND 4 > 80 CALL AS,247,VARPTR(R%):R%=R% AND 4 > 90 CALL AS,239,VARPTR(B%):B%=B% AND 4 > 100 IF U%=0 THEN PRINT " U" ELSE PRINT " *" > 110 IF L%=0 THEN PRINT "L "; ELSE PRINT "* "; > 120 IF R%=0 THEN PRINT "R" ELSE PRINT "*" > 130 IF D%=0 THEN PRINT " D" ELSE PRINT " *" > 140 IF B%=0 THEN PRINT "BTN" ELSE PRINT " * " > 150 PRINT CHR$(11); > 160 GOTO 50 > > The assembler code on line 20 is as follows (needs a bitmask in A, > outputs joystick info to [HL]): > > out 185 > in 187 > mov m,a > ret > > That's about it. Now back to the WiFi adapter... > > > - Kim > > > On Wed, Sep 24, 2025 at 4:57 PM Scott McDonnell <[email protected]> > wrote: > >> The BCR port was attractive to me because it is a port I wouldn't be >> using for anything else. That is really the main reason aside from the >> interrupts. >> >> The idea was to use a microcontroller which would allow me to fit the >> electronics inside the joystick body. I really only need a start bit to >> get the CPU attention and then stream my switch states. That was the >> idea, anyway. That is pretty much how the BCR would work, I would think. >> Well, originally the thought was to duplicate the BCR and send keycodes >> which could use the existing driver. But I am not sure if the arrow keys >> would be included somehow. If so, it could potentially work with any >> software that uses the arrow keys. >> >> I am surprised that I had not thought of scanning the keyboard the >> opposite way, though. That is a clever idea. >> >> I did think about simply wiring into the arrow keys on the keyboard, but >> I was trying to keep it external for community use. >> >> I still think the community should decide on some standard for a mod and >> make use of the several NC wires in the BCR port. I am aware of the mod >> to add a serial port there and that seems very useful. >> >> Thanks for all of the suggestions. >> >>
