- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
微机原理ch04 ARTHIMETIC AND LOGICA INSTRUCTIONS AND PROGRAMS
PAGE
44
ARTHIMETIC AND LOGICAL INSTRUCTIONS AND PROGRAMS
USING ADDITION AND SUBTRATION
Addition of unsigned numbers
The form of the ADD/ADC instruction is:
add dest, source ;dest = dest + source
adc dest, source ;dest = dest + source + CF
The instructions ADD and ADC are used to add two operands.
The destination operand can be:
a register
in memory
The source operand can be:
a register
in memory, or
immediate
Remember that memory-to-memory operation are NEVER allowed in 80x86 assembly language.
The instruction could change any of the ZF, SF, AF, CF, or PF bit of the flag register, depending on the operands involved.
Example:
Show how the flag register is affected by:
mov al, 0f5h
add al, 0bh
Solution:
F5 1111 0101
+ 0B 0000 1011
100 0000 0000
After the addition, the AL register (destination) contains 00H and the flags are as follows:
CF = 1, since there is a carry out from d7
SF = 0, the status of d7 of the result
PF = 1, the number of 1s is zero (zero is an even number)
AF = 1, there is a carry out from d3 to d4
ZF = 1, the result of the addition is zero (for 8 bits)
Case 1: Addition of individual byte and word data
Example 1:
Write a program to calculate the total of 5 bytes of data. The decimal data is as follow: 125, 235, 197, 91, and 48.
title prog3-1A adding 5 bytes
.model small
.stack 64
;
.data
count equ 05
data1 db 125, 235, 197, 91, 48
org 0008h
sum dw ?
;
.code
main proc far
mov ax, @data
mov ds, ax
mov cx, count ;CX is the loop counter
mov si, offset data1 ;SI is the data pointer
mov ax, 00 ;AX will be hold the sum
back: add al, [si] ;add the next byte to AL
jnc over ;if no carry, continue
inc ah ;else accumulate the carry in AH
over: inc si ;increment the data pointer
dec cx ;decrement the loop counter
jnz back ;if not finished, go add next byte
mov sum, ax ;store sum
mov ah, 4ch
int 21h ;go back to DOS
main endp
end main
Code segment
Data segment and stack segment
Example 2:
Write a program to calculate the
您可能关注的文档
- 广东省2010年行职业能力测验.doc
- 广东省揭阳市2013年高中毕业班高考前练兵_生物(三).doc
- 广东省省直单位198年竞争上岗考试试题.doc
- 广东省茂名市2013年一次高考模拟考试.doc
- 广东高考志愿填报技巧方法指导.pptx
- 广州小吃绍PPT课件.ppt
- 广告文本文体分析.ppt
- 广西公务考试行测真题1.doc
- 广东高考历史考及大纲解读.ppt
- 广州恒大足队全介绍.docx
- 2025年演出经纪人演出数据跨境流动法律问题专题试卷及解析.pdf
- 2025年信息系统安全专家物联网安全日志分析专题试卷及解析.pdf
- 2025年信息系统安全专家云环境持续安全监控专题试卷及解析.pdf
- 2025年信息系统安全专家ISMS内部审核流程与技巧专题试卷及解析.pdf
- 2025年演出经纪人艺人定位与数据化运营策略专题试卷及解析.pdf
- 2025年演出经纪人商务谈判中的僵局处理与冲突化解专题试卷及解析.pdf
- 2025年演出经纪人国际演出合同纠纷解决机制专题试卷及解析.pdf
- 2025年注册项目管理师蒙特卡洛模拟在敏捷项目迭代周期估算中的应用专题试卷及解析.pdf
- 2025年AWS认证子网与AWSSimSpaceWeaver仿真网络专题试卷及解析.pdf
- 2025年AWS认证SQS与EMR集群任务调度专题试卷及解析.pdf
最近下载
- 土地托管项目商业计划书.docx VIP
- 小学英语新人教精通版三年级上册Unit 4 Friends Lesson 2教学课件2024秋.pptx
- 2025年易制毒化学品考试练习测试题附答案.doc
- 能源技术革命创新行动计划(2025-2030年).pptx VIP
- 创业资源的管理与整合.pptx VIP
- 2024科技住宅设计标准.docx VIP
- 2025年信息管理系统项目立项申请报告模板.docx
- 管道施工ppt课件学习资料.ppt VIP
- 【2024年7月中考试题观察研讨课件】7. 滨州中考第21题 解析.pptx VIP
- GB50156-2012(2014年版) 汽车加油加气站设计与施工规范.pdf VIP
原创力文档


文档评论(0)