• Emulating a potentiometer for the Atari 5200

    10/28/2019 at 23:30 0 comments

    So far the controller adapters I have seen for the Atari 5200 and that can provide analog control use a used a digital potentiomenter (and extra capacitance). 

    This is certainly a nice solution but there are other alternatives, though:

    1) Keep series resistor constant, vary the voltage applied to charge the capactor (just like the trackball do)

    That can be done with a PWM providing 0-5V and some resistors in a network to match the desired voltage range. This method is used on the CX-53 trackball. 

    2) Detect when capacitors start to charge and hold the line down until the desired count, then push the line to +5V

    It is a pity that the architecture of the Pokey Chip, used by the Atarti 5200 to read the potentiometers do not discharge the capacitors at the beginning of the sampling cycle but at the end. The only mark of the beginning of the charge is that the voltage over the capacitor starts to ramp up and that can be done by the analog comparator of a microcontroller set to a voltage that is below the minimum Vih (1.9V). Luckly there is plenty of time to react to that, as the pokey counts in Hsync lines (64us ).

  • NES Hypershot Controller Pinout

    09/24/2019 at 05:43 0 comments

    I have acquired recently a Hypershot controller for Famicon model JE506. Such controller comes in a pair and share the DB-15 connector to be attached on expansion port.

    Given the state of the buttons I wonder if the previous owners were Wolverine and Sabertooth...

    Nevertheless I got some reading on NesDev Wiki that pointed that the Hypershot controllers should be read by the console as single switches instead of a stream of data. Such information were confirmed with a multimeter.

    The measurements performed were compared with the information presented on the wiki about the JE506 controller. The results show some difference from the JE506 information presented elsewhere on the wiki, considering the pinout of the expansion port presented elsewhere on the wiki. The Common pins for controllers (Out 1 and Out 2) are exchanged, as well as the JUMP/RUN function for both controllers. 

    The result of my measurements is depicted below.

  • A closer look at NEWPAD subrom routine

    08/27/2019 at 05:26 0 comments

    After spent some time unsuccessfully looking for precise information about the Mouse protocol used by MSX computers I got a subrom binary to disassemble and take a look.

    Mouse reading is performed by NEWPAD subroutine at address 0x1ad but the reading effectively occurs after addres 0x3509:

    The Mouse routine reads 6 nibbles (0..5) in sequence, cadenced by the (toggling of) pin 8. Small delay loops are inserted between readings. Both the Mouse and the Trackball reset their internal counters after one edge of the Pulse signal.

    The 5h nibble read might be the High order nibble for the Mouse or the delta Y value for a trackball. 

    Given the typical DPI resolution of the MSX mouse no displacement above 16 steps should be observed, then the expected value for the 5th nibble should be 0b0000 for positive displacement or 0b1111 for negative displacement.

    The trackball is a much less resolution device and uses solely 4 bits, nevertheless as the mouse only a small amount of displacement should be observed (zero or one count up/down). 

    One of the curious aspects of the trackball is that it uses an inverted sign bit, which means "0" displacement is represented by 0b1000, and that is the key for the NEWPAD routine to differentiate a trackball from a mouse. 

    ; Nibble 5:  Trackball: Delta Y, inverted Sign bit
    ;            (7) 0111  (-1) minus one
    ;            (8) 1000  ( 0) zero
    ;            (9) 1001  (+1) one plus
    ;          
    ;            Mouse: Delta X high nibble, normal sign bit 
    ;            ( 0) 0000  ( 0) Zero 
    ;            (15) 1111  (-1) Minus one
    
    xor 08h    ; Turn values 7, 8, 9 into 15, 0 and 1
    sub 02h    ; Turn 15, 0 and 1 into 13, 14 and 15
    cp 0dh     ; Trackball should greater or equal 13
    jr c,returnMouse ; values less than 13
    ;
    returnTrackBall:
    ....

    The brief positive pulse issued after the 6th nibble is read has the purpose of reset the internal Y counter of a mouse, as registers should be read in pairs (4 nibbles).