Microcontroller program to find smallest number in an array
Answers
Answered by
1
DATA SEGMENT A DW 8,2,5,6,1,3 DATA ENDS CODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX MOV CX,0000 MOV CL,06 LEA BX,A MOV DX,WORD PTR[BX] MOV AX,0000 L1:CMP AX,WORD PTR[BX] JNC L2 MOV AX,WORD PTR[BX] L2:CMP DX,WORD PTR[BX] JC L3 MOV DX,WORD PTR[BX] L3:ADD BX,02 DEC CL CMP CL,00 JNZ L1 MOV AH,4CH INT 21H CODE ENDS END START ;OUTPUT:-> ;-G CS: 0028 ; ;AX=0008 BX=000C CX=0000 DX=0001 SP=0000 BP=0000 SI=0000 DI=0000 ;DS=0BF4 ES=0BE4 SS=0BF4 CS=0BF5 IP=0028 NV UP EI PL ZR NA PE NC ;0BF5:0028 B44C MOV AH,4C
Answered by
0
Answer:
Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory
Similar questions