谁编写了14万行的汇编语言编写大数乘法软件程序

京 东 价:
[定价:¥]
PLUS会员专享价
您购买此商品可享受专属价
增值业务:
重  量:
选择系列:
搭配赠品:
服务支持:
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
Python程序设计入门到实战
商品介绍加载中...
扫一扫,精彩好书免费看
京东商城向您保证所售商品均为正品行货,京东自营商品开具机打发票或电子发票。
凭质保证书及京东商城发票,可享受全国联保服务(奢侈品、钟表除外;奢侈品、钟表由京东联系保修,享受法定三包售后服务),与您亲临商场选购的商品享受相同的质量保证。京东商城还为您提供具有竞争力的商品价格和,请您放心购买!
注:因厂家会在没有任何提前通知的情况下更改产品包装、产地或者一些附件,本司不能确保客户收到的货物与商城图片、产地、附件说明完全一致。只能确保为原厂正货!并且保证与当时市场上同样主流新品一致。若本商城没有及时更新,请大家谅解!
权利声明:京东上的所有商品信息、客户评价、商品咨询、网友讨论等内容,是京东重要的经营资源,未经许可,禁止非法转载使用。
注:本站商品信息均来自于合作方,其真实性、准确性和合法性由信息拥有者(合作方)负责。本站不提供任何保证,并不承担任何法律责任。
印刷版次不同,印刷时间和版次以实物为准。
价格说明:
京东价:京东价为商品的销售价,是您最终决定是否购买商品的依据。
划线价:商品展示的划横线价格为参考价,该价格可能是品牌专柜标价、商品吊牌价或由品牌供应商提供的正品零售价(如厂商指导价、建议零售价等)或该商品在京东平台上曾经展示过的销售价;由于地区、时间的差异性和市场行情波动,品牌专柜标价、商品吊牌价等可能会与您购物时展示的不一致,该价格仅供您参考。
折扣:如无特殊说明,折扣指销售商在原价、或划线价(如品牌专柜标价、商品吊牌价、厂商指导价、厂商建议零售价)等某一价格基础上计算出的优惠比例或优惠金额;如有疑问,您可在购买前联系销售商进行咨询。
异常问题:商品促销信息以商品详情页“促销”栏中的信息为准;商品的具体售价以订单结算页价格为准;如您发现活动商品售价或促销信息有异常,建议购买前先联系销售商咨询。
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
加载中,请稍候...
浏览了该商品的用户还浏览了
加载中,请稍候...
七日畅销榜
新书热卖榜
iframe(src='//www.googletagmanager.com/ns.html?id=GTM-T947SH', height='0', width='0', style='display: visibility:') 上传我的文档
 下载
 收藏
粉丝量:32
该文档贡献者很忙,什么也没留下。
 下载此文档
汇编语言第14章中断
下载积分:2500
内容提示:汇编语言第14章中断
文档格式:PPT|
浏览次数:1|
上传日期: 16:50:43|
文档星级:
全文阅读已结束,如果下载本文需要使用
 2500 积分
