汇编程序——在屏幕上显示一个字符串“Hello”

这是我们学习汇编的时候的代码,仅供学习参考。

源代码:

data segment
string db 'Hello',13,10,''  ;字符串以’’符号结尾,以单引号括起来
data ends

code segment

    assume cs:code,ds:data  
start:                  ;程序的入口地址
    push ds             ;save old data segment
    sub ax,ax           ;ax寄存器清零,作为数据段0偏移地址
    push ax             ;零偏移地址入栈

    mov ax,data
    mov ds,ax           ;把数据段地址装入数据段寄存器ds

    lea dx,string       ;把字符串首地址装入dx寄存器,或写成mov dx, offset string
    mov ah,9            ;DOS功能调用,在屏幕上显示字符串
    int 21h             ;DOS中断

    mov ah,4ch          ;return to DOS
    int 21h
code ends
    end start           ;汇编的结束,程序在此执行
4+

17 thoughts on “汇编程序——在屏幕上显示一个字符串“Hello”

  1. you are truly a excellent webmaster. The site loading pace is
    amazing. It seems that you’re doing any distinctive trick.

    Also, The contents are masterwork. you have performed a great task
    on this matter!

    0
  2. Your style is really unique compared to other folks I have read stuff from. Many thanks for posting when you have the opportunity, Guess I will just book mark this web site.

    0
  3. I’m very pleased to uncover this web site.
    I want to to thank you for your time for this particularly wonderful read!!
    I definitely loved every little bit of it and i also
    have you saved as a favorite to check out new things in your website.

    0
  4. I know this if off topic but I’m looking into starting my own blog
    and was wondering what all is required to get set up?
    I’m assuming having a blog like yours would cost a
    pretty penny? I’m not very web smart so I’m not 100%
    certain. Any tips or advice would be greatly appreciated.
    Many thanks

    0
  5. Hi there very cool web site!! Guy .. Excellent .. Superb .. I’ll bookmark your website and take the feeds also厈I am satisfied to search out a lot of useful info right here in the post, we’d like develop more techniques on this regard, thanks for sharing. . . . . .

    0
  6. Hello There. I found your blog using msn. This is a really well written article.
    I will make sure to bookmark it and come back to read
    more of your useful information. Thanks for the post.
    I’ll certainly return.

    0
  7. I just like the helpful information you provide on your articles. I抣l bookmark your weblog and test again here regularly. I’m fairly certain I抣l be informed many new stuff proper right here! Best of luck for the following!

    0

Leave a Reply

Your email address will not be published.