ʵÑéÈý »ã±àÓïÑÔ×Ó³ÌÐòÉè¼Æ(·ÖÖ§¡¢×Ó³ÌÐò)
Ò». ʵÑéÄ¿µÄ
1¡¢ÕÆÎÕ·ÖÖ§ºÍ×Ó³ÌÐò½á¹¹ºÍÉè¼Æ·½·¨£»
2¡¢ÊìϤÔÚPC»úÉϽ¨Á¢¡¢»ã±à¡¢Á¬½Ó¡¢µ÷ÊÔºÍÔËÐÐ8086/8088»ã±àÓïÑÔ³ÌÐòµÄ¹ý³Ì¡£ 3¡¢Í¨¹ý»ã±àÓïÑÔÁ˽â¸ß¼¶ÓïÑԵIJÎÊý´«µÝµÈ֪ʶ¡£
¶þ. ʵÑéÄÚÈÝ
1¡¢BLÖеÄÖ»ÓÐһλΪ1¡£±àд³ÌÐò²âÊÔ£¬²¢Êä³öÌáʾÐÅÏ¢¡°The X Bit is 1¡±£¬ÒªÇ󣺵ØÖ·±íºÍ×ªÒÆ±í¡£
2. ±àдһ¸ö×Ó³ÌÐò¼ÆËãz=f(x,y)=x*y+x-y£¨x,y,zÓзûºÅÊýÄÚ´æÊý£©¡£ÒªÇóͨ¹ý¶ÑÕ»(¼Ä´æÆ÷¡¢ÄÚ´æ)´«ËÍËùÓвÎÊý¡£ 3. ʵ¼ùC?AsmµÄת»»¹ý³Ì¡£
Èý. ʵÑé¹ý³ÌºÍ³ÌÐò
1¡¢BLÖеÄÖ»ÓÐһλΪ1¡£±àд³ÌÐò²âÊÔ£¬²¢Êä³öÌáʾÐÅÏ¢¡°The X Bit is 1¡±£¬ÒªÇ󣺵ØÖ·±íºÍ×ªÒÆ±í¡£ ;bl have one 1 cout< addres dw fun8,fun7,fun6,fun5,fun4,fun3,fun2,fun1 string8 db 'The 8 Bit is 1$' string7 db 'The 7 Bit is 1$' string6 db 'The 6 Bit is 1$' string5 db 'The 5 Bit is 1$' string4 db 'The 4 Bit is 1$' string3 db 'The 3 Bit is 1$' string2 db 'The 2 Bit is 1$' string1 db 'The 1 Bit is 1$' data ends assume ds:data,cs:code code segment start: mov ax,data mov ds,ax mov bl,10h mov ax,0000h mov cx,8 math: shl bl,1 jc right jmp next right:mov dl,02h mul dl mov bp,ax jmp addres[bp] next: inc ax loop math fun8:mov dx,offset string8 cout:mov ah,09h int 21h mov ah,4ch int 21h jmp cout jmp cout jmp cout jmp cout jmp cout jmp cout jmp cout jmp cout fun7:mov dx,offset string7 fun6:mov dx,offset string6 fun5:mov dx,offset string5 fun4:mov dx,offset string4 fun3:mov dx,offset string3 fun2:mov dx,offset string2 fun1:mov dx,offset string1 code ends end start 2. ±àдһ¸ö×Ó³ÌÐò¼ÆËãz=f(x,y)=x*y+x-y£¨x,y,zÓзûºÅÊýÄÚ´æÊý£©¡£ÒªÇóͨ¹ý¶ÑÕ»(¼Ä´æÆ÷¡¢ÄÚ´æ)´«ËÍËùÓвÎÊý¡£ ʹÓöÑÕ»£º data segment x db 03h y db 0ffh z dw 0000h data ends stack segment dw 100 dup(?) stack ends assume ds:data,cs:code,ss:stack code segment start: mov ax,data mov ds,ax mov ax,stack mov ss,ax mov al,x push ax mov al,y push ax call program mov z,dx add sp,2 jmp quit program: push bp mov bp,sp mov ax,[bp+6] mov dx,[bp+4] imul dl mov dx,ax mov ax,[bp+6] cbw add dx,ax mov ax,[bp+4] cbw sub dx,ax pop bp ret mov ah,4ch quit: int 21h code ends end start ¶þ¡¢Ê¹ÓüĴæÆ÷´«Öµ data segment x db 03h y db 0ffh z dw 0000h data ends stack segment dw 100 dup(?) stack ends assume ds:data,cs:code,ss:stack code segment start: mov ax,data mov ds,ax mov ax,stack mov ss,ax mov al,x mov bl,y call program mov z,dx jmp quit program: