← Back to Home

Practical 10

Implementation of cursor activity like hiding cursor and changing it to box size using INT 10H interrupts.

Theory

  1. What is the purpose of INT 10H interrupt in 8086 assembly language?
  2. Explain how cursor visibility is controlled using CH and CL registers.
  3. What values in CH and CL registers make the cursor invisible?
  4. How can you change the cursor shape from underline to block using INT 10H?

Code

Create a file named exp10.asm in Notepad and save it in D:\TASM:

.model small 
.stack 100h 
.data
    msg1 db 'Press any key to hide cursor...$'
    msg2 db 0Dh,0Ah,'Cursor is now hidden. Press any key...$'
    msg3 db 0Dh,0Ah,'Press any key to change cursor to box size...$'
    msg4 db 0Dh,0Ah,'Cursor is now box shaped. Press any key...$'
    msg5 db 0Dh,0Ah,'Cursor restored to normal. Program ends.$'
.code 
main proc 
    mov ax, @data
    mov ds, ax
    
    lea dx, msg1
    mov ah, 09h
    int 21h
    
    mov ah, 01h
    int 21h
    
    mov ah, 01h
    mov ch, 20h
    mov cl, 00h
    int 10h
    
    lea dx, msg2
    mov ah, 09h
    int 21h
    
    mov ah, 01h
    int 21h
    
    lea dx, msg3
    mov ah, 09h
    int 21h
    
    mov ah, 01h
    int 21h
    
    mov ah, 01h
    mov ch, 00h
    mov cl, 07h
    int 10h
    
    lea dx, msg4
    mov ah, 09h
    int 21h
    
    mov ah, 01h
    int 21h
    
    mov ah, 01h
    mov ch, 06h
    mov cl, 07h
    int 10h
    
    lea dx, msg5
    mov ah, 09h
    int 21h
    
    mov ah, 4ch 
    int 21h 
main endp 
end main 
    

Compilation and Execution using TASM

Inside DOSBox, compile and run:

    tasm filename.asm
    tlink filename.obj
    

Using Debug Tool

Run Debug:

td filename.exe