Write a in SPARC assembly programming to initialize an array

Write a in SPARC assembly programming to initialize an array

int ary[6] = {2, 5, -3, -4, 0, 6}

and then to find the largest element by searching the array(i.e. use a loop).

Note:-Run your program using gdb to verify array values at each array subscript.-Do not optimize your code (i.e. do not remove nops)

Solution

DATA SEGMENT ARR DB 1,4,2,3,9,8,6,7,5,10 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
Write a in SPARC assembly programming to initialize an array int ary[6] = {2, 5, -3, -4, 0, 6} and then to find the largest element by searching the array(i.e.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site