Not c assembly COMP375 Assembler Programming Assignment 2 1
}. Not c++... assembly
 COMP375 Assembler Programming Assignment 2 1. Write a program to find the smallest value in an array of 8 integers. include kiostream> using name space std; int main (int argn, char argv [J) int smallest i, arrayA[8] cout \"Enter 8 numbers endl; for (i 0; i 8 it cin array Ali asm t Find the smallest value in arrayA in assembler cout The smallest value is smallest endl; return 0; 2. Write a program that will calculate the log base 2 of an integer using the Intel BSR instruction The BSR instruction has the format Solution
DATA SEGMENT ARR DB 1,4,2,3,9,8,6,7 LEN DW $-ARR LARGE DB ? DATA ENDS CODE SEGMENT ASSUME DS:DATA CS:CODE START: MOV AX,DATA MOV DS,AX LEA SI,ARR MOV AL,ARR[SI] MOV LARGE,AL MOV CX,LEN REPEAT: MOV AL,ARR[SI] CMP LARGE,AL JG NOCHANGE MOV LARGE,AL NOCHANGE: INC SI LOOP REPEAT MOV AH,4CH INT 21H CODE ENDS END START
