Re: Polling input from the mouse



Dirk Wolfgang Glomp schrieb:
I dont know what is happend about the stream mode, wrap mode and remote mode.
Do you test this modi?


 EAh    sngl    set mouse to stream mode (mouse sends data on any changes)
 ECh    sngl    reset mouse wrap mode (to normal mode)
 EEh    sngl    set wrap mode
 F0h    sngl    set remote mode (instead of stream mode), mouse sends data
                only on issueing command EBh.

must issue command D4h to PORT 0064h first to access mouse functions
all commands except ECh and FFh are acknowledged by FAh (ACK) or
FEh (Resend);

More infos i found in: http://www.computer-engineering.org/ps2mouse/

I read that the stream mode,
is the default mode of operation following reset.
Most software used that mode.

I think this mode dont need to use the 0EBh(Read Data)-command.
Just use 0F4h (Enable Data Reporting), then the mouse sends data
to the controller.

Im a little bit confused how many bytes the mouse sends,
when i use command  0E9h(get mouse information/Status Request).
In the RBIL i found 2 bytes, in the computer-engineering stuff
i found 3 bytes.
Additional i found in RBIL 8 bytes for movement-Data
and 3 bytes in the computer-engineering stuff.

I dont know why, this routine dont work propper
and my pur DOS(6.22) hang constantly.

P0:       in   al, 64h
          test al, 2     ; input-buffer full?
          jz  P0
          mov  al, 0D4h  ; initiate mouse-command
          out  64h, al
          in   al, 64h
          cmp  al, 0FAh  ; acknowledge
          jnz P0
P1:       in   al, 64h
          test al, 2     ; input-buffer full?
          jz  P1
          mov  al, 0F4h  ; enable data-reporting
          out  60h, al
          in   al, 64h
          cmp  al, 0FAh
          jnz P1

P2:       in   al, 64h
          test al, 1     ; keyboard output buffer full?
          jz  KEYBOARD
          test al, 20h   ; mouse output buffer full?
          jnz P2
          in   al, 60h   ; get PS2-mouse-data
          call HEXOUT    ; show the value on screen
          jmp short P2
;------------------------
KEYBOARD: in   al, 60h   ; to clear output-buffer
P3:       in   al, 64h
          test al, 2     ; input-buffer full?
          jz  P3
          mov  al, 0D4h  ; initiate mouse-command
          out  64h, al
          in   al, 64h
          cmp  al, 0FAh
          jnz P3
P4:       in   al, 64h
          test al, 2     ; input-buffer full?
          jz  P4
          mov  al, 0F5h  ; dissable Data-Reporting
          out  60h, al
          in   al, 64h
          cmp  al, 0FAh
          jnz P4

Dirk

.