⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 div8u.s

📁 ICCAVR中所有的库函数源码
💻 S
字号:
;; This subroutine divides the two register variables r16 (dividend) and; r17 (divisor). The result is placed in r16. If mod is called the remainder; is the result.; Low registers used:  1 (r15,r14); High registers used: 3 (r16,r17,r18)mod8u::  set  rjmp xdiv8udiv8u::	  cltxdiv8u::  st	-y,R18  st	-y,R15  st	-y,R14  clr	r15	; zero-extend the dividend  clr	r14	; clear remainder  ldi	r18,16	; init loop counterd8u_1:  lsl	r16	; shift dividend/quotient left  rol	r15	; shift dividend into remainder  rol	r14	; shift dividend into remainder  cp	r14,r17 ; is remainder < divisor?  brcs	d8u_2	; branch if yes  sub	r14,r17 ; remainder -= divisor  inc	r16	; quotient++, lsb = 0d8u_2:  dec	r18	; decrement counter  brne	d8u_1	; if not done  brtc	nocopy8 ; if T is set, then copy the remainder R15 to R16  mov	r16,r14nocopy8:  ld R14,Y+  ld R15,Y+  ld R18,Y+  ret

⌨️ 快捷键说明

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