#include<stdio.h>
#include<stdlib.h>
void main(void){
unsigned short data[10]={2235,3278,581,2561,357,123,3,5456,45342,564};
unsigned short maxv,minv;
unsigned short *data_point;
data_point=data;
printf("Find max/min data using asm:\n");
__asm{
mov esi,data_point
mov ecx,9
mov ax,[esi]
mov bx,ax
addr2: add esi,2
cmp [esi],ax
jc findmin
jz next
mov ax,[esi]
jmp next
findmin: cmp [esi],bx
inc next
mov bx,[esi]
next: loop addr2
mov maxv,ax
mov minv,bx
}
printf("Mix is %d\n",maxv);
printf("Min is %d\n",minv);
}
不知道什么地缝有问题,,抄书的....全部一样的..
------解决思路----------------------
findmin: cmp [esi],bx
inc next ;; 这里笔误了吧,inc 应该是 jnc ?