s

Write an assembly language program which will display the word HELLO on the screen using the 10h Interrupt edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 27 February 2021 | 4430

If you want to print a string in 8086 assembly language. This can easily be done using dos interrupt 21h function 09h. Here is the sample code that does the same. print string. But the question is to print a string using bios interrupt 10h. There is no function in interrupt 10h to print a string. You should do this by printing one character at a time.

You can write a character to the screen using int 10h function AH=09h or AH=0Ah but they will Write character only at the current cursor position and the cursor is not incremented. So the best option for us would be to use int 10h function 0Eh.

Program to display HELLO using int 10h

.model tiny
.code

org 100h


main proc near
    
mov cx,5    ; hello has 5 words, loop 5 times
mov si,offset message   ; load address of message into si
loop1:
    push cx ; push the value of cs into stack
    
    mov ah,0Eh  ; bios function 0eh to teletype character
    mov al,[si] ; al will contain the value of the memory location pointed by si
    mov cx,1    ; cx is the number of times the character has to be printed. 
    int 10h     ; bios interrupt 10h
    
    inc si  ; increment the value of si, so that si points to the next character in the word hello 
    pop cx  ; pop the value of cx from stack
    loop loop1  ; loop decrements the value of cx by 1, compare if the value of cx is 0, if not zero go to loop1

mov ah,4ch
mov al,00
int 21h

ret

endp
message db 'HELLO'
end main