PIC17C4X
ds30412c-页 50
1996 微芯 技术 公司
例子 8-3 显示 这 sequence 至 做 一个 16 x 16
unsigned 乘以. 等式 8-1 显示 这 algorithm
那 是 使用. 这 32-位 结果 是 贮存 在 4 寄存器
res3:res0.
等式 8-1: 16 x 16 unsigned
MULTIPLICATION
ALGORITHM
res3:res0 = arg1h:arg1l * arg2h:arg2l
= (arg1h * arg2h * 2
16
)+
(arg1h * arg2l * 2
8
)+
(arg1l * arg2h * 2
8
)+
(arg1l * arg2l)
例子 8-3: 16 x 16 乘以 routine
movfp arg1l, wreg
mulwf arg2l ; arg1l * arg2l ->
; prodh:prodl
movpf prodh, res1 ;
movpf prodl, res0 ;
;
movfp arg1h, wreg
mulwf arg2h ; arg1h * arg2h ->
; prodh:prodl
movpf prodh, res3 ;
movpf prodl, res2 ;
;
movfp arg1l, wreg
mulwf arg2h ; arg1l * arg2h ->
; prodh:prodl
movfp prodl, wreg ;
addwf res1, f ; 增加 交叉
movfp prodh, wreg ; 产品
addwfc res2, f ;
clrf wreg, f ;
addwfc res3, f ;
;
movfp arg1h, wreg ;
mulwf arg2l ; arg1h * arg2l ->
; prodh:prodl
movfp prodl, wreg ;
addwf res1, f ; 增加 交叉
movfp prodh, wreg ; 产品
addwfc res2, f ;
clrf wreg, f ;
addwfc res3, f ;