久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標(biāo)題: msp430單片機(jī)做二分法查找例子加代碼注釋 [打印本頁(yè)]

作者: panpan222    時(shí)間: 2018-12-13 10:17
標(biāo)題: msp430單片機(jī)做二分法查找例子加代碼注釋
.data
List: .byte 1,3,4,7,9,10,12,17,19,21,26
Last: .byte 1
counter: .byte 1


Goal: .byte 1
Index: .space 1



       .text
       mov.w   #List,R5; move the first address of List to R5
       mov.w   #List+10,R6; same as R5+10 to R6
       mov.w   #Index,R12; move the address of Index to R12
       mov.b   Goal,R8;
       call    #binary; call binary subroutine
       sub.w   #0x2400,R7; R7-2400 give to R7 .The position of the value
       mov.b   R7,0(R12); store the final value
       jmp     $;


binary:
       cmp.b   #10,counter; compare with the mid number
       jge     action; jump to action if greater or equal
       mov.w   R6,R7;
       add.w   R5,R7; the add of the first and end address
       rra.w   R7; R7/2 get the mid address
       mov.b   R7,R10;
       cmp.b   R8,R10; compare to know if we get the Goal
       jge     Left; jump to Left if greater or equal
       jl      Right; jump to Right if less


Left:
       cmp.b   R8,R10; judge if R8=R10
       jeq     Done;
       mov.w   R7,R6; give the high Index to R6
       add.b   #1,counter; counter+1;
       jmp     binary;

Right:
       mov.w   R7,R5; give the low Index to R5
       add.b   #1,counter; counter+1
       jmp     binary;

action:
       add.w   #1,R7;
       ret ;return the result

Done:  ret; do return






歡迎光臨 (http://www.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 成人av影院| 久久久高清 | 国产精品一卡 | 日韩在线视频观看 | 日日骚网 | 欧美一区二区三区小说 | www.47久久青青 | 午夜久久久 | 国产福利91精品 | 日韩成人中文字幕 | 精品久久99 | 精品国产欧美一区二区 | 精品欧美一区免费观看α√ | 亚洲精品久久久久久一区二区 | 亚洲人在线播放 | 欧美一级大片 | 日日干干| 久久机热| av一区在线观看 | 中文在线播放 | 九九免费在线视频 | 91在线免费观看网站 | 中文字幕乱码一区二区三区 | 337p日本欧洲亚洲大胆鲁鲁 | 极品粉嫩国产48尤物在线播放 | 午夜视频在线观看网站 | 欧美综合网 | 999久久久久久久久6666 | 国产第一区二区 | 精品一区二区久久久久久久网站 | 国产成人精品一区二 | 高清一区二区三区 | 都市激情亚洲 | 精品久久久久久久人人人人传媒 | 亚洲一区二区 | 国产精品一区二区三区四区 | 中文字幕不卡在线88 | 国产精品日韩欧美一区二区三区 | 亚洲国产精品一区在线观看 | 天天操操 | 久久久久久久久久久久久久久久久久久久 |