Lab 3
Lab 3
.model small .stack 100h .code code segment start: mov dl,'a' ; store ascii code of a in dl mov ah, 2h ; ms-dos character output function int 21h ; displays character in dl register mov ax, 4c00h ; return to ms-dos int 21h code ends end start
Write a program to read a character from the keyboard and display it on the screen: Program:
.model small .stack 100h .code Code segment start: mov ah, 1h int 21h mov dl, al mov ah, 2h int 21h mov ax, 4c00h int 21h code ends end start ; display subprogram ; display character in dl ; return to ms-dos ; keyboard input subprogram ; read character into al
Write a program to display the message Hello world followed by Return and Line-feed
Program: .model small .stack 100h .code code segment message db 'Hello World', 13, 10, '$' start: mov ax, code mov ds, ax ; copy address of message to dx mov dx, offset message mov ah, 9h ; string output int 21h ; display string mov ax, 4c00h int 21h code ends end start