Assembly Language Programming Lab Edited For Ext
Assembly Language Programming Lab Edited For Ext
Variables: Declaration/definition
Assignment: Assigning values to variables
Input/output: Displaying messages/displaying variable values
Control flow: Loops, JUMPs
mov ah, 1h
int 21h
mov ah, 1h
int 21h
mov ah, 1h
int 21h
mov ah, 1h
15 Compiled by: Abdisa L.
int 21h
ret
Program 6
Example: Reading and displaying a character:
.model small
.stack 100h Output:
.code a
start:
mov dl, 'a' ;stor 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
end start
18 Compiled by: Abdisa L.
19 Compiled by: Abdisa L.
Program 8:
Write a program to load character ‘ ? ’ into register ax and
display the same on the screen.
.model small
.stack
.data
Message db "AUWC department of CS microprocessor lab.$"
.code
main proc
mov ax,seg Message ;moves the segment "Message" into AX
mov ds,ax ;moves ax into ds(ds=ax)
mov ah,9 ;func 9 of dos interrupt 21h prints the string that terminate with "&".
int 21h
mov ah,9 ;func 9 of dos interrupt 21h prints the string that terminate with "&".
int 21h
mov ah,9
int 21h
mov ah,1h
13 is the decimal
int 21h value of CR ASCII
code (carriage
mov [bx],al
mov dx,offset Disp return)
mov ah,9 10 is the decimal
int 21h
value of LF ASCII
mov dl,[bx] code (line feed)
mov ah,2h
int 21h
or al,30h
mov dl,al
mov ah,2
int 21h
mov dl,bl
mov ah,2
int 21h
or ax,3030h
mov cx,ax
mov al,ch
mov ah,2h
int 21h
mov dl,cl
mov ah,2h
int 21h
.code
start:
mov dx,30h
mov cx,07h
lop: mov ah,2h
int 21h
inc dx
loop lop