亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? extras.asm

?? mcs51,2051,x86系列MCU
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;
;       OPTIMIZED ASSEMBLY ROUTINES FOR INTEGER MATH.
;


;       Excerpts published by permission of Addison Wesley, from the book
;       titled "Programming and interfacing the 8051 microcontroller"
;       ISBN #0-201-63365-5

;===============================================================
; subroutine TC2AV_SB8
; 8-Bit Two's Complement to Absolute Value / Sign Bit Conversion
;
; input:     internal register XT holds a signed byte in two's
;          complement convension
; output:     internal register XA holds the absolute value of the
;          signed byte, addressable bit XS holds the sign (XS is
;          set if XT is a negative number)
; destroys:     a
;================================================================
TC2AV_SB8:
     mov     a, XT          ; read X into accumulator
     jb     acc.7, Xneg     ; X is negative if bit 7 is 1

     mov     XA, XT     ; else, XT is the absolute value
     clr     XS          ; clear sign bit for 'positive'
     ret               ; done
Xneg:
     cpl     a          ; X is negative so find absolute value
     inc     a          ; XA = copmlement(XT)+1
     mov     XA, a          ; save absolute value
     set     XS          ; set sign bit for 'negative'
     ret


;====================================================================
; subroutine AV_SB2TC8
; 8-Bit Absolute Value / Sign Bitto Two's Complement Conversion
;
; input:     internal register XA holds the absolute value of the
;          signed byte, addressable bit XS holds the sign (XS is
;          set if XT is a negative number)
; output:     internal register XT holds a signed byte in two's
;          complement convension.  the addressable bit XOV is
;          set if the byte is out of range (-128 to 127).
; destroys:     a
;====================================================================
AV_SB2TC8:
     mov     a, XA               ; get absolute value
     jnb     acc.7, range_OK     ; see if MSB is 0
     cjne     a, #80h, range_error
     jb     XS, range_OK     ; also error if X is positive

range_error:
     setb     XOV          ; set overflow bit
     ret

range_OK:
     clr     XOV          ; no overflow error
     jb     XS, Xneg1     ; check sign
     mov     XT, XA     ; if positive, XT is the same as XA
     ret               ; done
Xneg1:
     mov     a, XA          ; if X is negative, get its absolute value
     cpl     a          ; complement absolute value of X
     inc     a          ; XT = copmlement(XA)+1
     mov     XT, a          ; save two's complement representation
     ret


;===============================================================
; subroutine TC2AV_SB16
; 16-Bit Two's Complement to Absolute Value / Sign Bit Conversion
;
; input:     internal registers XTH and XTL hold a signed word in
;          two's complement convension
; output:     internal registers XAH and XAL hold the absolute
;          value of the signed word, addressable bit XS holds
;          the sign (XS is set if XT is a negative number)
; destroys:     a
;================================================================
TC2AV_SB16:
     mov     a, XTH     ; read X high byte into accumulator
     jb     acc.7, Xneg     ; X is negative if bit 7 is 1

     mov     XAH, XTH     ; else, XT is the absolute value
     mov     XAL, XTL
     clr     XS          ; clear sign bit for 'positive'
     ret               ; done
Xneg:
     mov     a, XTL     ; X is negative
     cpl     a          ; find its absolute value
     inc     a          ; XA = copmlement(XT)+1
     mov     XAL          ; XAL is found
     jnz     XL_OK          ; if not 0, high byte is not incremented

     mov     a, XTH     ; else get high byte
     cpl     a          ; complement high byte...
     inc     a          ; ... and increment
     mov     XAH          ; store in XAH
     ret               ; done
XL_OK:
     mov     a, XTH     ; get high byte
     cpl     a          ; complement high byte - do not increment
     mov     XAH          ; store in XAH
     ret               ; done

;====================================================================
; subroutine AV_SB2TC16
; 16-Bit Absolute Value / Sign Bit to Two's Complement Conversion
;
; input:     internal registers XAH and XAL hold the absolute
;          value of the signed word, addressable bit XS holds
;          the sign (XS is set if XT is a negative number)
; output:     internal registers XTH and XTL hold a signed word in
;          two's complement convension.  the addressable bit XOV is
;          set if the byte is out of range (-32768 to 32767).
; destroys:     a
;====================================================================
AV_SB2TC16:
     mov     a, XAH          ; get absolute value
     jnb     acc.7, range_OK1     ; see if MSB is 0
     clr     acc.7               ; see if X=-8000h
     orl     a, XAL          ; acc=0 only if X=8000
     jnz     range_error1     ; else error
     jb     XS, range_OK1     ; also error if X is positive

range_error1:
     setb     XOV          ; set overflow bit
     ret

