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

源代码:

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           ;汇编的结束,程序在此执行
0
Posted in 汇编语言

Leave a Comment:

电子邮件地址不会被公开。

  1. There is certainly a lot to find out about this subject. I love all of the points you ave made.

    0

    回复

  2. g

    Hi there friends, its fantastic post on the
    topic of tutoringand entirely explained, keep it up all the time.

    0

    回复

  3. g

    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

    回复

  4. 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

    回复

  5. You made some good points there. I checked on the internet for more info about the issue and found most people will go along with your views on this website.

    0

    回复