2. Data segment
Array db 0A7H,87H,34H,83H,80H,78H,0CDH,0D4H,67H
Result db ?
Data Ends
Code Segment
Assume cs:code, ds:data
Start: MOV AX,DATA
MOV DS,AX ; Initialise DS
MOV CX,0008H ; count =08h
LEA BX,ARRAY ; Address of array in BX
MOV AH,[BX] ; take 1st no. in AH
BACK: INC BX ; point to next no.
CMP AH,[BX] ;compare no. in AH with no. in mem loc
JB GO ;if AH is small, jump to GO label
MOV AH,[BX] ; if mem loc is larger
GO: LOOP BACK ; cx cx-1, if cx<>0 jump to BACK
INC BX ; store result
MOV [BX],AH
INT 3
Code ends
End start
4. Data segment
Array db 0A7H,87H,34H,83H,80H,78H,0CDH,0D4H,67H
Result db ?
Data Ends
Code Segment
Assume cs:code, ds:data
Start: MOV AX,DATA
MOV DS,AX ; Initialise DS
MOV CX,0008H ; count =08h
LEA BX,ARRAY ; Address of array in BX
MOV AH,[BX] ; take 1st no. in AH
BACK: INC BX ; point to next no.
CMP AH,[BX] ;compare no. in AH with no. in mem loc
JA GO ;if AH is larger, jump to GO label
MOV AH,[BX] ; if mem loc is smaller
GO: LOOP BACK ; cx cx-1, if cx<>0 jump to BACK
INC BX ; store result
MOV [BX],AH
INT 3
Code ends
End start
Jump if AH is Big
otherwise store
mem loc
5. 09 (length)
1 34
2 46
3 A7
4 D2
5 EF
6 DE
7 DF
8 ED
9 14
Largest EF
Experiment No.8
6. Questions to be answered
• Q.1, Q6, Q7 & Q9
• Q1. Ans:-- Assembler Directives
• Assume : It informs the assembler, the name of the
logical segment that should be used
General form: ASSUME seg_reg : seg_name,…
• Segment : Used to indicate the beginning of the logical
segment
General form: seg_name SEGMENT
• ENDS :Used to inform the end of the segment
General form: seg_name ENDS
• END : Used to inform the assembler, the end of the
program.
General form: END [starting address]
Where starting address is the label specified to indicate the
beginning of the program for CS register.
7. Questions to be answered
• Q6. Ans:-- Direct addressing mode
• Q7. Ans:-- Correct Instructions
1. MOV CL,09H
2. MOV AX,9876H
• Q9. Ans:-- Address Calculation for
1. MOV AX,[BX]
– Taking DS:BX, 0200:0020 is the address of the source
operand
– Shift DS by 4 bit positions DS = 02000h
– Add BX offset to obtain 02000 +
0020
----------
02020H
8. Questions to be answered
• Q9. Ans:-- Address Calculation for
2. MOV AL,[BP +SI]
– Taking SS: [BP+SI], Assuming SI as 0440h,
0400:[0010+0440] is the address of the
source operand.
– Shift SS by 4 bit positions for the base
address SS = 04000h
– Add [BP+SI] (0450) to obtain 04000 +
0450
---------
04450h