NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

3.1. Write ALP for the Data Transfer between registers.
CODE SEGMENT
ASSUME CS:CODE
START:MOV AX,21H
MOV BX,AX
MOV CX,AX
MOV DX,AX
INT 21H
CODE ENDS
END START


3.2. Write ALP to ADD two 16 bit numbers.
DATA SEGMENT
NUM1 DW 2500H
NUM2 DW 2400H
RES DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
ADD AX,BX
MOV [RES],AX
INT 21H
CODE ENDS
END START


3.3. Write ALP Subtract two 16 bit numbers.
DATA SEGMENT
NUM1 DW 2500H
NUM2 DW 2400H
RES DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
SUB AX,BX
MOV [RES],AX
INT 21H
CODE ENDS
END START


4.1 An ALP to transfer a given block of data from source memory block to the
destination memory block without overlap.
Code:
DATA SEGMENT
S1 DW 5638H, 5639H, 5640H, 5641H, 5642H, 5643H, 5644H, 5645H, 5646H,5647H
D1 DW 10 DUP(0)
COUNT DB 10
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
LEA SI,S1
LEA DI,D1
MOV CL,COUNT
L1:MOV AX,[SI]
MOV [DI],AX
INC SI
INC SI
INC DI
INC DI
DEC CL
JNZ L1
INT 21H
CODE ENDS
END START


4.2 An ALP to exchange a block of data located from source to the destination
memory locations.
Code:
DATA SEGMENT
S1 DW 2006H, 1215H, 4115H, 5116H, 6241H, 4125H, 3218H, 3215H,
3215H, 3615H
D1 DW 2007H, 1216H, 4116H, 5117H, 6242H, 4126H, 3219H, 3216H,
3216H, 3616H
DI1 DW ?
COUNT DB 10
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:MOV AX,DATA
MOV DS,AX
LEA SI,S1
LEA DI,D1
MOV CL,COUNT
L1: MOV AX,[SI]
MOV BX,[DI]
MOV [DI1],BX
MOV CX,[DI1]
MOV [DI],AX
MOV [SI],CX
INC SI
INC SI
INC DI
INC DI
DEC CL
JNZ L1
INT 21H
CODE ENDS
END START


5.1 Write an ALP to find the largest number from an array.
DATA SEGMENT
NUM DB 06H,05H,0FEH,32H,49H,36H
COUNT DB 5
LARGE DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE ,DS:DATA
START: MOV AX,DATA
MOV DS,AX
LEA SI,NUM
MOV CL,COUNT
MOV AL,[SI]
BACK: CMP AL,[SI+1]
JNC XYZ
MOV AL,[SI+1]
XYZ: INC SI
DEC CL
JNZ BACK
MOV LARGE,AL
INT 03H
CODE ENDS
END START


5.2 Write an ALP to find the smallest number from an array.
DATA SEGMENT
NUM DB 06H,05H,0FEH,32H,49H,36H
COUNT DB 5
SMALL DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE ,DS:DATA
START: MOV AX,DATA
MOV DS,AX
LEA SI,NUM
MOV CL,COUNT
MOV AL,[SI]
BACK: CMP AL,[SI+1]
JC XYZ
MOV AL,[SI+1]
XYZ: INC SI
DEC CL
JNZ BACK
MOV SMALL,AL
INT 03H
CODE ENDS
END START


5.3 Write an ALP to sort the given array of numbers in ascending
order.
DATA SEGMENT
NUM DB 06H,05H,0FEH,32H,49H,36H,0FDH,0AFH,01H,00H
COUNT DB 9
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE ,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CL,COUNT
MOV AH,CL
RPT: MOV BL,AH
LEA SI,NUM
BACK: MOV AL,[SI]
CMP AL,[SI+1]
JC XYZ
XCHG AL,[SI+1]
MOV [SI],AL
XYZ: INC SI
DEC BL
JNZ BACK
DEC CL
JNZ RPT
INT 21H
CODE ENDS
END START


5.4 Write an ALP to sort the given array of numbers in
descending order.
DATA SEGMENT
NUM DB 06H,05H,0FEH,32H,49H,36H,0FDH,0AFH,01H,00H
COUNT DB 9
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE ,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CL,COUNT
MOV AH,CL
RPT: MOV BL,AH
LEA SI,NUM
BACK: MOV AL,[SI]
CMP AL,[SI+1]
JNC XYZ
XCHG AL,[SI+1]
MOV [SI],AL
XYZ: INC SI
DEC BL
JNZ BACK
DEC CL
JNZ RPT
INT 21H
CODE ENDS
END START



6.1 Bit manipulation to check if the data is positive or negative.
DATA SEGMENT
NUM DB 72H ; 1000 0010
MES1 DB 'DATA IS POSITIVE $'
MES2 DB 'DATA IS NEGATIVE $'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AL,NUM
ROL AL,1
JC NEGA
LEA DX,MES1 ;Declare it positive.
JMP EXIT ;Exit program.
NEGA: LEA DX,MES2;Declare it negative.
EXIT: MOV AH,09H
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START


6.2 Bit manipulation to check if the data is odd or even
DATA SEGMENT
X DB 27
MSG1 DB 'NUMBER IS EVEN$'
MSG2 DB 'NUMBER IS ODD$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AL,X
TEST AL,01H
JNZ EXIT
LEA DX,MSG1
MOV AH,09H
INT 21H
JMP LAST
EXIT: LEA DX,MSG2 ;Declare it is Odd number.
MOV AH,09H
INT 21H
LAST: MOV AH,4CH
INT 21H
CODE ENDS
END START


6.3 Bit manipulation to count the number of 1’s and 0’s in given data.
DATA SEGMENT
X DB 0AAH
ONE DB ?
ZERO DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AH,X
MOV BL,8 ;Initialize BL to 8.
MOV CL,1 ;Initialize CL to 1.
UP: ROR AH,CL ;Perform the single bit rotate operation with respect to right.
JNC DOWN ;If no carry go to DOWN label.
INC ONE ;Increment one.
JMP DOWN1 ;Jump to DOWN1.
DOWN: INC ZERO ;Increment ZERO.
DOWN1: DEC BL ;Decrement the BL.
JNZ UP ;If no zero go to UP label.
MOV AH,4CH
INT 21H
CODE ENDS
END START
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.