I started from this example: viewtopic.php?t=24277 but I do not understand why it does not go on virtualbox when it works very well on a real machine
here is the initialization code:
Code: Select all
;commande au 8042: Enable Auxiliary Interface
mov al,0A8h
call env_8042_cmd
;commande au 8042: test Auxiliary Interface
mov al,0A9h
call env_8042_cmd
call lec_ps2
cmp al,0
jne fin_init_souris ;si c'est pas bon on initalise pas la souris
;définis les parametres de base
mov dx,seldat
mov ds,dx
mov byte[atts1],1
mov byte[nbts1],3
mov byte[nbzt1],0
;modifie le 8042 Command Byte
mov al,20h
call env_8042_cmd
call lec_ps2
bts ax,1 ;enable l'interruption auxilliaire
btr ax,5 ;met a zéro le bit "disable auxiliary device"
mov bl, al
mov al,60h
call env_8042_cmd
mov al,bl
call env_8042_dat
call lec_ps2
;commande a la souris: set to default value
mov al,0F6h
call env_ps2
;envoie la séquence d'activation de la molette par sequence de commandes set sample rate
mov al, 0F3h ;sample rate
call env_ps2
mov al, 200 ;a la valeur 200
call env_ps2
mov al, 0F3h ;sample rate
call env_ps2
mov al, 100 ;a la valeur 100
call env_ps2
mov al, 0F3h ;sample rate
call env_ps2
mov al, 80 ;a la valeur 80
call env_ps2
;vérifie le type de la souris pour voir si la molette a été activé
mov al,0F2h
call env_ps2
call lec_ps2
cmp al,3
jne molette_non_active
mov byte[nbts1],4
molette_non_active:
;configure la souris et l'active
mov al,0F3h ;set sample rate
call env_ps2
mov al,200 ;échantillons par seconde, valeur possible: 10,20,40,60,80,100,200
call env_ps2
mov al,0E8h ;set resolution
call env_ps2
mov al,3 ;valeur possible: 0,1,2,3
call env_ps2
mov al,0E6h ;set scaling 1:1
call env_ps2
mov al,0F4h ;enable
call env_ps2
;démasque l'irq 12
mov dx,0A1h
mov al,0EFh
out dx,al
az2:
in al,64h
test al,01h ;0=vide
jz az1
in al,60h
jmp az2
az1:
;aquitte toutes irq en attente
mov al,20h
out 0A0h,al
mov al,20h
out 20h,al
jmp fin_init_souris
Code: Select all
at8042ok_lec: ;attend que la puce ait des données disponible sur 60h
push eax
push ecx
mov ecx,10000
boucle_at8042ok_lec:
in al,64h
test al,1
jnz at8042ok
dec ecx
jnz boucle_at8042ok_lec
at8042ok:
pop ecx
pop eax
ret
at8042ok_env: ;attend la fin du traitement des donnes par la puce 8042
push eax
push ecx
mov ecx,10000
boucle_at8042ok_env:
in al,64h
test al,2
jz at8042ok
dec ecx
jnz boucle_at8042ok_env
pop ecx
pop eax
ret
env_ps2:
call at8042ok_env
push eax
mov al,0D4h
out 64h,al
pop eax
call at8042ok_env
out 60h,al
lec_ps2:
call at8042ok_lec
in al,60h
fin_lec_ps2:
ret
env_8042_cmd:
call at8042ok_env
out 64h,al
call at8042ok_env
ret
env_8042_dat:
call at8042ok_env
out 60h,al
ret