当前位置: 网站首页 > 技术应用 > 单片机应用 > 应用范例

汇编除法运算--双字节除以单字节

;***************************************************************************
;名称:16位除以8位
;被除数: xtmp1 xtmp2(H--L),
;除数  : xtmp3
;商    : xtmp4 xtmp5(H--L)
;余数  : xtmp6
;其它  : xtmp7
;***************************************************************************
F16DIV8:
 clrr xtmp6
 movia 16
 movar xtmp7
LDIV1:
 clrwdt
 bclr status,c
 rlr     xtmp2,1
 rlr     xtmp1,1
 rlr     xtmp6,1
 movr xtmp3,0
 jbts0 STATUS,C
 goto LDIV3
 subra xtmp6,A
LDIV2:
 jbts0 STATUS,C
 movar xtmp6
 goto LDIV4
LDIV3:
 subra xtmp6,R
 bset STATUS,C
LDIV4:
 rlr     xtmp5,R
 rlr     xtmp4,R
 djzr xtmp7,R
 goto LDIV1
 return

点击次数:  【关闭
  • 壹零零单片机©版权所有 2008-2023 粤ICP备17151077号

Powered by  xinfuke  5.2.5 ©2008-2024  www.100mcu.com