用汇编语言编 1.找出存放无符号数的数组A中最小的奇数.

1个回答

  • data segment buffer dw 5,1,7,89,8,9 number EQU ($-BUFFER) string db 'mix jishu number is:$' mix dw 30000 DATA ENDS code segment assume ds:data,cs:code START:mov ax,data mov ds,ax lea dx,string mov ah,09h int 21h CALL JISHU_PROC mov ax,mix mov bx,ax call bin_dec MOV AX,4C00H INT 21H JISHU_PROC PROC NEAR MOV DI,number MOV BX,0 LOOP1:MOV AX,buffer[BX] TEST AX,01H JNZ JISHU1 JZ next JISHU1:cmp ax,mix jl mixjishu jnl next mixjishu:MOV mix,AX next:ADD BX,2 DEC DI JNE LOOP1 RET JISHU_PROC ENDP bin_dec proc near ;子程序bin_dec输出 push bx push cx push si push di mov cx,100 call dec_div mov cx,10 call dec_div mov cx,1 call dec_div pop di pop si pop cx pop bx ret bin_dec endp ;子程序bin_dec结束 dec_div proc near mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h ret dec_div endp code ends end start 在buffer中改成你的数就可以了