cli is only necessary if we don't want hardware interrupts to be serviced at the moment.
It's hard to tell why it's used in the code you're referring to without seeing the actual code, but generally there can be multiple reasons:
- to avoid race conditions with interrupt service routines (when accessing shared mutable data)
- to change the interrupt vector table atomically (very similar to the above)
- to change
SS:SP atomically (very similar to the above)
- to avoid exceptions caused by ISRs while switching CPU modes (real<->protected)
- to measure time more precisely avoiding ISR contribution
- etc
Basically, whenever hardware ISRs can interfere with the main code in some undesired ways, you disable interrupts.
Oh, and int 10h has nothing to do with interrupt requests coming from the hardware. It's just that some ISRs are used to handle hardware interrupts (from e.g. the keyboard or network) and others are used as various helper routines or system calls with a convenient interface (you don't need to know the exact location of the ISR, vector number (10h) suffices). The BIOS int 10h functions let you change display modes and write text on the screen.