range_OK1:
     clr     XOV          ; no overflow error
     jb     XS, Xneg2     ; check sign
     mov     XTH, XAH     ; if positive, XT is the same as XA
     mov     XTL, XAL
     ret               ; done
Xneg2:
     mov     a, XAL     ; if X is negative, get its absolute value
     cpl     a          ; complement
     inc     a          ; XT = copmlement(XA)+1
     mov     XTL, a
     jnz     XL_OK1     ; if not 0, high byte is not incremented

     mov     a, XAH     ; else get high byte
     cpl     a          ; complement high byte...
     inc     a          ; ... and increment
     mov     XTH          ; store in XTH
     ret               ; done
XL_OK1:
     mov     a, XAH     ; get high byte
     cpl     a          ; complement high byte - do not increment
     mov     XTH          ; store in XTH
     ret               ; done

;===============================================================
; subroutine SMUL8
; 8-Bit Multiplication of Signed Integers in the Absolute Value
; / Sign Bit Format
;
; input:     internal registers XA and YA hold the absolute
;          values of the signed bytes X and Y.  addressable
;          bits XS and YS hold the sign bits, set if the
;          corresponding numbers are negative
; output:     internal registers ZAH and ZAL hold the absolute
;          value of the result Z=X碮.  addressable bit ZS
;          holds the sign of the result, set if the result is
;          negative.
; destroys:     a
;================================================================
SMUL8:
     mov     a, XA          ; read X and ...
     mov     b, YA          ; ... Y
     mul     ab          ; multiply X and Y
     mov     ZH, b          ; save result high ...
     mov     ZL, a          ; ... and low byte

     mov     C, XS          ; get sign of X
     xrl     C, YS          ; compute sign of result Z
     mov     ZS, C          ; save sign of result
     ret

;===============================================================
; subroutine SDIV8
; 8-Bit Division of Signed Integers in the Absolute Value /
; Sign Bit Format
;
; input:     internal registers XA and YA hold the absolute
;          values of the signed bytes X and Y.  addressable
;          bits XS and YS hold the sign bits, set if the
;          corresponding numbers are negative
; output:     internal registers ZAQ and ZAR hold the quotient and
;          the remainder of the division Z=X竃.  addressable
;          bit ZS holds the sign of the result, set if the
;          result is negative.  the addressible bit ZOV is set
;          if Y is zero.
; destroys:     a
;================================================================
SDIV8:
     mov     a, XA          ; read X and ...
     mov     b, YA          ; ... Y
     div     ab          ; divide X and Y
     mov     C, OV          ; get overflow flag
     mov     ZOV, C     ; save in ZOV.  (set if Y=0)
     mov     ZAQ, a     ; save result quotient
     mov     ZAR, a     ; save remainder

     mov     C, XS          ; get sign of X
     xrl     C, YS          ; compute sign of result Z
     mov     ZS, C          ; save sign of result
     ret

;====================================================================
; subroutine ADD16
; 16-Bit Unsigned Addition
;
; input:     internal registers XH, XL, YH, and YL hold the high and
;          low bytes of the unsigned words
; output:     internal registers ZH and ZL hold high and low bytes of
;          the unsigned word Z=X+Y.  addressible bit ZOV is set if
;          the result (Z) is out of range (an external carry is
;          produced from the high byte)
; destroys:     a, flags
;====================================================================
ADD16:
     mov     a, XL          ; load X low byte into accumulator
     add     a, YL          ; add Y low byte
     mov     ZL, a          ; put result in Z low byte
     mov     a, XH          ; load X high byte into accumulator
     addc     a, YH          ; add Y high byte with the carry from low ...
                    ; ... byte operation
      mov     ZH, a          ; save result in Z high byte
     mov     ZOV, C     ; set ZOV if external carry
     ret               ; done


;====================================================================
; subroutine SUB16
; 16-Bit Unsigned subtraction
;
; input:     internal registers XH, XL, YH, and YL hold the high and
;          low bytes of the unsigned words
; output:     internal registers ZH and ZL hold high and low bytes of
;          the signed word Z=X-Y.  addressible bit ZOV is set if
;          the result (Z) is out of range (if an external barrow is
;          produced)
; destroys:     a, flags
;====================================================================
SUB16:
     mov     a, XL          ; load X low byte into accumulator
     clr     C          ; clear carry flag
     subb     a, YL          ; subract Y low byte
     mov     ZL, a          ; put result in Z low byte
     mov     a, XH          ; load X high byte into accumulator
     subb     a, YH          ; subtract Y high byte with the barrow ...
                    ; ... from low byte operation
     mov     ZH, a          ; save result in Z high byte
     mov     ZOV, C     ; set ZOV id an external barrow is produced
     ret               ; done
