INT 33h AX=0002h removes the pointer from the screen, restoring what was under it, and subtracts 1 from the visibility counter. The driver keeps tracking the mouse while it is hidden: positions and buttons from INT 33h AX=0003h stay correct and an event handler is still called.

Its main use is protecting the screen. The driver draws the pointer by saving the pixels or the character cell under it and putting them back when the pointer moves. If the program draws into that area meanwhile, the driver's "restore" puts back old contents over the new drawing, leaving a hole the shape of the pointer. So drawing code wraps itself in hide and show:

MOV AX, 0002h ; hide the pointer
INT 33h
; ... write to the screen: text, pixels, a scroll ...
MOV AX, 0001h ; and show it again
INT 33h

Because it is a counter, nested routines can each hide and show without breaking the outer one. Hiding twice needs two shows:

prints: FE FF 00
XOR AX, AX ; reset: hidden, counter -1
INT 33h
MOV AX, 0001h ; show: 0, visible
INT 33h
MOV AX, 0002h ; hide: -1
INT 33h
MOV AX, 0002h ; hide again: -2
INT 33h
CALL COUNTER1 ; FE
MOV AX, 0001h ; one show is not enough: -1
INT 33h
CALL COUNTER1 ; FF
MOV AX, 0001h ; the second one shows it: 0
INT 33h
CALL COUNTER1 ; 00
MOV AX, 0002h ; leave it hidden, as a reset would
INT 33h
COUNTER1 PROC NEAR ; print the cursor counter: 00 shown, FF, FE... hidden
MOV AX, 002Ah ; mouse (driver 7.02+): AL = the counter
INT 33h
CALL PHEX2
MOV DL, " "
MOV AH, 02h
INT 21h
RET
COUNTER1 ENDP
PHEX2 PROC NEAR ; print AL as two hex digits; keeps every register
PUSH AX
PUSH CX
PUSH DX
MOV DH, AL ; keep the byte
MOV CL, 4
SHR AL, CL ; the high nibble
CALL HEXN1
MOV AL, DH
AND AL, 0Fh ; the low nibble
CALL HEXN1
POP DX
POP CX
POP AX
RET
HEXN1:
ADD AL, "0"
CMP AL, "9"
JBE HEXN2
ADD AL, 7 ; past "9": "A".."F"
HEXN2:
MOV DL, AL
MOV AH, 02h
INT 21h
RET
PHEX2 ENDP

Pitfalls

Every hide needs its show; a forgotten show leaves the pointer invisible for good, and the user has no idea why. Hiding and showing for every character printed makes the pointer flicker; hide once around a whole redraw. Drivers since version 4 also offer AX=0010h, which hides the pointer only while it is inside a given rectangle, for programs that update one area often.