Assembler-displays a string “Hello” on the screen

Assembler-displays a string “Hello” on the screen

This is the code when we learn assembly, for learning reference only.

Source code:

data segment
string db 'Hello',13,10,'$'  ;the string ends with the symbol'$' and is enclosed in single quotes
data ends

code segment

    assume cs:code,ds:data  
start:                  
    push ds             ;save old data segment
    sub ax,ax
    push ax 
    mov ax,data
    mov ds,ax

    lea dx,string
    mov ah,9
    int 21h             ;DOS

    mov ah,4ch          ;return to DOS
    int 21h
code ends
    end start
0

Leave a Reply

Your email address will not be published.