http:^^cs.nyu.edu^cs^dept_info^course_home_pages^fall96^v22.0201.002^shiftadd.html

来自「This data set contains WWW-pages collect」· HTML 代码 · 共 37 行

HTML
37
字号
Date: Tue, 14 Jan 1997 22:48:32 GMTServer: NCSA/1.4.1Content-type: text/htmlLast-modified: Mon, 21 Oct 1996 00:18:13 GMTContent-length: 915<HTML><HEAD>  <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac">  <TITLE>shift and add = multiply</TITLE></HEAD><BODY BGCOLOR="#fee7cb"><PRE>; code to demonstrate the shift &amp; add method of multiplication;;;  presume the input is in two bytes named fact1 and fact2;   and the output is going into a Word (unsigned) called PRODUCT;;        mov     bl, fact1       ; grab input        mov     al, fact2               mov     bh, 0           ;zero out high byte of bx        mov     dx, 0           ;zero accum (product)lp:     cmp     al, 0           ;check for end        je      fini        shr     al, 1           ;grab rightmost bit        jnc     nextbit           ;don't add it -bit was zero        add     dx, bx          ;add next shift into accumnextbit: shl    bx, 1           ;shift first fact to left        jmp     lpfini:   mov     product, dx </PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?