Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Please Help!!

Please Help!!

Please Help!!

I'm finishing up an electronics course at a technical colllege. This is my last quarter (thank god).

I'm taking microprocessors right now. I need to alter an assembly language program to get it to print a sentence.
Seems simple enough but I am pulling my hair out.  

This is the program:

MSG DB 'Hey this is fun...and it works!','$'

This program simply prints the sentence to the screen. I need it to print that same sentence with the printer.

I know the 17H interupt is used for this but I'm lost as to how exactly. I know I shouldn't have add too much to the code.

Is there a way I could use the sub-function AH, 05H? I tried this with different variations but no luck.

I'm not sure why we have this asignment when we were not taught this language, but there ain't much I can do about that.  

If anyone can help me I swear I'll remember you when I get rich.  


RE: Please Help!!

comments: (assuming this all applies to DOS, which it looks like)

Subfunction ah=5 of int021h is listed in my little reference book as print a character. The ascii code of the character should be in dl, and it prints a single character.

Int 017h is also supposed to print things. Like Int 021h it has subfunctions. Subfunction ah=1 is initialise printer port (port No. in dx, 0=LPT1 etc).
Int 017h ah=0 is write character, printer No. in dx, character in al. It returns the printer status in ah, bit0=timeout, bit3=i/o error etc...

Since all these routines are print a character rather than print a $-terminated string, you are going to have to read the string character by character in a loop and call the interrupt as many times as you need... I'm not sure if DOS provides a string print thingy.

I've never got deeply into printing things, so I might be telling you rubbish...

Int 020h as program termination has been considered obsolete since DOS version 2.0!!! Int 021h ah=04Ch is more up to date, but I don't know the pros and cons of each approach. Maybe you should ask whoever runs the course (if they're using int 020h simply because that was what got written into the course notes a long time ago, then that's not a good reason)

RE: Please Help!!

another option can be opening device PRN as a file and writing the string to it

RE: Please Help!!

msg db      'Hey this is fun...and it works!',10,13,'$'

    mov     dx,offset msg
    mov     ah,9
    int     21h

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close