CLI ;(1) Disable Keyboard (Send To Keyboard Controller command 0xAD ) CALL waitForWrite MOV al, 0xAD OUT 0x64, al ;(2) Make sure that mouse port is active by enbling it (command 0xA8) CALL waitForWrite MOV al, 0xA8 OUT 0x64, al ;(3) Reset The Mouse (Send To Keyboard Controller command 0xD4 and send to Mouse command 0xFF ) CALL waitForWrite MOV al, 0xD4 OUT 0x64, al CALL waitForWrite MOV al, 0xFF OUT 0x60, al ;(4) Reset Completition (Wait for mouse to sent 0xAA and mouseID - then assume reset mode complete and enters stream mode) CALL waitForRead IN al, 0x60 ;FA - ACK IN al, 0x60 ;AA - Reset Success; FC - Failure at reset CMP al, 0xAA JNE .hang IN al, 0x60 ;If success - MouseID ;(5) Enable mouse clock and IRQ12 by Keyboard Controller Command Byte CALL waitForWrite MOV al, 0x20 OUT 0x64, al CALL waitForRead IN al, 0x60 OR al, 0x2 AND al, 0xDF MOV bl, al CALL waitForWrite MOV al, 0x60 OUT 0x64, al CALL waitForWrite MOV al, bl OUT 0x60, al ;(6) Enable mouse to send data (Mouse command 0xF4) CALL waitForWrite MOV al, 0xD4 OUT 0x64, al CALL waitForWrite MOV al, 0xF4 OUT 0x60, al CALL waitForRead ;Should receive acknowledge from mouse IN al, 0x60 STI ... waitForWrite: PUSH ax .loop:IN al, 0x64 TEST al, 2 JNZ .loop POP ax RET waitForRead: PUSH ax .loop:IN al, 0x64 TEST al, 1 JZ .loop POP ax RET