下载此文档
该用户还上传了这些文档
汇编语言第14章中断
关注微信公众号拒绝访问 | www.ggdoc.com | 百度云加速
请打开cookies.
此网站 (www.ggdoc.com) 的管理员禁止了您的访问。原因是您的访问包含了非浏览器特征(3db3abdde9e543dd-ua98).
重新安装浏览器,或使用别的浏览器人员创新能力建设题 答案 陕西培训_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
人员创新能力建设题 答案 陕西培训
阅读已结束,下载文档到电脑
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,方便使用
还剩37页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢sword_yang 悬赏1000元的小程序: 用8位单片机汇编语言编写一个4倍精度(32位运算)的四
回复【96楼】windy__xp 龙笑
-----------------------------------------------------------------------
呃,写个程序仿真一下行不,还是必须用硬件验证呢?
我是观众!!喜欢这种游戏...
回复【100楼】mymainmail
回复【96楼】windy__xp 龙笑
-----------------------------------------------------------------------
呃,写个程序仿真一下行不,还是必须用硬件验证呢?
-----------------------------------------------------------------------
& &&&这个得杨老师说了算,哈哈,如果是我写的话,可能只会做到用软件仿真一下,看结果是否正确 这一步。主要可能是多测试一些异常情况的处理,比如益出等问题。
90楼的程序还有很多特殊状况没考虑进去
回复【103楼】avr741
-----------------------------------------------------------------------
哪些特殊情况呢?今天仿真郁闷死了,AVRstudio仿串口居然不行,调了半天才发现UCSRC和UBRRH这两个寄存器居然同时改变,搜了一下才发现坛子里有人发现这个问题,官方回复是说这是一个他们没发现的BUG
&调了半天才发现UCSRC和UBRRH这两个寄存器居然同时改变,搜了一下才发现坛子里有人发现这个问题,官方回复是说这是一个他们没发现的BUG&&&
我在这贴里也有发现这个问题
http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=3943831&bbs_page_no=1&search_mode=4&search_text=avr741&bbs_id=9999
【125楼】 avr741
等级:------
回复【49楼】smartzou&&
我想问一下 那个 UBRRH和UCSRC 的问题&&
若URSEL为0,对UBRRH值更新;若URSEL为1,对UCSRC设置更新&&
但是 执行完&&UCSRC=(1&&URSEL)|(1&&UCSZ1)|(1&&UCSZ0);//8位数据+1位STOP位&&这条语句后,UBRRH就变成了0x86了(而我开始给UBRRH赋的值为0)& &
我觉得会不会是 UBRR(或UBRRH)的问题呢?&&
-----------------------------------------------------------------------
是仿真画面显示的问题,因为仿真程序不知道UBRRH和UCSRC占用同一个地址0x20
AVR内部是对的
我也来一个avr的!!!
匆匆忙忙,欢迎纠错,呵呵
程序实现的是0xffffffff---0x0.的加减乘除,这里没有做减法结果为负数的简单处理。结果提供32位精度,其中加减乘比较简单,除法有一定技巧。
.include& & & & &m8def.inc&& & & &
;//r16,r17,r18,r19&&数值1; r1小数点位置
;//r20,r21,r22,r23&&数值2; r2小数点位置
;//加减法结果r16~r23,小数点在32位
;//乘法结果r12~r19,r3小数点位置
;//除法结果r12~r15,r3为小数点位置+128& & 如r13=140,表示小数点在r14的3、4位之间
a1:& & & & .byte& & & & 1
a2:& & & & .byte& & & & 1
a3:& & & & .byte& & & & 1
a4:& & & & .byte& & & & 1
a5:& & & & .byte& & & & 1
a6:& & & & .byte& & & & 1
a7:& & & & .byte& & & & 1
a8:& & & & .byte& & & & 1
b1: .byte& & & & 1
b2: .byte& & & & 1
b3: .byte& & & & 1
b4: .byte& & & & 1
b5: .byte& & & & 1
b6: .byte& & & & 1
b7: .byte& & & & 1
b8: .byte& & & & 1
.cseg& & & &
& & & & rjmp& & & & start
;//main program
start:& & & &
& & & & ldi& & & & r16,high(ramend)& & & & ;//reset stack pointer
& & & & out& & & & sph,r16
& & & & ldi& & & & r16,low(ramend)
& & & & out& & & & spl,r16& & & &
& & & & nop
& & & & nop
& & & & nop
& & & & nop
& & & & nop
//procedure//
;//**********整理加减法的两个数值的小数点位置
mov32:& & & & clr& & & & & & & & r12& && && &
& & & & & & & & clr& & & & & & & & r13
& & & & & & & & clr& & & & & & & & r14
& & & & & & & & clr& & & & & & & & r15
& & & & & & & & ldi& & & & & & & & r30,32
& & & & & & & & sub& & & & & & & & r30,r1& &&&;//计算小数点位置
&&& & & & & & & & breq& & & & chg1& && & ;//根据小数点数据,调整数值a,使小数点在r15和r16之间
chg2:& & & & clc
& & & & & & & & rol& & & & & & & & r19
& & & & & & & & rol& & & & & & & & r18
& & & & & & & & rol& & & & & & & & r17
& & & & & & & & rol& & & & & & & & r16
& & & & & & & & rol& & & & & & & & r15
& & & & & & & & rol& & & & & & & & r14
& & & & & & & & rol& & & & & & & & r13
& & & & & & & & rol& & & & & & & & r12
& & & & & & & & dec& & & & & & & & r30
& & & & & & & & breq& & & & chg1& & & & & & & & ;//是否调整结束?
& & & & & & & & rjmp& & & & chg2
chg1:& & & & sts& & & & & & & & a1,r12& & ;//保存数值a到sram
& & & & & & & & sts& & & & & & & & a2,r13
& & & & & & & & sts& & & & & & & & a3,r14
& & & & & & & & sts& & & & & & & & a4,r15
& & & & & & & & sts& & & & & & & & a5,r16
& & & & & & & & sts& & & & & & & & a6,r17
& & & & & & & & sts& & & & & & & & a7,r18
& & & & & & & & sts& & & & & & & & a8,r19
& & & & & & & & clr& & & & & & & & r16
& & & & & & & & clr& & & & & & & & r17
& & & & & & & & clr& & & & & & & & r18
& & & & & & & & clr& & & & & & & & r19
& & & & & & & & ldi& & & & & & & & r30,32
& & & & & & & & sub& & & & & & & & r30,r2& &&&;//计算小数点位置
& & & & & & & & breq& & & & chg3& & & & & & & & ;//根据小数点数据,调整数值b,使小数点在r19和r20之间
chg4:& & & & clc
& & & & & & & & rol& & & & & & & & r23
& & & & & & & & rol& & & & & & & & r22
& & & & & & & & rol& & & & & & & & r21
& & & & & & & & rol& & & & & & & & r20
& & & & & & & & rol& & & & & & & & r19
& & & & & & & & rol& & & & & & & & r18
& & & & & & & & rol& & & & & & & & r17
& & & & & & & & rol& & & & & & & & r16
& & & & & & & & dec& & & & & & & & r30
& & & & & & & & breq& & & & chg3& & & & & & & & ;//是否调整结束?
& & & & & & & & rjmp& & & & chg4
chg3:& & & & sts& & & & & & & & b1,r16& & ;//保存数值b到sram
& & & & & & & & sts& & & & & & & & b2,r17
& & & & & & & & sts& & & & & & & & b3,r18
& & & & & & & & sts& & & & & & & & b4,r19
& & & & & & & & sts& & & & & & & & b5,r20
& & & & & & & & sts& & & & & & & & b6,r21
& & & & & & & & sts& & & & & & & & b7,r22
& & & & & & & & sts& & & & & & & & b8,r23
& & & & & & & & ret
;//**********加法子子程序
add32:& & & & rcall& & & & mov32& & & & & & & & ;//调整数值a、b的小数点位置
& & & & & & & & clc
& & & & & & & & lds& & & & & & & & r5,a8& && & ;//从低到高逐位相加
& & & & & & & & adc& & & & & & & & r23,r5
& & & & & & & & lds& & & & & & & & r5,a7
& & & & & & & & adc& & & & & & & & r22,r5
& & & & & & & & lds& & & & & & & & r5,a6
& & & & & & & & adc& & & & & & & & r21,r5
& & & & & & & & lds& & & & & & & & r5,a5
& & & & & & & & adc& & & & & & & & r20,r5
& & & & & & & & lds& & & & & & & & r5,a4
& & & & & & & & adc& & & & & & & & r19,r5
& & & & & & & & lds& & & & & & & & r5,a3
& & & & & & & & adc& & & & & & & & r18,r5
& & & & & & & & lds& & & & & & & & r5,a2
& & & & & & & & adc& & & & & & & & r17,r5
& & & & & & & & lds& & & & & & & & r5,a1
& & & & & & & & adc& & & & & & & & r16,r5
& & & & & & & & ret
;//**********减法子子程序
sub32:& & & & rcall& & & & mov32&&& & & & & & & & ;//调整数值a、b的小数点位置
& & & & & & & & clc
& & & & & & & & lds& & & & & & & & r16,a1
& & & & & & & & lds& & & & & & & & r17,a2
& & & & & & & & lds& & & & & & & & r18,a3
& & & & & & & & lds& & & & & & & & r19,a4
& & & & & & & & lds& & & & & & & & r20,a5
& & & & & & & & lds& & & & & & & & r21,a6
& & & & & & & & lds& & & & & & & & r22,a7
& & & & & & & & lds& & & & & & & & r23,a8
& & & & & & & & lds& & & & & & & & r5,b8& & & & & & & & ;//从低到高逐位相减
& & & & & & & & sbc& & & & & & & & r23,r5
& & & & & & & & lds& & & & & & & & r5,b7
& & & & & & & & sbc& & & & & & & & r22,r5
& & & & & & & & lds& & & & & & & & r5,b6
& & & & & & & & sbc& & & & & & & & r21,r5
& & & & & & & & lds& & & & & & & & r5,b5
& & & & & & & & sbc& & & & & & & & r20,r5
& & & & & & & & lds& & & & & & & & r5,b4
& & & & & & & & sbc& & & & & & & & r19,r5
& & & & & & & & lds& & & & & & & & r5,b3
& & & & & & & & sbc& & & & & & & & r18,r5
& & & & & & & & lds& & & & & & & & r5,b2
& & & & & & & & sbc& & & & & & & & r17,r5
& & & & & & & & lds& & & & & & & & r5,b1
& & & & & & & & sbc& & & & & & & & r16,r5
& & & & & & & & ret
;//**********乘法子程序
mul32: & & & & mov& & & & & & & & r11,r19& & & & & & & & ;//数值a复制到r8~r11
& & & & & & & & mov& & & & & & & & r10,r18
& & & & & & & & mov& & & & & & & & r9,r17
& & & & & & & & mov& & & & & & & & r8,r16
& & & & & & & & clr& & & & & & & & r12& & & & & & & & & & & & ;//从清空r12~r19
& & & & & & & & clr& & & & & & & & r13
& & & & & & & & clr& & & & & & & & r14
& & & & & & & & clr& & & & & & & & r15
& & & & & & & & clr& & & & & & & & r16
& & & & & & & & clr& & & & & & & & r17
& & & & & & & & clr& & & & & & & & r18
& & & & & & & & clr& & & & & & & & r19
& & & & & & & & ldi& & & & & & & & r24,32& & & & & & & & ;//设置移位循环加法的次数,32次
add1:& & & & sbrs& & & & r20,7& & & & & & & & ;//数值b的首位是1就累加数值a,然后移位
& & & & & & & & rjmp& & & & noadd
& & & & & & & & clc
& & & & & & & & adc& & & & & & & & r19,r11& & & & & & & & ;//累加数值a
& & & & & & & & adc& & & & & & & & r18,r10
& & & & & & & & adc& & & & & & & & r17,r9
& & & & & & & & adc& & & & & & & & r16,r8
& & & & & & & & ldi& & & & & & & & r25,0
& & & & & & & & adc& & & & & & & & r15,r25
& & & & & & & & adc& & & & & & & & r14,r25
& & & & & & & & adc& & & & & & & & r13,r25
& & & & & & & & adc& & & & & & & & r12,r25
noadd:& & & & dec& & & & & & & & r24& & & & & & & & & & & & ;//判断是否移位结束
& & & & & & & & breq& & & & add2
& & & & & & & & rol& & & & & & & & r19& & & & & & & & & & & & ;//64位的结果移位r12~r19
& & & & & & & & rol& & & & & & & & r18
& & & & & & & & rol& & & & & & & & r17
& & & & & & & & rol& & & & & & & & r16
& & & & & & & & rol& & & & & & & & r15
& & & & & & & & rol& & & & & & & & r14
& & & & & & & & rol& & & & & & & & r13
& & & & & & & & rol& & & & & & & & r12
& & & & & & & & clc
& & & & & & & & rol& & & & & & & & r23& & & & & & & & & & & & ;//数值b进行移位
& & & & & & & & rol& & & & & & & & r22
& & & & & & & & rol& & & & & & & & r21
& & & & & & & & rol& & & & & & & & r20
& & & & & & & & rjmp& & & & add1& & & &
& & & & & & & &
add2:& & & & add& & & & & & & & r1,r2& & & & & & & & ;//计算小数点位置
& & & & & & & & mov& & & & & & & & r3,r1& & & &
& & & & & & & & ret
;//**********除法子程序
div32:&&ldi& & & & & & & & r25,128& & & & & & & & ;//初始化小数点
& & & & & & & & clr& & & & & & & & r12& & & & & & & & & & & & ;//清空结果值
& & & & & & & & clr& & & & & & & & r13
& & & & & & & & clr& & & & & & & & r14
& & & & & & & & clr& & & & & & & & r15& && && &
& & & & & & & & cpi& & & & & & & & r16,0
& & & & & & & & brne& & & & iszo
& & & & & & & & cpi& & & & & & & & r17,0
& & & & & & & & brne& & & & iszo
& & & & & & & & cpi& & & & & & & & r18,0
& & & & & & & & brne& & & & iszo
& & & & & & & & cpi& & & & & & & & r19,0
& & & & & & & & brne& & & & iszo
& & & & & & & & rjmp& & & & chg& & & & & & & & & & & & ;//a=0,结果为0
iszo:& & & & cpi& & & & & & & & r20,0
& & & & & & & & brne& & & & movbb
& & & & & & & & cpi& & & & & & & & r21,0
& & & & & & & & brne& & & & movbb
& & & & & & & & cpi& & & & & & & & r22,0
& & & & & & & & brne& & & & movbb
& & & & & & & & cpi& & & & & & & & r23,0
& & & & & & & & brne& & & & movbb
& & & & & & & & ldi& & & & & & & & r25,0xff& & & & ;//b=0,小数点=0xff 表示溢出
& & & & & & & & rjmp& & & & isov
movbb:& & & & cpi& & & & & & & & r20,0x80& & & & ;//确认数值b首位是1
& & & & & & & & brsh& & & & movaa
& & & & & & & & clc
& & & & & & & & rol& & & & & & & & r23
& & & & & & & & rol& & & & & & & & r22
& & & & & & & & rol& & & & & & & & r21
& & & & & & & & rol& & & & & & & & r20
& & & & & & & & dec& & & & & & & & r25
& & & & & & & & rjmp& & & & movbb
movaa:& & & & cpi& & & & & & & & r16,0x80& & & & & & & & ;//确认数值a首位是1
& & & & & & & & brsh& & & & dixgo
& & & & & & & & clc
& & & & & & & & rol& & & & & & & & r19
& & & & & & & & rol& & & & & & & & r18
& & & & & & & & rol& & & & & & & & r17
& & & & & & & & rol& & & & & & & & r16
& & & & & & & & clc
& & & & & & & & rol& & & & & & & & r15& & & & & & & & & & & & & & & & ;//结果值同步移位
& & & & & & & & rol& & & & & & & & r14
& & & & & & & & rol& & & & & & & & r13
& & & & & & & & rol& & & & & & & & r12
& & & & & & & & inc& & & & & & & & r25& & & & & & & & & & & & & & & & ;//小数点移位
& & & & & & & & sbrs& & & & r12,7
& & & & & & & & rjmp& & & & movaa
& & & & & & & & rjmp& & & & chg
dixgo:& & & & cp& & & & & & & & r16,r20& & & & & & & & & & & & ;//判断数值a、b的大小关系,a小于b时rjmp&&dix1
& & & & & & & & brlo& & & & dix1& & & & & & & & & & & & ;//a大于等于b时rjmp&&go3
& & & & & & & & cp& & & & & & & & r16,r20
& & & & & & & & brne& & & & go3
& & & & & & & & cp& & & & & & & & r17,r21
& & & & & & & & brlo& & & & dix1
& & & & & & & & cp& & & & & & & & r17,r21
& & & & & & & & brne& & & & go3
& & & & & & & & cp& & & & & & & & r18,r22
& & & & & & & & brlo& & & & dix1
& & & & & & & & cp& & & & & & & & r18,r22
& & & & & & & & brne& & & & go3
& & & & & & & & cp& & & & & & & & r19,r23
& & & & & & & & brlo& & & & dix1
& & & & & & & & rjmp& & & & go3
& & & & & & & &
dix1:& & & & mov& & & & & & & & r8,r16& & & & & & & & & & & & & & & & ;//执行2×a-b的操作,同时结果+1、小数点移位
& & & & & & & & mov& & & & & & & & r9,r17
& & & & & & & & mov& & & & & & & & r10,r18
& & & & & & & & mov& & & & & & & & r11,r19
& & & & & & & & clc
& & & & & & & & sbc& & & & & & & & r19,r23& & & & & & & & & & & & & & & & ;//a-b
& & & & & & & & sbc& & & & & & & & r18,r22
& & & & & & & & sbc& & & & & & & & r17,r21
& & & & & & & & sbc& & & & & & & & r16,r20
& & & & & & & & clc
& & & & & & & & adc& & & & & & & & r19,r11& & & & & & & & & & & & & & & & ;//余数+a
& & & & & & & & adc& & & & & & & & r18,r10
& & & & & & & & adc& & & & & & & & r17,r9
& & & & & & & & adc& & & & & & & & r16,r8
& & & & & & & & inc& & & & & & & & r25& & & & & & & & & & & & & & & & & & & & ;//小数点移位
& & & & & & & & sec
& & & & & & & & rol& & & & & & & & r15& & & & & & & & & & & & & & & & ;//结果值移位+1
& & & & & & & & rol& & & & & & & & r14
& & & & & & & & rol& & & & & & & & r13
& & & & & & & & rol& & & & & & & & r12& & & & & & & & & & & & & & & & & & & &
& & & & & & & & rjmp& & & & movaa
& & & & & & & &
go3:& & & & clc& & & & & & & & & & & & & & & & & & & & & & & & ;//执行a-b& &
& & & & & & & & sbc& & & & & & & & r19,r23
& & & & & & & & sbc& & & & & & & & r18,r22
& & & & & & & & sbc& & & & & & & & r17,r21
& & & & & & & & sbc& & & & & & & & r16,r20
& & & & & & & & inc& & & & & & & & r15& & & & & & & & & & & & & & & & ;//结果+1
& & & & & & & & rjmp& & & & movaa
chg:& & add& & & & r25,r1& & & & & & & & & & & & & & & & ;//调整小数点位置
& & & & & & & & sub& & & & r25,r2
isov:& & & & mov& & & & r3,r25
& & & & & & & & ret
4BIT做的12位计算器程序成不成?全套代码.
8BIT有个7位的,也是现成的计算器.都是浮点10进制.
回复【107楼】zhuyi
4bit做的12位计算器程序成不成?全套代码.
8bit有个7位的,也是现成的计算器.都是浮点10进制.
-----------------------------------------------------------------------
如果你能用4位机实现 IEEE754 四则运算(当然还得详细注释),估计冠军就非你莫属了。。。
不是IEEE754标准,不过既然是演示的,10进制最直观.
既然如此,先贴4位的.
;******************************************************************************************
;*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & 12位BCD精度算术运算& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & && &*
;******************************************************************************************
.AUTOIMPORT ON
.include& & & & &macro.asm&
.EXPORT& & & & & & & & Add1212,Sub1212,Mul1212,Div1212,ResultProcessAgain
.EXPORT& & & & & & & & SL_operand1,SL_operand2,SR_operand1,SR_operand2
.EXPORT& & & & & & & & operand1,operand2,operand3,sign1,sign2,sign3,dot1,dot2,dot3,calflag
.EXPORT& & & & & & & & ramtest2
.ORG& & & & $0300
& & & & operand1& & & & & & & & & & & & .dn& & & & 14& & & & ;操作数1(BCD),小端模式,低位数在低地址,高位数在高地址
& & & & dot1& & & & & & & & & & & & & & & & .dn& & & & 1& & & & ;小数点(2进制保存)
& & & & sign1& & & & & & & & & & & & & & & & .dn& & & & 1& & & & ;符号位(负数 = 1)
& & & & operand2& & & & & & & & & & & & .dn& & & & 14& & & & ;操作数2(BCD)
& & & & dot2& & & & & & & & & & & & & & & & .dn& & & & 1
& & & & sign2& & & & & & & & & & & & & & & & .dn& & & & 1& & & &
& & & & operand3& & & & & & & & & & & & .dn& & & & 24& & & & ;一般用来存放运算结果(BCD)
& & & & dot3& & & & & & & & & & & & & & & & .dn& & & & 2
& & & & sign3& & & & & & & & & & & & & & & & .dn& & & & 1
& & & & calflag& & & & & & & & & & & & & & & & .dn& & & & 1& & & & ;.0: 有按下&dot1 key&即有小数点, .1: 溢出标记, .2: 错误标记,
& & & & operandextend& & & & & & & & .dn& & & & 24&&;计算中额外使用的RAM
& & & & caltemp& & & & & & & & & & & & & & & & .dn& & & & 4
& & & & ramtest2& & & & & & & & & & & & .dn& & & & 1
;*********************************************************************
; 结果格式化于本计算器,数据(主要是小数的处理)限定 & ,&&**
; 如果大于其,则置错误标记& && && && && && && && && && && && && && &**
; 如果 = 0,则sign=0& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;*********************************************************************
ResultProcessAgain:
& & & & lda& & & & & & & & calflag& & & & & & & & ;首先判断运算中有无错误发生
& & & & jb2& & & & & & & & ResultProcessAgainEnd
;如果小数太多,先移位便于下面的处理
;不改动原有ResultProcessAgain_CountNum程序
& & & & mrw& & & & & & & & Ry0,dot3+0
& & & & mrw& & & & & & & & Ry1,dot3+1
& & & & subi*& & & & Ry0,15
& & & & sbci*& & & & Ry1,0
& & & & jnc& & & & & & & & ResultProcessAgain_CountNum
& & & & call& & & & SR_operand3
& & & & _DECb& & & & dot3
& & & & subi*& & & & Ry0,1
& & & & sbci*& & & & Ry1,0
& & & & _JCo& & & & -6
ResultProcessAgain_CountNum:
;首先统计结果位数(和小数点有关)
& & & & _LDI& & & & Ry0,24
& & & & lda& & & & & & & & dot3+0
& & & & sub*& & & & Ry0
& & & & lda& & & & & & & & dot3+1
& & & & sbc*& & & & Ry1& & & & & & & & & & & & ;获得扫描位数
& & & & lda& & & & & & & & dot3+0
& & & & or& & & & & & & & dot3+1
& & & & _JZo& & & & 3
& & & & subi*& & & & Ry0,1& & & & & & & & ;有小数点少扫描一位
& & & & sbci*& & & & Ry1,0
& & & & _LDI& & & & caltemp,24
& & & & shlx
& & & & setdat& & & & operand3+23
ResultProcessAgain_CountNumLoop:
& & & & lda& & & & & & & & @hl
& & & & jnz& & & & & & & & ResultProcessAgain_CountNum2
& & & & _DECb& & & & caltemp
& & & & _HLDEC
& & & & subi*& & & & Ry0,1
& & & & sbci*& & & & Ry1,0
& & & & or& & & & & & & & Ry0
& & & & jnz& & & & & & & & ResultProcessAgain_CountNumLoop
ResultProcessAgain_CountNum2:
& & & & mrw& & & & & & & & Ry0,caltemp+0
& & & & mrw& & & & & & & & Ry1,caltemp+1
& & & & subi& & & & Ry0,13
& & & & sbci& & & & Ry1,0
& & & & jnc& & & & & & & & ResultProcessAgain2& & & & & & & & & & & & ;总位数小于13位,LCD能全部显示
& & & & lda& & & & & & & & dot3+0
& & & & sub*& & & & Ry0
& & & & lda& & & & & & & & dot3+1
& & & & sbc*& & & & Ry1& & & & & & & & & & & & & & & & & & & & & & & & & & & & ;获得整数部分个数
& & & & subi& & & & Ry0,12
& & & & sbci& & & & Ry1,0
& & & & jnc& & & & & & & & ResultProcessAgain_Fshift& & & & ;整数部分少于12个(但总位数大于12),去变换浮点
& & & & subi& & & & Ry0,13
& & & & sbci& & & & Ry1,0
& & & & jc& & & & & & & & ResultProcessAgain_err& & & & & & & & ;整数部分&=13个 + 小数部分,溢出!
;与比较大小
ResultProcessAgain_MagnitudeCmp:
& & & & _HLVARB& & & & operand3,dot3
& & & & lds& & & & & & & & Ry0,9
& & & & sub#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & lds& & & & & & & & Ry0,9
& & & & sbc#& & & & @hl,DA
& & & & jnc& & & & & & & & ResultProcessAgain_Fshift& & & & ;此处,数据整数部分小于
& & & & lda& & & & & & & & dot3+0& & & & & & & & & & & & & & & & & & & & & & & & ;判断999'999'999'999.000的情况
& & & & or& & & & & & & & dot3+1
& & & & jz& & & & & & & & ResultProcessAgain_err& & & & & & & &
ResultProcessAgain_Fshift:& & & & & & & & & & & & & & & & ;使其总位数&13位& & & & & & & &
& & & & call& & & & SR_operand3
& & & & _DECb& & & & dot3
& & & & _DECb& & & & caltemp
& & & & lds& & & & & & & & Ry0,13
& & & & sub& & & & & & & & caltemp+0
& & & & lds& & & & & & & & Ry0,0
& & & & sbc& & & & & & & & caltemp+1
& & & & jc& & & & & & & & ResultProcessAgain_Fshift
ResultProcessAgain2:& & & & & & & & & & & & & & & & & & & & ;移除小数点右端的’0‘
& & & & lda& & & & & & & & dot3+0
& & & & or& & & & & & & & dot3+1
& & & & jz& & & & & & & & ResultProcessAgain3
& & & & lda& & & & & & & & operand3+0
& & & & jnz& & & & & & & & ResultProcessAgain3
& & & & call& & & & SR_operand3
& & & & _DECb& & & & dot3
& & & & jmp& & & & & & & & ResultProcessAgain2
ResultProcessAgain3:& & & & & & & & & & & & & & & & & & & & ;防止出现&-0&的处理,可能会更改opd3的符号
& & & & lda& & & & & & & & operand3+0
& & & & or& & & & & & & & operand3+1
& & & & or& & & & & & & & operand3+2
& & & & or& & & & & & & & operand3+3
& & & & or& & & & & & & & operand3+4
& & & & or& & & & & & & & operand3+5
& & & & or& & & & & & & & operand3+6
& & & & or& & & & & & & & operand3+7
& & & & or& & & & & & & & operand3+8
& & & & or& & & & & & & & operand3+9
& & & & or& & & & & & & & operand3+10
& & & & or& & & & & & & & operand3+11
& & & & jnz& & & & & & & & ResultProcessAgain4
& & & & lds& & & & & & & & sign3,0
ResultProcessAgain4:& & & &
& & & & lds& & & & & & & & caltemp,1011B
& & & & and*& & & & calflag
& & & & jmp& & & & & & & & ResultProcessAgainEnd
ResultProcessAgain_err:& & & &
& & & & lds& & & & & & & & caltemp,0100B& & & & & & & & & & & & & & & & ;error
& & & & or*& & & & & & & & calflag
ResultProcessAgainEnd:
& & & & rts
;*********************************************************************
; 12BCD + 12BCD加减法(带符号与小数点处理)& && && && && && && && && &**
; 被加(减)数:& & & & operand1& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 加(减)数:& & & & & & & & operand2& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 和(差):& & & & & & & & operand3; 24BCD& & & & & & & && && & & & & & & & & & & & & & & & & & & && &&&& & & & & & & & **
; 使用:& & & & @hl x=15,@zr x=15& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 执行时间:&&(500KHz osc)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; Date:& & & & & & & & , & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;*********************************************************************& & & &
& & & & lda& & & & & & & & sign1
& & & & eor& & & & & & & & sign2
& & & & jz& & & & & & & & Add1212_1
& & & & jmp& & & & & & & & Sub1212_1
Add1212_1:
& & & & _FHL& & & & operand3,24,0
& & & & lda& & & & & & & & dot1
& & & & sub& & & & & & & & dot2
& & & & jnc& & & & & & & & Add1212_shiftB& & & &
Add1212_shiftA:& & & & & & & & & & & & & & & & & & & & ;加数小数多
& & & & sta& & & & & & & & caltemp
& & & & lda& & & & & & & & dot2
& & & & sta& & & & & & & & dot3& & & & & & & & & & & & & & & & ;获得结果的小数点(和差的小数点以小数点多的操作数为准)
& & & & _ZRVAR& & & & operand3,caltemp& & & & ;获得operand3中的开始地址以对齐
& & & & shlx
& & & & setdat& & & & operand1
& & & & call& & & & CopyHLtoZR_12n
& & & & shlx
& & & & setdat& & & & operand2
& & & & jmp& & & & & & & & Add1212_com
Add1212_shiftB:& & & & & & & & & & & & & & & & & & & & ;被加数小数多
& & & & lda& & & & & & & & dot2
& & & & sub& & & & & & & & dot1
& & & & sta& & & & & & & & caltemp
& & & & lda& & & & & & & & dot1
& & & & sta& & & & & & & & dot3
& & & & _ZRVAR& & & & operand3,caltemp
& & & & shlx
& & & & setdat& & & & operand2
& & & & call& & & & CopyHLtoZR_12n
& & & & shlx
& & & & setdat& & & & operand1
Add1212_com:& & & & & & & & & & & & & & & & & & & & ;24BCD加法
& & & & szrx
& & & & setdat& & & & operand3& & & & & & & & & & & & ;数据对齐完毕用@zr来指向operand3中的数据,@hl可能指向opd1,也可能是opd2
& & & & call& & & & HLaddZR_add1212& & & &
& & & & lda& & & & & & & & sign1& & & & & & & & & & & & & & & & ;获得符号位
& & & & sta& & & & & & & & sign3
Add1212End:
& & & & rts
& & & & lda& & & & & & & & sign1
& & & & eor& & & & & & & & sign2
& & & & jz& & & & & & & & Sub1212_1
& & & & jmp& & & & & & & & Add1212_1
Sub1212_1:
& & & & _FHL& & & & operand3,24,0
& & & & lda& & & & & & & & dot1
& & & & sub& & & & & & & & dot2
& & & & jnc& & & & & & & & Sub1212_SubB
Sub1212_SubA:
& & & & sta& & & & & & & & caltemp
& & & & lda& & & & & & & & dot2
& & & & sta& & & & & & & & dot3
& & & & _ZRVAR& & & & operand3,caltemp
& & & & shlx
& & & & setdat& & & & operand1
& & & & call& & & & CopyHLtoZR_12n
& & & & shlx
& & & & setdat& & & & operand2
& & & & szrx
& & & & setdat& & & & operand3
& & & & call& & & & ComparMagnitude& & & & & & & & ;operand1 - operand2
& & & & shlx
& & & & setdat& & & & operand2
& & & & szrx
& & & & setdat& & & & operand3
& & & & jnc& & & & & & & & Sub1212_SubA2
& & & & call& & & & ZRsubHL_sub1212 & & & & ;operand1 - operand2
& & & & lda& & & & & & & & sign1
& & & & jmp& & & & & & & & Sub1212_sign
Sub1212_SubA2:
& & & & call& & & & HLsubZR_sub1212& & & & & & & & ;operand2 - operand1
& & & & lds& & & & & & & & sign3,1
& & & & eor& & & & & & & & sign1
& & & & jmp& & & & & & & & Sub1212_sign
Sub1212_SubB:
& & & & lda& & & & & & & & dot2
& & & & sub& & & & & & & & dot1
& & & & sta& & & & & & & & caltemp
& & & & lda& & & & & & & & dot1
& & & & sta& & & & & & & & dot3
& & & & _ZRVAR& & & & operand3,caltemp
& & & & shlx
& & & & setdat& & & & operand2
& & & & call& & & & CopyHLtoZR_12n
& & & & shlx
& & & & setdat& & & & operand1
& & & & szrx
& & & & setdat& & & & operand3
& & & & call& & & & ComparMagnitude& & & & & & & & ;operand2 - operand1
& & & & shlx
& & & & setdat& & & & operand1
& & & & szrx
& & & & setdat& & & & operand3
& & & & jnc& & & & & & & & Sub1212_SubB2
& & & & call& & & & ZRsubHL_sub1212& & & & & & & & ;operand2 - operand1
& & & & lds& & & & & & & & sign3,1
& & & & eor& & & & & & & & sign1
& & & & jmp& & & & & & & & Sub1212_sign
Sub1212_SubB2:
& & & & call& & & & HLsubZR_sub1212& & & & & & & & ;operand1 - operand2
& & & & lda& & & & & & & & sign1
& & & & jmp& & & & & & & & Sub1212_sign
Sub1212_sign:
& & & & sta& & & & & & & & sign3
Sub1212End:& & & &
& & & & rts
& & & & & & & &
;由@HL复制到@ZR 12nibbles
CopyHLtoZR_12n:
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & lid$& & & & @zr,@hl
& & & & rts
;@zr + @hl, 结果(24BCD)放回@zr
HLaddZR_add1212:
& & & & lda#& & & & @hl
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & ;0
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;1
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;2
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;3
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;4
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;5
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;6
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;7
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;8
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;9
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;10
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;11
& & & & lds& & & & & & & & caltemp,0
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;12
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;13
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;14
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;15
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;16
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;17
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;18
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;19
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;20
& & & & lds& & & & & & & & caltemp,0& && && &
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;21
& & & & lds& & & & & & & & caltemp,0
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;22
& & & & lds& & & & & & & & caltemp,0
& & & & adc*#& & & & @zr,DA& & & & & & & & & & & & ;23
& & & & rts
; 比较数据大小
; 比较原理:@zr(24BCD精度) - @hl(12BCD精度)
; 输入: @hl,@zr
; 输出:CF
ComparMagnitude:
& & & & lda#& & & & @hl
& & & & sub#& & & & @zr,DA& & & & & & & & ;0
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;1
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;2
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;3
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;4
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;5
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;6
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;7
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;8
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;9
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;10
& & & & lda#& & & & @hl& && && && &
& & & & sbc#& & & & @zr,DA& && &;11
& & & & lds& & & & & & & & caltemp,0& & & & & & & &
& & & & sbc#& & & & @zr,DA& & & & & & & & ;12
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;13
& & & & lda& & & & & & & & caltemp& && &&&
& & & & sbc#& & & & @zr,DA& && &;14
& & & & lda& & & & & & & & caltemp
& & & & sbc#& & & & @zr,DA& && &;15
& & & & lda& & & & & & & & caltemp
& & & & sbc#& & & & @zr,DA& && &;16
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;17
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;18
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;19
& & & & lda& & & & & & & & caltemp& && &&&
& & & & sbc#& & & & @zr,DA& && &;20
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;21
& & & & lda& & & & & & & & caltemp& && &&&
& & & & sbc#& & & & @zr,DA& && &;22
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc#& & & & @zr,DA& && &;23
& & & & rts
; @hl - @zr, 结果放回@zr
HLsubZR_sub1212:
;@hl & @zr时,@hl所指向的是12位BCD数!
;@zr指向的BCD个数一定是小于或等于12
& & & & lda& & & & & & & & @zr
& & & & sub#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;0
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;1
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;2
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;3
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;4
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;5
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;6
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;7
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;8
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;9
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;10
& & & & lda& & & & & & & & @zr
& & & & sbc#& & & & @hl,DA
& & & & sta#& & & & @zr& & & & & & & & & & & & ;11
& & & & rts
; @zr - @hl,结果放回@zr
ZRsubHL_sub1212:
& & & & lda#& & & & @hl
& & & & sub*#& & & & @zr,DA& & & & & & & & ;0
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;1
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;2
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;3
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;4
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;5
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;6
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;7
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;8
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;9
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;10
& & & & lda#& & & & @hl& && && && &
& & & & sbc*#& & & & @zr,DA& && &;11
& & & & lds& & & & & & & & caltemp,0& & & & & & & &
& & & & sbc*#& & & & @zr,DA& & & & & & & & ;12
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;13
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;14
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;15
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;16
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;17
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;18
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;19
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;20
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;21
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;22
& & & & lda& & & & & & & & caltemp& && && &
& & & & sbc*#& & & & @zr,DA& && &;23
& & & & rts
& & & & & & & &
;*********************************************************************& & & &
; 12BCD ÷ 12BCD除法& & & & (带符号与小数点处理) & & & & & & & & & & & & & & & && && && && & **
; 被除数:& & & & operand1& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 除数:& & & & & & & & operand2& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 商:& & & & & & & & operand3& & & & & & & & & & & & & & & & & & & & & & & & & & & && && & & & & & & & & & & & & & & & & & & & **
; 使用:& & & & operandextend,,caltemp,Ry0,Ry1& && && && && && && && &&&**
;& & & & & & & & & & & & @hl(x = 15,14)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;& & & & & & & & & & & & @zr(x = 15)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 执行时间:&&35ms(最大时间 / 1)(500KHz osc)& & & & & & & & & & & & & & & & **
; Date:& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;*********************************************************************
;检查除数是否为0
& & & & lds& & & & & & & & caltemp,0& & & & & & & &
& & & & shlx
& & & & setdat& & & & operand2+0
& & & & lda#& & & & @hl
& & & & or*& & & & & & & & caltemp
& & & & cphlh
& & & & setdat& & & & operand2+12
& & & & _JMPo& & & & -4
& & & & jz& & & & & & & & Div1212_err
; 调整使operand1+11 && 0
& & & & lds& & & & & & & & caltemp,11
& & & & lds& & & & & & & & dot3+0,12
& & & & lda& & & & & & & & dot1
& & & & add*& & & & dot3+0
& & & & lds& & & & & & & & dot3+1,0
& & & & adc*& & & & dot3+1
& & & & shlx
& & & & setdat& & & & operand1+11
& & & & lda& & & & & & & & @hl
& & & & jnz& & & & & & & & Div1212_start
& & & & call& & & & SL_operand1
& & & & _INCb& & & & dot3
& & & & dec*& & & & caltemp
& & & & _JNZo& & & & -7
;++++++++++++++++++++++++++++++++++++++++++++++
Div1212_start:
& & & & _FHL& & & & operand3,24,0
& & & & _SHL& & & & operand1,15
& & & & _SHL& & & & operand2,14
& & & & _FZR& & & & operandextend,13,0
& & & & _SZR& & & & operandextend,15
& & & & _LDI& & & & Ry0,23& & & & & & & & & & & & ; 移位BCD次数
;++++++++++++++++++++++++++++++++++++++++++++++
Div1212_Loop:
& & & & call& & & & SL_operandextend
& & & & subi& & & & Ry0,12
& & & & sta& & & & & & & & caltemp+0
& & & & sbci& & & & Ry1,0
& & & & sta& & & & & & & & caltemp+1
& & & & jnc& & & & & & & & Div1212_Loop2& & & & ;原始12位数据已处理完,后面补零提高精度
& & & & mhl& & & & & & & & 15& & & & & & & & & & & & & & & & ;得到被除数开始地址
& & & & _HLVAR2B& & & & caltemp
& & & & mwr& & & & & & & & operandextend+0,@hl
;++++++++++++++++++++++++++++++++++++++++++++++
Div1212_Loop2:
; 被乘数operandextend减乘数,
; 输出: CF
Div1212_Sub:
& & & & mzr& & & & & & & & 15& & & & & & & & & & & & ; 恢复operandextend被除数
& & & & mhl& & & & & & & & 14& & & & & & & & & & & & ; 恢复除数
& & & & lda#& & & & @hl
& & & & sub*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & sbc*#& & & & @zr,DA
& & & & jc& & & & & & & & Div1212_Sub2
& & & & dec*& & & & @zr
& & & & das*#& & & & @zr
Div1212_Sub2:
& & & & jnc& & & & & & & & Div1212_Add
& & & & inc*& & & & operand3+0
& & & & jmp& & & & & & & & Div1212_Loop2
;++++++++++++++++++++++++++++++++++++++++++++++& & & &
; 被乘数operandextend加乘数
Div1212_Add:
& & & & mzr& & & & & & & & 15& & & & & & & & & & & & ; 恢复operandextend被除数
& & & & mhl& & & & & & & & 14& & & & & & & & & & & & ; 恢复除数
& & & & lda#& & & & @hl
& & & & add*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & lda#& & & & @hl
& & & & adc*#& & & & @zr,DA
& & & & jnc& & & & & & & & Div1212_Add2
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
Div1212_Add2:
& & & & subi*& & & & Ry0,1
& & & & sbci*& & & & Ry1,0
& & & & jnc& & & & & & & & Div1212_2
& & & & call& & & & SL_operand3& & & & ; 让出位置给下一位商
& & & & jmp& & & & & & & & Div1212_Loop& & & &
;++++++++++++++++++++++++++++++++++++++++++++++
Div1212_2:
;符号和小数点处理
& & & & lda& & & & & & & & sign1
& & & & eor& & & & & & & & sign2
& & & & sta& & & & & & & & sign3
& & & & lda& & & & & & & & dot2
& & & & sub*& & & & dot3+0
& & & & _JCo& & & & 2
& & & & dec*& & & & dot3+1
& & & & jmp& & & & & & & & Div1212End
Div1212_err:
& & & & lds& & & & & & & & caltemp,0100B& & & & ;err
& & & & or*& & & & & & & & calflag
Div1212End:
& & & & rts
;*********************************************************************
; 12BCD x 12BCD乘法(带符号与小数点处理) & & & & & & & & & & & & & & & && && && && & **
; 被乘数:& & & & operand1& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 乘数:& & & & & & & & operand2& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 积:& & & & & & & & operand3, 24BCD& & & & & & & && && & & & & & & & & & & & & & & & & & & && &&&& & & & & & & & & & & & **
; 使用:& & & & operandextend,caltemp& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;& & & & & & & & & & & & @hl(x = 13,14,15)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;& & & & & & & & & & & & @zr(x = 15),下一个4bit积的地址& & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 执行时间: 14ms(500KHz osc)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; Date:& & & & & & & & , & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;*********************************************************************
& & & & _FHL& & & & operand3,24,0
& & & & _SHL& & & & operand1,15
& & & & _SHL& & & & operand2,14
& & & & _SHL& & & & operand3,13
;;; 第一个4bit乘数
& & & & mhl& & & & & & & & 14& & & & & & & & & & & & ; 恢复乘数地址
& & & & smui#& & & & @hl& & & & & & & & & & & & ; 设定 .0 ~ .3 为乘数
& & & & rhl& & & & & & & & 14& & & & & & & & & & & & ; 保存下次乘数地址(.4 ~ .7)
& & & & mhl& & & & & & & & 15& & & & & & & & & & & & ; 恢复被乘数
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & call& & & & M1212_Add
;;; 第二个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&& & & & & & & & & & & & & & & & ; 1~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl14
;;; 第三个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc8&& & & & & & & & & & & & & & & & ; 2~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl15
;;; 第四个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&
& & & & idc8&& & & & & & & & & & & & & & & & ; 3~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl16
;;; 第五个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idch&& & & & & & & & & & & & & & & & ; 4~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl17
;;; 第六个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&
& & & & idch&& & & & & & & & & & & & & & & & ; 5~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl18
;;; 第七个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc8&
& & & & idch&& & & & & & & & & & & & & & & & ; 6~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl19
;;; 第八个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&
& & & & idc8&
& & & & idch&& & & & & & & & & & & & & & & & ; 7~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl20
;;; 第九个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idch&
& & & & idch&& & & & & & & & & & & & & & & & ; 8~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl21
;;; 第十个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&
& & & & idch&
& & & & idch&& & & & & & & & & & & & & & & & ; 9~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl22
;;; 第十一个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc8&
& & & & idch&
& & & & idch&& & & & & & & & & & & & & & & & ; 10~23
& & & & call& & & & M1212_Add
& & & & call& & & & M1212_CPhl23
;;; 第十二个4bit乘数
& & & & mhl& & & & & & & & 14
& & & & smui#& & & & @hl
& & & & rhl& & & & & & & & 14
& & & & mhl& & & & & & & & 15
& & & & call& & & & Mul1201
& & & & mhl& & & & & & & & 13
& & & & idc&
& & & & idc8&
& & & & idch&
& & & & idch&& & & & & & & & & & & & & & & & ; 11~23
& & & & call& & & & M1212_Add
;符号和小数点处理
& & & & lda& & & & & & & & sign1
& & & & eor& & & & & & & & sign2
& & & & sta& & & & & & & & sign3
& & & & lda& & & & & & & & dot1
& & & & add& & & & & & & & dot2
& & & & sta& & & & & & & & dot3+0
& & & & lds& & & & & & & & caltemp,0
& & & & adc*& & & & dot3+1
Mul1212_End:& & & &
& & & & rts
;============和累加处理============
M1212_Add:
& & & & lda& & & & & & & & operandextend+0
& & & & add*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+1
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+2
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+3
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+4
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+5
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+6
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+7
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+8
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+9
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+10
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+11
& & & & adc*#& & & & @hl,DA
& & & & lda& & & & & & & & operandextend+12
& & & & adc*#& & & & @hl,DA
& & & & rts
;============高位进位处理2(HL)============
M1212_CPhl14:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl15:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl16:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl17:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl18:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl19:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl20:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl21:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl22:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl23:
& & & & jnc& & & & & & & & M1212_CPhl_End
& & & & inc*& & & & @hl
& & & & daa*#& & & & @hl
M1212_CPhl_End:
& & & & rts& & & &
;*********************************************************************& & & &
; 12BCD x 1BCD乘法& && && && && && && && && && && && && && && & & & & & & & **
; 被乘数:& & & & @HL(x = 15) 12bcd& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 乘数:& & & & & & & & @HL(x = 14) 1bcd& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; 积:& & & & & & & & 13BCD& & & & & & & && && & & & & & & & & & & & & & & & & & & && &&&& & & & **
; 使用:& & & & ZR,X区: 15(zr)下一个4bit积的地址& & & & & & & & & & & & & & & & & & & & & & & & **
; 执行时间:&&us(500KHz osc)& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
; Date:& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & **
;*********************************************************************& & & &
& & & & szrx& & & &
& & & & setdat& & & & operandextend
& & & & rzr& & & & & & & & 15
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0
& & & & lds8#& & & & @zr,0& & & & & & & & ; 清零乘积暂存器
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;1
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;2
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;1
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;2
& & & & call& & & & M1212_CP3
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;2
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;3
& & & & call& & & & M1212_CP4
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;3
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;4
& & & & call& & & & M1212_CP5
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;4
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;5
& & & & call& & & & M1212_CP6
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;5
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;6
& & & & call& & & & M1212_CP7
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;6
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;7
& & & & call& & & & M1212_CP8
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;7
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;8
& & & & call& & & & M1212_CP9
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;8
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;9
& & & & call& & & & M1212_CP10
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;9
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;10
& & & & call& & & & M1212_CP11
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;10
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;11
& & & & call& & & & M1212_CP12
& & & & muld#& & & & @hl
& & & & mzr& & & & & & & & 15
& & & & add*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;11
& & & & rzr& & & & & & & & 15
& & & & adcm*#& & & & @zr,DA& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ;12
& & & & call& & & & M1212_CP13
& & & & rts
& & & & & & & &
;============高位进位处理1(ZR)============
M1212_CP3:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP4:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP5:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP6:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP7:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP8:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP9:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP10:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP11:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP12:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP13:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP14:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP15:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP16:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP17:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP18:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP19:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP20:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP21:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP22:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP23:
& & & & jnc& & & & & & & & M1212_CP_End
& & & & inc*& & & & @zr
& & & & daa*#& & & & @zr
M1212_CP_End:
& & & & rts& & & &
;操作数1左移1个,低位补0
SL_operand1:
& & & & _LMOVR& & & & operand1+10,operand1+11
& & & & _LMOVR& & & & operand1+9,operand1+10
& & & & _LMOVR& & & & operand1+8,operand1+9
& & & & _LMOVR& & & & operand1+7,operand1+8
& & & & _LMOVR& & & & operand1+6,operand1+7
& & & & _LMOVR& & & & operand1+5,operand1+6
& & & & _LMOVR& & & & operand1+4,operand1+5
& & & & _LMOVR& & & & operand1+3,operand1+4
& & & & _LMOVR& & & & operand1+2,operand1+3
& & & & _LMOVR& & & & operand1+1,operand1+2
& & & & _LMOVR& & & & operand1+0,operand1+1
& & & & lds& & & & & & & & operand1+0,0
& & & & rts
;操作数2左移1个,低位补0
SL_operand2:& & & &
& & & & _LMOVR& & & & operand2+10,operand2+11
& & & & _LMOVR& & & & operand2+9,operand2+10
& & & & _LMOVR& & & & operand2+8,operand2+9
& & & & _LMOVR& & & & operand2+7,operand2+8
& & & & _LMOVR& & & & operand2+6,operand2+7
& & & & _LMOVR& & & & operand2+5,operand2+6
& & & & _LMOVR& & & & operand2+4,operand2+5
& & & & _LMOVR& & & & operand2+3,operand2+4
& & & & _LMOVR& & & & operand2+2,operand2+3
& & & & _LMOVR& & & & operand2+1,operand2+2
& & & & _LMOVR& & & & operand2+0,operand2+1& & & & & & & &
& & & & lds& & & & & & & & operand2+0,0
& & & & rts
;结果左移1个
SL_operand3:
& & & & _LMOVR& & & & operand3+22,operand3+23
& & & & _LMOVR& & & & operand3+21,operand3+22
& & & & _LMOVR& & & & operand3+20,operand3+21
& & & & _LMOVR& & & & operand3+19,operand3+20
& & & & _LMOVR& & & & operand3+18,operand3+19
& & & & _LMOVR& & & & operand3+17,operand3+18
& & & & _LMOVR& & & & operand3+16,operand3+17
& & & & _LMOVR& & & & operand3+15,operand3+16
& & & & _LMOVR& & & & operand3+14,operand3+15
& & & & _LMOVR& & & & operand3+13,operand3+14
& & & & _LMOVR& & & & operand3+12,operand3+13
& & & & _LMOVR& & & & operand3+11,operand3+12
& & & & _LMOVR& & & & operand3+10,operand3+11
& & & & _LMOVR& & & & operand3+9, operand3+10
& & & & _LMOVR& & & & operand3+8, operand3+9
& & & & _LMOVR& & & & operand3+7, operand3+8
& & & & _LMOVR& & & & operand3+6, operand3+7
& & & & _LMOVR& & & & operand3+5, operand3+6
& & & & _LMOVR& & & & operand3+4, operand3+5
& & & & _LMOVR& & & & operand3+3, operand3+4
& & & & _LMOVR& & & & operand3+2, operand3+3
& & & & _LMOVR& & & & operand3+1, operand3+2
& & & & _LMOVR& & & & operand3+0, operand3+1& & & & & & & &
& & & & lds& & & & & & & & operand3+0,0
& & & & rts
;operandextend左移一个(13位 & 12位max除数)
SL_operandextend:
& & & & _LMOVR& & & & operandextend+11,operandextend+12
& & & & _LMOVR& & & & operandextend+10,operandextend+11
& & & & _LMOVR& & & & operandextend+9,operandextend+10
& & & & _LMOVR& & & & operandextend+8,operandextend+9
& & & & _LMOVR& & & & operandextend+7,operandextend+8
& & & & _LMOVR& & & & operandextend+6,operandextend+7
& & & & _LMOVR& & & & operandextend+5,operandextend+6
& & & & _LMOVR& & & & operandextend+4,operandextend+5
& & & & _LMOVR& & & & operandextend+3,operandextend+4
& & & & _LMOVR& & & & operandextend+2,operandextend+3
& & & & _LMOVR& & & & operandextend+1,operandextend+2
& & & & _LMOVR& & & & operandextend+0,operandextend+1
& & & & lds& & & & & & & & operandextend+0,0
& & & & rts
;操作数1右移1个,高位补0
SR_operand1:& & & &
& & & & _LMOVR& & & & operand1+1,operand1+0
& & & & _LMOVR& & & & operand1+2,operand1+1
& & & & _LMOVR& & & & operand1+3,operand1+2
& & & & _LMOVR& & & & operand1+4,operand1+3
& & & & _LMOVR& & & & operand1+5,operand1+4
& & & & _LMOVR& & & & operand1+6,operand1+5
& & & & _LMOVR& & & & operand1+7,operand1+6
& & & & _LMOVR& & & & operand1+8,operand1+7
& & & & _LMOVR& & & & operand1+9,operand1+8
& & & & _LMOVR& & & & operand1+10,operand1+9
& & & & _LMOVR& & & & operand1+11,operand1+10
& & & & lds& & & & & & & & operand1+11,0
& & & & rts
;操作数2右移1个,高位补0
SR_operand2:& & & &
& & & & _LMOVR& & & & operand2+1,operand2+0
& & & & _LMOVR& & & & operand2+2,operand2+1
& & & & _LMOVR& & & & operand2+3,operand2+2
& & & & _LMOVR& & & & operand2+4,operand2+3
& & & & _LMOVR& & & & operand2+5,operand2+4
& & & & _LMOVR& & & & operand2+6,operand2+5
& & & & _LMOVR& & & & operand2+7,operand2+6
& & & & _LMOVR& & & & operand2+8,operand2+7
& & & & _LMOVR& & & & operand2+9,operand2+8
& & & & _LMOVR& & & & operand2+10,operand2+9
& & & & _LMOVR& & & & operand2+11,operand2+10
& & & & lds& & & & & & & & operand2+11,0
& & & & rts
;结果右移1个,高位补0
SR_operand3:
& & & & _LMOVR& & & & operand3+1, operand3+0
& & & & _LMOVR& & & & operand3+2, operand3+1
& & & & _LMOVR& & & & operand3+3, operand3+2
& & & & _LMOVR& & & & operand3+4, operand3+3
& & & & _LMOVR& & & & operand3+5, operand3+4
& & & & _LMOVR& & & & operand3+6, operand3+5
& & & & _LMOVR& & & & operand3+7, operand3+6
& & & & _LMOVR& & & & operand3+8, operand3+7
& & & & _LMOVR& & & & operand3+9, operand3+8
& & & & _LMOVR& & & & operand3+10,operand3+9
& & & & _LMOVR& & & & operand3+11,operand3+10
& & & & _LMOVR& & & & operand3+12,operand3+11
& & & & _LMOVR& & & & operand3+13,operand3+12
& & & & _LMOVR& & & & operand3+14,operand3+13
& & & & _LMOVR& & & & operand3+15,operand3+14
& & & & _LMOVR& & & & operand3+16,operand3+15
& & & & _LMOVR& & & & operand3+17,operand3+16
& & & & _LMOVR& & & & operand3+18,operand3+17
& & & & _LMOVR& & & & operand3+19,operand3+18
& & & & _LMOVR& & & & operand3+20,operand3+19
& & & & _LMOVR& & & & operand3+21,operand3+20
& & & & _LMOVR& & & & operand3+22,operand3+21
& & & & _LMOVR& & & & operand3+23,operand3+22
& & & & lds& & & & & & & & operand3+23,0
& & & & rts& && && && && && && &
注: 这个4BIT是没有带C移位的.
再来8bit的. 6502 MCU. 很容易扩展任意精度.
;_________________________________________________________________________________________
;& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & B C D&&运 算 子 程 序
;_________________________________________________________________________________________
;_________________________________________________________________________________________
;左移一位BCD数, 同时小数点加一
;输入: (temp0)-&数据最低位
cal_BCD_inputSL:
& & & & lda& & & & & & & & &temp0+0
& & & & sta& & & & & & & & &temp1+0
& & & & lda& & & & & & & & &temp0+1
& & & & sta& & & & & & & & &temp1+1
& & & & ldx& & & & & & & & #4
& & & & lda& & & & & & & & &temp1+0
& & & & sta& & & & & & & & &temp0+0
& & & & lda& & & & & & & & &temp1+1
& & & & sta& & & & & & & & &temp0+1
& & & & lda& & & & & & & & (&temp0)
& & & & asl
& & & & sta& & & & & & & & (&temp0)
& & & & _INCw& & & & &temp0
& & & & lda& & & & & & & & (&temp0)
& & & & rol
& & & & sta& & & & & & & & (&temp0)
& & & & _INCw& & & & &temp0
& & & & lda& & & & & & & & (&temp0)
& & & & rol
& & & & sta& & & & & & & & (&temp0)
& & & & _INCw& & & & &temp0
& & & & lda& & & & & & & & (&temp0)
& & & & rol
& & & & sta& & & & & & & & (&temp0)
& & & & dex
& & & & bne& & & & & & & & ?loop
& & & & _INCw& & & & &temp0
& & & & lda& & & & & & & & (&temp0)& & & & & & & & ;小数点数据
& & & & bne& & & & & & & & ?dotinc& & & &
& & & & bbr4& & & & &calflag,?end& & & & ;有按下过dot
& & & & inc& & & & & & & & a
& & & & sta& & & & & & & & (&temp0)
& & & & rmb4& & & & &calflag
& & & & rts
;_________________________________________________________________________________________
;统计数据个数,便于显示
;输入: (temp3)-&小数点RAM
;输出: Acc, cal_digcnt, 有效的数字个数,如:0.001,则cal_digcnt = 4
cal_Number:
& & & & lda& & & & & & & & (temp3)
& & & & sta& & & & & & & & &temp2
& & & & _DECw& & & & &temp3
& & & & lda& & & & & & & & #7
& & & & sta& & & & & & & & &cal_digcnt
& & & & lda& & & & & & & & (&temp3)
& & & & and& & & & & & & & #$f0
& & & & bne& & & & & & & & ?end
& & & & lda& & & & & & & & &temp2
& & & & inc& & & & & & & & a
& & & & cmp& & & & & & & & &cal_digcnt
& & & & bcs& & & & & & & & ?end
& & & & dec& & & & & & & & &cal_digcnt
& & & & lda& & & & & & & & (&temp3)
& & & & and& & & & & & & & #$0f
& & & & bne& & & & & & & & ?end
& & & & lda& & & & & & & & &temp2
& & & & inc& & & & & & & & a
& & & & cmp& & & & & & & & &cal_digcnt
& & & & bcs& & & & & & & & ?end
& & & & dec& & & & & & & & &cal_digcnt
& & & & _DECw& & & & &temp3
& & & & jmp& & & & & & & & ?loop
& & & & lda& & & & & & & & &cal_digcnt
& & & & rts
;_________________________________________________________________________________________
; & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & 7BCD + 7BCD 加法
;_________________________________________________________________________________________
& & & & jsr& & & & & & & & cal_CequA
& & & & jsr& & & & & & & & cal_DequB
& & & & lda& & & & & & & & calC_sign
& & & & eor& & & & & & & & calD_sign
& & & & _bne& & & & Sub2
& & & & jsr& & & & & & & & cal_adjust
& & & & sed
& & & & clc
& & & & lda& & & & & & & & &calC+0
& & & & adc& & & & & & & & &calD+0
& & & & sta& & & & & & & & &calC+0
& & & & lda& & & & & & & & &calC+1
& & & & adc& & & & & & & & &calD+1
& & & & sta& & & & & & & & &calC+1
& & & & lda& & & & & & & & &calC+2
& &

我要回帖

更多关于 汇编语言编写窗口界面 的文章

 

随机推荐