This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Masterkiller

By: a guest on Oct 12th, 2008  |  syntax: ASM (NASM)  |  size: 1.47 KB  |  views: 190  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. mouseDataStatus db 0
  2. mouseDataX db 0
  3. mouseDataY db 0
  4. irq12: PUSHAD
  5. PUSH DS, ES
  6. XOR eax, eax
  7. MOV DS, ax
  8. MOV ES, ax
  9. IN al, 0x64
  10. .checkData: TEST al, 0x1 ;1 <data available?>
  11. JZ .iexit
  12. TEST al, 0x20 ;Test bit 5 <mouse data?>
  13. JNZ .mouseDataAvailable
  14. IN al, 0x60 ;Removing unexpected keyboard data
  15. JMP short .checkData
  16. .mouseDataAvailable: ;Get the 3 byte packet
  17. IN al, 0x60
  18. MOV byte[CS:mouseDataStatus], al
  19. CALL waitForRead
  20. IN al, 0x60
  21. MOV byte[CS:mouseDataX], al
  22. CALL waitForRead
  23. IN al, 0x60
  24. MOV byte[CS:mouseDataY], al
  25. ;Packet Ready
  26. .calcX: MOV dx, word[0x7108] ;Check X data negative
  27. TEST byte[CS:mouseDataStatus], 0x10
  28. JZ .posX ;X is positive
  29. NEG byte[CS:mouseDataX]
  30. INC byte[CS:mouseDataX]
  31. MOVZX cx, byte[CS:mouseDataX]
  32. SUB dx, cx ;Convert Negative X data to positive and substract it
  33. PUSH dx
  34. JMP short .calcY
  35. .posX: MOVZX cx, byte[CS:mouseDataX] ;Add positive X data
  36. ADD dx, cx
  37. PUSH dx
  38. .calcY: MOV dx, word[0x710A] ;Check Y data negative
  39. TEST byte[CS:mouseDataStatus], 0x20
  40. JZ .posY ;Y is positive
  41. NEG byte[CS:mouseDataY]
  42. INC byte[CS:mouseDataY]
  43. MOVZX cx, byte[CS:mouseDataY]
  44. SUB dx, cx ;Convert Negative Y data to positive and substract it
  45. PUSH dx
  46. JMP short .endCalc
  47. .posY: MOVZX cx, byte[CS:mouseDataY] ;Add positive Y data
  48. ADD dx, cx
  49. PUSH dx
  50. .endCalc: CALL UnDisplayCursor ;Remove cursor from old position
  51. CALL DisplayCursor ;Set cursor to the new position (X and Y are on the top of the stack)
  52. ADD sp, 4
  53. .iexit: POP DS, ES
  54. POPAD
  55. IRET ;Exit Interrupt
clone this paste RAW Paste Data