flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > OS Construction > Strange PS2 Mouse Packet :-( | 
  
| Author | 
  | 
              
| 
                  
                   BAiC 23 Mar 2012, 22:35 
                  what is "secuencia" initialized to? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   cod3b453 24 Mar 2012, 00:16 
                  When a packet is marked as ready, you can read all data bytes at once without re-polling, so there should be no reason to force the sequence. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   BAiC 24 Mar 2012, 01:18 
                  Quote: 
 you need to poll for the next byte. in fact, I've had issues in this respect with my driver. VirtualBox allows you to read in each byte as easily as a sequence of in instructions yet VMware (and my real hardware) simply ends up reading in the same byte each time.  | 
              |||
                  
  | 
              
| 
                  
                   flash 24 Mar 2012, 03:10 
                  Hello BAiC! secuencia is initialized to zero. I copy the code, it is just a simple floppy boot code. I am testing it on qemu:
 
                  
                Code: use16 org 7C00h mov di,1660 mov ax,0b800h mov es,ax @@: in al,64h test al,2 jnz @b mov al,0A8h ; Activar el dispositivo auxiliar PS2 out 64h,al @@: in al,64h test al,1 jz TestOut in al,60h jmp @f TestOut: test al,2 jnz @b @@: in al,64h test al,2 jnz @b mov al,0D4h ; Indicar el envío de un comando al dispositivo out 64h,al @@: in al,64h test al,2 jnz @b mov al,0F6h ; Enviar comando reset(para inicializar el dispositivo) out 60h,al @@: in al,64h test al,1 jz @b in al,60h cmp al,0xAA je @f @@: in al,64h test al,2 jnz @b mov al,0D4h ; Indicar el envío de otro comando out 64h,al @@: in al,64h test al,2 jnz @b mov al,0F4h ; Activar el ratón out 60h,al mousepoll: in al,64h test al,1 jz mousepoll test al,20h jz mousepoll ; Here starts the problematic part, just at sequence reading cmp [secuencia],0 jne @f in al,60h mov [mousey],al inc [secuencia] jmp mousepoll @@: cmp [secuencia],1 jne @f in al,60h mov [control],al inc [secuencia] jmp mousepoll @@: in al,60h mov [mousex],al mov [secuencia],0 push di mov al,[control] call bin8 add di,144 mov al,[mousex] call bin8 add di,144 mov al,[mousey] call bin8 pop di push di add di,20 test [control],1 jz @f mov [es:di], word 0100111001001001b mov [es:di+2], word 0000111000100000b mov [es:di+4], word 0000111000100000b @@: test [control],2 jz @f mov [es:di], word 0000111000100000b mov [es:di+2], word 0000111000100000b mov [es:di+4], word 0100111001000100b @@: test [control],4 jz @f mov [es:di], word 0000111000100000b mov [es:di+2], word 0100111001000011b mov [es:di+4], word 0000111000100000b @@: pop di jmp mousepoll bin8: mov cx,8 @@: shl al,1 jc uno mov [es:di],word '0 ' add di,2 loop @b ret uno: mov [es:di],word '1 ' add di,2 loop @b ret secuencia db 0 control db 0 mousex db 0 mousey db 0 times 510-($-$$) db 0 dw 0xAA55  | 
              |||
                  
  | 
              
| 
                  
                   BAiC 24 Mar 2012, 09:50 
                  the error that you describe sounds like you haven't read in all of the data bytes from the initialization sequence. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   BAiC 24 Mar 2012, 10:02 
                  immediately before the "mousepoll" label you are issuing Command 0xF4. That command has a response byte which you'll need to poll for. I'm looking at my driver for that type of command and it has an interrupt which expects to read in 1 byte. my driver is an Interrupt-powered State Machine so it looks considerably different from what you have. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   flash 25 Mar 2012, 00:04 
                  Thank's a lot BAiC! It works fine now!!!!
 
                  
                Just adding a read poll before label: Code: @@: in al,64h test al,1 jz @b in al,60h  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.