Yuxing Mouse

From NESdev Wiki
Jump to navigationJump to search

The 裕兴 (Yùxìng) Mouse is a nearly bog-standard serial mouse that can be connected to either controller port. The only difference is that the X and Y axes are swapped compared to the normal serial mouse protocol, most likely for purposes of vendor lock-in.

Input ($4016 write)

7  bit  0
---- ----
xxxx xxxS
        |
        +- Inverted strobe

The mouse is read by first writing 0, then 1, to $4016 -- the opposite of what is written to read a standard controller.

Output ($4016 or $4017 read)

7  bit  0
---- ----
xxxx xxxD
        |
        +- Inverted serial data

Response

The serial data consists of three nine-bit packets: one 0 start bit, seven data bits, one 1 stop bit.

#1 [0 1LRXXYY 1]
    | ||||||| +- Stop bit
    | |||||++--- Y movement, bits 7..6
    | |||++----- X movement, bits 7..6
    | ||+------- 1: right mouse button pressed
    | |+-------- 0: left mouse button pressed
    | +--------- Synchronization, indicates first of three packets
    +----------- Start bit

#2 [0 0YYYYYY 1]
    |  |||||| +- Stop bit
    |  ++++++--- Y movement, bits 5..0
    +----------- Start bit

#3 [0 0XXXXXX 1]
    |  |||||| +- Stop bit
    |  ++++++--- X movement, bits 5..0
    +----------- Start bit