;====================================================================
; subroutine SUB32
; 32-Bit Unsigned subtraction
;
; input:     internal registers X3, X2, X1, X0, and Y3, Y2, Y1, and Y0
;          hold the 32-bit unsigned integers
; output:     internal registers Z3, Z2, Z1, and Z0 hold the result
;          Z=X-Y.  addressible bit ZOV is set if the result (Z) is
;          out of range (if an external barrow is produced)
; destroys:     a, flags
;====================================================================
SUB32:
     mov     a, X0          ; load X low byte into accumulator
     clr     C          ; clear carry flag
     subb     a, Y0          ; subract Y low byte
     mov     Z0, a          ; put result in Z low byte
     mov     a, X1          ; repeat with other bytes...
     subb     a, Y1
     mov     a, X2
     subb     a, Y2
     mov     a, X3
     subb     a, Y3
     mov     ZOV, C     ; set ZOV id an external barrow is produced
     ret               ; done
;====================================================================
; subroutine BMW
; Byte Multiplied by 16-Bit Word
;
; input:     internal register X holds the 8-bit unsigned integer.
;          internal registers YH, and YL hold the high and
;          low bytes of the unsigned word.
; output:     internal registers Z2, Z1 and Z0 hold the three result
;          bytes.  Z2 is the most significant byte, and Z0, the least
;          significant.  The result always fits in 3 bytes.
; destroys:     a, b, r0, flags
;====================================================================
BMW:
     mov     a, X          ; load X into accumulator
     mov     b, YL          ; load Y low byte into b register
     mul     ab          ; multiply
     mov     Z0, a          ; save result low byte
     push     b          ; push result high byte
                    ; this byte needs to be added to the low
                    ; byte of the product X*YH

     mov     a, X          ; load X into accumulator
     mov     b, YH          ; load Y high byte into b register
     mul     ab          ; multiply
     pop     r0          ; recall X*YL high byte
     add     a, r0          ; add X*YL high byte and X*YH low byte
     mov     Z1, a          ; save result
     clr     a          ; clear accumulator
     addc     a, b          ; a = b + carry flag
     mov     Z2, a          ; save result
     ret               ; done
