Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to Print a given string on printer Using INT 17h

Posted By: Waggoner Fischer     Category: Assembly Language     Views: 3910

Write a Program to Print a given string on printer Using INT 17h.

Code for Program to Print a given string on printer Using INT 17h in Assembly Language

prnstr macro msg
        mov ah, 09h
        lea dx, msg
        int 21h
        endm

data segment
        msg1 db "Enter string to be printed : $"
        msg2 db 0dh, 0ah, "I/O Error or Paper out...$"
        msg3 db 0ah, "Printing string...$"
        buf db 80
            db 0
            db 80 dup(' ')
data ends

code segment
        assume cs:code, ds:data, es:data
start :
        mov ax, data
        mov ds, ax
        mov es, ax

        prnstr msg1
        mov ah, 0ah
        lea dx, buf
        int 21h
        mov si, offset buf + 2
        mov ch, 00h
        mov cl, byte ptr [si-1]

        mov dx, 0000h
again :
        mov ah, 02h
        int 17h

        test ah, 00101001b
        jz cont
        prnstr msg2
        jmp again
cont :
        mov ah, 00h
        mov dx, 0000h
next :
        mov ah, 00h
        mov al, [si]
        int 17h
        inc si
        loop next

        mov ax, 4c00h
        int 21h
code ends
        end start
  
Share: 


Didn't find what you were looking for? Find more on Program to Print a given string on printer Using INT 17h Or get search suggestion and latest updates.

Waggoner Fischer
Waggoner Fischer author of Program to Print a given string on printer Using INT 17h is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!