PCB抄板/芯片解密

解密PIC单片机的乘除运算子程序

分类:热门芯片解密型号 | 发布:admin | 查看: | 发表时间:2009-10-9

 

PIC单片机(Peripheral Interface Controller)是一种用来开发的去控制外围设备的集成电路(IC)。一种具有分散作用(多任务)功能的CPU。与人类相比,大脑就是CPU,PIC 共享的部分相当于人的神经系统。
PIC单片机有计算功能和记忆内存像CPU并由软件控制允行。然而,处理能力—存储器容量却很有限,这取决于PIC的类型。但是它们的最高操作频率大约都在20MHz左右,存储器容量用做写程序的大约1K—4K字节。
(提示:橙盒科技PCB工作室可专业提供PIC系列单片机高效可靠的解密服务,有PIC系列单片机解密需求者欢迎与我们联系,咨询电话:
芯片解密咨询电话:0755-8222164182175584 , 24小时服务电话18927468661
咨询QQ 994589503 , 1357273089
以下提供PIC单片机完整的乘除运算子程序:
  #define    STATUS    3
  #define    skpb    skpnc    ;skip if borrowed
  #define    skpnb    skpc    ;skip if no borrow
  cblock    0x10
  PROD:2            ;2 bytes for production
  QUOT:2            ;2 bytes for quotient
  PAVRA            ;divider/multiplier
  PAVRB            ;reminder / multiplier
  PAVRC            ;additional byte space
  mcount            ;loop counter
  endc
  org    000h
  ;movlw    0x20;
  ;movwf    PAVRA
  ;movlw    0x30
  ;movwf    PAVRB
  call    BBYTE_DIV
  goto    $-1
  ;====================================
  ;PROD:2 = PAVRA * PAVRB
  ;====================================
  BYTE_MUL
  clrf    PROD
  clrf    PROD+1
  movlw    .8
  movwf    mcount
  _mul1
  rlf    PROD,f        ;left shift 16-bit with LSB=0
  bcf    PROD,0
  rlf    PROD+1,f
  rlf    PAVRA,w        ;make left-rotate shift
  rlf    PAVRA,f        ;and check MSB
  skpc            ;skip if MSB=1
  goto    _mul2        ;MSB=0
  ;do when MSB=1
  movf    PAVRB,w
  addwf    PROD,f
  skpnc
  incf    PROD+1,f
  _mul2
  decfsz    mcount,f
  goto    _mul1
  retlw    0
  ;====================================
  ;WORD divided by BYTE               =
  ;PROD:2 / PAVRA                     =
  ;QUOT:2 = Quotient                  =
  ;PAVRB = Reminder                  =
  ;====================================
  WBYTE_DIV
  movf    PAVRA,f
  skpnz
  retlw    1        ;return if divider=0
  clrf    PAVRB
  clrf    PAVRC
  clrf    QUOT
  clrf    QUOT+1
  movlw    .16
  movwf    mcount
  _wdiv1
  rlf    QUOT,f        ;adjust Quotient
  rlf    QUOT+1,f
  bcf    QUOT,0
  ;
  rlf    PROD+1,w
  rlf    PROD,f
  rlf    PROD+1,f
  ;
  rlf    PAVRB,f
  rlf    PAVRC,f
  ;
  movf    PAVRA,w
  subwf    PAVRB,f
  skpb            ;skip if borrow
  goto    _wdiv2
  ;if borrow
  btfsc    PAVRC,0
  goto    _wdiv2
  addwf    PAVRB,f
  bcf    PAVRC,0
  goto    _wdiv3
  _wdiv2    ;if no borrow
  bcf    PAVRC,0
  bsf    QUOT,0
  _wdiv3
  decfsz    mcount,f
  goto    _wdiv1
  retlw    0
  ;====================================
  ;BYTE divided by BYTE               =
  ;PROD[0] / PAVRA                    =
  ;QUOT[0] = Quotient                 =
  ;PAVRB   = Reminder                 =
  ;====================================
  BBYTE_DIV
  movf    PAVRA,f
  skpnz
  retlw    1        ;return if divider=0
  clrf    PAVRB        ;clear reminder
  clrf    QUOT        ;clear quotient
  movlw    .8
  movwf    mcount        ;for 8 times shift
  _bdiv1
  rlf    QUOT,f        ;adjust Quotient
  bcf    QUOT,0        ;left shift i bit
  ;
  rlf    PROD,w        ;get 1 bit, MSB first
  rlf    PROD,f        ;do rotate shift
  ;
  rlf    PAVRB,f        ;set to LSB of reminder
  ;
  movf    PAVRA,w        ;reminder - divider
  subwf    PAVRB,f
  skpb            ;skip if borrow
  goto    _bdiv2
  ;do if borrowed
  addwf    PAVRB,f        ;cancel subtraction
  goto    _bdiv3        ;go for next
  _bdiv2    ;do if no borrow
  bsf    QUOT,0        ;reminder > divider
  ;update quotient
  _bdiv3
  decfsz    mcount,f    ;loop test
  goto    _bdiv1        ;do 8 times
  retlw    0        ;completed
  END
Tags: 解密  PIC单片机  乘除运算  子程序  
« MICROCHIP公司PIC系列单片机解密常见问题解答    at88sc0104单片机解密成功 »
相关文章:
  • PCB抄板专线:0755-82221641
  • 芯片解密专线:0755-82173891
  • 咨询QQ:994589503,418219082
  • 邮箱:chkeji@126.com
PCB抄板网 | 关于橙盒 | PCB抄板 | PCB设计 | 芯片解密 | 单片机解密 | 样机制作 | 电子产品克隆 | 联系橙盒