;====================================================================
; subroutine MUL16
; Multiply two 16-Bit Unsigned Words
;
; input:     internal register XH, XL, YH, and YL hold the high and
;          low bytes of the two unsigned words X and Y.
; output:     internal registers Z3, Z2, Z1 and Z0 hold the four result
;          bytes.  Z3 is the most significant byte, and Z0, the least
;          significant.  The result always fits in 4 bytes.
; destroys:     a, b, r0, r1, flags
;====================================================================
MUL16:
     lcall BMW          ; multiply XL with (YH:YL)
     mov     a, Z2
     push     acc          ; push ZL2
     mov     a, Z1
     push     acc          ; push ZL1
     mov     a, Z0

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲伦在线观看| 亚洲第四色夜色| 欧美三级电影网站| 国产一区二区三区久久久 | 久久精品国产99| **性色生活片久久毛片| 欧美一级欧美三级| 91丨porny丨中文| 久久99精品久久久久久动态图| 中文字幕一区二| 欧美成人r级一区二区三区| 色婷婷精品久久二区二区蜜臀av| 免费高清成人在线| 亚洲男人都懂的| 欧美国产日韩精品免费观看| 欧美精品xxxxbbbb| 91农村精品一区二区在线| 国产在线精品一区二区| 五月婷婷久久丁香| 一区二区三区欧美日韩| 国产精品免费久久| 精品国产91久久久久久久妲己 | 国产在线观看免费一区| 亚洲无线码一区二区三区| 国产精品久久久久一区二区三区 | 欧美一区二区女人| 欧美视频在线不卡| 91美女精品福利| 成人听书哪个软件好| 国产乱码精品一品二品| 久久成人麻豆午夜电影| 石原莉奈在线亚洲三区| 亚洲mv在线观看| 亚洲精品日韩一| 国产乱人伦偷精品视频不卡| 国产精品女主播av| www激情久久| 精品美女一区二区| 欧美sm美女调教| 欧美一区二区视频网站| 欧美日韩国产首页| 欧美久久一二区| 欧美吞精做爰啪啪高潮| 91成人在线精品| 色妹子一区二区| 在线观看日韩毛片| 在线视频一区二区三| 欧美丝袜丝nylons| 欧美日韩精品一区二区三区蜜桃| 欧美性受极品xxxx喷水| 欧美三级一区二区| 欧美日韩一二区| 日韩一二三四区| 精品国产免费一区二区三区四区| 日韩美女天天操| 国产亚洲自拍一区| 中文字幕在线观看不卡视频| 中文字幕一区二区三区在线观看| 一色屋精品亚洲香蕉网站| 亚洲精品视频在线观看免费| 亚洲一区二区三区四区不卡| 午夜成人免费视频| 另类综合日韩欧美亚洲| 国内精品嫩模私拍在线| 国产精品一二三在| 91视频国产观看| 制服丝袜亚洲网站| 欧美精品一区二区三区四区| 国产欧美一区二区精品性| 亚洲免费观看视频| 丝瓜av网站精品一区二区| 久久99精品久久久久| 国产成人av电影免费在线观看| 99在线精品一区二区三区| 欧美丝袜自拍制服另类| 久久综合九色综合97婷婷女人| 国产精品第13页| 亚洲成年人影院| 国产乱人伦偷精品视频免下载| 成人av动漫网站| 欧美视频一区二区| 26uuu国产一区二区三区| 中文字幕一区二区三区色视频 | 中文字幕日韩av资源站| 一区二区视频在线看| 蜜臀a∨国产成人精品| 国产成人亚洲综合a∨猫咪| 色综合久久天天| 精品国产乱码久久久久久久| 亚洲欧洲韩国日本视频| 日本成人在线看| 99久久综合狠狠综合久久| 欧美一区二区三区人| 国产精品美女久久久久aⅴ国产馆| 亚洲国产精品欧美一二99| 国产精品一区二区在线看| 色狠狠色噜噜噜综合网| 久久久久久免费网| 亚洲成av人在线观看| 国产999精品久久久久久绿帽| 欧美在线免费观看亚洲| 中文字幕第一区| 7777精品伊人久久久大香线蕉| 精品不卡在线视频| 亚洲一区二区三区在线播放| 国产精品亚洲视频| 欧美精品 日韩| 中文字幕在线一区免费| 美女看a上一区| 欧美性猛交xxxxxxxx| 国产精品网站在线| 精品在线观看视频| 欧美精品精品一区| 亚洲美女一区二区三区| 国产91丝袜在线播放0| 欧美肥胖老妇做爰| 一区二区三区日韩在线观看| 国产高清不卡一区| 精品国产乱码久久久久久图片 | 精品成人一区二区三区四区| 一区二区三区免费网站| 成人丝袜高跟foot| 国产色爱av资源综合区| 蜜桃一区二区三区在线| 欧美人与z0zoxxxx视频| 一区二区三区不卡视频在线观看| 高清成人在线观看| 久久久五月婷婷| 久久精品国产精品亚洲红杏| 欧美日韩国产精选| 一区二区三区高清在线| 色悠久久久久综合欧美99| 国产精品久久久久久久久果冻传媒| 国产久卡久卡久卡久卡视频精品| 精品乱人伦小说| 另类的小说在线视频另类成人小视频在线 | 成人白浆超碰人人人人| 国产偷国产偷精品高清尤物| 国产精品18久久久久久vr| 精品国产精品一区二区夜夜嗨| 日韩**一区毛片| 91精品在线观看入口| 日韩极品在线观看| 日韩一区二区三区高清免费看看| 婷婷开心久久网| 91精品婷婷国产综合久久 | 中文字幕亚洲一区二区va在线| 成人av资源在线观看| 亚洲人吸女人奶水| 在线观看精品一区| 香蕉成人伊视频在线观看| 3d成人动漫网站| 国内精品在线播放| 欧美激情中文字幕| 色综合一区二区| 亚洲国产wwwccc36天堂| 91精品国产综合久久小美女| 婷婷综合另类小说色区| 欧美制服丝袜第一页| 亚洲一区二区影院| 欧洲色大大久久| 日本在线观看不卡视频| 精品久久久久久久久久久久包黑料 | 欧美午夜影院一区| 国产精品午夜电影| 日本高清免费不卡视频| 亚洲成在线观看| 欧美日韩一区精品| 国产精品黄色在线观看| 国产精品夜夜嗨| 中文字幕欧美激情| 波多野结衣的一区二区三区| 综合中文字幕亚洲| 91精品国产综合久久小美女| 久久av中文字幕片| 久久欧美一区二区| 蜜臀久久久99精品久久久久久| 久久久久久久久久看片| 成人午夜碰碰视频| 一区二区在线免费| av午夜一区麻豆| 一区二区三区**美女毛片| 欧美日韩美女一区二区| 日本欧美加勒比视频| 国产精品国产馆在线真实露脸 | 五月天一区二区三区| 欧美电视剧免费全集观看| 国产伦精品一区二区三区免费 | 欧美一区二区日韩| 国产另类ts人妖一区二区| 久久综合久久久久88| 欧美在线综合视频| 久久精品久久综合| 国产精品精品国产色婷婷| 欧美亚洲日本一区| 理论电影国产精品| 亚洲色图欧美偷拍| 欧美一级二级三级乱码| 色呦呦国产精品| 日韩黄色在线观看|