You are on page 1of 10

Task 01:

data segment

; add your data here!

pkey db "press any key...$"

str db "This is my first Letter using assembly!:$"

ends

stack segment

dw 128 dup(0)

ends

code segment

start:

; set segment registers:

mov ax, data

mov ds, ax

mov es, ax

; add your code here

lea dx, str

mov ah, 9

int 21h ; output string at ds:dx

;Input
mov ah,1

int 21h

;Output

mov dl,al ;Input Goes to al

mov ah,2

int 21h

; wait for any key....

mov ah, 1

int 21h

mov ax, 4c00h ; exit to operating system.

int 21h

ends

end start ; set entry point and stop the assembler.

Task 02:

data segment

; add your data here!

pkey db "press any key...$"

a db "Enter num1:5"

b db "Enter mun2:4"
c db "The result is:9"

ends

stack segment

dw 128 dup(0)

ends

code segment

start:

; set segment registers:

mov ax, data

mov ds, ax

mov es, ax

; add your code here

; Task 02 Perform addition/subtraction/division/multiplication by taking inputs from the user.

;First Number

lea dx, a

mov ah, 9

int 21h

;First Number Input

mov ah,1

int 21h

mov bh , al

mov dl, 0AH

mov ah,2
int 21h

mov dl, 13

int 21h

;Second Number

lea dx, b

mov ah, 9

int 21h ; output string at ds:dx

;Second Number Input

mov ah,1

int 21h

mov bl , al

sub bh , 030h

sub bl , 030h

add bh , bl

add bh , 030h

mov dl, 0AH

mov ah,2

int 21h

mov dl, 13

int 21h

lea dx, c
mov ah, 9

int 21h

mov dl,bh

mov ah,2

int 21h

; wait for any key....

mov ah, 1

int 21h

mov ax, 4c00h ; exit to operating system.

int 21h

ends

end start ; set entry point and stop the assembler.

Task 03:

.MODEL SMALL

.STACK 100H

.DATA

MSG1 DB "ENTER A HEX DIGIT: $"

MSG2 DB "IN DECIMAL IT IS $"

.CODE

MAIN PROC

MOV AX, @DATA


MOV DS, AX

LEA DX, MSG1 ; ENTER A HEX DIGIT:

MOV AH, 9

INT 21H

; INPUT A VALUE

MOV AH, 1

INT 21H

MOV BH, AL ; MOVING THE VALUE FROM AL TO BH

MOV AH,2

MOV DL,0DH ; LINE BREAK

INT 21H

MOV DL,0AH

INT 21H

LEA DX, MSG2 ; IN DECIMAL IT IS:

MOV AH, 9

INT 21H

; 1ST DECIMAL DIGIT PRINT

MOV AH, 2

MOV DL, 31H

INT 21H

MOV AH, 2 ; 2ND DECIMAL DIGIT PRINT

SUB BH, 11H

MOV DL, BH

INT 21H
EXIT:

MAIN ENDP

END MAIN

Task 04:

data segment

; add your data here!

s1 db "THE sum of $"

s2 db " and $"

s3 db " is $"

ends

stack segment

dw 128 dup(0)

ends

code segment

start:

; set segment registers:

mov ax, data

mov ds, ax

mov es, ax

; add your code here

;Printing '?'

MOV DL, 03FH ;character is '?'


mov ah , 2

INT 21h ;display character

;Input 1

mov ah,1

int 21h

mov cl , al

mov bl, cl

;Input 2

mov ah,1

int 21h

mov ch , al

;Sum and Sub to convert

mov dl , cl

add cl, ch

sub cl, 030h

;New Line

mov dl, 0AH

mov ah , 2

int 21h

mov dL,0DH ;carriage return

int 21h ;execute carriage return

mov dL,0AH ;line feed

int 21h ;execute line feed


;PRINTING

lea dx, s1

mov ah, 9

int 21h

mov dl,bl

mov ah,2

int 21h

lea dx, s2

mov ah, 9

int 21h

mov dl,ch

mov ah,2

int 21h

lea dx, s3

mov ah, 9

int 21h

;Print of Summation

mov dl,cl

mov ah,2

int 21h
ends

end start ; set entry point and stop the assembler.

You might also like